@smooai/chat-widget 0.10.0 → 0.10.2
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/README.md +1 -0
- package/dist/chat-widget.global.js +56 -12
- package/dist/chat-widget.global.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +7 -0
- package/src/element.ts +44 -4
- package/src/styles.ts +30 -8
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,12 @@ interface ChatWidgetConfig {
|
|
|
88
88
|
connectionErrorMessage?: string;
|
|
89
89
|
/** Start the panel open instead of collapsed to the launcher. */
|
|
90
90
|
startOpen?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Hide the "powered by smooth-operator" branding in the header tag and the
|
|
93
|
+
* composer footer. Defaults to `false` (branding shown). The `hide-branding`
|
|
94
|
+
* HTML attribute maps to this.
|
|
95
|
+
*/
|
|
96
|
+
hideBranding?: boolean;
|
|
91
97
|
/**
|
|
92
98
|
* Suggested starter prompts shown as clickable chips before the first message.
|
|
93
99
|
* Clicking one sends it. Capped at 5 for layout.
|
|
@@ -253,6 +259,16 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
253
259
|
private tickReveal;
|
|
254
260
|
/** Snap the bound bubble to the full buffered text immediately (reduced-motion / no-rAF). */
|
|
255
261
|
private snapReveal;
|
|
262
|
+
/**
|
|
263
|
+
* Full-page sizing probe: decide whether the host's container gives it a
|
|
264
|
+
* real box. With the `.wrap` flex chain hidden, `height: 100%` of a SIZED
|
|
265
|
+
* container still resolves (clientHeight > 0), while an auto-height parent
|
|
266
|
+
* (e.g. mounted straight into `<body>`) collapses to ~0. Only the latter
|
|
267
|
+
* gets `data-viewport-fallback`, whose CSS applies `min-height: 100dvh` —
|
|
268
|
+
* so an embed inside a fixed-height box never overflows it (the composer
|
|
269
|
+
* stays visible), and a bare full-page route still fills the viewport.
|
|
270
|
+
*/
|
|
271
|
+
private syncViewportFallback;
|
|
256
272
|
/** Cancel any in-flight reveal loop and clear its state (called on full rebuild). */
|
|
257
273
|
private resetReveal;
|
|
258
274
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/element.ts","../src/loader-core.ts","../src/persistence.ts","../src/conversation.ts","../src/fingerprint.ts"],"mappings":";;;;UASiB,eAAA;;EAEb,IAAA;;EAEA,UAAA;EAJ4B;EAM5B,OAAA;EAN4B;EAQ5B,WAAA;EAJA;EAMA,SAAA;EAFA;EAIA,eAAA;EAAA;EAEA,mBAAA;EAEA;EAAA,UAAA;EAIA;EAFA,cAAA;EAUA;EARA,MAAA;EAYA;EANA,iBAAA;EAMsB;EAJtB,qBAAA;EAesB;EAbtB,kBAAA;EAasB;EAXtB,sBAAA;AAAA;;;;;;;;;KAWQ,cAAA;AAAA,UAEK,gBAAA;EAyBb;;;;EApBA,QAAA;EA6BmD;;;;EAxBnD,IAAA,GAAO,cAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/element.ts","../src/loader-core.ts","../src/persistence.ts","../src/conversation.ts","../src/fingerprint.ts"],"mappings":";;;;UASiB,eAAA;;EAEb,IAAA;;EAEA,UAAA;EAJ4B;EAM5B,OAAA;EAN4B;EAQ5B,WAAA;EAJA;EAMA,SAAA;EAFA;EAIA,eAAA;EAAA;EAEA,mBAAA;EAEA;EAAA,UAAA;EAIA;EAFA,cAAA;EAUA;EARA,MAAA;EAYA;EANA,iBAAA;EAMsB;EAJtB,qBAAA;EAesB;EAbtB,kBAAA;EAasB;EAXtB,sBAAA;AAAA;;;;;;;;;KAWQ,cAAA;AAAA,UAEK,gBAAA;EAyBb;;;;EApBA,QAAA;EA6BmD;;;;EAxBnD,IAAA,GAAO,cAAA;EAsCP;EApCA,OAAA;EA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IAAA,EAAM,QAAA;EAAA,QAcV,YAAA;EAAA,QAKA,kBAAA;EAAA,IAKJ,sBAAA,IAA0B,eAAA;;EAK9B,SAAA,CAAU,IAAA;;EAMV,WAAA,CAAY,QAAA;EAAA,QAMJ,MAAA;EAAA,QAKA,SAAA;EAAA,QAKA,YAAA;ED/S6B;EAAA,QCqT7B,WAAA;EDlTiB;;;;;;;;AAMhB;AAIb;;;;EAV6B,QCuUjB,eAAA;ED3TR;;;AACK;AAOT;;EARI,QCkVQ,uBAAA;EDzUQ;EAAA,QCkVF,YAAA;ED9UL;;;;;;;;;;;;ECgWH,OAAA,IAAW,OAAA;EDpVC;AAAA;AAItB;;;;EAJsB,QCwYV,QAAA;EDnYO;EAAA,QC2YD,YAAA;EDzYY;;;;;EAAA,QC8aZ,mBAAA;ED1aK;EAAA,QCubL,aAAA;EDtbd;;;;EAAA,QCycc,SAAA;ED7bN;EAAA,QC6cM,cAAA;;;AD7ciD;AAiBnE;ECqdU,IAAA,CAAK,IAAA,WAAe,OAAA;;UAoElB,eAAA;EDzhB8B;AAsH1C;;;ECsdU,kBAAA,CAAmB,KAAA,UAAe,OAAA,qBAAqC,OAAA;EDtd/C;ECwfxB,iBAAA,CAAkB,IAAA,WAAe,OAAA;EDxfkB;EAAA,QCqhB3C,eAAA;EDrhBsD;;;;ACtLxE;EAivBU,mBAAA,CAAoB,SAAA,WAAoB,OAAA;;EAsB9C,qBAAA;EAvwBmD;EA4wBnD,UAAA;AAAA;;;;;;;AJ7yBJ;;;;;;;;;;;;;;;;;;;AAgC0B;AAW1B;;;;AAA0B;AAE1B;;;;;;;;;iBKmDgB,kBAAA;;;;;;iBAUA,sBAAA,CAAuB,GAAA,uBAA0B,GAAA,GAAM,EAAA"}
|
package/dist/index.js
CHANGED
|
@@ -332,6 +332,7 @@ function resolveConfig(config) {
|
|
|
332
332
|
greeting: config.greeting ?? "Hi! How can I help you today?",
|
|
333
333
|
connectionErrorMessage: config.connectionErrorMessage ?? "We couldn't reach the chat. Please try again in a moment.",
|
|
334
334
|
startOpen: config.startOpen ?? false,
|
|
335
|
+
hideBranding: config.hideBranding ?? false,
|
|
335
336
|
examplePrompts: (config.examplePrompts ?? []).filter((p) => p.trim().length > 0).slice(0, 5),
|
|
336
337
|
requireName: config.requireName ?? false,
|
|
337
338
|
requireEmail: config.requireEmail ?? false,
|
|
@@ -1398,11 +1399,11 @@ function buildStyles(theme, mode = "popover") {
|
|
|
1398
1399
|
--sac-ease: cubic-bezier(.16, 1, .3, 1);
|
|
1399
1400
|
|
|
1400
1401
|
${mode === "fullpage" ? `/* Full-page: fill the host's box (sized by its container, else the viewport). */
|
|
1401
|
-
display:
|
|
1402
|
+
display: flex;
|
|
1403
|
+
flex-direction: column;
|
|
1402
1404
|
position: relative;
|
|
1403
1405
|
width: 100%;
|
|
1404
|
-
height: 100
|
|
1405
|
-
min-height: 100vh;` : `/* Popover: float in the bottom-right corner. */
|
|
1406
|
+
height: 100%;` : `/* Popover: float in the bottom-right corner. */
|
|
1406
1407
|
position: fixed;
|
|
1407
1408
|
bottom: 24px;
|
|
1408
1409
|
right: 24px;
|
|
@@ -1410,7 +1411,20 @@ function buildStyles(theme, mode = "popover") {
|
|
|
1410
1411
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
1411
1412
|
-webkit-font-smoothing: antialiased;
|
|
1412
1413
|
}
|
|
1413
|
-
|
|
1414
|
+
${mode === "fullpage" ? `
|
|
1415
|
+
/* Viewport fallback — the element sets this attribute only when the host's
|
|
1416
|
+
container gives it no resolved height (e.g. mounted straight into an
|
|
1417
|
+
auto-height <body>). A sized container always wins, so an embed inside a
|
|
1418
|
+
fixed-height box never overflows it (composer stays visible). */
|
|
1419
|
+
:host([data-viewport-fallback]) { min-height: 100dvh; }
|
|
1420
|
+
/* The render wrapper passes the host's box down to the panel via flex. */
|
|
1421
|
+
.wrap {
|
|
1422
|
+
flex: 1;
|
|
1423
|
+
display: flex;
|
|
1424
|
+
flex-direction: column;
|
|
1425
|
+
min-height: 0;
|
|
1426
|
+
}
|
|
1427
|
+
` : ""}
|
|
1414
1428
|
* { box-sizing: border-box; }
|
|
1415
1429
|
|
|
1416
1430
|
/* ───────────────────────────── Launcher ───────────────────────────── */
|
|
@@ -1492,11 +1506,13 @@ function buildStyles(theme, mode = "popover") {
|
|
|
1492
1506
|
pointer-events: none;
|
|
1493
1507
|
background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--sac-primary) 22%, transparent), transparent 70%);
|
|
1494
1508
|
}
|
|
1495
|
-
/* Full-page: the panel becomes the whole surface
|
|
1509
|
+
/* Full-page: the panel becomes the whole surface — it follows the host's box
|
|
1510
|
+
(via the .wrap flex chain), never a hardcoded viewport unit. */
|
|
1496
1511
|
.panel.fullpage {
|
|
1497
1512
|
width: 100%;
|
|
1498
|
-
|
|
1499
|
-
|
|
1513
|
+
flex: 1;
|
|
1514
|
+
height: auto;
|
|
1515
|
+
min-height: 0;
|
|
1500
1516
|
max-width: none;
|
|
1501
1517
|
max-height: none;
|
|
1502
1518
|
border: none;
|
|
@@ -1572,7 +1588,8 @@ function buildStyles(theme, mode = "popover") {
|
|
|
1572
1588
|
}
|
|
1573
1589
|
.close:hover { background: color-mix(in srgb, var(--sac-text) 12%, transparent); transform: translateY(1px); }
|
|
1574
1590
|
.close svg { width: 16px; height: 16px; opacity: .8; }
|
|
1575
|
-
.powered { margin-left: auto; font-size: 10.5px; letter-spacing: .02em; opacity: .6; }
|
|
1591
|
+
.powered { margin-left: auto; font-size: 10.5px; letter-spacing: .02em; opacity: .6; color: inherit; text-decoration: none; }
|
|
1592
|
+
.powered:hover { opacity: .85; text-decoration: underline; }
|
|
1576
1593
|
.header-sep { height: 1px; margin: 0 16px; background: linear-gradient(90deg, transparent, var(--sac-border), transparent); }
|
|
1577
1594
|
|
|
1578
1595
|
/* Full-page header: taller, logo-led, no close. */
|
|
@@ -1844,6 +1861,8 @@ function buildStyles(theme, mode = "popover") {
|
|
|
1844
1861
|
color: color-mix(in srgb, var(--sac-text) 38%, transparent);
|
|
1845
1862
|
}
|
|
1846
1863
|
.footer b { font-weight: 600; color: color-mix(in srgb, var(--sac-text) 55%, transparent); }
|
|
1864
|
+
.footer a { color: inherit; text-decoration: none; }
|
|
1865
|
+
.footer a:hover { text-decoration: underline; }
|
|
1847
1866
|
|
|
1848
1867
|
/* ─────────────────── Pre-chat identity form ───────────────────────── */
|
|
1849
1868
|
.prechat { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 22px 20px; }
|
|
@@ -2097,6 +2116,8 @@ function phoneToE164(value) {
|
|
|
2097
2116
|
return null;
|
|
2098
2117
|
}
|
|
2099
2118
|
}
|
|
2119
|
+
/** Public smooth-operator repo — the "powered by" header tag + footer link here. */
|
|
2120
|
+
const SMOOTH_OPERATOR_URL = "https://github.com/SmooAI/smooth-operator";
|
|
2100
2121
|
const OBSERVED = [
|
|
2101
2122
|
"endpoint",
|
|
2102
2123
|
"agent-id",
|
|
@@ -2105,7 +2126,8 @@ const OBSERVED = [
|
|
|
2105
2126
|
"placeholder",
|
|
2106
2127
|
"greeting",
|
|
2107
2128
|
"start-open",
|
|
2108
|
-
"mode"
|
|
2129
|
+
"mode",
|
|
2130
|
+
"hide-branding"
|
|
2109
2131
|
];
|
|
2110
2132
|
/**
|
|
2111
2133
|
* Inline SVG icons (static, trusted strings — never interpolated with user data).
|
|
@@ -2222,6 +2244,7 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2222
2244
|
greeting: this.overrides.greeting ?? this.getAttribute("greeting") ?? void 0,
|
|
2223
2245
|
connectionErrorMessage: this.overrides.connectionErrorMessage,
|
|
2224
2246
|
startOpen: this.overrides.startOpen ?? this.hasAttribute("start-open"),
|
|
2247
|
+
hideBranding: this.overrides.hideBranding ?? this.hasAttribute("hide-branding"),
|
|
2225
2248
|
examplePrompts: this.overrides.examplePrompts,
|
|
2226
2249
|
requireName: this.overrides.requireName,
|
|
2227
2250
|
requireEmail: this.overrides.requireEmail,
|
|
@@ -2275,7 +2298,7 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2275
2298
|
<span class="title">${escapeHtml(resolved.agentName)}</span>
|
|
2276
2299
|
<span class="status"><span class="dot off"></span><span class="status-text"></span></span>
|
|
2277
2300
|
</div>
|
|
2278
|
-
|
|
2301
|
+
${resolved.hideBranding ? "" : `<a class="powered" href="${SMOOTH_OPERATOR_URL}" target="_blank" rel="noopener noreferrer">powered by smooth-operator</a>`}
|
|
2279
2302
|
</div>` : `<div class="header">
|
|
2280
2303
|
<div class="avatar">${monogram}</div>
|
|
2281
2304
|
<div class="meta">
|
|
@@ -2309,7 +2332,8 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2309
2332
|
<button type="submit" class="pc-submit">Start chat</button>
|
|
2310
2333
|
</form>
|
|
2311
2334
|
</div>`;
|
|
2312
|
-
const
|
|
2335
|
+
const footerInner = [resolved.hideBranding ? "" : `<a href="${SMOOTH_OPERATOR_URL}" target="_blank" rel="noopener noreferrer">powered by <b>smooth‑operator</b></a>`, this.allowChatRestore ? `<button type="button" class="restore-link">Restore my chats</button>` : ""].filter(Boolean).join(" · ");
|
|
2336
|
+
const footerHtml = footerInner ? `<div class="footer">${footerInner}</div>` : "";
|
|
2313
2337
|
const chatHtml = `
|
|
2314
2338
|
<div class="messages"></div>
|
|
2315
2339
|
<div class="interrupt hidden"></div>
|
|
@@ -2318,9 +2342,10 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2318
2342
|
<textarea rows="1" placeholder="${escapeHtml(resolved.placeholder)}"></textarea>
|
|
2319
2343
|
<button class="send" type="button" aria-label="Send message">${ICON.send}</button>
|
|
2320
2344
|
</div>
|
|
2321
|
-
|
|
2345
|
+
${footerHtml}
|
|
2322
2346
|
</div>`;
|
|
2323
2347
|
const container = document.createElement("div");
|
|
2348
|
+
container.className = "wrap";
|
|
2324
2349
|
container.innerHTML = `
|
|
2325
2350
|
${fullpage ? "" : `<button class="launcher" part="launcher" aria-label="Open chat">${ICON.spark}</button>`}
|
|
2326
2351
|
<div class="panel${fullpage ? " fullpage" : " hidden"}" part="panel" role="${fullpage ? "region" : "dialog"}" aria-label="${escapeHtml(resolved.agentName)} chat">
|
|
@@ -2364,6 +2389,7 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2364
2389
|
await this.controller?.connect().catch(() => {});
|
|
2365
2390
|
})();
|
|
2366
2391
|
});
|
|
2392
|
+
if (fullpage) this.syncViewportFallback();
|
|
2367
2393
|
if (fullpage && !gating) this.controller?.connect().catch(() => {});
|
|
2368
2394
|
this.syncOpenState();
|
|
2369
2395
|
if (!gating) this.renderMessages();
|
|
@@ -2853,6 +2879,24 @@ var SmoothAgentChatElement = class extends HTMLElement {
|
|
|
2853
2879
|
this.streamBubbleEl.textContent = this.streamTarget;
|
|
2854
2880
|
}
|
|
2855
2881
|
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Full-page sizing probe: decide whether the host's container gives it a
|
|
2884
|
+
* real box. With the `.wrap` flex chain hidden, `height: 100%` of a SIZED
|
|
2885
|
+
* container still resolves (clientHeight > 0), while an auto-height parent
|
|
2886
|
+
* (e.g. mounted straight into `<body>`) collapses to ~0. Only the latter
|
|
2887
|
+
* gets `data-viewport-fallback`, whose CSS applies `min-height: 100dvh` —
|
|
2888
|
+
* so an embed inside a fixed-height box never overflows it (the composer
|
|
2889
|
+
* stays visible), and a bare full-page route still fills the viewport.
|
|
2890
|
+
*/
|
|
2891
|
+
syncViewportFallback() {
|
|
2892
|
+
const wrap = this.shadowRoot?.querySelector(".wrap");
|
|
2893
|
+
if (!wrap) return;
|
|
2894
|
+
const prev = wrap.style.display;
|
|
2895
|
+
wrap.style.display = "none";
|
|
2896
|
+
const heightless = this.clientHeight < 8;
|
|
2897
|
+
wrap.style.display = prev;
|
|
2898
|
+
this.toggleAttribute("data-viewport-fallback", heightless);
|
|
2899
|
+
}
|
|
2856
2900
|
/** Cancel any in-flight reveal loop and clear its state (called on full rebuild). */
|
|
2857
2901
|
resetReveal() {
|
|
2858
2902
|
if (this.rafId && typeof cancelAnimationFrame === "function") cancelAnimationFrame(this.rafId);
|