@eshal-bot/chat-widget 0.2.15 → 0.2.17
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-VOzNYu1D.esm.js → chat-widget-MarkdownRenderer-D0VG_NOg.esm.js} +6 -6
- package/dist/chat-widget-index-CNSzbZUh.esm.js +20 -0
- package/dist/chat-widget-markdown-chunk.js +43 -5
- package/dist/chat-widget-markdown-chunk.min.js +1 -1
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +53 -2
- package/dist/chat-widget.min.js +2 -2
- package/dist/chat-widget.umd.js +7 -7
- package/package.json +1 -1
- package/dist/chat-widget-index-CnsqQX_h.esm.js +0 -20
|
@@ -88402,6 +88402,37 @@
|
|
|
88402
88402
|
return typeof u === 'string' && /^https?:\/\//i.test(u) ? u : undefined;
|
|
88403
88403
|
}
|
|
88404
88404
|
|
|
88405
|
+
const LINK_RE = /\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;
|
|
88406
|
+
const LINK_STYLE = {
|
|
88407
|
+
color: '#1d4ed8',
|
|
88408
|
+
textDecoration: 'underline',
|
|
88409
|
+
overflowWrap: 'anywhere'
|
|
88410
|
+
};
|
|
88411
|
+
function linkifyText(text) {
|
|
88412
|
+
if (!text) return text;
|
|
88413
|
+
const out = [];
|
|
88414
|
+
let last = 0;
|
|
88415
|
+
let key = 0;
|
|
88416
|
+
for (const m of String(text).matchAll(LINK_RE)) {
|
|
88417
|
+
const idx = m.index ?? 0;
|
|
88418
|
+
const label = m[1] ?? m[3];
|
|
88419
|
+
const url = safeUrl(m[2] ?? m[3]);
|
|
88420
|
+
if (!url) continue;
|
|
88421
|
+
if (idx > last) out.push(text.slice(last, idx));
|
|
88422
|
+
out.push(/*#__PURE__*/jsxRuntimeExports.jsx("a", {
|
|
88423
|
+
href: url,
|
|
88424
|
+
target: "_blank",
|
|
88425
|
+
rel: "noopener noreferrer",
|
|
88426
|
+
style: LINK_STYLE,
|
|
88427
|
+
children: label
|
|
88428
|
+
}, key++));
|
|
88429
|
+
last = idx + m[0].length;
|
|
88430
|
+
}
|
|
88431
|
+
if (out.length === 0) return text;
|
|
88432
|
+
if (last < text.length) out.push(text.slice(last));
|
|
88433
|
+
return out;
|
|
88434
|
+
}
|
|
88435
|
+
|
|
88405
88436
|
// Kept in its own tiny module (not A2uiBlock.jsx): MessageList imports it
|
|
88406
88437
|
// eagerly, and A2uiBlock/MarkdownRenderer are lazy-loaded to keep charts and
|
|
88407
88438
|
// react-markdown out of the widget's initial bundle.
|
|
@@ -88821,7 +88852,7 @@
|
|
|
88821
88852
|
whiteSpace: 'pre-wrap',
|
|
88822
88853
|
wordBreak: 'break-word'
|
|
88823
88854
|
},
|
|
88824
|
-
children: String(spec.body)
|
|
88855
|
+
children: linkifyText(String(spec.body))
|
|
88825
88856
|
})]
|
|
88826
88857
|
});
|
|
88827
88858
|
}
|
|
@@ -88961,7 +88992,7 @@
|
|
|
88961
88992
|
whiteSpace: 'pre-wrap',
|
|
88962
88993
|
wordBreak: 'break-word'
|
|
88963
88994
|
},
|
|
88964
|
-
children: showFull ? full || summary : summary || full
|
|
88995
|
+
children: linkifyText(showFull ? full || summary : summary || full)
|
|
88965
88996
|
}), hasMore && /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
88966
88997
|
type: "button",
|
|
88967
88998
|
onClick: () => setShowFull(v => !v),
|
|
@@ -89000,7 +89031,7 @@
|
|
|
89000
89031
|
minWidth: 0,
|
|
89001
89032
|
wordBreak: 'break-word'
|
|
89002
89033
|
},
|
|
89003
|
-
children: f.value
|
|
89034
|
+
children: typeof f.value === 'string' ? linkifyText(f.value) : f.value
|
|
89004
89035
|
})]
|
|
89005
89036
|
}, i))
|
|
89006
89037
|
}), actions.length > 0 && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
@@ -89541,7 +89572,7 @@
|
|
|
89541
89572
|
whiteSpace: 'pre-wrap',
|
|
89542
89573
|
wordBreak: 'break-word'
|
|
89543
89574
|
},
|
|
89544
|
-
children: String(spec.body)
|
|
89575
|
+
children: linkifyText(String(spec.body))
|
|
89545
89576
|
}), /*#__PURE__*/jsxRuntimeExports.jsx(ButtonGroup, {
|
|
89546
89577
|
spec: {
|
|
89547
89578
|
buttons: lockedButtons
|
|
@@ -91585,6 +91616,12 @@
|
|
|
91585
91616
|
};
|
|
91586
91617
|
}
|
|
91587
91618
|
|
|
91619
|
+
function rehypeImagePolicy() {
|
|
91620
|
+
return tree => {
|
|
91621
|
+
return;
|
|
91622
|
+
};
|
|
91623
|
+
}
|
|
91624
|
+
|
|
91588
91625
|
/**
|
|
91589
91626
|
* WidgetCitationContext - the message's `sources` array + download handler,
|
|
91590
91627
|
* supplied by `<MessageBubble>` and consumed by every `<CitationPill>` that
|
|
@@ -92232,8 +92269,9 @@
|
|
|
92232
92269
|
// Skip the rehypeCitations plugin when the org opted out -
|
|
92233
92270
|
// markers then render as plain text so nothing squeaks
|
|
92234
92271
|
// through as a placeholder pill.
|
|
92272
|
+
// rehypeImagePolicy is a no-op unless the backend sends chatImagePolicy.
|
|
92235
92273
|
,
|
|
92236
|
-
rehypePlugins: provideCitations ? [rehypeCitations] : [],
|
|
92274
|
+
rehypePlugins: provideCitations ? [rehypeCitations, rehypeImagePolicy] : [rehypeImagePolicy],
|
|
92237
92275
|
components: {
|
|
92238
92276
|
// Citation-marker → pill swap. Every `<span>` normally passes
|
|
92239
92277
|
// through unchanged; when the HAST plugin has tagged it as a
|