livechat 0.6.2 → 0.6.4

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/app/models/livechat/conversation.rb +6 -0
  4. data/app/views/layouts/livechat/application.html.erb +18 -1
  5. data/app/views/livechat/conversations/_thread_panel.html.erb +16 -14
  6. data/app/views/livechat/conversations/index.html.erb +1 -1
  7. data/config/locales/livechat.ar.yml +1 -1
  8. data/config/locales/livechat.bg.yml +1 -1
  9. data/config/locales/livechat.bn.yml +1 -1
  10. data/config/locales/livechat.de.yml +1 -1
  11. data/config/locales/livechat.el.yml +1 -1
  12. data/config/locales/livechat.en.yml +1 -1
  13. data/config/locales/livechat.es.yml +1 -1
  14. data/config/locales/livechat.fr.yml +1 -1
  15. data/config/locales/livechat.hi.yml +1 -1
  16. data/config/locales/livechat.hr.yml +1 -1
  17. data/config/locales/livechat.id.yml +1 -1
  18. data/config/locales/livechat.it.yml +1 -1
  19. data/config/locales/livechat.ja.yml +1 -1
  20. data/config/locales/livechat.ko.yml +1 -1
  21. data/config/locales/livechat.lb.yml +1 -1
  22. data/config/locales/livechat.nl.yml +1 -1
  23. data/config/locales/livechat.pl.yml +1 -1
  24. data/config/locales/livechat.pt.yml +1 -1
  25. data/config/locales/livechat.ro.yml +1 -1
  26. data/config/locales/livechat.ru.yml +1 -1
  27. data/config/locales/livechat.th.yml +1 -1
  28. data/config/locales/livechat.tr.yml +1 -1
  29. data/config/locales/livechat.uk.yml +1 -1
  30. data/config/locales/livechat.ur.yml +1 -1
  31. data/config/locales/livechat.vi.yml +1 -1
  32. data/config/locales/livechat.zh-CN.yml +1 -1
  33. data/lib/livechat/dashboard.js +3 -2
  34. data/lib/livechat/version.rb +1 -1
  35. data/lib/livechat/widget.js +22 -8
  36. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebf70396ba82be98cc6f9332c276c5314a14b3ba4330f99646505ce1dd293e7e
4
- data.tar.gz: f48e3578174194d4a501cfc2fd30a7f5772e58b8b9a79399c46073eb4bdac003
3
+ metadata.gz: dde311c3ece9cf024af38e37018971db6e9f5a17a33779a37f3230357959262b
4
+ data.tar.gz: 53175ed6be91ba5d011dc5183f98578c949d447919e43cce14421be333e0d5bb
5
5
  SHA512:
6
- metadata.gz: ef83bc9a0d405fc0aa5ad055a12243e83a0a2d35d1f9ed058c68b27381c9965575747372992f69fc87fe70a909e8b06f44a7b31df410216e758a7a5aed9c0910
7
- data.tar.gz: f77398569393337ae0cf9f023bb887c3ac0d15aa07b34b05669d98af643124f949a41b4d77089b14b30a116e9cfec6fb350689a9d59316f20f5353991bc7aeca
6
+ metadata.gz: 571815fbdf33d0d5d78a3c759157da59bb252fa404701be47ec6378a9614eeb0f7d0e886fcd56ed3deec9fcf000be1186c27d3dbe23a54f072f8258aab66f1aa
7
+ data.tar.gz: 68dd083b3fbdff4eb89311ecc8bf140f88a66196ddb49e31ad920413c02906a3a50d67f5e655f44faf5655a2d60ebc8dfc822a85b3675f44dc673fded8793ea0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.4
4
+
5
+ - Hardened the visitor widget composer against host app form-control styles, so
6
+ embedded textareas no longer pick up an extra border or shadow.
7
+ - Matched the visitor widget's chat surface to the inbox pattern: white thread
8
+ background, gray support bubbles, and visible timestamps.
9
+ - Fixed stale typing indicators by clearing each side's typing hint when they
10
+ send and suppressing the hint when a new message arrives.
11
+ - Renamed the default inbox title to `LiveChat` across shipped locales while
12
+ keeping it overridable through `livechat.dashboard.title`.
13
+ - Simplified inbox conversation context by showing visitor email as plain text,
14
+ removing the page URL from the thread header, and keeping direct
15
+ `/livechat/:id` pages scrollable after the two-column inbox layout.
16
+
17
+ ## 0.6.3
18
+
19
+ - Replaced the selected thread's separate status badge and resolve/reopen
20
+ button with a compact Open/Resolved status toggle.
21
+ - Refreshed the README inbox screenshots to show the new status toggle.
22
+
3
23
  ## 0.6.2
