@ensembleapp/client-sdk 0.0.53 → 0.0.54
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 +10 -5
- package/dist/index.js +151 -115
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.global.js +47 -47
- package/dist/widget/widget.global.js.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -5436,6 +5436,40 @@ function FullDisplayMode({
|
|
|
5436
5436
|
}) });
|
|
5437
5437
|
}
|
|
5438
5438
|
|
|
5439
|
+
// lib/chat/display-modes/HideToolsDisplayMode.tsx
|
|
5440
|
+
import { Fragment as Fragment4, jsx as jsx12 } from "react/jsx-runtime";
|
|
5441
|
+
function isToolCallPart(part) {
|
|
5442
|
+
return part.type.startsWith("tool-") || part.type === "dynamic-tool";
|
|
5443
|
+
}
|
|
5444
|
+
function HideToolsDisplayMode({
|
|
5445
|
+
sections,
|
|
5446
|
+
messageId,
|
|
5447
|
+
renderPart,
|
|
5448
|
+
renderGroup
|
|
5449
|
+
}) {
|
|
5450
|
+
return /* @__PURE__ */ jsx12(Fragment4, { children: sections.map((section, sectionIdx) => {
|
|
5451
|
+
const visibleParts = section.parts.filter((part) => !isToolCallPart(part));
|
|
5452
|
+
if (visibleParts.length === 0) return null;
|
|
5453
|
+
const sectionKey = `${messageId}-section-${sectionIdx}`;
|
|
5454
|
+
const children = visibleParts.map((part, partIdx) => /* @__PURE__ */ jsx12(
|
|
5455
|
+
"div",
|
|
5456
|
+
{
|
|
5457
|
+
className: "chat-widget__hide-tools-part",
|
|
5458
|
+
children: renderPart(part, `${sectionKey}-part-${partIdx}`)
|
|
5459
|
+
},
|
|
5460
|
+
`${sectionKey}-part-${partIdx}`
|
|
5461
|
+
));
|
|
5462
|
+
if (section.type === "step") {
|
|
5463
|
+
return /* @__PURE__ */ jsx12("div", { className: "chat-widget__hide-tools-section", children }, sectionKey);
|
|
5464
|
+
}
|
|
5465
|
+
if (section.type === "group") {
|
|
5466
|
+
const groupKey = `${messageId}-group-${section.groupName}`;
|
|
5467
|
+
return /* @__PURE__ */ jsx12("div", { className: "chat-widget__hide-tools-section", children: renderGroup(section.groupName, groupKey, /* @__PURE__ */ jsx12(Fragment4, { children })) }, sectionKey);
|
|
5468
|
+
}
|
|
5469
|
+
return null;
|
|
5470
|
+
}) });
|
|
5471
|
+
}
|
|
5472
|
+
|
|
5439
5473
|
// lib/chat/renderers/MessageRenderer.tsx
|
|
5440
5474
|
import React5, { useCallback as useCallback6, useMemo as useMemo4 } from "react";
|
|
5441
5475
|
import ReactMarkdown from "react-markdown";
|
|
@@ -8905,7 +8939,7 @@ styleInject(".chat-widget__feedback {\n display: flex;\n align-items: center;\
|
|
|
8905
8939
|
// lib/chat/components/MessageFeedback.tsx
|
|
8906
8940
|
import { MessageSquare, MessageSquareText, ThumbsDown, ThumbsUp } from "lucide-react";
|
|
8907
8941
|
import { useCallback as useCallback5, useEffect as useEffect4, useState as useState7 } from "react";
|
|
8908
|
-
import { jsx as
|
|
8942
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8909
8943
|
var classNames = {
|
|
8910
8944
|
wrapper: "chat-widget__feedback-wrapper",
|
|
8911
8945
|
container: "chat-widget__feedback",
|
|
@@ -9024,7 +9058,7 @@ var MessageFeedback = ({
|
|
|
9024
9058
|
const CommentIcon = hasComment ? MessageSquareText : MessageSquare;
|
|
9025
9059
|
return /* @__PURE__ */ jsxs10("div", { className: classNames.wrapper, children: [
|
|
9026
9060
|
/* @__PURE__ */ jsxs10("div", { className: classNames.container, children: [
|
|
9027
|
-
/* @__PURE__ */
|
|
9061
|
+
/* @__PURE__ */ jsx13(
|
|
9028
9062
|
"button",
|
|
9029
9063
|
{
|
|
9030
9064
|
type: "button",
|
|
@@ -9033,10 +9067,10 @@ var MessageFeedback = ({
|
|
|
9033
9067
|
disabled: isSubmitting,
|
|
9034
9068
|
title: "Good response",
|
|
9035
9069
|
"aria-label": "Mark as good response",
|
|
9036
|
-
children: /* @__PURE__ */
|
|
9070
|
+
children: /* @__PURE__ */ jsx13(ThumbsUp, { className: classNames.icon })
|
|
9037
9071
|
}
|
|
9038
9072
|
),
|
|
9039
|
-
/* @__PURE__ */
|
|
9073
|
+
/* @__PURE__ */ jsx13(
|
|
9040
9074
|
"button",
|
|
9041
9075
|
{
|
|
9042
9076
|
type: "button",
|
|
@@ -9045,10 +9079,10 @@ var MessageFeedback = ({
|
|
|
9045
9079
|
disabled: isSubmitting,
|
|
9046
9080
|
title: "Could be improved",
|
|
9047
9081
|
"aria-label": "Mark as could be improved",
|
|
9048
|
-
children: /* @__PURE__ */
|
|
9082
|
+
children: /* @__PURE__ */ jsx13(ThumbsDown, { className: classNames.icon })
|
|
9049
9083
|
}
|
|
9050
9084
|
),
|
|
9051
|
-
/* @__PURE__ */
|
|
9085
|
+
/* @__PURE__ */ jsx13(
|
|
9052
9086
|
"button",
|
|
9053
9087
|
{
|
|
9054
9088
|
type: "button",
|
|
@@ -9057,14 +9091,14 @@ var MessageFeedback = ({
|
|
|
9057
9091
|
disabled: isSubmitting,
|
|
9058
9092
|
title: "Add comment",
|
|
9059
9093
|
"aria-label": "Add comment",
|
|
9060
|
-
children: /* @__PURE__ */
|
|
9094
|
+
children: /* @__PURE__ */ jsx13(CommentIcon, { className: classNames.icon })
|
|
9061
9095
|
}
|
|
9062
9096
|
)
|
|
9063
9097
|
] }),
|
|
9064
9098
|
showCommentBox && /* @__PURE__ */ jsxs10("div", { className: classNames.commentSection, children: [
|
|
9065
|
-
/* @__PURE__ */
|
|
9099
|
+
/* @__PURE__ */ jsx13("div", { className: classNames.commentHeader, children: isCommentRequired && /* @__PURE__ */ jsx13("span", { className: classNames.commentRequired, children: "Required" }) }),
|
|
9066
9100
|
/* @__PURE__ */ jsxs10("div", { className: classNames.commentBody, children: [
|
|
9067
|
-
/* @__PURE__ */
|
|
9101
|
+
/* @__PURE__ */ jsx13(
|
|
9068
9102
|
"textarea",
|
|
9069
9103
|
{
|
|
9070
9104
|
className: classNames.textarea,
|
|
@@ -9075,7 +9109,7 @@ var MessageFeedback = ({
|
|
|
9075
9109
|
}
|
|
9076
9110
|
),
|
|
9077
9111
|
/* @__PURE__ */ jsxs10("div", { className: classNames.actions, children: [
|
|
9078
|
-
/* @__PURE__ */
|
|
9112
|
+
/* @__PURE__ */ jsx13(
|
|
9079
9113
|
"button",
|
|
9080
9114
|
{
|
|
9081
9115
|
type: "button",
|
|
@@ -9085,7 +9119,7 @@ var MessageFeedback = ({
|
|
|
9085
9119
|
children: "Save"
|
|
9086
9120
|
}
|
|
9087
9121
|
),
|
|
9088
|
-
/* @__PURE__ */
|
|
9122
|
+
/* @__PURE__ */ jsx13(
|
|
9089
9123
|
"button",
|
|
9090
9124
|
{
|
|
9091
9125
|
type: "button",
|
|
@@ -9105,7 +9139,7 @@ styleInject('.tag-group {\n margin: 6px 0;\n}\n.tag-group-header {\n display:
|
|
|
9105
9139
|
|
|
9106
9140
|
// lib/chat/components/TagGroupDisplay.tsx
|
|
9107
9141
|
import { ChevronRight } from "lucide-react";
|
|
9108
|
-
import { jsx as
|
|
9142
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
9109
9143
|
function TagGroupDisplay({
|
|
9110
9144
|
tagId,
|
|
9111
9145
|
isExpanded,
|
|
@@ -9121,18 +9155,18 @@ function TagGroupDisplay({
|
|
|
9121
9155
|
"aria-expanded": isExpanded,
|
|
9122
9156
|
type: "button",
|
|
9123
9157
|
children: [
|
|
9124
|
-
/* @__PURE__ */
|
|
9158
|
+
/* @__PURE__ */ jsx14(
|
|
9125
9159
|
ChevronRight,
|
|
9126
9160
|
{
|
|
9127
9161
|
className: `tag-group-chevron ${isExpanded ? "tag-group-chevron--expanded" : ""}`,
|
|
9128
9162
|
"aria-hidden": "true"
|
|
9129
9163
|
}
|
|
9130
9164
|
),
|
|
9131
|
-
/* @__PURE__ */
|
|
9165
|
+
/* @__PURE__ */ jsx14("span", { className: "tag-group-label", children: tagId })
|
|
9132
9166
|
]
|
|
9133
9167
|
}
|
|
9134
9168
|
),
|
|
9135
|
-
isExpanded && /* @__PURE__ */
|
|
9169
|
+
isExpanded && /* @__PURE__ */ jsx14("div", { className: "tag-group-content", role: "region", children })
|
|
9136
9170
|
] });
|
|
9137
9171
|
}
|
|
9138
9172
|
|
|
@@ -9141,13 +9175,13 @@ styleInject(".tool-call-item {\n font-size: 13px;\n color: var(--chat-text-mut
|
|
|
9141
9175
|
|
|
9142
9176
|
// lib/chat/components/ToolCallDisplay.tsx
|
|
9143
9177
|
import { useState as useState8 } from "react";
|
|
9144
|
-
import { jsx as
|
|
9178
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9145
9179
|
function CollapsibleSection({ label, content }) {
|
|
9146
9180
|
const [isCollapsed, setIsCollapsed] = useState8(false);
|
|
9147
9181
|
return /* @__PURE__ */ jsxs12("div", { className: "tool-call-section", children: [
|
|
9148
|
-
/* @__PURE__ */
|
|
9182
|
+
/* @__PURE__ */ jsx15("div", { className: "tool-call-section-label", children: label }),
|
|
9149
9183
|
/* @__PURE__ */ jsxs12("div", { className: "tool-call-section-content-wrapper", children: [
|
|
9150
|
-
/* @__PURE__ */
|
|
9184
|
+
/* @__PURE__ */ jsx15(
|
|
9151
9185
|
"button",
|
|
9152
9186
|
{
|
|
9153
9187
|
className: "tool-call-section-toggle",
|
|
@@ -9156,7 +9190,7 @@ function CollapsibleSection({ label, content }) {
|
|
|
9156
9190
|
children: isCollapsed ? "SHOW" : "HIDE"
|
|
9157
9191
|
}
|
|
9158
9192
|
),
|
|
9159
|
-
/* @__PURE__ */
|
|
9193
|
+
/* @__PURE__ */ jsx15("div", { className: `tool-call-section-content ${isCollapsed ? "collapsed" : ""}`, children: /* @__PURE__ */ jsx15("pre", { children: formatOutput(content) }) })
|
|
9160
9194
|
] })
|
|
9161
9195
|
] });
|
|
9162
9196
|
}
|
|
@@ -9175,13 +9209,13 @@ function ToolCallDisplay({ toolPart, className = "" }) {
|
|
|
9175
9209
|
const canExpand = hasInput || hasOutput;
|
|
9176
9210
|
const renderStatusIcon = () => {
|
|
9177
9211
|
if (isLoading) {
|
|
9178
|
-
return /* @__PURE__ */
|
|
9212
|
+
return /* @__PURE__ */ jsx15("span", { className: "tool-call-spinner" });
|
|
9179
9213
|
}
|
|
9180
9214
|
const borderClass = hasFailed ? "tool-call-status-icon--error" : "";
|
|
9181
|
-
return /* @__PURE__ */
|
|
9182
|
-
/* @__PURE__ */
|
|
9183
|
-
/* @__PURE__ */
|
|
9184
|
-
] }) : /* @__PURE__ */
|
|
9215
|
+
return /* @__PURE__ */ jsx15("span", { className: `tool-call-status-icon ${borderClass}`, children: hasFailed ? /* @__PURE__ */ jsxs12("svg", { className: "tool-call-status-icon__inner tool-call-status-icon__inner--error", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
9216
|
+
/* @__PURE__ */ jsx15("line", { x1: "5", y1: "5", x2: "11", y2: "11" }),
|
|
9217
|
+
/* @__PURE__ */ jsx15("line", { x1: "11", y1: "5", x2: "5", y2: "11" })
|
|
9218
|
+
] }) : /* @__PURE__ */ jsx15("svg", { className: "tool-call-status-icon__inner tool-call-status-icon__inner--success", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx15("polyline", { points: "4,8 7,11 12,5" }) }) });
|
|
9185
9219
|
};
|
|
9186
9220
|
return /* @__PURE__ */ jsxs12("div", { className: `tool-call-item ${className}`, children: [
|
|
9187
9221
|
/* @__PURE__ */ jsxs12("div", { className: "tool-call-header", children: [
|
|
@@ -9189,9 +9223,9 @@ function ToolCallDisplay({ toolPart, className = "" }) {
|
|
|
9189
9223
|
/* @__PURE__ */ jsxs12("span", { className: "tool-call-label", children: [
|
|
9190
9224
|
isLoading ? "Calling" : "Called",
|
|
9191
9225
|
" ",
|
|
9192
|
-
/* @__PURE__ */
|
|
9226
|
+
/* @__PURE__ */ jsx15("code", { children: toolName })
|
|
9193
9227
|
] }),
|
|
9194
|
-
canExpand && /* @__PURE__ */
|
|
9228
|
+
canExpand && /* @__PURE__ */ jsx15(
|
|
9195
9229
|
"button",
|
|
9196
9230
|
{
|
|
9197
9231
|
className: "tool-call-toggle",
|
|
@@ -9200,12 +9234,12 @@ function ToolCallDisplay({ toolPart, className = "" }) {
|
|
|
9200
9234
|
children: isExpanded ? "HIDE" : "SHOW"
|
|
9201
9235
|
}
|
|
9202
9236
|
),
|
|
9203
|
-
isDenied && /* @__PURE__ */
|
|
9204
|
-
hasError && /* @__PURE__ */
|
|
9237
|
+
isDenied && /* @__PURE__ */ jsx15("span", { className: "tool-call-error", children: "DENIED" }),
|
|
9238
|
+
hasError && /* @__PURE__ */ jsx15("span", { className: "tool-call-error", children: "ERROR" })
|
|
9205
9239
|
] }),
|
|
9206
9240
|
isExpanded && canExpand && /* @__PURE__ */ jsxs12("div", { className: "tool-call-details", children: [
|
|
9207
|
-
hasInput && /* @__PURE__ */
|
|
9208
|
-
hasOutput && /* @__PURE__ */
|
|
9241
|
+
hasInput && /* @__PURE__ */ jsx15(CollapsibleSection, { label: "IN", content: input }),
|
|
9242
|
+
hasOutput && /* @__PURE__ */ jsx15(CollapsibleSection, { label: "OUT", content: output })
|
|
9209
9243
|
] })
|
|
9210
9244
|
] });
|
|
9211
9245
|
}
|
|
@@ -9240,7 +9274,7 @@ function createSDKWidget(widget) {
|
|
|
9240
9274
|
var createWidget = (widget) => widget;
|
|
9241
9275
|
|
|
9242
9276
|
// lib/chat/components/WidgetRenderer.tsx
|
|
9243
|
-
import { Fragment as
|
|
9277
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9244
9278
|
function renderError(container, message) {
|
|
9245
9279
|
container.innerHTML = "";
|
|
9246
9280
|
const errorDiv = document.createElement("div");
|
|
@@ -9398,7 +9432,7 @@ To fix, add your ReactDOM to the widget config:
|
|
|
9398
9432
|
sendMessage,
|
|
9399
9433
|
sendStructuredMessage
|
|
9400
9434
|
});
|
|
9401
|
-
return /* @__PURE__ */
|
|
9435
|
+
return /* @__PURE__ */ jsx16(Fragment5, { children: element });
|
|
9402
9436
|
} catch (error) {
|
|
9403
9437
|
console.error(`SDK widget "${widget.widgetType}" render threw:`, error);
|
|
9404
9438
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -9408,19 +9442,19 @@ To fix, add your ReactDOM to the widget config:
|
|
|
9408
9442
|
] });
|
|
9409
9443
|
}
|
|
9410
9444
|
}
|
|
9411
|
-
return /* @__PURE__ */
|
|
9445
|
+
return /* @__PURE__ */ jsx16("div", { ref: containerRef, className: "widget-customer-root" });
|
|
9412
9446
|
}
|
|
9413
9447
|
|
|
9414
9448
|
// lib/chat/renderers/MessageRenderer.tsx
|
|
9415
|
-
import { Fragment as
|
|
9449
|
+
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9416
9450
|
function FormattedMarkdownComponent({ children }) {
|
|
9417
9451
|
const MarkdownComponent = ReactMarkdown;
|
|
9418
|
-
return /* @__PURE__ */
|
|
9452
|
+
return /* @__PURE__ */ jsx17(
|
|
9419
9453
|
MarkdownComponent,
|
|
9420
9454
|
{
|
|
9421
9455
|
remarkPlugins: [remarkGfm],
|
|
9422
9456
|
components: {
|
|
9423
|
-
a: ({ children: children2, href, ...props }) => /* @__PURE__ */
|
|
9457
|
+
a: ({ children: children2, href, ...props }) => /* @__PURE__ */ jsx17("a", { href, target: "_blank", rel: "noopener noreferrer", ...props, children: children2 })
|
|
9424
9458
|
},
|
|
9425
9459
|
children: children.replace(/\n\n/gi, "\n\n \n\n")
|
|
9426
9460
|
}
|
|
@@ -9460,10 +9494,10 @@ function MessageRenderer({
|
|
|
9460
9494
|
if (part.type === "text") {
|
|
9461
9495
|
const trimmed = part.text?.trim();
|
|
9462
9496
|
if (!trimmed) return null;
|
|
9463
|
-
return /* @__PURE__ */
|
|
9497
|
+
return /* @__PURE__ */ jsx17("div", { className: "chat-widget__markdown", children: /* @__PURE__ */ jsx17(FormattedMarkdown, { children: trimmed }) }, key);
|
|
9464
9498
|
}
|
|
9465
9499
|
if (part.type.startsWith("tool-") || part.type === "dynamic-tool") {
|
|
9466
|
-
return /* @__PURE__ */
|
|
9500
|
+
return /* @__PURE__ */ jsx17(ToolCallDisplay, { toolPart: part }, key);
|
|
9467
9501
|
}
|
|
9468
9502
|
if (part.type === "data-ui") {
|
|
9469
9503
|
const dataPart = part;
|
|
@@ -9476,7 +9510,7 @@ function MessageRenderer({
|
|
|
9476
9510
|
"]"
|
|
9477
9511
|
] }, key);
|
|
9478
9512
|
}
|
|
9479
|
-
return /* @__PURE__ */
|
|
9513
|
+
return /* @__PURE__ */ jsx17(React5.Fragment, { children: uiWidgets.map((widget, idx) => {
|
|
9480
9514
|
const widgetDef = widgets.find((w) => w.widgetType === widget.widgetType);
|
|
9481
9515
|
if (!widgetDef) {
|
|
9482
9516
|
return /* @__PURE__ */ jsxs14("span", { children: [
|
|
@@ -9485,12 +9519,12 @@ function MessageRenderer({
|
|
|
9485
9519
|
"]"
|
|
9486
9520
|
] }, `${key}-widget-${idx}`);
|
|
9487
9521
|
}
|
|
9488
|
-
return /* @__PURE__ */
|
|
9522
|
+
return /* @__PURE__ */ jsx17(
|
|
9489
9523
|
"div",
|
|
9490
9524
|
{
|
|
9491
9525
|
className: "chat-widget__widget",
|
|
9492
9526
|
inert: readonly ? true : void 0,
|
|
9493
|
-
children: /* @__PURE__ */
|
|
9527
|
+
children: /* @__PURE__ */ jsx17(
|
|
9494
9528
|
WidgetRenderer,
|
|
9495
9529
|
{
|
|
9496
9530
|
widget: widgetDef,
|
|
@@ -9515,7 +9549,7 @@ function MessageRenderer({
|
|
|
9515
9549
|
const renderGroup = useCallback6(
|
|
9516
9550
|
(groupName, key, children) => {
|
|
9517
9551
|
const isExpanded = tagExpansion?.state.get(key) ?? true;
|
|
9518
|
-
return /* @__PURE__ */
|
|
9552
|
+
return /* @__PURE__ */ jsx17(
|
|
9519
9553
|
TagGroupDisplay,
|
|
9520
9554
|
{
|
|
9521
9555
|
tagId: groupName,
|
|
@@ -9528,9 +9562,9 @@ function MessageRenderer({
|
|
|
9528
9562
|
},
|
|
9529
9563
|
[tagExpansion]
|
|
9530
9564
|
);
|
|
9531
|
-
const DisplayMode = displayMode === "brief" ? BriefDisplayMode : FullDisplayMode;
|
|
9532
|
-
return /* @__PURE__ */ jsxs14(
|
|
9533
|
-
/* @__PURE__ */
|
|
9565
|
+
const DisplayMode = displayMode === "brief" ? BriefDisplayMode : displayMode === "hide-tools" ? HideToolsDisplayMode : FullDisplayMode;
|
|
9566
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
9567
|
+
/* @__PURE__ */ jsx17("div", { className, children: /* @__PURE__ */ jsx17(
|
|
9534
9568
|
DisplayMode,
|
|
9535
9569
|
{
|
|
9536
9570
|
sections: message.sections,
|
|
@@ -9539,7 +9573,7 @@ function MessageRenderer({
|
|
|
9539
9573
|
renderGroup
|
|
9540
9574
|
}
|
|
9541
9575
|
) }),
|
|
9542
|
-
!readonly && feedback && /* @__PURE__ */
|
|
9576
|
+
!readonly && feedback && /* @__PURE__ */ jsx17(
|
|
9543
9577
|
MessageFeedback,
|
|
9544
9578
|
{
|
|
9545
9579
|
messageId: message.id,
|
|
@@ -9554,7 +9588,7 @@ function MessageRenderer({
|
|
|
9554
9588
|
}
|
|
9555
9589
|
|
|
9556
9590
|
// lib/chat/ChatWidget.tsx
|
|
9557
|
-
import { jsx as
|
|
9591
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9558
9592
|
var classNames2 = {
|
|
9559
9593
|
container: "chat-widget",
|
|
9560
9594
|
header: "chat-widget__header",
|
|
@@ -10017,7 +10051,7 @@ var ChatWidget = forwardRef(function ChatWidget2({
|
|
|
10017
10051
|
style: themeVariables,
|
|
10018
10052
|
"data-chat-widget": "",
|
|
10019
10053
|
children: [
|
|
10020
|
-
title && /* @__PURE__ */
|
|
10054
|
+
title && /* @__PURE__ */ jsx18("div", { className: classNames2.header, children: /* @__PURE__ */ jsx18("h3", { className: classNames2.headerTitle, children: title }) }),
|
|
10021
10055
|
/* @__PURE__ */ jsxs15(
|
|
10022
10056
|
"div",
|
|
10023
10057
|
{
|
|
@@ -10029,21 +10063,21 @@ var ChatWidget = forwardRef(function ChatWidget2({
|
|
|
10029
10063
|
const isUser = message.role === "user";
|
|
10030
10064
|
const isLastMessage = index === messages.length - 1;
|
|
10031
10065
|
const showFeedback = feedbackEnabled && !isUser && !(status === "streaming" && isLastMessage);
|
|
10032
|
-
return /* @__PURE__ */
|
|
10066
|
+
return /* @__PURE__ */ jsx18("div", { className: classNames2.messageWrapper, children: /* @__PURE__ */ jsx18(
|
|
10033
10067
|
"div",
|
|
10034
10068
|
{
|
|
10035
10069
|
className: cn(
|
|
10036
10070
|
classNames2.messageRow,
|
|
10037
10071
|
isUser ? classNames2.userMessageRow : classNames2.assistantMessageRow
|
|
10038
10072
|
),
|
|
10039
|
-
children: /* @__PURE__ */
|
|
10073
|
+
children: /* @__PURE__ */ jsx18(
|
|
10040
10074
|
"div",
|
|
10041
10075
|
{
|
|
10042
10076
|
className: cn(
|
|
10043
10077
|
classNames2.messageBubble,
|
|
10044
10078
|
isUser ? classNames2.userMessage : classNames2.assistantMessage
|
|
10045
10079
|
),
|
|
10046
|
-
children: /* @__PURE__ */
|
|
10080
|
+
children: /* @__PURE__ */ jsx18(
|
|
10047
10081
|
MessageRenderer,
|
|
10048
10082
|
{
|
|
10049
10083
|
message,
|
|
@@ -10078,17 +10112,17 @@ var ChatWidget = forwardRef(function ChatWidget2({
|
|
|
10078
10112
|
}
|
|
10079
10113
|
) }, message.id);
|
|
10080
10114
|
}),
|
|
10081
|
-
status === "streaming" && /* @__PURE__ */
|
|
10082
|
-
/* @__PURE__ */
|
|
10083
|
-
/* @__PURE__ */
|
|
10084
|
-
/* @__PURE__ */
|
|
10115
|
+
status === "streaming" && /* @__PURE__ */ jsx18("div", { className: classNames2.loadingContainer, children: /* @__PURE__ */ jsx18("div", { className: classNames2.loadingBubble, children: /* @__PURE__ */ jsxs15("div", { className: classNames2.loadingDots, children: [
|
|
10116
|
+
/* @__PURE__ */ jsx18("div", { className: classNames2.loadingDot }),
|
|
10117
|
+
/* @__PURE__ */ jsx18("div", { className: classNames2.loadingDot, "data-delay": "1" }),
|
|
10118
|
+
/* @__PURE__ */ jsx18("div", { className: classNames2.loadingDot, "data-delay": "2" })
|
|
10085
10119
|
] }) }) }),
|
|
10086
|
-
/* @__PURE__ */
|
|
10120
|
+
/* @__PURE__ */ jsx18("div", { ref: messagesEndRef })
|
|
10087
10121
|
]
|
|
10088
10122
|
}
|
|
10089
10123
|
),
|
|
10090
|
-
/* @__PURE__ */
|
|
10091
|
-
/* @__PURE__ */
|
|
10124
|
+
/* @__PURE__ */ jsx18("div", { className: classNames2.inputContainer, children: /* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, className: classNames2.inputForm, children: [
|
|
10125
|
+
/* @__PURE__ */ jsx18(
|
|
10092
10126
|
"textarea",
|
|
10093
10127
|
{
|
|
10094
10128
|
ref: textareaRef,
|
|
@@ -10101,7 +10135,7 @@ var ChatWidget = forwardRef(function ChatWidget2({
|
|
|
10101
10135
|
className: classNames2.textarea
|
|
10102
10136
|
}
|
|
10103
10137
|
),
|
|
10104
|
-
/* @__PURE__ */
|
|
10138
|
+
/* @__PURE__ */ jsx18("div", { className: classNames2.toolbar, children: speechEnabled && /* @__PURE__ */ jsx18(
|
|
10105
10139
|
SpeechToTextButton,
|
|
10106
10140
|
{
|
|
10107
10141
|
className: classNames2.micButton,
|
|
@@ -10115,25 +10149,25 @@ var ChatWidget = forwardRef(function ChatWidget2({
|
|
|
10115
10149
|
onListeningChange: setIsMicActive
|
|
10116
10150
|
}
|
|
10117
10151
|
) }),
|
|
10118
|
-
/* @__PURE__ */
|
|
10152
|
+
/* @__PURE__ */ jsx18(
|
|
10119
10153
|
"button",
|
|
10120
10154
|
{
|
|
10121
10155
|
type: "button",
|
|
10122
10156
|
onClick: status === "streaming" ? stop : handleSendMessage,
|
|
10123
10157
|
disabled: status === "streaming" ? false : !input.trim() || isInputDisabled,
|
|
10124
10158
|
className: classNames2.submitButton,
|
|
10125
|
-
children: status === "streaming" ? /* @__PURE__ */
|
|
10159
|
+
children: status === "streaming" ? /* @__PURE__ */ jsx18(StopCircle, { className: classNames2.sendIcon }) : /* @__PURE__ */ jsx18(Send, { className: classNames2.sendIcon })
|
|
10126
10160
|
}
|
|
10127
10161
|
)
|
|
10128
10162
|
] }) }),
|
|
10129
|
-
pendingToolOutput && /* @__PURE__ */
|
|
10163
|
+
pendingToolOutput && /* @__PURE__ */ jsx18(
|
|
10130
10164
|
InputFormOverlay,
|
|
10131
10165
|
{
|
|
10132
10166
|
args: pendingToolOutput.args,
|
|
10133
10167
|
onComplete: handleToolOutput
|
|
10134
10168
|
}
|
|
10135
10169
|
),
|
|
10136
|
-
pendingToolApproval && /* @__PURE__ */
|
|
10170
|
+
pendingToolApproval && /* @__PURE__ */ jsx18(
|
|
10137
10171
|
ToolApprovalOverlay,
|
|
10138
10172
|
{
|
|
10139
10173
|
approval: pendingToolApproval,
|
|
@@ -10154,7 +10188,7 @@ styleInject(".chat-popup__anchor {\n position: fixed;\n inset-block-end: 20px;
|
|
|
10154
10188
|
// lib/chat/PopupChatWidget.tsx
|
|
10155
10189
|
import { MessageSquare as MessageSquare2, X } from "lucide-react";
|
|
10156
10190
|
import { useEffect as useEffect7, useMemo as useMemo6, useState as useState10 } from "react";
|
|
10157
|
-
import { jsx as
|
|
10191
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
10158
10192
|
function PopupChatWidget({ anchor, ...props }) {
|
|
10159
10193
|
const [isOpen, setIsOpen] = useState10(anchor?.initiallyOpen ?? false);
|
|
10160
10194
|
const [hasOpened, setHasOpened] = useState10(anchor?.initiallyOpen ?? false);
|
|
@@ -10238,7 +10272,7 @@ function PopupChatWidget({ anchor, ...props }) {
|
|
|
10238
10272
|
};
|
|
10239
10273
|
}, [props.popupSize]);
|
|
10240
10274
|
return /* @__PURE__ */ jsxs16("div", { style: themeStyle, children: [
|
|
10241
|
-
/* @__PURE__ */
|
|
10275
|
+
/* @__PURE__ */ jsx19("div", { className: cn("chat-popup__anchor", anchorPositionClass), children: anchor?.render ? anchor.render({ isOpen: openResolved, toggle: handleToggle }) : !openResolved && /* @__PURE__ */ jsxs16(
|
|
10242
10276
|
"button",
|
|
10243
10277
|
{
|
|
10244
10278
|
type: "button",
|
|
@@ -10247,12 +10281,12 @@ function PopupChatWidget({ anchor, ...props }) {
|
|
|
10247
10281
|
"aria-expanded": isOpen,
|
|
10248
10282
|
"aria-label": anchor?.label ?? "Open chat",
|
|
10249
10283
|
children: [
|
|
10250
|
-
/* @__PURE__ */
|
|
10251
|
-
/* @__PURE__ */
|
|
10284
|
+
/* @__PURE__ */ jsx19(MessageSquare2, { className: "chat-popup__anchor-icon" }),
|
|
10285
|
+
/* @__PURE__ */ jsx19("span", { children: anchor?.label ?? "Chat" })
|
|
10252
10286
|
]
|
|
10253
10287
|
}
|
|
10254
10288
|
) }),
|
|
10255
|
-
/* @__PURE__ */
|
|
10289
|
+
/* @__PURE__ */ jsx19(
|
|
10256
10290
|
"div",
|
|
10257
10291
|
{
|
|
10258
10292
|
className: cn(
|
|
@@ -10261,26 +10295,26 @@ function PopupChatWidget({ anchor, ...props }) {
|
|
|
10261
10295
|
openResolved ? "chat-popup__panel--open" : "chat-popup__panel--closed"
|
|
10262
10296
|
),
|
|
10263
10297
|
children: /* @__PURE__ */ jsxs16("div", { className: "chat-popup__panel-inner", style: popupStyle, children: [
|
|
10264
|
-
showClose && /* @__PURE__ */
|
|
10298
|
+
showClose && /* @__PURE__ */ jsx19(
|
|
10265
10299
|
"div",
|
|
10266
10300
|
{
|
|
10267
10301
|
className: cn(
|
|
10268
10302
|
"chat-popup__close",
|
|
10269
10303
|
closeConfig?.position === "top-start" ? "chat-popup__close--start" : "chat-popup__close--end"
|
|
10270
10304
|
),
|
|
10271
|
-
children: closeConfig?.render ? closeConfig.render({ toggle: handleToggle }) : /* @__PURE__ */
|
|
10305
|
+
children: closeConfig?.render ? closeConfig.render({ toggle: handleToggle }) : /* @__PURE__ */ jsx19(
|
|
10272
10306
|
"button",
|
|
10273
10307
|
{
|
|
10274
10308
|
type: "button",
|
|
10275
10309
|
className: "chat-popup__close-button",
|
|
10276
10310
|
onClick: handleToggle,
|
|
10277
10311
|
"aria-label": "Close chat",
|
|
10278
|
-
children: /* @__PURE__ */
|
|
10312
|
+
children: /* @__PURE__ */ jsx19(X, { className: "chat-popup__close-icon" })
|
|
10279
10313
|
}
|
|
10280
10314
|
)
|
|
10281
10315
|
}
|
|
10282
10316
|
),
|
|
10283
|
-
hasOpened && /* @__PURE__ */
|
|
10317
|
+
hasOpened && /* @__PURE__ */ jsx19(
|
|
10284
10318
|
ChatWidget,
|
|
10285
10319
|
{
|
|
10286
10320
|
...props,
|
|
@@ -10300,7 +10334,7 @@ import z10 from "zod";
|
|
|
10300
10334
|
import { MessageSquare as MessageSquare3, MessageSquareText as MessageSquareText2, ThumbsDown as ThumbsDown2, ThumbsUp as ThumbsUp2 } from "lucide-react";
|
|
10301
10335
|
import { useEffect as useEffect8, useMemo as useMemo7, useRef as useRef6, useState as useState11 } from "react";
|
|
10302
10336
|
import z9 from "zod";
|
|
10303
|
-
import { Fragment as
|
|
10337
|
+
import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
10304
10338
|
var vendorCardsHybridSchema = z9.object({
|
|
10305
10339
|
fromLocation: z9.string().describe("The location the user is searching from"),
|
|
10306
10340
|
fromCoordinates: z9.object({
|
|
@@ -10414,12 +10448,12 @@ function HybridVendorCards({
|
|
|
10414
10448
|
return miles < 0.1 ? "< 0.1 mi" : `${miles.toFixed(1)} mi`;
|
|
10415
10449
|
};
|
|
10416
10450
|
if (!serverEnriched || !serverEnriched.vendorDetails) {
|
|
10417
|
-
return /* @__PURE__ */
|
|
10451
|
+
return /* @__PURE__ */ jsx20("div", { children: "Loading vendor details..." });
|
|
10418
10452
|
}
|
|
10419
10453
|
const vendorData = serverEnriched.vendorDetails?.data ?? {};
|
|
10420
10454
|
const distances = distanceMatrix?.data ?? [];
|
|
10421
10455
|
return /* @__PURE__ */ jsxs17("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
|
|
10422
|
-
loadingDistance && /* @__PURE__ */
|
|
10456
|
+
loadingDistance && /* @__PURE__ */ jsx20("style", { children: `@keyframes hybrid-vendor-cards-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }` }),
|
|
10423
10457
|
payload.vendors.map((v, index) => {
|
|
10424
10458
|
const data = vendorData[v.vendor_id];
|
|
10425
10459
|
const name23 = data?.names?.[0]?.value ?? "Unknown";
|
|
@@ -10451,8 +10485,8 @@ function HybridVendorCards({
|
|
|
10451
10485
|
position: "relative"
|
|
10452
10486
|
},
|
|
10453
10487
|
children: [
|
|
10454
|
-
/* @__PURE__ */
|
|
10455
|
-
/* @__PURE__ */
|
|
10488
|
+
/* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
10489
|
+
/* @__PURE__ */ jsx20("div", { style: {
|
|
10456
10490
|
width: "2rem",
|
|
10457
10491
|
height: "2rem",
|
|
10458
10492
|
borderRadius: "9999px",
|
|
@@ -10464,29 +10498,29 @@ function HybridVendorCards({
|
|
|
10464
10498
|
fontSize: "0.875rem",
|
|
10465
10499
|
color: "#374151"
|
|
10466
10500
|
}, children: name23.charAt(0).toUpperCase() }),
|
|
10467
|
-
/* @__PURE__ */
|
|
10501
|
+
/* @__PURE__ */ jsx20("span", { style: { fontWeight: 600, fontSize: "1rem", color: "#111827" }, children: name23 })
|
|
10468
10502
|
] }) }),
|
|
10469
10503
|
(reviewCount != null || cnScore != null) && /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", color: "#6b7280" }, children: [
|
|
10470
|
-
avgRating != null && /* @__PURE__ */ jsxs17(
|
|
10471
|
-
/* @__PURE__ */
|
|
10472
|
-
/* @__PURE__ */
|
|
10504
|
+
avgRating != null && /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
10505
|
+
/* @__PURE__ */ jsx20("span", { style: { color: "#facc15" }, children: "\u2605" }),
|
|
10506
|
+
/* @__PURE__ */ jsx20("span", { children: avgRating.toFixed(1) }),
|
|
10473
10507
|
reviewCount != null && /* @__PURE__ */ jsxs17("span", { style: { color: "#9ca3af" }, children: [
|
|
10474
10508
|
"(",
|
|
10475
10509
|
reviewCount,
|
|
10476
10510
|
" reviews)"
|
|
10477
10511
|
] })
|
|
10478
10512
|
] }),
|
|
10479
|
-
avgRating != null && cnScore != null ? /* @__PURE__ */
|
|
10513
|
+
avgRating != null && cnScore != null ? /* @__PURE__ */ jsx20("span", { style: { color: "#9ca3af" }, children: "\u2022" }) : null,
|
|
10480
10514
|
cnScore != null ? /* @__PURE__ */ jsxs17("span", { children: [
|
|
10481
10515
|
"CN Score: ",
|
|
10482
10516
|
cnScore
|
|
10483
10517
|
] }) : null
|
|
10484
10518
|
] }),
|
|
10485
|
-
careLocationType && /* @__PURE__ */
|
|
10486
|
-
address && /* @__PURE__ */
|
|
10487
|
-
/* @__PURE__ */
|
|
10488
|
-
/* @__PURE__ */
|
|
10489
|
-
/* @__PURE__ */
|
|
10519
|
+
careLocationType && /* @__PURE__ */ jsx20("div", { style: { color: "#6b7280" }, children: careLocationType }),
|
|
10520
|
+
address && /* @__PURE__ */ jsx20("div", { style: { color: "#6b7280" }, children: address }),
|
|
10521
|
+
/* @__PURE__ */ jsx20("div", { style: { display: "flex", alignItems: "center", gap: "0.25rem", color: "#6b7280", minHeight: "1.25rem" }, children: loadingDistance ? /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
10522
|
+
/* @__PURE__ */ jsx20("span", { children: "\u{1F4CD}" }),
|
|
10523
|
+
/* @__PURE__ */ jsx20("span", { style: {
|
|
10490
10524
|
width: "100px",
|
|
10491
10525
|
height: "0.875rem",
|
|
10492
10526
|
background: "linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)",
|
|
@@ -10494,8 +10528,8 @@ function HybridVendorCards({
|
|
|
10494
10528
|
animation: "hybrid-vendor-cards-shimmer 1.5s infinite",
|
|
10495
10529
|
borderRadius: "0.25rem"
|
|
10496
10530
|
} })
|
|
10497
|
-
] }) : distance ? /* @__PURE__ */ jsxs17(
|
|
10498
|
-
/* @__PURE__ */
|
|
10531
|
+
] }) : distance ? /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
10532
|
+
/* @__PURE__ */ jsx20("span", { children: "\u{1F4CD}" }),
|
|
10499
10533
|
/* @__PURE__ */ jsxs17("span", { children: [
|
|
10500
10534
|
distance,
|
|
10501
10535
|
" from ",
|
|
@@ -10503,7 +10537,7 @@ function HybridVendorCards({
|
|
|
10503
10537
|
] })
|
|
10504
10538
|
] }) : null }),
|
|
10505
10539
|
hourlyRate && /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "0.25rem", color: "#6b7280" }, children: [
|
|
10506
|
-
/* @__PURE__ */
|
|
10540
|
+
/* @__PURE__ */ jsx20("span", { children: "\u{1F4B0}" }),
|
|
10507
10541
|
/* @__PURE__ */ jsxs17("span", { children: [
|
|
10508
10542
|
"Rate: $",
|
|
10509
10543
|
hourlyRate,
|
|
@@ -10511,9 +10545,9 @@ function HybridVendorCards({
|
|
|
10511
10545
|
] })
|
|
10512
10546
|
] }),
|
|
10513
10547
|
v.notes && /* @__PURE__ */ jsxs17("div", { style: { color: "#374151", marginTop: "0.4rem" }, children: [
|
|
10514
|
-
/* @__PURE__ */
|
|
10515
|
-
/* @__PURE__ */
|
|
10516
|
-
/* @__PURE__ */
|
|
10548
|
+
/* @__PURE__ */ jsx20("span", { style: { marginRight: "0.25rem" }, children: "\u2728" }),
|
|
10549
|
+
/* @__PURE__ */ jsx20("strong", { children: "Recommendation notes" }),
|
|
10550
|
+
/* @__PURE__ */ jsx20("div", { style: { marginLeft: "1.25rem", marginTop: "0.25rem", color: "#6b7280" }, children: v.notes })
|
|
10517
10551
|
] }),
|
|
10518
10552
|
(() => {
|
|
10519
10553
|
const state = getFeedbackState(v.vendor_id);
|
|
@@ -10541,7 +10575,7 @@ function HybridVendorCards({
|
|
|
10541
10575
|
handleFeedback(v.vendor_id, { comment: trimmedComment, vendorId: v.vendor_id, vendorName: name23 });
|
|
10542
10576
|
}
|
|
10543
10577
|
};
|
|
10544
|
-
return /* @__PURE__ */ jsxs17(
|
|
10578
|
+
return /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
10545
10579
|
/* @__PURE__ */ jsxs17("div", { style: {
|
|
10546
10580
|
display: "flex",
|
|
10547
10581
|
flexWrap: "wrap",
|
|
@@ -10550,11 +10584,11 @@ function HybridVendorCards({
|
|
|
10550
10584
|
minHeight: "1.75rem"
|
|
10551
10585
|
}, children: [
|
|
10552
10586
|
verification?.verified && /* @__PURE__ */ jsxs17("span", { style: { display: "flex", alignItems: "center", gap: "0.25rem", color: "#22c55e", fontSize: "0.75rem" }, children: [
|
|
10553
|
-
/* @__PURE__ */
|
|
10587
|
+
/* @__PURE__ */ jsx20("span", { style: { fontSize: "0.875rem" }, children: "\u2713" }),
|
|
10554
10588
|
" Wellthy Verified"
|
|
10555
10589
|
] }),
|
|
10556
10590
|
hasBackgroundCheck && /* @__PURE__ */ jsxs17("span", { style: { display: "flex", alignItems: "center", gap: "0.25rem", color: "#22c55e", fontSize: "0.75rem" }, children: [
|
|
10557
|
-
/* @__PURE__ */
|
|
10591
|
+
/* @__PURE__ */ jsx20("span", { style: { fontSize: "0.875rem" }, children: "\u2713" }),
|
|
10558
10592
|
" Background check"
|
|
10559
10593
|
] }),
|
|
10560
10594
|
messageContext && /* @__PURE__ */ jsxs17("div", { style: {
|
|
@@ -10563,7 +10597,7 @@ function HybridVendorCards({
|
|
|
10563
10597
|
gap: "0.25rem",
|
|
10564
10598
|
alignItems: "center"
|
|
10565
10599
|
}, children: [
|
|
10566
|
-
/* @__PURE__ */
|
|
10600
|
+
/* @__PURE__ */ jsx20(
|
|
10567
10601
|
"button",
|
|
10568
10602
|
{
|
|
10569
10603
|
onClick: () => handleRatingClick("positive"),
|
|
@@ -10581,10 +10615,10 @@ function HybridVendorCards({
|
|
|
10581
10615
|
height: "1.75rem"
|
|
10582
10616
|
},
|
|
10583
10617
|
title: "This vendor was helpful",
|
|
10584
|
-
children: /* @__PURE__ */
|
|
10618
|
+
children: /* @__PURE__ */ jsx20(ThumbsUp2, { style: { width: "1rem", height: "1rem" } })
|
|
10585
10619
|
}
|
|
10586
10620
|
),
|
|
10587
|
-
/* @__PURE__ */
|
|
10621
|
+
/* @__PURE__ */ jsx20(
|
|
10588
10622
|
"button",
|
|
10589
10623
|
{
|
|
10590
10624
|
onClick: () => handleRatingClick("negative"),
|
|
@@ -10602,13 +10636,13 @@ function HybridVendorCards({
|
|
|
10602
10636
|
height: "1.75rem"
|
|
10603
10637
|
},
|
|
10604
10638
|
title: "This vendor was not helpful",
|
|
10605
|
-
children: /* @__PURE__ */
|
|
10639
|
+
children: /* @__PURE__ */ jsx20(ThumbsDown2, { style: { width: "1rem", height: "1rem" } })
|
|
10606
10640
|
}
|
|
10607
10641
|
),
|
|
10608
10642
|
(() => {
|
|
10609
10643
|
const hasComment = !!state.commentText?.trim();
|
|
10610
10644
|
const CommentIcon = hasComment ? MessageSquareText2 : MessageSquare3;
|
|
10611
|
-
return /* @__PURE__ */
|
|
10645
|
+
return /* @__PURE__ */ jsx20(
|
|
10612
10646
|
"button",
|
|
10613
10647
|
{
|
|
10614
10648
|
onClick: handleCommentToggle,
|
|
@@ -10626,13 +10660,13 @@ function HybridVendorCards({
|
|
|
10626
10660
|
height: "1.75rem"
|
|
10627
10661
|
},
|
|
10628
10662
|
title: hasComment ? "Edit comment" : "Add comment",
|
|
10629
|
-
children: /* @__PURE__ */
|
|
10663
|
+
children: /* @__PURE__ */ jsx20(CommentIcon, { style: { width: "1rem", height: "1rem" } })
|
|
10630
10664
|
}
|
|
10631
10665
|
);
|
|
10632
10666
|
})()
|
|
10633
10667
|
] })
|
|
10634
10668
|
] }),
|
|
10635
|
-
state.showComment && /* @__PURE__ */
|
|
10669
|
+
state.showComment && /* @__PURE__ */ jsx20("div", { style: {
|
|
10636
10670
|
position: "absolute",
|
|
10637
10671
|
bottom: 0,
|
|
10638
10672
|
left: 0,
|
|
@@ -10643,7 +10677,7 @@ function HybridVendorCards({
|
|
|
10643
10677
|
padding: "0.75rem 1rem",
|
|
10644
10678
|
boxShadow: "0 -2px 8px rgba(0, 0, 0, 0.1)"
|
|
10645
10679
|
}, children: /* @__PURE__ */ jsxs17("div", { style: { display: "flex", gap: "0.5rem", alignItems: "flex-start" }, children: [
|
|
10646
|
-
/* @__PURE__ */
|
|
10680
|
+
/* @__PURE__ */ jsx20(
|
|
10647
10681
|
"textarea",
|
|
10648
10682
|
{
|
|
10649
10683
|
placeholder: "Share your thoughts about this vendor...",
|
|
@@ -10663,7 +10697,7 @@ function HybridVendorCards({
|
|
|
10663
10697
|
}
|
|
10664
10698
|
),
|
|
10665
10699
|
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", flexDirection: "column", gap: "0.375rem" }, children: [
|
|
10666
|
-
/* @__PURE__ */
|
|
10700
|
+
/* @__PURE__ */ jsx20(
|
|
10667
10701
|
"button",
|
|
10668
10702
|
{
|
|
10669
10703
|
onClick: handleCommentSubmit,
|
|
@@ -10682,7 +10716,7 @@ function HybridVendorCards({
|
|
|
10682
10716
|
children: "Save"
|
|
10683
10717
|
}
|
|
10684
10718
|
),
|
|
10685
|
-
/* @__PURE__ */
|
|
10719
|
+
/* @__PURE__ */ jsx20(
|
|
10686
10720
|
"button",
|
|
10687
10721
|
{
|
|
10688
10722
|
onClick: handleCommentToggle,
|
|
@@ -10713,7 +10747,7 @@ function HybridVendorCards({
|
|
|
10713
10747
|
// lib/chat/widgets/VendorCards.tsx
|
|
10714
10748
|
import { MessageSquare as MessageSquare4, MessageSquareText as MessageSquareText3, ThumbsDown as ThumbsDown3, ThumbsUp as ThumbsUp3 } from "lucide-react";
|
|
10715
10749
|
import React9 from "react";
|
|
10716
|
-
import { Fragment as
|
|
10750
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
10717
10751
|
var vendorCardsSchema = jsonSchema({
|
|
10718
10752
|
type: "object",
|
|
10719
10753
|
description: "displaying a list of vendor cards. Use this widget to represent data from CareNetwork vendor search tool.",
|
|
@@ -10759,7 +10793,7 @@ var vendorCardsSchema = jsonSchema({
|
|
|
10759
10793
|
});
|
|
10760
10794
|
|
|
10761
10795
|
// lib/chat/widgets/default-widgets.tsx
|
|
10762
|
-
import { jsx as
|
|
10796
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
10763
10797
|
var defaultChatWidgets = [
|
|
10764
10798
|
createSDKWidget({
|
|
10765
10799
|
widgetType: "person-card",
|
|
@@ -10768,7 +10802,7 @@ var defaultChatWidgets = [
|
|
|
10768
10802
|
photoUri: z10.string().optional().describe("URL to a photo of the person"),
|
|
10769
10803
|
details: z10.record(z10.string(), z10.any()).optional()
|
|
10770
10804
|
}).describe("showing a person card with name, photo and additional details"),
|
|
10771
|
-
render: (payload) => /* @__PURE__ */
|
|
10805
|
+
render: (payload) => /* @__PURE__ */ jsx22(
|
|
10772
10806
|
"div",
|
|
10773
10807
|
{
|
|
10774
10808
|
style: {
|
|
@@ -10782,7 +10816,7 @@ var defaultChatWidgets = [
|
|
|
10782
10816
|
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"
|
|
10783
10817
|
},
|
|
10784
10818
|
children: /* @__PURE__ */ jsxs19("div", { style: { display: "flex", alignItems: "flex-start", gap: "0.75rem" }, children: [
|
|
10785
|
-
payload.photoUri && /* @__PURE__ */
|
|
10819
|
+
payload.photoUri && /* @__PURE__ */ jsx22(
|
|
10786
10820
|
"img",
|
|
10787
10821
|
{
|
|
10788
10822
|
src: payload.photoUri,
|
|
@@ -10798,13 +10832,13 @@ var defaultChatWidgets = [
|
|
|
10798
10832
|
}
|
|
10799
10833
|
),
|
|
10800
10834
|
/* @__PURE__ */ jsxs19("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
10801
|
-
/* @__PURE__ */
|
|
10802
|
-
payload.details ? /* @__PURE__ */
|
|
10835
|
+
/* @__PURE__ */ jsx22("div", { style: { fontWeight: 600, fontSize: "1rem", color: "#111827", marginBottom: "0.25rem" }, children: payload.name }),
|
|
10836
|
+
payload.details ? /* @__PURE__ */ jsx22("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: Object.entries(payload.details).map(([key, value]) => /* @__PURE__ */ jsxs19("div", { style: { display: "flex", gap: "0.5rem", fontSize: "0.875rem" }, children: [
|
|
10803
10837
|
/* @__PURE__ */ jsxs19("span", { style: { color: "#6b7280", fontWeight: 500, minWidth: "fit-content" }, children: [
|
|
10804
10838
|
key,
|
|
10805
10839
|
":"
|
|
10806
10840
|
] }),
|
|
10807
|
-
/* @__PURE__ */
|
|
10841
|
+
/* @__PURE__ */ jsx22("span", { style: { color: "#374151" }, children: String(value) })
|
|
10808
10842
|
] }, key)) }) : null
|
|
10809
10843
|
] })
|
|
10810
10844
|
] })
|
|
@@ -10817,7 +10851,7 @@ var defaultChatWidgets = [
|
|
|
10817
10851
|
uri: z10.string().url(),
|
|
10818
10852
|
text: z10.string().optional()
|
|
10819
10853
|
}).describe("rendering a clickable link"),
|
|
10820
|
-
render: (payload) => /* @__PURE__ */
|
|
10854
|
+
render: (payload) => /* @__PURE__ */ jsx22(
|
|
10821
10855
|
"a",
|
|
10822
10856
|
{
|
|
10823
10857
|
href: payload.uri,
|
|
@@ -10868,7 +10902,7 @@ var getVendorCardsWidget = (isProd) => {
|
|
|
10868
10902
|
}
|
|
10869
10903
|
},
|
|
10870
10904
|
// Client-side: fetch distance matrix progressively
|
|
10871
|
-
render: (payload, enriched, { messageContext, invokeTool }) => /* @__PURE__ */
|
|
10905
|
+
render: (payload, enriched, { messageContext, invokeTool }) => /* @__PURE__ */ jsx22(
|
|
10872
10906
|
HybridVendorCards,
|
|
10873
10907
|
{
|
|
10874
10908
|
payload,
|
|
@@ -10887,6 +10921,8 @@ export {
|
|
|
10887
10921
|
ChatWidget,
|
|
10888
10922
|
FullDisplayMode,
|
|
10889
10923
|
FullDisplayMode as FullRenderer,
|
|
10924
|
+
HideToolsDisplayMode,
|
|
10925
|
+
HideToolsDisplayMode as HideToolsRenderer,
|
|
10890
10926
|
MessageRenderer,
|
|
10891
10927
|
PopupChatWidget,
|
|
10892
10928
|
SDK_WIDGET_MARKER,
|