@smooai/chat-widget 0.10.1 → 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 +14 -5
- package/dist/chat-widget.global.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +7 -0
- package/src/element.ts +20 -4
- package/src/styles.ts +4 -1
package/README.md
CHANGED
|
@@ -228,6 +228,7 @@ Declarative attributes mirror the programmatic [`ChatWidgetConfig`](./src/config
|
|
|
228
228
|
| `greeting` | `greeting` | Shown before the first message. |
|
|
229
229
|
| `mode` | `mode` | `popover` (default) or `fullpage`. |
|
|
230
230
|
| `start-open` | `startOpen` | Open the panel immediately (no launcher click). |
|
|
231
|
+
| `hide-branding` | `hideBranding` | Hide the "powered by smooth-operator" tag + footer link. Default shown. |
|
|
231
232
|
| — | `theme` | Brand colors (see [Theming](#theming)). |
|
|
232
233
|
| — | `userName` / `userEmail` | Optional participant identity. |
|
|
233
234
|
|
|
@@ -11772,6 +11772,7 @@ var SmoothAgentChat = (function(exports) {
|
|
|
11772
11772
|
greeting: config.greeting ?? "Hi! How can I help you today?",
|
|
11773
11773
|
connectionErrorMessage: config.connectionErrorMessage ?? "We couldn't reach the chat. Please try again in a moment.",
|
|
11774
11774
|
startOpen: config.startOpen ?? false,
|
|
11775
|
+
hideBranding: config.hideBranding ?? false,
|
|
11775
11776
|
examplePrompts: (config.examplePrompts ?? []).filter((p) => p.trim().length > 0).slice(0, 5),
|
|
11776
11777
|
requireName: config.requireName ?? false,
|
|
11777
11778
|
requireEmail: config.requireEmail ?? false,
|
|
@@ -13707,7 +13708,8 @@ ${mode === "fullpage" ? `
|
|
|
13707
13708
|
}
|
|
13708
13709
|
.close:hover { background: color-mix(in srgb, var(--sac-text) 12%, transparent); transform: translateY(1px); }
|
|
13709
13710
|
.close svg { width: 16px; height: 16px; opacity: .8; }
|
|
13710
|
-
.powered { margin-left: auto; font-size: 10.5px; letter-spacing: .02em; opacity: .6; }
|
|
13711
|
+
.powered { margin-left: auto; font-size: 10.5px; letter-spacing: .02em; opacity: .6; color: inherit; text-decoration: none; }
|
|
13712
|
+
.powered:hover { opacity: .85; text-decoration: underline; }
|
|
13711
13713
|
.header-sep { height: 1px; margin: 0 16px; background: linear-gradient(90deg, transparent, var(--sac-border), transparent); }
|
|
13712
13714
|
|
|
13713
13715
|
/* Full-page header: taller, logo-led, no close. */
|
|
@@ -13979,6 +13981,8 @@ ${mode === "fullpage" ? `
|
|
|
13979
13981
|
color: color-mix(in srgb, var(--sac-text) 38%, transparent);
|
|
13980
13982
|
}
|
|
13981
13983
|
.footer b { font-weight: 600; color: color-mix(in srgb, var(--sac-text) 55%, transparent); }
|
|
13984
|
+
.footer a { color: inherit; text-decoration: none; }
|
|
13985
|
+
.footer a:hover { text-decoration: underline; }
|
|
13982
13986
|
|
|
13983
13987
|
/* ─────────────────── Pre-chat identity form ───────────────────────── */
|
|
13984
13988
|
.prechat { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 22px 20px; }
|
|
@@ -14232,6 +14236,8 @@ ${mode === "fullpage" ? `
|
|
|
14232
14236
|
return null;
|
|
14233
14237
|
}
|
|
14234
14238
|
}
|
|
14239
|
+
/** Public smooth-operator repo — the "powered by" header tag + footer link here. */
|
|
14240
|
+
const SMOOTH_OPERATOR_URL = "https://github.com/SmooAI/smooth-operator";
|
|
14235
14241
|
const OBSERVED = [
|
|
14236
14242
|
"endpoint",
|
|
14237
14243
|
"agent-id",
|
|
@@ -14240,7 +14246,8 @@ ${mode === "fullpage" ? `
|
|
|
14240
14246
|
"placeholder",
|
|
14241
14247
|
"greeting",
|
|
14242
14248
|
"start-open",
|
|
14243
|
-
"mode"
|
|
14249
|
+
"mode",
|
|
14250
|
+
"hide-branding"
|
|
14244
14251
|
];
|
|
14245
14252
|
/**
|
|
14246
14253
|
* Inline SVG icons (static, trusted strings — never interpolated with user data).
|
|
@@ -14357,6 +14364,7 @@ ${mode === "fullpage" ? `
|
|
|
14357
14364
|
greeting: this.overrides.greeting ?? this.getAttribute("greeting") ?? void 0,
|
|
14358
14365
|
connectionErrorMessage: this.overrides.connectionErrorMessage,
|
|
14359
14366
|
startOpen: this.overrides.startOpen ?? this.hasAttribute("start-open"),
|
|
14367
|
+
hideBranding: this.overrides.hideBranding ?? this.hasAttribute("hide-branding"),
|
|
14360
14368
|
examplePrompts: this.overrides.examplePrompts,
|
|
14361
14369
|
requireName: this.overrides.requireName,
|
|
14362
14370
|
requireEmail: this.overrides.requireEmail,
|
|
@@ -14410,7 +14418,7 @@ ${mode === "fullpage" ? `
|
|
|
14410
14418
|
<span class="title">${escapeHtml(resolved.agentName)}</span>
|
|
14411
14419
|
<span class="status"><span class="dot off"></span><span class="status-text"></span></span>
|
|
14412
14420
|
</div>
|
|
14413
|
-
|
|
14421
|
+
${resolved.hideBranding ? "" : `<a class="powered" href="${SMOOTH_OPERATOR_URL}" target="_blank" rel="noopener noreferrer">powered by smooth-operator</a>`}
|
|
14414
14422
|
</div>` : `<div class="header">
|
|
14415
14423
|
<div class="avatar">${monogram}</div>
|
|
14416
14424
|
<div class="meta">
|
|
@@ -14444,7 +14452,8 @@ ${mode === "fullpage" ? `
|
|
|
14444
14452
|
<button type="submit" class="pc-submit">Start chat</button>
|
|
14445
14453
|
</form>
|
|
14446
14454
|
</div>`;
|
|
14447
|
-
const
|
|
14455
|
+
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(" · ");
|
|
14456
|
+
const footerHtml = footerInner ? `<div class="footer">${footerInner}</div>` : "";
|
|
14448
14457
|
const chatHtml = `
|
|
14449
14458
|
<div class="messages"></div>
|
|
14450
14459
|
<div class="interrupt hidden"></div>
|
|
@@ -14453,7 +14462,7 @@ ${mode === "fullpage" ? `
|
|
|
14453
14462
|
<textarea rows="1" placeholder="${escapeHtml(resolved.placeholder)}"></textarea>
|
|
14454
14463
|
<button class="send" type="button" aria-label="Send message">${ICON.send}</button>
|
|
14455
14464
|
</div>
|
|
14456
|
-
|
|
14465
|
+
${footerHtml}
|
|
14457
14466
|
</div>`;
|
|
14458
14467
|
const container = document.createElement("div");
|
|
14459
14468
|
container.className = "wrap";
|