4
24
 
5
25
  - Reworked the inbox into a two-column desktop layout: conversation list on the
@@ -49,6 +49,7 @@ module Livechat
49
49
  message = messages.new(author_type: 'visitor', body: body)
50
50
  attach(message, files)
51
51
  message.save!
52
+ clear_typing!('visitor')
52
53
  message
53
54
  end
54
55
  end
@@ -58,6 +59,7 @@ module Livechat
58
59
  agent_id: agent_id.to_s, agent_label: agent_label)
59
60
  attach(message, files)
60
61
  message.save!
62
+ clear_typing!('agent')
61
63
  message
62
64
  end
63
65
 
@@ -109,6 +111,10 @@ module Livechat
109
111
  Rails.cache.exist?(typing_cache_key(author_type))
110
112
  end
111
113
 
114
+ def clear_typing!(author_type)
115
+ Rails.cache.delete(typing_cache_key(author_type))
116
+ end
117
+
112
118
  private
113
119
 
114
120
  # Attach only real uploads, and only where attachments are enabled — a
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title><%= t('livechat.dashboard.title', default: 'Chat') %> — <%= Livechat.app_name %></title>
4
+ <title><%= t('livechat.dashboard.title', default: 'LiveChat') %> — <%= Livechat.app_name %></title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <%= csrf_meta_tags %>
7
7
  <%# Same-origin script instead of inline handlers, so thread polling and
@@ -61,6 +61,20 @@
61
61
  .head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
62
62
  .head-row h1 { margin: 0; flex: 1; }
63
63
  .head-row form { display: inline; }
64
+ .status-toggle-form { flex: 0 0 auto; }
65
+ .status-toggle { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; width: 176px;
66
+ min-height: 36px; padding: 3px; border-radius: 999px; border: 1px solid var(--border);
67
+ background: var(--bg); color: var(--muted); overflow: hidden; }
68
+ .status-toggle::before { content: ""; position: absolute; z-index: 0; top: 3px; bottom: 3px;
69
+ width: calc(50% - 3px); border-radius: 999px; background: var(--surface);
70
+ box-shadow: 0 1px 2px rgba(15, 23, 42, .12); transition: left .16s ease; }
71
+ .status-toggle.is-open::before { left: 3px; }
72
+ .status-toggle.is-resolved::before { left: 50%; }
73
+ .status-toggle span { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
74
+ min-width: 0; padding: 0 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
75
+ .status-toggle.is-open span:first-child { color: var(--open); }
76
+ .status-toggle.is-resolved span:last-child { color: var(--text); }
77
+ .status-toggle:hover { text-decoration: none; color: var(--text); }
64
78
  button, .button { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
65
79
  background: var(--surface); color: var(--text); font: inherit; }
66
80
  button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
@@ -203,6 +217,7 @@
203
217
  .lvc-convo .container { display: flex; flex-direction: column; padding-bottom: 16px; }
204
218
  .lvc-convo .breadcrumb, .lvc-convo .head-row, .lvc-convo .context-line,
205
219
  .lvc-convo .flash { flex: 0 0 auto; }
220
+ .lvc-convo .conversation-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
206
221
  .lvc-convo .card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
207
222
  .lvc-convo .thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
208
223
  .lvc-convo .reply { flex: 0 0 auto; }
@@ -223,6 +238,8 @@
223
238
  .inbox-thread .conversation-panel { padding: 0; }
224
239
  .mobile-back { display: block; flex: 0 0 auto; margin: 10px 10px 0; font-size: 13px; }
225
240
  .conversation-panel .head-row h1 { font-size: 18px; }
241
+ .status-toggle { width: 152px; min-height: 34px; }
242
+ .status-toggle span { padding: 0 7px; font-size: 12px; }
226
243
  .thread .msg { max-width: 88%; }
227
244
  }
228
245
  </style>
@@ -1,28 +1,30 @@
1
1
  <div class="conversation-panel">
2
2
  <div class="head-row">
