Commit Graph

57 Commits

Author SHA1 Message Date
Abhinav Raut 13bfa07402 merge main into the widget language branch 2026-10-19 00:00:30 +05:30
Abhinav Raut f87d99f452 polish app layouts and fix UI regressions
Use available admin space and make forms adapt to screen width.
Preserve reply edits during resizing and improve widget feedback.
2026-10-12 00:34:18 +05:30
Yinghao Sun 475bf6916c let the host page choose the live chat widget language
The widget's UI language was either the inbox's fixed language or, on
"auto", the browser's. Host apps with their own language switch had no
way to tell the widget which language their user picked.

- widget.js: an optional `language` setting (LibredeskSettings or
  initLibredesk) is passed to the iframe as `lang`, and
  `Libredesk.setLanguage(code)` switches it later. A call made while the
  iframe is still loading is sent once it reports WIDGET_LOADED.
- main.js: on inboxes set to "auto", a `lang` the host passed wins over
  the browser language; a language the admin fixed for the inbox stays.
- App.vue: SET_LANGUAGE loads the strings and switches the i18n locale in
  place (help center content reloads in the new language), so an open
  conversation is not reset.
- Short or regional tags match a shipped translation: zh -> zh-CN,
  de-AT -> de-DE.

Closes #657
2026-10-04 23:13:59 +01:00
Abhinav Raut 73f9ab3ec5 hide the closed widget window on a timer 2026-10-04 22:55:04 +05:30
Abhinav Raut bfcdcc0dbe tune animations across the app and widget 2026-10-04 22:37:14 +05:30
Abhinav Raut 0df54faac7 fix color scheme listener on old safari and reject fractional message counts 2026-09-22 12:28:30 +05:30
Abhinav Raut 127d98c46e fix proactive message bugs and simplify launcher and preview settings 2026-09-22 03:17:42 +05:30
Abhinav Raut a6143729c7 fix widget compatibility and asset loading 2026-09-22 01:57:49 +05:30
Abhinav Raut 374cd26e4a improve live chat widget settings and branding
Reduce the inbox form to five grouped tabs and add a responsive live preview.
Add separate light and dark branding with system theme support.
Add launcher size and logo scale controls. Ref #627
Fix realtime message ordering in the agent dashboard. Fixes #626
2026-09-22 01:29:25 +05:30
Abhinav Raut 04464fb2e0 show message previews only after the widget loads 2026-09-20 23:19:57 +05:30
Abhinav Raut 835128504e fix widget, search and help center bugs
- handoff form no longer overwrites a JWT contact's name, email or phone.
  The CRM resyncs those on every exchange, so the edit reverted anyway.
  Visitors still get their submitted values saved.
- search queries dropped the cs and cp table aliases. Any saved view
  filtering on conversation_statuses.name returned a 500.
- status and priority never showed as selected in the search filters.
  The combobox compares strings, the store gives numbers.
- widget logout left the previous visitor's pre chat draft on screen.
- an auto hidden campaign preview was suppressed forever instead of for
  the session.
- switching campaigns in the admin preview did not close the open panel.
  The watcher only saw null and non null, so it now keys on campaign id.
- the Help tab blanked out when featured_ids came back as null.
- copilot panel spinner stuck when no conversation was open.
- help center theme toggle was hidden when there were no nav links and
  one locale.
- help center dark mode leaked into the article panel inside the widget.
2026-09-20 22:51:20 +05:30
Abhinav Raut 08e6801fc4 polish widget UI and fix proactive message delete
Widget:
- home background stays pinned while the content scrolls, fade sits on it
- one radius and shadow scale across cards, buttons and inputs
- live search in the help tab with a "no results" state
- attachment-only messages show "Image" in the conversation preview
- launcher and panel use the same shadows as the header

Admin:
- preview column is a fixed width so zoom does not resize it, hidden on small screens
- preview matches the real widget again
- search spinner replaces the magnifier instead of covering the page

Fixes:
- deleting a proactive message did nothing, the dialog cleared the pending
  id before the handler read it
- an inbox created through the API could not be saved from the form, it
  jumped to the pre-chat tab with no error

