@sevenfold/setto-client 0.25.2 → 0.25.3
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/setto-client.js +35 -2
- package/dist/setto-client.js.map +1 -1
- package/package.json +1 -1
package/dist/setto-client.js
CHANGED
|
@@ -35140,6 +35140,36 @@ function useChatPinTracking(active, logRef, pinToBottomRef, programmaticScrollRe
|
|
|
35140
35140
|
};
|
|
35141
35141
|
}, [active, logRef, pinToBottomRef, programmaticScrollRef]);
|
|
35142
35142
|
}
|
|
35143
|
+
function useChatInputIsolation(active, mounted, chatRef, logRef) {
|
|
35144
|
+
useEffect(() => {
|
|
35145
|
+
if (!active) return;
|
|
35146
|
+
const chat = chatRef.current;
|
|
35147
|
+
if (!chat) return;
|
|
35148
|
+
const stopPointerPropagation = (event) => event.stopPropagation();
|
|
35149
|
+
const stopTouchPropagation = (event) => event.stopPropagation();
|
|
35150
|
+
const containWheel = (event) => {
|
|
35151
|
+
event.stopPropagation();
|
|
35152
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
35153
|
+
const nestedScroller = target?.closest(
|
|
35154
|
+
".setto-chat__chat-list, .setto-chat__markdown pre, .setto-chat__table-wrap"
|
|
35155
|
+
);
|
|
35156
|
+
if (nestedScroller) return;
|
|
35157
|
+
event.preventDefault();
|
|
35158
|
+
const log = logRef.current;
|
|
35159
|
+
if (!log) return;
|
|
35160
|
+
const scale = event.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : event.deltaMode === WheelEvent.DOM_DELTA_PAGE ? log.clientHeight : 1;
|
|
35161
|
+
log.scrollBy({ left: event.deltaX * scale, top: event.deltaY * scale });
|
|
35162
|
+
};
|
|
35163
|
+
chat.addEventListener("pointermove", stopPointerPropagation, true);
|
|
35164
|
+
chat.addEventListener("touchmove", stopTouchPropagation, { capture: true, passive: true });
|
|
35165
|
+
if (mounted) chat.addEventListener("wheel", containWheel, { capture: true, passive: false });
|
|
35166
|
+
return () => {
|
|
35167
|
+
chat.removeEventListener("pointermove", stopPointerPropagation, true);
|
|
35168
|
+
chat.removeEventListener("touchmove", stopTouchPropagation, true);
|
|
35169
|
+
if (mounted) chat.removeEventListener("wheel", containWheel, true);
|
|
35170
|
+
};
|
|
35171
|
+
}, [active, mounted, chatRef, logRef]);
|
|
35172
|
+
}
|
|
35143
35173
|
function useDesktopPopup() {
|
|
35144
35174
|
const [desktop, setDesktop] = useState(false);
|
|
35145
35175
|
useEffect(() => {
|
|
@@ -35227,6 +35257,7 @@ function SettoChat() {
|
|
|
35227
35257
|
});
|
|
35228
35258
|
const conversationId = useRef(storedActiveConversation(config.siteId));
|
|
35229
35259
|
const visitor = useRef(null);
|
|
35260
|
+
const chatRef = useRef(null);
|
|
35230
35261
|
const logRef = useRef(null);
|
|
35231
35262
|
const pinToBottomRef = useRef(true);
|
|
35232
35263
|
const programmaticScrollRef = useRef(false);
|
|
@@ -35238,6 +35269,7 @@ function SettoChat() {
|
|
|
35238
35269
|
useChatViewport(mounted && !desktopPopup, logRef, pinToBottomRef, programmaticScrollRef);
|
|
35239
35270
|
useChatPinTracking(mounted, logRef, pinToBottomRef, programmaticScrollRef);
|
|
35240
35271
|
useChatAutoScroll(mounted, logRef, pinToBottomRef, programmaticScrollRef);
|
|
35272
|
+
useChatInputIsolation(Boolean(settings?.enabled), mounted, chatRef, logRef);
|
|
35241
35273
|
const locale = i18n.language || "no";
|
|
35242
35274
|
const isNo = norwegian(locale);
|
|
35243
35275
|
const siteName = settings?.displayName?.trim() || config.displayName?.trim() || null;
|
|
@@ -35565,6 +35597,7 @@ function SettoChat() {
|
|
|
35565
35597
|
return /* @__PURE__ */ jsxs(
|
|
35566
35598
|
"aside",
|
|
35567
35599
|
{
|
|
35600
|
+
ref: chatRef,
|
|
35568
35601
|
className: `setto-chat${mounted ? " setto-chat--mounted" : ""}${visible ? " setto-chat--visible" : ""}`,
|
|
35569
35602
|
style: palette,
|
|
35570
35603
|
"aria-label": labels.title,
|
|
@@ -35762,8 +35795,8 @@ function useChatStyles() {
|
|
|
35762
35795
|
const style = document.createElement("style");
|
|
35763
35796
|
style.dataset.settoChat = "";
|
|
35764
35797
|
style.textContent = `
|
|
35765
|
-
.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;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;-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}}
|
|
35766
|
-
.setto-chat{position:fixed;right:max(18px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));z-index:2147483000;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;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}
|
|
35798
|
+
.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}}
|
|
35799
|
+
.setto-chat{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}
|
|
35767
35800
|
.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)}
|
|
35768
35801
|
.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:58px;padding:.35rem .75rem;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}
|
|
35769
35802
|
.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(58px + 1.3rem) .75rem 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:#0a84ff;justify-content:flex-end;color:#fff}.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-raised)}.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;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}
|