3
3
  <h1><%= conversation.display_name %> <span class="case-id">#<%= conversation.id %></span></h1>
4
- <span class="badge status-<%= conversation.status %>">
5
- <%= t("livechat.statuses.#{conversation.status}", default: conversation.status.humanize) %>
6
- </span>
7
4
  <% if conversation.open? %>
8
- <%= button_to t('livechat.dashboard.resolve', default: 'Resolve'),
9
- resolve_conversation_path(conversation) %>
5
+ <%= button_to resolve_conversation_path(conversation), method: :post,
6
+ form_class: 'status-toggle-form',
7
+ class: 'status-toggle is-open',
8
+ aria: { label: t('livechat.dashboard.resolve', default: 'Resolve') } do %>
9
+ <span><%= t('livechat.statuses.open', default: 'Open') %></span>
10
+ <span><%= t('livechat.statuses.resolved', default: 'Resolved') %></span>
11
+ <% end %>
10
12
  <% else %>
11
- <%= button_to t('livechat.dashboard.reopen', default: 'Reopen'),
12
- reopen_conversation_path(conversation) %>
13
+ <%= button_to reopen_conversation_path(conversation), method: :post,
14
+ form_class: 'status-toggle-form',
15
+ class: 'status-toggle is-resolved',
16
+ aria: { label: t('livechat.dashboard.reopen', default: 'Reopen') } do %>
17
+ <span><%= t('livechat.statuses.open', default: 'Open') %></span>
18
+ <span><%= t('livechat.statuses.resolved', default: 'Resolved') %></span>
19
+ <% end %>
13
20
  <% end %>
14
21
  </div>
15
22
 
16
- <%# One quiet line of live context: who to email, the language to answer in,
17
- and the page of their LAST message (refreshed on every visitor write). %>
23
+ <%# One quiet line of live context: who the visitor is and the language to answer in. %>
18
24
  <p class="muted context-line">
19
25
  <% context = [] %>
20
- <% context << mail_to(conversation.visitor_email) if conversation.visitor_email.present? %>
26
+ <% context << conversation.visitor_email if conversation.visitor_email.present? %>
21
27
  <% context << conversation.locale if conversation.locale.present? %>
