@aircall/blocks 0.18.1 → 0.19.0
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/index.d.ts +4 -0
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -260,6 +260,8 @@ type ChatbotResponseBlockProps = {
|
|
|
260
260
|
streaming?: boolean;
|
|
261
261
|
sources?: ChatbotResponseBlockSource[];
|
|
262
262
|
onFeedback?: (value: ChatbotResponseBlockFeedback) => void;
|
|
263
|
+
onSourceClick?: (source: ChatbotResponseBlockSource) => void;
|
|
264
|
+
onCopy?: () => void;
|
|
263
265
|
className?: string;
|
|
264
266
|
};
|
|
265
267
|
/**
|
|
@@ -284,6 +286,8 @@ declare function ChatbotResponseBlock({
|
|
|
284
286
|
streaming,
|
|
285
287
|
sources,
|
|
286
288
|
onFeedback,
|
|
289
|
+
onSourceClick,
|
|
290
|
+
onCopy,
|
|
287
291
|
className
|
|
288
292
|
}: ChatbotResponseBlockProps): React$1.JSX.Element;
|
|
289
293
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1078,7 +1078,7 @@ CopyButtonLabel.displayName = "CopyButtonLabel";
|
|
|
1078
1078
|
|
|
1079
1079
|
//#endregion
|
|
1080
1080
|
//#region src/components/chatbot-response-block.tsx
|
|
1081
|
-
function SourcesBadge({ sources }) {
|
|
1081
|
+
function SourcesBadge({ sources, onSourceClick }) {
|
|
1082
1082
|
const t = useDsTranslation("blocks");
|
|
1083
1083
|
return /* @__PURE__ */ jsxs(HoverCard, { children: [/* @__PURE__ */ jsx(HoverCardTrigger, {
|
|
1084
1084
|
render: /* @__PURE__ */ jsx(Button, {
|
|
@@ -1098,7 +1098,8 @@ function SourcesBadge({ sources }) {
|
|
|
1098
1098
|
href: source.url,
|
|
1099
1099
|
target: "_blank",
|
|
1100
1100
|
rel: "noreferrer noopener",
|
|
1101
|
-
"aria-label": t("chatbotResponse.openSource", { title: source.title })
|
|
1101
|
+
"aria-label": t("chatbotResponse.openSource", { title: source.title }),
|
|
1102
|
+
onClick: () => onSourceClick?.(source)
|
|
1102
1103
|
}),
|
|
1103
1104
|
children: [
|
|
1104
1105
|
/* @__PURE__ */ jsx(ItemMedia, {
|
|
@@ -1187,7 +1188,7 @@ const MARKDOWN_COMPONENTS = {
|
|
|
1187
1188
|
* />
|
|
1188
1189
|
* ```
|
|
1189
1190
|
*/
|
|
1190
|
-
function ChatbotResponseBlock({ messageId, markdown, streaming = false, sources, onFeedback, className }) {
|
|
1191
|
+
function ChatbotResponseBlock({ messageId, markdown, streaming = false, sources, onFeedback, onSourceClick, onCopy, className }) {
|
|
1191
1192
|
const t = useDsTranslation("blocks");
|
|
1192
1193
|
const [feedback, setFeedback] = useState(null);
|
|
1193
1194
|
const onFeedbackRef = useCallbackRef(onFeedback);
|
|
@@ -1233,7 +1234,10 @@ function ChatbotResponseBlock({ messageId, markdown, streaming = false, sources,
|
|
|
1233
1234
|
className: "flex items-center gap-1",
|
|
1234
1235
|
children: [sources && sources.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1235
1236
|
className: "flex flex-1",
|
|
1236
|
-
children: /* @__PURE__ */ jsx(SourcesBadge, {
|
|
1237
|
+
children: /* @__PURE__ */ jsx(SourcesBadge, {
|
|
1238
|
+
sources,
|
|
1239
|
+
onSourceClick
|
|
1240
|
+
})
|
|
1237
1241
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1238
1242
|
className: "ml-auto flex items-center gap-1",
|
|
1239
1243
|
children: [
|
|
@@ -1242,6 +1246,7 @@ function ChatbotResponseBlock({ messageId, markdown, streaming = false, sources,
|
|
|
1242
1246
|
variant: "ghost",
|
|
1243
1247
|
size: "icon-sm",
|
|
1244
1248
|
"aria-label": t("chatbotResponse.copy"),
|
|
1249
|
+
onCopied: onCopy,
|
|
1245
1250
|
children: /* @__PURE__ */ jsx(CopyButtonIcon, {})
|
|
1246
1251
|
}),
|
|
1247
1252
|
/* @__PURE__ */ jsx(Button, {
|