Skip to content

feat(web): offer contact support on dashboard errors - #936

Merged
clbotdev merged 3 commits into
mainfrom
feat/in-app-support
Dec 1, 2026
Merged

clbotdev merged 3 commits into
mainfrom
feat/in-app-support

Conversation

@clbotdev

Copy link
Copy Markdown
Contributor

For codelitdev/frontlit#268.

A customer whose uploads failed only saw a raw TUS error in a toast. They could report it, but couldn't make sense of it, and we had to ask who they were before we could start.

What changes

On the hosted app, an error toast on any /dashboard page (including the page editor) now reads "Something went wrong. We've encountered an error while doing that." with a Contact support button.

The button opens the support chat with everything attached:

  • user: email, name and user ID
  • school: name and URL
  • page
  • the original error: its title and message
  • browser

No one has to ask.

  • One switch for all error toasts: Toaster (components-library) takes an optional mapToast. The web app uses it to rewrite error toasts (destructive variant, or titled "Error") on dashboard pages. None of the ~175 error toast call sites change.
  • POST /api/support/session: reads the signed-in user and school on the server, starts a support session with the support API key, and returns only the session token. The browser sends only the page and the error text.
  • Chat loader: loaded only on /dashboard pages, without the floating bubble (launcher: false). It closes when you leave the dashboard. No iframe is created until Contact support is clicked.

Only on the hosted app

It's on only when all of these are set: MULTITENANT=true, FRONTLIT_TEAM_ID and FRONTLIT_SUPPORT_API_KEY. Otherwise toasts are unchanged, the loader never loads, and the route returns 404. Self-hosted setups never get it.

Optional, for testing against non-production: FRONTLIT_API_URL (default https://api.frontlit.app) and FRONTLIT_EMBED_URL (default https://embed.frontlit.app).

Needs codelitdev/frontlit#278, so the chat can be clicked while the upload dialog is still open.

Testing

  • New tests: route tests (session payload; off when single-tenant or with no team ID; 401; 400; 502) and toast/loader tests. The full jest suite passes (847 tests) and tsc is clean.
  • Local e2e: multitenant school, local FrontLit, real browser.
    • An upload on Settings → Branding failed, and the toast showed the generic message with Contact support.
    • Clicking it opened the chat over the upload dialog.
    • Sending a message created a FrontLit ticket. The ticket had the user ID, the school's name and URL, page: /dashboard/settings, errorTitle: Upload Failed and error: Failed to obtain signature.
    • Clicking again reopened the same conversation. The chat stayed open between dashboard pages and closed on leaving the dashboard.
  • Self-hosted check: with MULTITENANT unset (and the FrontLit env vars still set), the team ID isn't sent to the browser and the route returns 404.

On the hosted app, an error toast on a /dashboard page now says "We've
encountered an error while doing that." with a Contact support button,
instead of a raw message like a TUS upload error. The button starts a
support session from the server (user, school and the error) and opens
the support chat with it.

It's on only when MULTITENANT=true and FRONTLIT_TEAM_ID and
FRONTLIT_SUPPORT_API_KEY are set, so self-hosted setups never load or
call the chat.
@clbotdev

Copy link
Copy Markdown
Contributor Author

QA e2e passed (codelit/courselit-app:qa-pr936-5258f301 on courselit-classic-app, with codelit/frontlit#278 on QA sites).

Setup on QA:

  • Support key: a support-sessions-only API key for FrontLit QA My Team.
  • Env vars: courselit-classic-app has FRONTLIT_TEAM_ID, FRONTLIT_SUPPORT_API_KEY, FRONTLIT_API_URL and FRONTLIT_EMBED_URL set with kubectl set env. They're not in the infra repo.

What I checked on coolschool.clqa.site, signed in, on /dashboard/profile:

  1. Loader: https://embed.frontlit.cluster.clqa.site/chat.js loaded, with no bubble and no iframe.
  2. Toast: I made the MediaLit upload fail in the browser (TUS requests sent to a dead URL). After TUS's retries, the toast showed "Something went wrong / We've encountered an error while doing that." with Contact support, not the raw TUS error.
  3. Chat: Contact support called /api/support/session (200), and the chat opened over the still-open upload dialog. I clicked into it and sent a message.
  4. Ticket: the FrontLit ticket showed:
    • User ID and school (coolschool, https://coolschool.clqa.site)
    • Page: page: /dashboard/profile
    • Error: errorTitle: Upload Failed, and error: tus: failed to create upload, caused by [object ProgressEvent], originated from request (method: POST, url: https://api.medialit.clqa.site/media/create/resumable, …)
    • Browser: user agent

Cleanup: the test ticket is closed, and the test profile photo was removed.

On hosted schools, replace the Discord, bug report and paid support
sections with a card that opens the support chat. Self-hosted setups
keep the page as it was.
@clbotdev

Copy link
Copy Markdown
Contributor Author

Added in 7dbb362: on hosted schools (support chat on), /dashboard/support shows Documentation and a new Chat with us card. The Discord, bug report and Priority Support sections are hidden. Self-hosted setups keep the page as it was. The card and the error toast now share one useContactSupport hook.

Local: multitenant school shows the two cards; Start a chat opened the chat and the ticket had the school, user and /dashboard/support, with no error attached. Single-tenant with the FrontLit variables set shows the old page and loads no chat script.

QA (qa-pr936-7dbb362b, biller-test-1 as admin): same result. Ticket tkt_i9685y1of6yhkhzbl6g26yj6 (now closed) had account biller-test-1 and page /dashboard/support.

Tests: 2 new page tests; full suite 849 passing.

@clbotdev
clbotdev merged commit e8b58cc into main Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants