@sevenfold/setto-client 0.43.0 → 0.45.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.
package/dist/chrome.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export interface SettoChromeHandshake {
|
|
|
71
71
|
} | null;
|
|
72
72
|
sitesLoaded: boolean;
|
|
73
73
|
editMode: boolean;
|
|
74
|
+
/** May edit, whether or not editing now (0.44). The chrome loads the editor for it. */
|
|
75
|
+
canEdit?: boolean;
|
|
74
76
|
/** A signed-out visitor trying the editor on setto.no. */
|
|
75
77
|
guestEdit: boolean;
|
|
76
78
|
authLoading: boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Session } from '@supabase/supabase-js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether this session is the site's support account: the member a Setto admin
|
|
4
|
+
* signs in as with «Rediger» in the admin. setto-server makes the account and
|
|
5
|
+
* names its one site in `app_metadata.setto_support_site`, which only the
|
|
6
|
+
* service role can write (`src/lib/support-account.ts` there).
|
|
7
|
+
*
|
|
8
|
+
* Read from the session rather than asked of the server, so the editor is
|
|
9
|
+
* there on the first render. It only opens the editor's furniture; every
|
|
10
|
+
* write is still the server's to allow or refuse.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSupportSession(session: Session | null, siteId: string): boolean;
|
|
@@ -97,6 +97,13 @@ export declare function insertMention(value: string, name: string, at: {
|
|
|
97
97
|
value: string;
|
|
98
98
|
caret: number;
|
|
99
99
|
};
|
|
100
|
+
/** The visitor's conversations: those still going first, then those that have ended. */
|
|
101
|
+
export declare function chatGroups<T extends {
|
|
102
|
+
status: 'bot' | 'human' | 'closed';
|
|
103
|
+
}>(chats: readonly T[]): Array<{
|
|
104
|
+
ended: boolean;
|
|
105
|
+
chats: T[];
|
|
106
|
+
}>;
|
|
100
107
|
/**
|
|
101
108
|
* «Translated from English · Show original» under a translated message, in
|
|
102
109
|
* the visitor's language. The toggle is a real button; the line is left out
|
package/dist/provider.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface SettoContextValue {
|
|
|
20
20
|
editMode: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* True when this person may edit this site: signed in, a member, the site is
|
|
23
|
-
* paid for, and this is not `/setto`. The Setto menu is drawn whenever this
|
|
23
|
+
* paid for (or this is the site's support account), and this is not `/setto`. The Setto menu is drawn whenever this
|
|
24
24
|
* is; outside `editMode` it shows the site as a visitor sees it.
|
|
25
25
|
* Absent on a client older than 0.33, where `editMode` meant this.
|
|
26
26
|
*/
|
package/dist/setto-client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useState, useRef, useEffect, useMemo, useId, useInsertionEffect, useLayoutEffect, Children, createContext, useContext, useCallback, useSyncExternalStore, forwardRef
|
|
3
|
+
import { useState, useRef, useEffect, useMemo, useId, Fragment as Fragment$1, useInsertionEffect, useLayoutEffect, Children, createContext, useContext, useCallback, useSyncExternalStore, forwardRef } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import * as ReactDOM from "react-dom";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
@@ -22014,6 +22014,10 @@ function useSiteAccess(supabase, session, siteId) {
|
|
|
22014
22014
|
}, [supabase, session, siteId]);
|
|
22015
22015
|
return state;
|
|
22016
22016
|
}
|
|
22017
|
+
function isSupportSession(session, siteId) {
|
|
22018
|
+
const site = session?.user?.app_metadata?.setto_support_site;
|
|
22019
|
+
return typeof site === "string" && site === siteId;
|
|
22020
|
+
}
|
|
22017
22021
|
const CHROME_CONTRACT = 1;
|
|
22018
22022
|
function chromeUrl(apiUrl) {
|
|
22019
22023
|
return `${apiUrl.replace(/\/$/, "")}/chrome/v${CHROME_CONTRACT}.js`;
|
|
@@ -22081,6 +22085,7 @@ function SettoChrome() {
|
|
|
22081
22085
|
currentSite: null,
|
|
22082
22086
|
sitesLoaded: false,
|
|
22083
22087
|
editMode: false,
|
|
22088
|
+
canEdit: false,
|
|
22084
22089
|
guestEdit: false,
|
|
22085
22090
|
authLoading: true
|
|
22086
22091
|
}));
|
|
@@ -22094,6 +22099,7 @@ function SettoChrome() {
|
|
|
22094
22099
|
} : null,
|
|
22095
22100
|
sitesLoaded: setto.sites !== null,
|
|
22096
22101
|
editMode: setto.editMode,
|
|
22102
|
+
canEdit: setto.canEdit,
|
|
22097
22103
|
guestEdit: setto.guestEdit,
|
|
22098
22104
|
authLoading: setto.authLoading
|
|
22099
22105
|
});
|
|
@@ -35569,6 +35575,12 @@ function CloseIcon({ size = 22 }) {
|
|
|
35569
35575
|
}
|
|
35570
35576
|
) });
|
|
35571
35577
|
}
|
|
35578
|
+
function chatGroups(chats) {
|
|
35579
|
+
return [false, true].map((ended) => ({ ended, chats: chats.filter((chat) => chat.status === "closed" === ended) })).filter((group) => group.chats.length > 0);
|
|
35580
|
+
}
|
|
35581
|
+
function CheckIcon$1() {
|
|
35582
|
+
return /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l4.5 4.5L19 7.5" }) });
|
|
35583
|
+
}
|
|
35572
35584
|
function PlusIcon() {
|
|
35573
35585
|
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
35574
35586
|
"path",
|
|
@@ -36259,6 +36271,8 @@ function SettoChat() {
|
|
|
36259
36271
|
const [queued, setQueued] = useState(false);
|
|
36260
36272
|
const [loadingConversation, setLoadingConversation] = useState(false);
|
|
36261
36273
|
const [humanJoined, setHumanJoined] = useState(false);
|
|
36274
|
+
const [ended, setEnded] = useState(false);
|
|
36275
|
+
const [ending, setEnding] = useState(false);
|
|
36262
36276
|
const [originals, setOriginals] = useState(() => /* @__PURE__ */ new Set());
|
|
36263
36277
|
const [availability, setAvailability] = useState({
|
|
36264
36278
|
humanAvailable: false,
|
|
@@ -36358,7 +36372,10 @@ function SettoChat() {
|
|
|
36358
36372
|
failed: "Jeg får ikke svart akkurat nå. Kontakt gjerne teamet direkte.",
|
|
36359
36373
|
image: "Bilde",
|
|
36360
36374
|
seen: "Sett",
|
|
36361
|
-
emptyChats: "Nye samtaler du starter her vises i denne listen."
|
|
36375
|
+
emptyChats: "Nye samtaler du starter her vises i denne listen.",
|
|
36376
|
+
endChat: "Avslutt samtalen",
|
|
36377
|
+
endedChats: "Avsluttet",
|
|
36378
|
+
startNew: "Start en ny samtale"
|
|
36362
36379
|
} : {
|
|
36363
36380
|
open: siteName ? `Open chat with ${siteName}` : "Open chat",
|
|
36364
36381
|
close: "Close chat",
|
|
@@ -36383,7 +36400,10 @@ function SettoChat() {
|
|
|
36383
36400
|
failed: "I cannot reply right now. Please contact the team directly.",
|
|
36384
36401
|
image: "Image",
|
|
36385
36402
|
seen: "Seen",
|
|
36386
|
-
emptyChats: "New conversations you start here will appear in this list."
|
|
36403
|
+
emptyChats: "New conversations you start here will appear in this list.",
|
|
36404
|
+
endChat: "End this conversation",
|
|
36405
|
+
endedChats: "Ended",
|
|
36406
|
+
startNew: "Start a new conversation"
|
|
36387
36407
|
};
|
|
36388
36408
|
function ensureVisitor() {
|
|
36389
36409
|
return visitor.current ??= visitorId();
|
|
@@ -36439,6 +36459,7 @@ function SettoChat() {
|
|
|
36439
36459
|
rememberConversation(next.conversationId);
|
|
36440
36460
|
loadedConversationRef.current = next.conversationId;
|
|
36441
36461
|
setHumanJoined(next.humanJoined);
|
|
36462
|
+
setEnded(next.status === "closed");
|
|
36442
36463
|
setMessages(next.messages);
|
|
36443
36464
|
const supported = "realtimeTopic" in next || "teamReadAt" in next || "visitorReadAt" in next;
|
|
36444
36465
|
const serverTeamReadAt = typeof next.teamReadAt === "string" ? next.teamReadAt : null;
|
|
@@ -36521,6 +36542,31 @@ function SettoChat() {
|
|
|
36521
36542
|
useEffect(() => {
|
|
36522
36543
|
refreshRef.current = refreshConversation;
|
|
36523
36544
|
});
|
|
36545
|
+
async function endConversation() {
|
|
36546
|
+
const id = conversationId.current;
|
|
36547
|
+
const visitorIdValue = visitor.current;
|
|
36548
|
+
if (!id || !visitorIdValue || ending) return;
|
|
36549
|
+
setEnding(true);
|
|
36550
|
+
try {
|
|
36551
|
+
const response = await fetch(
|
|
36552
|
+
`${apiUrl}/sites/${encodeURIComponent(config.siteId)}/chat/conversations/${encodeURIComponent(id)}/public/close`,
|
|
36553
|
+
{
|
|
36554
|
+
method: "POST",
|
|
36555
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
36556
|
+
body: JSON.stringify({ visitorId: visitorIdValue })
|
|
36557
|
+
}
|
|
36558
|
+
);
|
|
36559
|
+
if (!response.ok) return;
|
|
36560
|
+
typingSender().stop();
|
|
36561
|
+
setEnded(true);
|
|
36562
|
+
setDrawer(false);
|
|
36563
|
+
void refreshConversation();
|
|
36564
|
+
void loadChats();
|
|
36565
|
+
} catch {
|
|
36566
|
+
} finally {
|
|
36567
|
+
setEnding(false);
|
|
36568
|
+
}
|
|
36569
|
+
}
|
|
36524
36570
|
async function loadConversation(id) {
|
|
36525
36571
|
const visitorIdValue = ensureVisitor();
|
|
36526
36572
|
setLoadingConversation(true);
|
|
@@ -36713,6 +36759,7 @@ function SettoChat() {
|
|
|
36713
36759
|
setRealtime(null);
|
|
36714
36760
|
setTeamTypingUntil(null);
|
|
36715
36761
|
setHumanJoined(false);
|
|
36762
|
+
setEnded(false);
|
|
36716
36763
|
setMessages(welcomeMessages());
|
|
36717
36764
|
setDraft("");
|
|
36718
36765
|
setTapped(/* @__PURE__ */ new Set());
|
|
@@ -36896,22 +36943,40 @@ function SettoChat() {
|
|
|
36896
36943
|
/* @__PURE__ */ jsx(PlusIcon, {}),
|
|
36897
36944
|
labels.newChat
|
|
36898
36945
|
] }),
|
|
36899
|
-
|
|
36946
|
+
conversationId.current && !ended ? /* @__PURE__ */ jsxs(
|
|
36900
36947
|
"button",
|
|
36901
36948
|
{
|
|
36902
|
-
className:
|
|
36949
|
+
className: "setto-chat__new setto-chat__end",
|
|
36903
36950
|
type: "button",
|
|
36904
|
-
onClick: () => void
|
|
36951
|
+
onClick: () => void endConversation(),
|
|
36952
|
+
disabled: ending || sending,
|
|
36905
36953
|
children: [
|
|
36906
|
-
/* @__PURE__ */ jsx(
|
|
36907
|
-
|
|
36908
|
-
isNo ? "nb-NO" : "en-GB",
|
|
36909
|
-
{ day: "numeric", month: "short" }
|
|
36910
|
-
) })
|
|
36954
|
+
/* @__PURE__ */ jsx(CheckIcon$1, {}),
|
|
36955
|
+
labels.endChat
|
|
36911
36956
|
]
|
|
36912
|
-
}
|
|
36913
|
-
|
|
36914
|
-
|
|
36957
|
+
}
|
|
36958
|
+
) : null,
|
|
36959
|
+
/* @__PURE__ */ jsx("div", { className: "setto-chat__chat-list", children: conversations.length ? chatGroups(conversations).map(({ ended: closedGroup, chats: group }) => {
|
|
36960
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
36961
|
+
closedGroup ? /* @__PURE__ */ jsx("span", { className: "setto-chat__chat-group", children: labels.endedChats }) : null,
|
|
36962
|
+
group.map((chat) => /* @__PURE__ */ jsxs(
|
|
36963
|
+
"button",
|
|
36964
|
+
{
|
|
36965
|
+
className: `setto-chat__chat-row${conversationId.current === chat.id ? " is-active" : ""}${closedGroup ? " is-ended" : ""}`,
|
|
36966
|
+
type: "button",
|
|
36967
|
+
onClick: () => void loadConversation(chat.id),
|
|
36968
|
+
children: [
|
|
36969
|
+
/* @__PURE__ */ jsx("span", { children: chat.preview }),
|
|
36970
|
+
/* @__PURE__ */ jsx("time", { children: new Date(chat.lastActivityAt).toLocaleDateString(
|
|
36971
|
+
isNo ? "nb-NO" : "en-GB",
|
|
36972
|
+
{ day: "numeric", month: "short" }
|
|
36973
|
+
) })
|
|
36974
|
+
]
|
|
36975
|
+
},
|
|
36976
|
+
chat.id
|
|
36977
|
+
))
|
|
36978
|
+
] }, closedGroup ? "ended" : "open");
|
|
36979
|
+
}) : /* @__PURE__ */ jsx("p", { children: labels.emptyChats }) })
|
|
36915
36980
|
]
|
|
36916
36981
|
}
|
|
36917
36982
|
),
|
|
@@ -37021,7 +37086,11 @@ function SettoChat() {
|
|
|
37021
37086
|
}
|
|
37022
37087
|
),
|
|
37023
37088
|
/* @__PURE__ */ jsxs("div", { className: "setto-chat__composer-shell", ref: composerShellRef, children: [
|
|
37024
|
-
|
|
37089
|
+
ended ? /* @__PURE__ */ jsx("div", { className: "setto-chat__ended", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: startNew, children: [
|
|
37090
|
+
/* @__PURE__ */ jsx(PlusIcon, {}),
|
|
37091
|
+
labels.startNew
|
|
37092
|
+
] }) }) : null,
|
|
37093
|
+
!ended && nearby.length ? /* @__PURE__ */ jsxs("div", { className: "setto-chat__team", children: [
|
|
37025
37094
|
teamRowLabelled(nearby) ? /* @__PURE__ */ jsx("span", { className: "setto-chat__team-label", children: labels.teamRow }) : null,
|
|
37026
37095
|
nearby.map((human) => /* @__PURE__ */ jsxs(
|
|
37027
37096
|
"button",
|
|
@@ -37043,7 +37112,7 @@ function SettoChat() {
|
|
|
37043
37112
|
human.handle
|
|
37044
37113
|
))
|
|
37045
37114
|
] }) : null,
|
|
37046
|
-
/* @__PURE__ */ jsx(
|
|
37115
|
+
ended ? null : /* @__PURE__ */ jsx(
|
|
37047
37116
|
SiteChatComposer,
|
|
37048
37117
|
{
|
|
37049
37118
|
value: draft,
|
|
@@ -37135,7 +37204,7 @@ function useChatStyles() {
|
|
|
37135
37204
|
style.textContent = `
|
|
37136
37205
|
.setto-chat__markdown{display:block;min-width:0;white-space:normal}.setto-chat__markdown> :first-child{margin-top:0}.setto-chat__markdown> :last-child{margin-bottom:0}.setto-chat__markdown p{margin:0 0 .72em}.setto-chat__markdown h1,.setto-chat__markdown h2,.setto-chat__markdown h3{margin:.95em 0 .36em;font-size:1em;font-weight:680;line-height:1.28;letter-spacing:-.012em}.setto-chat__markdown h1{font-size:1.08em}.setto-chat__markdown ul,.setto-chat__markdown ol{margin:.12em 0 .72em;padding-left:1.25em}.setto-chat__markdown ul{list-style:disc}.setto-chat__markdown ol{list-style:decimal}.setto-chat__markdown li{margin:.2em 0;padding-left:.08em}.setto-chat__markdown li::marker{color:color-mix(in srgb,var(--setto-chat-accent) 78%,var(--setto-chat-ink))}.setto-chat__markdown strong{font-weight:700}.setto-chat__markdown a{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--setto-chat-accent) 70%,transparent);text-decoration-thickness:1px;text-underline-offset:.16em}.setto-chat__markdown blockquote{margin:.2em 0 .72em;padding:.08em 0 .08em .7em;border-left:2px solid color-mix(in srgb,var(--setto-chat-accent) 58%,transparent);color:color-mix(in srgb,var(--setto-chat-ink) 76%,transparent)}.setto-chat__markdown hr{height:1px;margin:.85em 0;border:0;background:color-mix(in srgb,var(--setto-chat-ink) 13%,transparent)}.setto-chat__markdown code{padding:.08em .28em;border-radius:.32em;background:color-mix(in srgb,var(--setto-chat-ink) 8%,transparent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em}.setto-chat__markdown pre{max-width:100%;margin:.3em 0 .78em;padding:.7em;overflow-x:auto;overscroll-behavior:contain;border-radius:.7em;background:color-mix(in srgb,var(--setto-chat-ink) 8%,transparent);white-space:pre;-webkit-overflow-scrolling:touch}.setto-chat__markdown pre code{padding:0;background:transparent}.setto-chat__table-wrap{max-width:100%;margin:.25em 0 .75em;overflow-x:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.setto-chat__markdown table{width:100%;border-collapse:collapse;font-size:.88em}.setto-chat__markdown th,.setto-chat__markdown td{padding:.38em .5em;border-bottom:1px solid color-mix(in srgb,var(--setto-chat-ink) 13%,transparent);text-align:left;vertical-align:top}.setto-chat__markdown th{font-weight:680}.setto-chat__markdown-image-label{font-style:italic;color:color-mix(in srgb,var(--setto-chat-ink) 62%,transparent)}.setto-chat__word{display:inline-block}.setto-chat__markdown.is-revealing .setto-chat__word{opacity:0;transform:translateY(.08em);filter:blur(.35px);animation:setto-chat-word-in 180ms cubic-bezier(.2,.8,.2,1) forwards;will-change:opacity,transform,filter}@keyframes setto-chat-word-in{to{opacity:1;transform:none;filter:none}}
|
|
37137
37206
|
.setto-chat{--setto-chat-edge:.75rem;position:fixed;right:max(18px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));z-index:2147483000;overscroll-behavior:contain;color:var(--setto-chat-ink);font-family:"Archivo Variable",Archivo,system-ui,sans-serif;-webkit-font-smoothing:antialiased}.setto-chat *,.setto-chat *::before,.setto-chat *::after{box-sizing:border-box}.setto-chat button,.setto-chat input,.setto-chat textarea{font:inherit}.setto-chat--mounted{top:0;right:auto;bottom:auto;left:0;width:100vw;height:var(--setto-chat-layout-height,100lvh);overflow:hidden;background:var(--setto-chat-canvas);opacity:0;transition:opacity ${CLOSE_MS}ms ease}.setto-chat--visible{opacity:1}.setto-chat__shell{position:absolute;top:var(--setto-chat-top,0);left:0;width:100%;height:var(--setto-chat-height,100svh);display:flex;overflow:hidden;overscroll-behavior:contain;background:var(--setto-chat-canvas);opacity:0;transform:translateY(12px) scale(.994);transform-origin:center bottom;transition:opacity ${CLOSE_MS}ms ease,transform ${CLOSE_MS}ms cubic-bezier(.16,1,.3,1)}.setto-chat--visible .setto-chat__shell{opacity:1;transform:none}
|
|
37138
|
-
.setto-chat__scrim{position:absolute;inset:0;z-index:45;border:0;background:rgba(33,23,17,.32);opacity:0;pointer-events:none;transition:opacity 220ms ease}.setto-chat__scrim.is-open{opacity:1;pointer-events:auto}.setto-chat__chats{position:relative;z-index:50;width:min(84vw,280px);height:100%;flex:0 0 280px;padding:1rem .85rem calc(1rem + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:.9rem;background:color-mix(in srgb,var(--setto-chat-crema) 32%,var(--setto-chat-canvas));border-right:1px solid color-mix(in srgb,var(--setto-chat-ink) 12%,transparent);overflow:hidden}.setto-chat__chats-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:34px;font-size:.66rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent)}.setto-chat__chats-heading button{width:34px;height:34px;padding:0;border:0;border-radius:8px;background:transparent;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.setto-chat__new{display:flex;align-items:center;gap:.55rem;width:100%;padding:.5rem .55rem;border:0;border-radius:8px;background:transparent;color:var(--setto-chat-ink);font-weight:600;font-size:.9rem;text-align:left;cursor:pointer;transition:background 140ms ease}.setto-chat__new:hover{background:color-mix(in srgb,var(--setto-chat-ink) 5%,transparent)}.setto-chat__chat-list{display:flex;flex-direction:column;gap:.1rem;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;margin-right:-.85rem;padding-right:.3rem}.setto-chat__chat-list p{margin:.35rem .55rem;font-size:.85rem;line-height:1.5;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent)}.setto-chat__chat-row{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.4rem;padding:.55rem;border:0;border-radius:8px;background:transparent;color:var(--setto-chat-ink);text-align:left;cursor:pointer}.setto-chat__chat-row:hover,.setto-chat__chat-row.is-active{background:color-mix(in srgb,var(--setto-chat-ink) 7.5%,transparent)}.setto-chat__chat-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.9rem;font-weight:600}.setto-chat__chat-row time{font-size:.72rem;color:color-mix(in srgb,var(--setto-chat-ink) 55%,transparent)}
|
|
37207
|
+
.setto-chat__scrim{position:absolute;inset:0;z-index:45;border:0;background:rgba(33,23,17,.32);opacity:0;pointer-events:none;transition:opacity 220ms ease}.setto-chat__scrim.is-open{opacity:1;pointer-events:auto}.setto-chat__chats{position:relative;z-index:50;width:min(84vw,280px);height:100%;flex:0 0 280px;padding:1rem .85rem calc(1rem + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:.9rem;background:color-mix(in srgb,var(--setto-chat-crema) 32%,var(--setto-chat-canvas));border-right:1px solid color-mix(in srgb,var(--setto-chat-ink) 12%,transparent);overflow:hidden}.setto-chat__chats-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:34px;font-size:.66rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent)}.setto-chat__chats-heading button{width:34px;height:34px;padding:0;border:0;border-radius:8px;background:transparent;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.setto-chat__new{display:flex;align-items:center;gap:.55rem;width:100%;padding:.5rem .55rem;border:0;border-radius:8px;background:transparent;color:var(--setto-chat-ink);font-weight:600;font-size:.9rem;text-align:left;cursor:pointer;transition:background 140ms ease}.setto-chat__new:hover{background:color-mix(in srgb,var(--setto-chat-ink) 5%,transparent)}.setto-chat__chat-list{display:flex;flex-direction:column;gap:.1rem;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;margin-right:-.85rem;padding-right:.3rem}.setto-chat__chat-list p{margin:.35rem .55rem;font-size:.85rem;line-height:1.5;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent)}.setto-chat__chat-row{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.4rem;padding:.55rem;border:0;border-radius:8px;background:transparent;color:var(--setto-chat-ink);text-align:left;cursor:pointer}.setto-chat__chat-row:hover,.setto-chat__chat-row.is-active{background:color-mix(in srgb,var(--setto-chat-ink) 7.5%,transparent)}.setto-chat__chat-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.9rem;font-weight:600}.setto-chat__chat-row time{font-size:.72rem;color:color-mix(in srgb,var(--setto-chat-ink) 55%,transparent)}.setto-chat__chat-row.is-ended span{font-weight:500;color:color-mix(in srgb,var(--setto-chat-ink) 72%,transparent)}.setto-chat__chat-group{display:block;margin:.75rem .55rem .2rem;font-size:.66rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:color-mix(in srgb,var(--setto-chat-ink) 58%,transparent)}.setto-chat__end{margin-top:-.6rem;font-weight:500;color:color-mix(in srgb,var(--setto-chat-ink) 72%,transparent)}.setto-chat__end:disabled{opacity:.5;cursor:default}.setto-chat__ended{position:relative;z-index:1;display:flex;justify-content:center;padding:.25rem 0 .35rem}.setto-chat__ended button{display:inline-flex;align-items:center;gap:.5rem;min-height:44px;padding:0 1.15rem;border:0;border-radius:999px;background:var(--setto-chat-accent);color:var(--setto-chat-on-accent);font:inherit;font-size:.95rem;font-weight:600;cursor:pointer;box-shadow:0 8px 24px -16px color-mix(in srgb,var(--setto-chat-ink) 45%,transparent);transition:transform 200ms ease}.setto-chat__ended button:hover{transform:translateY(-1px)}
|
|
37139
37208
|
.setto-chat__main{position:relative;z-index:1;display:flex;flex:1;min-width:0;max-width:820px;height:100%;margin:0 auto;flex-direction:column;background:var(--setto-chat-canvas)}.setto-chat__header{position:absolute;inset:0 0 auto;z-index:30;min-height:calc(46px + 2 * var(--setto-chat-edge));padding:var(--setto-chat-edge);display:flex;align-items:center;gap:.5rem;background:linear-gradient(to bottom,color-mix(in srgb,var(--setto-chat-crema) 88%,transparent),color-mix(in srgb,var(--setto-chat-crema) 72%,transparent));border-bottom:1px solid color-mix(in srgb,var(--setto-chat-ink) 12%,transparent);backdrop-filter:blur(20px) saturate(150%);-webkit-backdrop-filter:blur(20px) saturate(150%);isolation:isolate}.setto-chat__round-button{flex:none;width:46px;height:46px;padding:0;border:1px solid color-mix(in srgb,var(--setto-chat-ink) 12%,transparent);border-radius:50%;background:var(--setto-chat-raised);color:var(--setto-chat-ink);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background 160ms ease,border-color 160ms ease,color 160ms ease}.setto-chat__round-button:hover{background:var(--setto-chat-crema);border-color:var(--setto-chat-accent);color:var(--setto-chat-accent)}.setto-chat__round-button:active{transform:scale(.96)}.setto-chat__brand{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;line-height:1.15;text-align:center}.setto-chat__brand h2{margin:0;color:var(--setto-chat-ink);font-size:1.02rem;font-weight:600;line-height:1.15}.setto-chat__brand p{max-width:100%;margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:color-mix(in srgb,var(--setto-chat-ink) 56%,transparent);font-size:.78rem;line-height:1.15}
|
|
37140
37209
|
.setto-chat__body{position:relative;display:flex;flex:1 1 auto;min-height:0;height:100%;flex-direction:column}.setto-chat__log{display:flex;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;flex-direction:column;padding:calc(46px + 2 * var(--setto-chat-edge) + 1.3rem) .75rem var(--setto-chat-composer-space,8rem);scroll-padding-bottom:var(--setto-chat-composer-space,8rem);scroll-behavior:auto;-webkit-overflow-scrolling:touch}.setto-chat__message-list{display:flex;flex-direction:column}.setto-chat__message{--setto-chat-bubble:color-mix(in srgb,var(--setto-chat-ink) 7%,var(--setto-chat-canvas));display:flex;align-items:flex-end;gap:.55rem;width:100%;margin-bottom:1rem;color:color-mix(in srgb,var(--setto-chat-ink) 92%,transparent);font-size:16px;line-height:1.5;overflow-wrap:anywhere}.setto-chat__message-stack{display:flex;min-width:0;max-width:min(78%,36rem);flex-direction:column;align-items:flex-start}.setto-chat__message-bubble{position:relative;min-width:2.5rem;padding:.58rem .82rem;border-radius:19px 19px 19px 5px;background:var(--setto-chat-bubble);white-space:pre-wrap}.setto-chat__message--assistant .setto-chat__message-bubble::before,.setto-chat__message--human .setto-chat__message-bubble::before{content:"";position:absolute;z-index:0;left:-7px;bottom:0;width:16px;height:17px;border-bottom-right-radius:14px;background:var(--setto-chat-bubble)}.setto-chat__message--assistant .setto-chat__message-bubble::after,.setto-chat__message--human .setto-chat__message-bubble::after{content:"";position:absolute;z-index:1;left:-10px;bottom:0;width:10px;height:18px;border-bottom-right-radius:10px;background:var(--setto-chat-canvas)}.setto-chat__message-copy,.setto-chat__image{position:relative;z-index:2}.setto-chat__message--visitor{--setto-chat-bubble:var(--setto-chat-accent);justify-content:flex-end;color:var(--setto-chat-on-accent)}.setto-chat__message--visitor .setto-chat__message-stack{align-items:flex-end}.setto-chat__message--visitor .setto-chat__message-bubble{border-radius:19px 19px 5px 19px}.setto-chat__message--visitor .setto-chat__message-bubble::before{content:"";position:absolute;z-index:0;right:-7px;bottom:0;width:16px;height:17px;border-bottom-left-radius:14px;background:var(--setto-chat-bubble)}.setto-chat__message--visitor .setto-chat__message-bubble::after{content:"";position:absolute;z-index:1;right:-10px;bottom:0;width:10px;height:18px;border-bottom-left-radius:10px;background:var(--setto-chat-canvas)}.setto-chat__message--system{justify-content:center;color:color-mix(in srgb,var(--setto-chat-ink) 55%,transparent);font-size:.78rem;line-height:1.45;text-align:center}.setto-chat__message--system .setto-chat__message-stack{max-width:85%;align-items:center}.setto-chat__message--system .setto-chat__message-bubble{padding:.25rem .6rem;background:transparent}.setto-chat__avatar{position:relative;z-index:3;display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;margin-bottom:1px;overflow:hidden;border:2px solid var(--setto-chat-canvas);border-radius:50%;background:var(--setto-chat-crema);color:var(--setto-chat-ink);box-shadow:0 2px 8px color-mix(in srgb,var(--setto-chat-ink) 14%,transparent)}.setto-chat__avatar--assistant{background:var(--setto-chat-accent);color:var(--setto-chat-on-accent)}.setto-chat__avatar img{display:block;width:100%;height:100%;object-fit:cover}.setto-chat__speaker{display:block;margin:0 0 .2rem .4rem;color:color-mix(in srgb,var(--setto-chat-ink) 52%,transparent);font-size:.69rem;font-weight:500;line-height:1.2}.setto-chat__typing{display:inline-block;min-width:1.8rem;animation:setto-chat-pulse 1s ease-in-out infinite}.setto-chat__image{display:block;width:max-content;max-width:100%;margin-top:.65rem;overflow:hidden;border-radius:13px}.setto-chat__image img{display:block;width:min(280px,100%);max-height:260px;object-fit:cover}
|
|
37141
37210
|
.setto-chat__message--agent-joined{justify-content:flex-start;align-items:center;gap:.55rem;padding:.1rem 0;color:color-mix(in srgb,var(--setto-chat-ink) 62%,transparent);font-size:.8rem;line-height:1.4;text-align:left}.setto-chat__message--agent-joined .setto-chat__message-stack{max-width:calc(100% - 38px);align-items:flex-start}.setto-chat__message--agent-joined .setto-chat__message-bubble{min-width:0;padding:.2rem 0;background:transparent;white-space:normal}.setto-chat__avatar--joined{margin:0}button.setto-chat__avatar{padding:0;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform 140ms ease}button.setto-chat__avatar:active{transform:scale(.94)}button.setto-chat__avatar:focus-visible{outline:2px solid var(--setto-chat-accent);outline-offset:2px}
|
|
@@ -37239,7 +37308,7 @@ function SettoProvider({ config, children }) {
|
|
|
37239
37308
|
pageStoreRef.current = new PageStore(bundledManifest(config.pages));
|
|
37240
37309
|
setStoreReady(true);
|
|
37241
37310
|
}, [i18n, config.theme, config.pages]);
|
|
37242
|
-
const canEdit = !!session && access.currentSite?.status === "live" && !onAdminRoute && !authLoading && !access.loading;
|
|
37311
|
+
const canEdit = !!session && (access.currentSite?.status === "live" || !!access.currentSite && isSupportSession(session, config.siteId)) && !onAdminRoute && !authLoading && !access.loading;
|
|
37243
37312
|
const [editing, setEditingState] = useState(() => readEditing(config.siteId));
|
|
37244
37313
|
const setEditing = useCallback(
|
|
37245
37314
|
(on) => {
|