22
- <% if conversation.page_url.present? %>
23
- <% context << link_to(conversation.page_url.sub(%r{\Ahttps?://}, ''), conversation.page_url,
24
- target: '_blank', rel: 'noopener') %>
25
- <% end %>
26
28
  <%= safe_join(context, ' · ') %>
27
29
  </p>
28
30
 
@@ -1,6 +1,6 @@
1
1
  <% content_for :body_class, 'lvc-inbox' %>
2
2
 
3
- <h1><%= t('livechat.dashboard.title', default: 'Chat') %></h1>
3
+ <h1><%= t('livechat.dashboard.title', default: 'LiveChat') %></h1>
4
4
 
5
5
  <div class="inbox-shell <%= 'has-selected' if @selected_conversation %>">
6
6
  <aside class="inbox-sidebar" aria-label="<%= t('livechat.dashboard.conversations', default: 'Conversations') %>">
@@ -41,7 +41,7 @@ ar:
41
41
  resolved: "قام %{agent} بحل المحادثة"
42
42
  reopened: "قام %{agent} بإعادة فتح المحادثة"
43
43
  dashboard:
44
- title: "الدردشة"
44
+ title: "LiveChat"
45
45
  empty: "لا يوجد شيء هنا. عندما يكتب زائر، تظهر المحادثة في هذه الصفحة."
46
46
  visitor: "الزائر"
47
47
  last_message: "آخر رسالة"
@@ -41,7 +41,7 @@ bg:
41
41
  resolved: "%{agent} разреши разговора"
42
42
  reopened: "%{agent} отвори отново разговора"
43
43
  dashboard:
44
- title: "Чат"
44
+ title: "LiveChat"
45
45
  empty: "Тук няма нищо. Когато посетител напише съобщение, разговорът се появява на тази страница."
46
46
  visitor: "Посетител"
47
47
  last_message: "Последно съобщение"
@@ -41,7 +41,7 @@ bn:
41
41
  resolved: "%{agent} কথোপকথনটি সমাধান করেছেন"
42
42
  reopened: "%{agent} কথোপকথনটি আবার খুলেছেন"
43
43
  dashboard:
44
- title: "চ্যাট"
44
+ title: "LiveChat"
45
45
  empty: "এখানে এখনও কিছু নেই। কোনো দর্শনার্থী লিখলে কথোপকথনটি এই পৃষ্ঠায় দেখা যাবে।"
46
46
  visitor: "দর্শনার্থী"
47
47
  last_message: "শেষ বার্তা"
@@ -41,7 +41,7 @@ de:
41
41
  resolved: "%{agent} hat die Unterhaltung gelöst"
42
42
  reopened: "%{agent} hat die Unterhaltung wieder geöffnet"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Hier ist noch nichts. Wenn ein Besucher schreibt, erscheint die Unterhaltung auf dieser Seite."
46
46
  visitor: "Besucher"
47
47
  last_message: "Letzte Nachricht"
@@ -41,7 +41,7 @@ el:
41
41
  resolved: "%{agent} επέλυσε τη συνομιλία"
42
42
  reopened: "%{agent} άνοιξε ξανά τη συνομιλία"
43
43
  dashboard:
44
- title: "Συνομιλία"
44
+ title: "LiveChat"
45
45
  empty: "Δεν υπάρχει τίποτα εδώ ακόμα. Όταν ένας επισκέπτης γράψει, η συνομιλία εμφανίζεται σε αυτήν τη σελίδα."
46
46
  visitor: "Επισκέπτης"
47
47
  last_message: "Τελευταίο μήνυμα"
@@ -41,7 +41,7 @@ en:
41
41
  resolved: "%{agent} resolved the conversation"
42
42
  reopened: "%{agent} reopened the conversation"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Nothing here. When a visitor writes, the conversation lands on this page."
46
46
  visitor: "Visitor"
47
47
  last_message: "Last message"
@@ -41,7 +41,7 @@ es:
41
41
  resolved: "%{agent} resolvió la conversación"
42
42
  reopened: "%{agent} reabrió la conversación"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Nada por aquí todavía. Cuando un visitante escriba, la conversación aparecerá en esta página."
46
46
  visitor: "Visitante"
47
47
  last_message: "Último mensaje"
@@ -41,7 +41,7 @@ fr:
41
41
  resolved: "%{agent} a résolu la conversation"
42
42
  reopened: "%{agent} a rouvert la conversation"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Rien ici pour l'instant. Lorsqu'un visiteur écrit, la conversation apparaît sur cette page."
46
46
  visitor: "Visiteur"
47
47
  last_message: "Dernier message"
@@ -41,7 +41,7 @@ hi:
41
41
  resolved: "%{agent} ने बातचीत सुलझा दी"
42
42
  reopened: "%{agent} ने बातचीत फिर से खोली"
43
43
  dashboard:
44
- title: "चैट"
44
+ title: "LiveChat"
45
45
  empty: "यहाँ अभी कुछ नहीं है। जब कोई विज़िटर लिखेगा, तो बातचीत इस पेज पर दिखाई देगी।"
46
46
  visitor: "विज़िटर"
47
47
  last_message: "आख़िरी संदेश"
@@ -41,7 +41,7 @@ hr:
41
41
  resolved: "%{agent} je riješio/la razgovor"
42
42
  reopened: "%{agent} je ponovno otvorio/la razgovor"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Ovdje još nema ničega. Kad posjetitelj napiše poruku, razgovor se pojavljuje na ovoj stranici."
46
46
  visitor: "Posjetitelj"
47
47
  last_message: "Zadnja poruka"
@@ -41,7 +41,7 @@ id:
41
41
  resolved: "%{agent} menyelesaikan percakapan"
42
42
  reopened: "%{agent} membuka kembali percakapan"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Belum ada apa-apa di sini. Saat pengunjung menulis, percakapan akan muncul di halaman ini."
46
46
  visitor: "Pengunjung"
47
47
  last_message: "Pesan terakhir"
@@ -41,7 +41,7 @@ it:
41
41
  resolved: "%{agent} ha risolto la conversazione"
42
42
  reopened: "%{agent} ha riaperto la conversazione"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Ancora niente qui. Quando un visitatore scrive, la conversazione compare in questa pagina."
46
46
  visitor: "Visitatore"
47
47
  last_message: "Ultimo messaggio"
@@ -41,7 +41,7 @@ ja:
41
41
  resolved: "%{agent}さんが会話を解決済みにしました"
42
42
  reopened: "%{agent}さんが会話を再開しました"
43
43
  dashboard:
44
- title: "チャット"
44
+ title: "LiveChat"
45
45
  empty: "まだ何もありません。訪問者がメッセージを書くと、会話がこのページに表示されます。"
46
46
  visitor: "訪問者"
47
47
  last_message: "最後のメッセージ"
@@ -41,7 +41,7 @@ ko:
41
41
  resolved: "%{agent}님이 대화를 해결했습니다"
42
42
  reopened: "%{agent}님이 대화를 다시 열었습니다"
43
43
  dashboard:
44
- title: "채팅"
44
+ title: "LiveChat"
45
45
  empty: "아직 아무것도 없습니다. 방문자가 메시지를 보내면 이 페이지에 대화가 표시됩니다."
46
46
  visitor: "방문자"
47
47
  last_message: "마지막 메시지"
@@ -41,7 +41,7 @@ lb:
41
41
  resolved: "%{agent} huet d'Gespréich geléist"
42
42
  reopened: "%{agent} huet d'Gespréich nees opgemaach"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Hei ass nach näischt. Wann e Besucher schreift, erschéngt d'Gespréich op dëser Säit."
46
46
  visitor: "Besucher"
47
47
  last_message: "Lescht Noriicht"
@@ -41,7 +41,7 @@ nl:
41
41
  resolved: "%{agent} heeft het gesprek opgelost"
42
42
  reopened: "%{agent} heeft het gesprek heropend"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Nog niets hier. Zodra een bezoeker schrijft, verschijnt het gesprek op deze pagina."
46
46
  visitor: "Bezoeker"
47
47
  last_message: "Laatste bericht"
@@ -41,7 +41,7 @@ pl:
41
41
  resolved: "%{agent} rozwiązał(a) rozmowę"
42
42
  reopened: "%{agent} wznowił(a) rozmowę"
43
43
  dashboard:
44
- title: "Czat"
44
+ title: "LiveChat"
45
45
  empty: "Nic tu jeszcze nie ma. Gdy odwiedzający napisze, rozmowa pojawi się na tej stronie."
46
46
  visitor: "Odwiedzający"
47
47
  last_message: "Ostatnia wiadomość"
@@ -41,7 +41,7 @@ pt:
41
41
  resolved: "%{agent} resolveu a conversa"
42
42
  reopened: "%{agent} reabriu a conversa"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Nada por aqui ainda. Quando um visitante escrever, a conversa aparecerá nesta página."
46
46
  visitor: "Visitante"
47
47
  last_message: "Última mensagem"
@@ -41,7 +41,7 @@ ro:
41
41
  resolved: "%{agent} a rezolvat conversația"
42
42
  reopened: "%{agent} a redeschis conversația"
43
43
  dashboard:
44
- title: "Chat"
44
+ title: "LiveChat"
45
45
  empty: "Nimic aici deocamdată. Când un vizitator scrie, conversația apare pe această pagină."
46
46
  visitor: "Vizitator"
47
47
  last_message: "Ultimul mesaj"
@@ -41,7 +41,7 @@ ru:
41
41
  resolved: "%{agent} завершил(а) диалог"
42
42
  reopened: "%{agent} возобновил(а) диалог"
43
43
  dashboard:
44
- title: "Чат"
44
+ title: "LiveChat"
45
45
  empty: "Пока здесь пусто. Когда посетитель напишет, диалог появится на этой странице."
46
46
  visitor: "Посетитель"
47
47
  last_message: "Последнее сообщение"
@@ -41,7 +41,7 @@ th:
41
41
  resolved: "%{agent} แก้ไขการสนทนาแล้ว"
42
42
  reopened: "%{agent} เปิดการสนทนาอีกครั้ง"
43
43
  dashboard:
44
- title: "แชท"
44
+ title: "LiveChat"
45
45
  empty: "ยังไม่มีอะไรที่นี่ เมื่อผู้เยี่ยมชมส่งข้อความ การสนทนาจะปรากฏบนหน้านี้"
46
46
  visitor: "ผู้เยี่ยมชม"
47
47
  last_message: "ข้อความล่าสุด"
@@ -41,7 +41,7 @@ tr:
41
41
  resolved: "%{agent} görüşmeyi çözdü"
42
42
  reopened: "%{agent} görüşmeyi yeniden açtı"
43
43
  dashboard:
44
- title: "Sohbet"
44
+ title: "LiveChat"
45
45
  empty: "Henüz burada bir şey yok. Bir ziyaretçi yazdığında görüşme bu sayfada görünür."
46
46
  visitor: "Ziyaretçi"
47
47
  last_message: "Son mesaj"
@@ -41,7 +41,7 @@ uk:
41
41
  resolved: "%{agent} завершив(ла) розмову"
42
42
  reopened: "%{agent} відновив(ла) розмову"
43
43
  dashboard:
44
- title: "Чат"
44
+ title: "LiveChat"
45
45
  empty: "Поки що тут порожньо. Коли відвідувач напише, розмова з'явиться на цій сторінці."
46
46
  visitor: "Відвідувач"
47
47
  last_message: "Останнє повідомлення"
@@ -41,7 +41,7 @@ ur:
41
41
  resolved: "%{agent} نے گفتگو حل کر دی"
42
42
  reopened: "%{agent} نے گفتگو دوبارہ کھول دی"
43
43
  dashboard:
44
- title: "چیٹ"
44
+ title: "LiveChat"
45
45
  empty: "یہاں ابھی کچھ نہیں ہے۔ جب کوئی وزیٹر لکھے گا تو گفتگو اس صفحے پر نظر آئے گی۔"
46
46
  visitor: "وزیٹر"
47
47
  last_message: "آخری پیغام"
@@ -41,7 +41,7 @@ vi:
41
41
  resolved: "%{agent} đã giải quyết cuộc trò chuyện"
42
42
  reopened: "%{agent} đã mở lại cuộc trò chuyện"
43
43
  dashboard:
44
- title: "Trò chuyện"
44
+ title: "LiveChat"
45
45
  empty: "Chưa có gì ở đây. Khi khách truy cập nhắn tin, cuộc trò chuyện sẽ xuất hiện trên trang này."
46
46
  visitor: "Khách truy cập"
47
47
  last_message: "Tin nhắn cuối"
@@ -41,7 +41,7 @@
41
41
  resolved: "%{agent} 已解决该对话"
42
42
  reopened: "%{agent} 重新打开了该对话"
43
43
  dashboard:
44
- title: "聊天"
44
+ title: "LiveChat"
45
45
  empty: "这里还没有内容。当访客发来消息时,对话会显示在此页面。"
46
46
  visitor: "访客"
47
47
  last_message: "最后一条消息"
@@ -460,8 +460,9 @@
460
460
  .then(function (response) { return response.ok ? response.json() : null; })
461
461
  .then(function (data) {
462
462
  if (!data) return;
463
- setTyping(!!data.typing);
464
- if (data.messages && data.messages.length) data.messages.forEach(append);
463
+ var messages = data.messages || [];
464
+ if (messages.length) messages.forEach(append);
465
+ setTyping(!!data.typing && !messages.some(function (message) { return message.author === "visitor"; }));
465
466
  if (atBottom) thread.scrollTop = thread.scrollHeight;
466
467
  })
467
468
  .catch(function () { /* transient network error — next tick retries */ });
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Livechat
4
- VERSION = '0.6.2'
4
+ VERSION = '0.6.4'
5
5
  end
@@ -890,8 +890,9 @@
890
890
  if (isOpen) {
891
891
  // Only an open panel renders (and thereby "consumes") messages;
892
892
  // while closed, the poll feeds the badge and nothing else.
893
- (data.messages || []).forEach(appendMessage);
894
- setTyping(!!data.typing);
893
+ var messages = data.messages || [];
894
+ messages.forEach(appendMessage);
895
+ setTyping(!!data.typing && !messages.some(function (message) { return message.author === "agent"; }));
895
896
  if (data.unread > 0) request("POST", "/read");
896
897
  setUnread(0);
897
898
  syncEmailRow();
@@ -947,9 +948,10 @@
947
948
  if (message.author === "system") {
948
949
  var line = document.createElement("div");
949
950
  line.className = "lvc-system";
950
- line.textContent = message.event === "resolved"
951
+ var text = message.event === "resolved"
951
952
  ? config.labels.eventResolved
952
953
  : config.labels.eventReopened;
954
+ line.textContent = text + " · " + formatMessageTime(message.at);
953
955
  listEl.appendChild(line);
954
956
  lastAuthorKey = null;
955
957
  keepTypingLast();
@@ -963,9 +965,10 @@
963
965
  if (authorKey !== lastAuthorKey) {
964
966
  var who = document.createElement("div");
965
967
  who.className = "lvc-who lvc-who-" + message.author;
966
- who.textContent = message.author === "visitor"
968
+ var name = message.author === "visitor"
967
969
  ? config.labels.you
968
970
  : (message.label || config.labels.team);
971
+ who.textContent = name + " · " + formatMessageTime(message.at);
969
972
  listEl.appendChild(who);
970
973
  lastAuthorKey = authorKey;
971
974
  }
@@ -1034,6 +1037,15 @@
1034
1037
  if (listEl) listEl.scrollTop = listEl.scrollHeight;
1035
1038
  }
1036
1039
 
1040
+ function formatMessageTime(value) {
1041
+ if (!value) return "";
1042
+ var date = new Date(value);
1043
+ if (isNaN(date.getTime())) return "";
1044
+ return date.toLocaleString(undefined, {
1045
+ day: "numeric", month: "short", hour: "2-digit", minute: "2-digit"
1046
+ });
1047
+ }
1048
+
1037
1049
  function noteTyping() {
1038
1050
  if (!hasThread || !inputEl || !inputEl.value.trim()) return;
1039
1051
  var now = Date.now();
@@ -1105,6 +1117,7 @@
1105
1117
  if (result.ok) {
1106
1118
  inputEl.value = "";
1107
1119
  autogrow();
1120
+ lastTypingSentAt = 0;
1108
1121
  clearFiles();
1109
1122
  hasThread = true;
1110
1123
  appendMessage(result.data.message);
@@ -1222,7 +1235,7 @@
1222
1235
  // min-height:0 lets this flex child actually scroll within the panel
1223
1236
  // instead of overflowing it (the classic flexbox scroll gotcha).
1224
1237
  "#lvc-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:14px;" +
1225
- "background:var(--lvc-bg);display:flex;flex-direction:column;gap:4px}" +
1238
+ "background:var(--lvc-surface);display:flex;flex-direction:column;gap:4px}" +
1226
1239
  // Class rules carry the #lvc-root prefix so they outrank the
1227
1240
  // id-level `#lvc-root *` reset above.
1228
1241
  "#lvc-root .lvc-who{font-size:11px;color:var(--lvc-muted);margin:8px 4px 2px}" +
@@ -1234,7 +1247,7 @@
1234
1247
  "border-bottom-right-radius:4px}" +
1235
1248
  "#lvc-root[dir=rtl] .lvc-visitor{align-self:flex-start;border-bottom-right-radius:14px;" +
1236
1249
  "border-bottom-left-radius:4px}" +
1237
- "#lvc-root .lvc-agent{align-self:flex-start;background:var(--lvc-surface);border:1px solid var(--lvc-border);" +
1250
+ "#lvc-root .lvc-agent{align-self:flex-start;background:var(--lvc-bg);border:1px solid var(--lvc-border);" +
1238
1251
  "border-bottom-left-radius:4px}" +
1239
1252
  "#lvc-root[dir=rtl] .lvc-agent{align-self:flex-end;border-bottom-left-radius:14px;" +
1240
1253
  "border-bottom-right-radius:4px}" +
@@ -1258,8 +1271,9 @@
1258
1271
  "#lvc-form:focus-within{border-color:var(--lvc-accent)}" +
1259
1272
  // appearance:none flattens Safari's default textarea bevel, which would
1260
1273
  // otherwise show as a second inset box inside the composer.
1261
- "#lvc-root #lvc-input{-webkit-appearance:none;appearance:none;border:none;background:none;" +
1262
- "resize:none;font:inherit;color:var(--lvc-text);padding:4px 4px 0;max-height:120px;outline:none}" +
1274
+ "#lvc-root #lvc-input{-webkit-appearance:none!important;appearance:none!important;border:none!important;" +
1275
+ "box-shadow:none!important;background:transparent!important;resize:none;font:inherit;color:var(--lvc-text);" +
1276
+ "padding:4px 4px 0;max-height:120px;outline:none!important}" +
1263
1277
  "#lvc-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px}" +
1264
1278
  "#lvc-tools{display:flex;align-items:center;gap:2px}" +
1265
1279
  // Tool buttons (attach, and room for more) are quiet — the accent is the
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: 0.6.2
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov