@eshal-bot/chat-widget 0.2.17 → 0.2.19
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/{chat-widget-MarkdownRenderer-D0VG_NOg.esm.js → chat-widget-MarkdownRenderer-D50nDQ4t.esm.js} +6 -6
- package/dist/chat-widget-index-ClEAcv15.esm.js +20 -0
- package/dist/chat-widget-markdown-chunk.js +28 -13
- package/dist/chat-widget-markdown-chunk.min.js +1 -1
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +147 -30
- package/dist/chat-widget.min.js +6 -6
- package/dist/chat-widget.umd.js +8 -8
- package/package.json +1 -1
- package/dist/chat-widget-index-CNSzbZUh.esm.js +0 -20
|
@@ -88402,6 +88402,21 @@
|
|
|
88402
88402
|
return typeof u === 'string' && /^https?:\/\//i.test(u) ? u : undefined;
|
|
88403
88403
|
}
|
|
88404
88404
|
|
|
88405
|
+
/**
|
|
88406
|
+
* The same rule for images a card draws itself (A2UI card, list item,
|
|
88407
|
+
* avatar, gallery), which never pass through markdown. Returns `src`
|
|
88408
|
+
* unchanged while the policy is off (the default) or in report mode, and
|
|
88409
|
+
* undefined when enforce blocks the host, so the caller skips the <img>.
|
|
88410
|
+
*/
|
|
88411
|
+
function policedImageSrc(src) {
|
|
88412
|
+
return src;
|
|
88413
|
+
}
|
|
88414
|
+
function rehypeImagePolicy() {
|
|
88415
|
+
return tree => {
|
|
88416
|
+
return;
|
|
88417
|
+
};
|
|
88418
|
+
}
|
|
88419
|
+
|
|
88405
88420
|
const LINK_RE = /\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;
|
|
88406
88421
|
const LINK_STYLE = {
|
|
88407
88422
|
color: '#1d4ed8',
|
|
@@ -88479,6 +88494,12 @@
|
|
|
88479
88494
|
* bug this file fixes (12-06-2026).
|
|
88480
88495
|
*/
|
|
88481
88496
|
|
|
88497
|
+
|
|
88498
|
+
// Card images (banner, list item, avatar, gallery) go through the chat image
|
|
88499
|
+
// policy too. Unchanged while it is off, which is the default.
|
|
88500
|
+
const cardImageSrc = u => policedImageSrc(safeUrl(u));
|
|
88501
|
+
// True only when the policy itself drops a URL that would otherwise render.
|
|
88502
|
+
const cardImageBlocked = u => safeUrl(u) !== undefined && cardImageSrc(u) === undefined;
|
|
88482
88503
|
function A2uiBlock({
|
|
88483
88504
|
spec,
|
|
88484
88505
|
isDark = false,
|
|
@@ -88913,7 +88934,7 @@
|
|
|
88913
88934
|
const summary = String(spec.body || '').trim();
|
|
88914
88935
|
const full = String(spec.details || '').trim();
|
|
88915
88936
|
const hasMore = summary.length > 0 && full.length > summary.length + 2;
|
|
88916
|
-
const imageUrl =
|
|
88937
|
+
const imageUrl = cardImageSrc(spec.image);
|
|
88917
88938
|
const pill = status && status.label ? _STATUS_PILL(isDark)[status.variant || 'success'] : null;
|
|
88918
88939
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
88919
88940
|
style: {
|
|
@@ -89727,8 +89748,8 @@
|
|
|
89727
89748
|
display: 'flex',
|
|
89728
89749
|
flexDirection: 'column'
|
|
89729
89750
|
},
|
|
89730
|
-
children: [
|
|
89731
|
-
src:
|
|
89751
|
+
children: [cardImageSrc(item.image) && /*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
89752
|
+
src: cardImageSrc(item.image),
|
|
89732
89753
|
alt: item.name || '',
|
|
89733
89754
|
referrerPolicy: "no-referrer",
|
|
89734
89755
|
onError: e => {
|
|
@@ -89842,8 +89863,8 @@
|
|
|
89842
89863
|
fontWeight: 700,
|
|
89843
89864
|
fontSize: 16
|
|
89844
89865
|
},
|
|
89845
|
-
children:
|
|
89846
|
-
src:
|
|
89866
|
+
children: cardImageSrc(spec.avatar) ? /*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
89867
|
+
src: cardImageSrc(spec.avatar),
|
|
89847
89868
|
alt: spec.name || '',
|
|
89848
89869
|
referrerPolicy: "no-referrer",
|
|
89849
89870
|
onError: e => {
|
|
@@ -90281,8 +90302,8 @@
|
|
|
90281
90302
|
border: '1px solid ' + (isDark ? '#374151' : '#e5e7eb'),
|
|
90282
90303
|
background: isDark ? '#111827' : '#f9fafb'
|
|
90283
90304
|
},
|
|
90284
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
90285
|
-
src:
|
|
90305
|
+
children: [!cardImageBlocked(img.url) && /*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
90306
|
+
src: cardImageSrc(img.url),
|
|
90286
90307
|
alt: img.caption || `Image ${i + 1}`,
|
|
90287
90308
|
referrerPolicy: "no-referrer",
|
|
90288
90309
|
onError: e => {
|
|
@@ -91616,12 +91637,6 @@
|
|
|
91616
91637
|
};
|
|
91617
91638
|
}
|
|
91618
91639
|
|
|
91619
|
-
function rehypeImagePolicy() {
|
|
91620
|
-
return tree => {
|
|
91621
|
-
return;
|
|
91622
|
-
};
|
|
91623
|
-
}
|
|
91624
|
-
|
|
91625
91640
|
/**
|
|
91626
91641
|
* WidgetCitationContext - the message's `sources` array + download handler,
|
|
91627
91642
|
* supplied by `<MessageBubble>` and consumed by every `<CitationPill>` that
|