Adds livechatWidgetTabs.cy.js covering the proactive message and help
center tabs.
2026-09-20 18:48:51 +05:30
Abhinav Raut a074bc4d55 add hover animation to widget launcher
The launcher grows a little on hover and springs back when the pointer
leaves. Also adds a black launcher logo for light backgrounds, softens
the launcher shadow, and expands the widget when help opens on an article.
2026-09-19 17:27:01 +05:30
Abhinav Raut f6f1bb4ad1 show helpcenter article as is inside the widget. adds new ?embed query param that shows the entire helpcenter in embed mode 2026-09-19 03:58:04 +05:30
Abhinav Raut d2dc51b734 link article translations by group id and tidy the widget chat
Move the translation_group_id migration into v2.9.0 and drop the slug backfill. Existing articles each get their own group and admins link translations from the new UI. The public article page now builds its language links from the group instead of the slug, so translations with different slugs no longer 404.
2026-09-19 02:13:13 +05:30
Abhinav Raut 216451647b label audience prechat toggle, pin handoff conversation, clear dismissed preview timers 2026-09-18 20:07:35 +05:30
Abhinav Raut 7d77754b52 improve live chat widget flows
Expand widget conversations with audience-specific forms, AI handoffs, message previews, and help article translations. Keep existing inbox settings compatible and reject invalid live chat configuration.
2026-09-18 16:09:15 +05:30
Abhinav Raut 9c1e14704f fix campaign reply and poll edge cases, enlarge mobile launcher 2026-09-18 01:05:21 +05:30
Abhinav Raut 89f58904d2 wip: add widget campaigns, help center in widget and transcript download 2026-09-16 02:11:44 +05:30
Abhinav Raut 78b1c26e94 Update static/widget.js
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-19 18:51:24 +05:30
Anandumv b5228e6621 fix(widget): gamma-correct luminance in contrastColor
contrastColor() fed raw sRGB channel values straight into the WCAG
relative-luminance formula and compared the result against the 0.179
threshold. That threshold assumes gamma-corrected (linear) values, so
without the correction dark colors like #333333 were scored as bright
enough for black text, producing black-on-dark-background icons.

Fixes #351
2026-07-14 12:25:20 +05:30
Abhinav Raut 9c6a6c254d fix widget draft attachments, prechat phone default, and shadow tweaks
Draft attachments now keep url and disposition, so a restored draft can render its attachments correctly instead of losing them.

The prechat phone field now picks a country code from the browser locale when the field is required (falling back to US), so users are not forced to pick one manually. Non-required phone fields still start blank.

Also soften the widget iframe and launcher bubble box shadows to a lighter, tinted look.
2026-07-10 01:09:09 +05:30
Abhinav Raut 8f658f274d add livechat pre-chat phone field and fix default launcher logo 2026-07-09 01:49:38 +05:30
Abhinav Raut 62a1fc836e add livechat widget preview and misc improvements
Livechat:
- Add a live widget preview that renders in the inbox settings help rail.
- Warn when the primary or header colors are too close to the background.
- Require gradient/image background values and notice banner text when enabled.
- Show a default launcher logo in the widget when none is set, matching the preview.
- Drop the Beta badge from the livechat channel.

General settings:
- Add "set agents away on login". Agents log in as away and must go online manually.
- Add "show subject in conversation list" toggle.

Other:
- Add a keyboard shortcuts dialog from the user menu.
- Show a "snoozed until" badge on snoozed conversations.
- Contact search now matches emails partially instead of exact.
- Give outgoing message bubbles a secondary background.
2026-07-03 02:34:42 +05:30
Abhinav Raut c645df820d Fix widget auto-init race when script is served from memory cache 2026-04-17 18:39:50 +05:30
Abhinav Raut dfa9808168 Consolidate widget iframe layout and honor prefers-reduced-motion 2026-04-17 00:55:51 +05:30
Abhinav Raut 6ef17eeae6 Make widget /auth/exchange idempotent
Prevent tokens sent twice from widget.js, send only once.
Update doc strings & comments for clarity.
Fix error handling
2026-04-16 01:16:24 +05:30
Abhinav Raut de8c825c4f Increase widget iframe and launcher shadow depth 2026-04-15 19:52:41 +05:30
Abhinav Raut c61073750e Centralize widget 401 handling in axios response interceptor, clear session and visitor cookies on expiry 2026-04-15 01:10:04 +05:30
Abhinav Raut 1cb6074b1c Sync widget isOpen state across all open/close paths 2026-04-13 23:16:24 +05:30
Abhinav Raut 0d9196b269 Add color customization for live chat launcher 2026-04-13 04:16:22 +05:30
Abhinav Raut e860164ad7 Add widget home screen customization with configurable backgrounds, announcements, and external links
Fix inconsistnet close button for mobile devices.
2026-04-13 04:01:07 +05:30
Abhinav Raut c798c676a5 Hide server-side security fields in chat settings response and adjust iframe border radius 2026-04-12 23:17:11 +05:30
Abhinav Raut bdaf9159a2 Add dynamic launcher size adjustment for mobile and desktop 2026-04-08 12:48:47 +05:30
Abhinav Raut eea99130fa Defer widget launcher display until auth and conversation data are loaded 2026-04-06 14:21:36 +05:30
Abhinav Raut 3c3d6a6149 feat: replace widget JWT auth with Redis session tokens and parent-domain cookies Fix iOS Safari session loss by moving storage from iframe localStorage to first-party cookies.
Add /auth/exchange, /auth/me endpoints for the same.

