Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/sites/embed/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ interface OpenOptions {
type Command = [string, ...unknown[]];

const Z = "2147483000";
// Every element the loader adds to the page also sets `pointerEvents: "auto"`:
// modal dialogs (Radix, shadcn, Headless UI) put `pointer-events: none` on
// <body> while they are open, which would leave the chat unclickable when a
// host opens it from inside a dialog (e.g. "Contact support" on an upload
// error).
const ICONS: Record<string, string> = {
chat: '<path d="M4 4h16v12H7l-3 3V4z"/>',
message: '<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>',
Expand Down Expand Up @@ -200,6 +205,7 @@ function css(el: HTMLElement, styles: Record<string, string>) {
css(previewCard, {
position: "fixed",
zIndex: Z,
pointerEvents: "auto",
right: "16px",
bottom: `${bubbleSize() + 28}px`,
width: "min(300px, calc(100vw - 32px))",
Expand Down Expand Up @@ -285,6 +291,7 @@ function css(el: HTMLElement, styles: Record<string, string>) {
const base = {
position: "fixed",
zIndex: Z,
pointerEvents: "auto",
cursor: "pointer",
display: "flex",
alignItems: "center",
Expand Down Expand Up @@ -405,6 +412,7 @@ function css(el: HTMLElement, styles: Record<string, string>) {
css(iframe, {
position: "fixed",
zIndex: Z,
pointerEvents: "auto",
bottom: "0",
left: "50%",
transform: "translateX(-50%)",
Expand All @@ -419,6 +427,7 @@ function css(el: HTMLElement, styles: Record<string, string>) {
css(iframe, {
position: "fixed",
zIndex: Z,
pointerEvents: "auto",
boxShadow: "0 25px 50px -12px rgba(0,0,0,.25)",
background: config.colors?.card ?? "#fff",
colorScheme: "normal",
Expand Down
Loading