Fix duplicate network calls, and agent notification for new conversations.
2026-04-05 18:58:45 +05:30
Abhinav Raut 154be058e4 Fix widget mobile view zooming in for ios as the msg input had text size < 16 px.
More fixes for widget mobile view
Sync messages once websocket is connected
2026-04-05 00:09:37 +05:30
Abhinav Raut 5c29708cc9 Fix iframe src url 2026-04-04 22:58:59 +05:30
Abhinav Raut 6abb6ad017 Move continuity config and intervals to live chat inbox form from toml.
- Refactor widget.js.
- Fix possible race conditions in inbox reload logic.
- Reload only the updated inbox when an inbox is updated / created not all.
- Retain last inbox while navigatin back from admin -> inbox
2026-04-04 21:35:04 +05:30
Abhinav Raut 0a9e57dcc5 Revamp live chat widget JS API, use inbox UUID, non-blocking installation
Update installation instructions for clarity
Remove unncessary convo custom attribs being passed in JWT tokens for live chat
2026-04-04 18:11:54 +05:30
Abhinav Raut 000fd83b30 Add uuid column to inboxes table to use as widget public identifiers
Auto focus on form inputs in widget
Use defer widget in widget installation script
2026-04-03 02:34:07 +05:30
Abhinav Raut 14a7bf4435 Add widget.js minification step to build; subtle shadows. 2026-03-25 11:26:08 +05:30
Abhinav Raut 2233712f85 Polish widget UX: accessibility, tab nav, expand/collapse, conversation list, and mobile fixes. 2026-03-25 02:28:43 +05:30
Abhinav Raut f26602152b Fix widget unread badge not restoring when chat is closed
showChat() unconditionally hides the unread badge, but hideChat()
never re-evaluates it. If the visitor opens and closes the widget
without viewing any conversation, the badge stays hidden even though
unread messages remain.
2026-03-22 17:33:08 +05:30
Abhinav Raut a788553137 Use first unread message as subject for continuity emails, add ref number to continuity email subject.
- Continuity email layout fixes and improvments.
- Replace haikunator with email local part for visitor names, fallback to "Visitor"
- Add optional website_url config field for "go to chat" link in continuity email footer
- Remove unused / unncessary i18n keys.
2026-03-16 00:49:20 +05:30
Abhinav Raut eb0a7b437d Add page visit tracking to widget
- fix duplicate initialization guard
- notification bell for agents
- Refactor and clean up dead code
- Fixes to pre chat form
- Add new column country to users table
- Update ratelimit pkg to be generic
2026-03-11 03:52:07 +05:30
Abhinav Raut 0a662b081c Add widget js API (hideDefaultLauncher, setUser, logout), fix static methods, update installation tab 2026-03-03 16:53:38 +05:30
Abhinav Raut 107f1adb0d fix issues with threading with widget messages
- fix: live chat email inbox not being initialized.
- make launcher logo take entire launcher space.
- New columns last_interaction_sender_id and last_message_sender_id to track who sent last message in conversation
2026-01-18 13:47:07 +05:30
Abhinav Raut 98b3b54b6f Add installation tab to live chat form for copying widget js snippet
New common CopyButton component for copying text to clipboard
2025-10-05 14:25:41 +05:30
Abhinav Raut 16ca6b6df7 Send batched unread messages in conversation continuity email after contact has not seen a conversation for configured amount of time, instead of sending a single message immediately when contact is disconnected on websocket.
Make the batching interval and time threshold for unread messages configurable
2025-10-03 01:54:17 +05:30