@webless/agent 0.12.1 → 0.13.1
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 +3 -1
- package/dist/{chunk-HKQFEO6R.js → chunk-P6ZM4BIU.js} +992 -585
- package/dist/chunk-P6ZM4BIU.js.map +1 -0
- package/dist/embed.cjs +1081 -672
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +613 -194
- package/dist/embed.css.map +1 -1
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.js +3 -1
- package/dist/embed.js.map +1 -1
- package/dist/{panel-controller-DbDHLs4L.d.cts → panel-controller-VmCsa5Si.d.cts} +3 -0
- package/dist/{panel-controller-DbDHLs4L.d.ts → panel-controller-VmCsa5Si.d.ts} +3 -0
- package/dist/presentation.cjs +7 -1
- package/dist/presentation.cjs.map +1 -1
- package/dist/presentation.d.cts +1 -0
- package/dist/presentation.d.ts +1 -0
- package/dist/presentation.js +7 -1
- package/dist/presentation.js.map +1 -1
- package/dist/react.cjs +1097 -690
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +613 -194
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +5 -3
- package/dist/react.d.ts +5 -3
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HKQFEO6R.js.map +0 -1
package/dist/react.cjs
CHANGED
|
@@ -46,7 +46,7 @@ __export(react_exports, {
|
|
|
46
46
|
module.exports = __toCommonJS(react_exports);
|
|
47
47
|
|
|
48
48
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
49
|
-
var
|
|
49
|
+
var import_react20 = require("react");
|
|
50
50
|
|
|
51
51
|
// src/react/page-shift.ts
|
|
52
52
|
var import_react = require("react");
|
|
@@ -2614,7 +2614,12 @@ function parseAgentSearchReferences(value) {
|
|
|
2614
2614
|
const url = safeSearchUrl(action.url);
|
|
2615
2615
|
cta = { label: action.label.trim(), ...url ? { url } : {} };
|
|
2616
2616
|
}
|
|
2617
|
-
|
|
2617
|
+
const suggestions = Array.isArray(data.suggestions) && data.suggestions.length <= 8 && data.suggestions.every((item) => text2(item)) ? [...new Set(data.suggestions.map((item) => item.trim()))] : void 0;
|
|
2618
|
+
return {
|
|
2619
|
+
sources,
|
|
2620
|
+
...cta ? { cta } : {},
|
|
2621
|
+
...suggestions ? { suggestions } : {}
|
|
2622
|
+
};
|
|
2618
2623
|
}
|
|
2619
2624
|
function parseAgentSearchDiscoveryOutput(value) {
|
|
2620
2625
|
let decoded = value;
|
|
@@ -3196,6 +3201,7 @@ function presentVisitorToolResult(result, registry = []) {
|
|
|
3196
3201
|
status: "completed",
|
|
3197
3202
|
kind: "search",
|
|
3198
3203
|
sources: search.sources,
|
|
3204
|
+
suggestions: search.suggestions,
|
|
3199
3205
|
...search.cta ? { cta: search.cta } : {}
|
|
3200
3206
|
};
|
|
3201
3207
|
}
|
|
@@ -4213,7 +4219,7 @@ function unregisterAgentPanelController(customerId) {
|
|
|
4213
4219
|
}
|
|
4214
4220
|
|
|
4215
4221
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
4216
|
-
var
|
|
4222
|
+
var import_react18 = require("react");
|
|
4217
4223
|
|
|
4218
4224
|
// src/react/types/conversation.ts
|
|
4219
4225
|
var defaultAgentRailTheme = {
|
|
@@ -4495,25 +4501,260 @@ function AgentActivityBubble({
|
|
|
4495
4501
|
] });
|
|
4496
4502
|
}
|
|
4497
4503
|
|
|
4498
|
-
// src/react/components/
|
|
4504
|
+
// src/react/components/LearnMore/LearnMore.tsx
|
|
4505
|
+
var import_react7 = require("react");
|
|
4506
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4507
|
+
function QuestionIcon() {
|
|
4508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4509
|
+
"svg",
|
|
4510
|
+
{
|
|
4511
|
+
viewBox: "0 0 24 24",
|
|
4512
|
+
width: "18",
|
|
4513
|
+
height: "18",
|
|
4514
|
+
fill: "none",
|
|
4515
|
+
stroke: "currentColor",
|
|
4516
|
+
strokeWidth: "1.5",
|
|
4517
|
+
strokeLinecap: "round",
|
|
4518
|
+
strokeLinejoin: "round",
|
|
4519
|
+
"aria-hidden": "true",
|
|
4520
|
+
children: [
|
|
4521
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
|
|
4524
|
+
]
|
|
4525
|
+
}
|
|
4526
|
+
);
|
|
4527
|
+
}
|
|
4528
|
+
function LearnMore({
|
|
4529
|
+
results,
|
|
4530
|
+
disabled,
|
|
4531
|
+
onSelect
|
|
4532
|
+
}) {
|
|
4533
|
+
const headingId = (0, import_react7.useId)();
|
|
4534
|
+
const panelId = (0, import_react7.useId)();
|
|
4535
|
+
const [open, setOpen] = (0, import_react7.useState)(true);
|
|
4536
|
+
const questions = [
|
|
4537
|
+
...new Set(results.flatMap((result) => result.suggestions ?? []))
|
|
4538
|
+
].slice(0, 3);
|
|
4539
|
+
if (!questions.length) return null;
|
|
4540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "learn-more", "aria-labelledby": headingId, children: [
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id: headingId, className: "learn-more__heading", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4542
|
+
"button",
|
|
4543
|
+
{
|
|
4544
|
+
type: "button",
|
|
4545
|
+
className: "learn-more__toggle",
|
|
4546
|
+
"aria-expanded": open,
|
|
4547
|
+
"aria-controls": panelId,
|
|
4548
|
+
onClick: () => setOpen((current) => !current),
|
|
4549
|
+
children: [
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Learn more" }),
|
|
4551
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4552
|
+
"svg",
|
|
4553
|
+
{
|
|
4554
|
+
className: "learn-more__chevron",
|
|
4555
|
+
viewBox: "0 0 16 16",
|
|
4556
|
+
fill: "none",
|
|
4557
|
+
"aria-hidden": "true",
|
|
4558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4559
|
+
"path",
|
|
4560
|
+
{
|
|
4561
|
+
d: "M4 6.5l4 4 4-4",
|
|
4562
|
+
stroke: "currentColor",
|
|
4563
|
+
strokeWidth: "1.6",
|
|
4564
|
+
strokeLinecap: "round",
|
|
4565
|
+
strokeLinejoin: "round"
|
|
4566
|
+
}
|
|
4567
|
+
)
|
|
4568
|
+
}
|
|
4569
|
+
)
|
|
4570
|
+
]
|
|
4571
|
+
}
|
|
4572
|
+
) }),
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4574
|
+
"div",
|
|
4575
|
+
{
|
|
4576
|
+
id: panelId,
|
|
4577
|
+
className: `learn-more__panel${open ? " learn-more__panel--open" : ""}`,
|
|
4578
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "learn-more__panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "learn-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4579
|
+
"button",
|
|
4580
|
+
{
|
|
4581
|
+
type: "button",
|
|
4582
|
+
disabled,
|
|
4583
|
+
onClick: () => onSelect(question),
|
|
4584
|
+
children: [
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(QuestionIcon, {}) }),
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-text", children: question }),
|
|
4587
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4588
|
+
"svg",
|
|
4589
|
+
{
|
|
4590
|
+
className: "learn-more__question-arrow",
|
|
4591
|
+
viewBox: "0 0 24 24",
|
|
4592
|
+
fill: "none",
|
|
4593
|
+
stroke: "currentColor",
|
|
4594
|
+
strokeWidth: "1.5",
|
|
4595
|
+
"aria-hidden": "true",
|
|
4596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
|
|
4597
|
+
}
|
|
4598
|
+
)
|
|
4599
|
+
]
|
|
4600
|
+
}
|
|
4601
|
+
) }, question)) }) })
|
|
4602
|
+
}
|
|
4603
|
+
)
|
|
4604
|
+
] });
|
|
4605
|
+
}
|
|
4606
|
+
|
|
4607
|
+
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4499
4608
|
var import_react8 = require("react");
|
|
4609
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4610
|
+
function SiteIcon() {
|
|
4611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4612
|
+
"svg",
|
|
4613
|
+
{
|
|
4614
|
+
viewBox: "0 0 24 24",
|
|
4615
|
+
width: "18",
|
|
4616
|
+
height: "18",
|
|
4617
|
+
fill: "none",
|
|
4618
|
+
stroke: "currentColor",
|
|
4619
|
+
strokeWidth: "1.5",
|
|
4620
|
+
"aria-hidden": "true",
|
|
4621
|
+
children: [
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4625
|
+
]
|
|
4626
|
+
}
|
|
4627
|
+
);
|
|
4628
|
+
}
|
|
4629
|
+
function SourceFavicon({ url }) {
|
|
4630
|
+
const [failed, setFailed] = (0, import_react8.useState)(false);
|
|
4631
|
+
let faviconUrl = null;
|
|
4632
|
+
if (url) {
|
|
4633
|
+
try {
|
|
4634
|
+
faviconUrl = `${new URL(url).origin}/favicon.ico`;
|
|
4635
|
+
} catch {
|
|
4636
|
+
faviconUrl = null;
|
|
4637
|
+
}
|
|
4638
|
+
}
|
|
4639
|
+
if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SiteIcon, {});
|
|
4640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4641
|
+
"img",
|
|
4642
|
+
{
|
|
4643
|
+
src: faviconUrl,
|
|
4644
|
+
alt: "",
|
|
4645
|
+
loading: "lazy",
|
|
4646
|
+
onError: () => setFailed(true)
|
|
4647
|
+
}
|
|
4648
|
+
);
|
|
4649
|
+
}
|
|
4650
|
+
function searchSources(results) {
|
|
4651
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
4652
|
+
return results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4653
|
+
const url = safeSearchUrl(source.url);
|
|
4654
|
+
const key = url ?? source.id;
|
|
4655
|
+
if (seenSources.has(key)) return [];
|
|
4656
|
+
seenSources.add(key);
|
|
4657
|
+
return [{ ...source, url, key }];
|
|
4658
|
+
});
|
|
4659
|
+
}
|
|
4660
|
+
function SearchReferences({
|
|
4661
|
+
results,
|
|
4662
|
+
mode = "default"
|
|
4663
|
+
}) {
|
|
4664
|
+
const sources = searchSources(results);
|
|
4665
|
+
const seenActions = /* @__PURE__ */ new Set();
|
|
4666
|
+
const actions = results.flatMap((result) => {
|
|
4667
|
+
const url = safeSearchUrl(result.cta?.url);
|
|
4668
|
+
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4669
|
+
seenActions.add(url);
|
|
4670
|
+
return [{ label: result.cta.label, url }];
|
|
4671
|
+
});
|
|
4672
|
+
if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
|
|
4673
|
+
return null;
|
|
4674
|
+
const Container = mode === "default" ? "details" : "div";
|
|
4675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "search-references", children: [
|
|
4676
|
+
mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4677
|
+
Container,
|
|
4678
|
+
{
|
|
4679
|
+
className: "search-references__disclosure",
|
|
4680
|
+
"aria-label": "Sources",
|
|
4681
|
+
children: [
|
|
4682
|
+
mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { className: "search-references__heading", children: [
|
|
4683
|
+
"Sources (",
|
|
4684
|
+
sources.length,
|
|
4685
|
+
")"
|
|
4686
|
+
] }) : null,
|
|
4687
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
4688
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
4689
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SourceFavicon, { url: source.url }) }),
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4691
|
+
"span",
|
|
4692
|
+
{
|
|
4693
|
+
className: "search-references__title",
|
|
4694
|
+
title: source.title,
|
|
4695
|
+
children: source.title
|
|
4696
|
+
}
|
|
4697
|
+
),
|
|
4698
|
+
source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4699
|
+
"svg",
|
|
4700
|
+
{
|
|
4701
|
+
className: "search-references__row-arrow",
|
|
4702
|
+
viewBox: "0 0 24 24",
|
|
4703
|
+
fill: "none",
|
|
4704
|
+
stroke: "currentColor",
|
|
4705
|
+
strokeWidth: "1.5",
|
|
4706
|
+
"aria-hidden": "true",
|
|
4707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
|
|
4708
|
+
}
|
|
4709
|
+
) : null
|
|
4710
|
+
] });
|
|
4711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4712
|
+
"a",
|
|
4713
|
+
{
|
|
4714
|
+
className: "search-references__source",
|
|
4715
|
+
href: source.url,
|
|
4716
|
+
target: "_blank",
|
|
4717
|
+
rel: "noopener noreferrer",
|
|
4718
|
+
children: content
|
|
4719
|
+
}
|
|
4720
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
|
|
4721
|
+
}) })
|
|
4722
|
+
]
|
|
4723
|
+
}
|
|
4724
|
+
) : null,
|
|
4725
|
+
mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4726
|
+
"a",
|
|
4727
|
+
{
|
|
4728
|
+
className: "search-references__cta",
|
|
4729
|
+
href: action.url,
|
|
4730
|
+
target: "_blank",
|
|
4731
|
+
rel: "noopener noreferrer",
|
|
4732
|
+
children: action.label
|
|
4733
|
+
},
|
|
4734
|
+
action.url
|
|
4735
|
+
)) }) : null
|
|
4736
|
+
] });
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
// src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
|
|
4740
|
+
var import_react10 = require("react");
|
|
4500
4741
|
var import_react_dom = require("react-dom");
|
|
4501
4742
|
|
|
4502
4743
|
// src/react/components/AgentRail/AgentRailOverlayContext.tsx
|
|
4503
|
-
var
|
|
4504
|
-
var AgentRailOverlayContext = (0,
|
|
4744
|
+
var import_react9 = require("react");
|
|
4745
|
+
var AgentRailOverlayContext = (0, import_react9.createContext)(null);
|
|
4505
4746
|
function useAgentRailPortalRoots() {
|
|
4506
|
-
return (0,
|
|
4747
|
+
return (0, import_react9.useContext)(AgentRailOverlayContext);
|
|
4507
4748
|
}
|
|
4508
4749
|
function useAgentRailMenuPortalRoot() {
|
|
4509
|
-
return (0,
|
|
4750
|
+
return (0, import_react9.useContext)(AgentRailOverlayContext)?.railRef ?? null;
|
|
4510
4751
|
}
|
|
4511
4752
|
|
|
4512
4753
|
// src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
|
|
4513
|
-
var
|
|
4754
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4514
4755
|
var FOCUSABLE_SELECTOR = 'button:not(:disabled), a[href], textarea:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])';
|
|
4515
4756
|
function CloseIcon() {
|
|
4516
|
-
return /* @__PURE__ */ (0,
|
|
4757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4517
4758
|
"path",
|
|
4518
4759
|
{
|
|
4519
4760
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -4526,14 +4767,18 @@ function CloseIcon() {
|
|
|
4526
4767
|
function AnswerReceiptDialog({
|
|
4527
4768
|
brandLabel = "",
|
|
4528
4769
|
onClose,
|
|
4529
|
-
steps
|
|
4770
|
+
steps = [],
|
|
4771
|
+
title = "How this answer was made",
|
|
4772
|
+
summary,
|
|
4773
|
+
children
|
|
4530
4774
|
}) {
|
|
4775
|
+
const titleId = (0, import_react10.useId)();
|
|
4531
4776
|
const portalRoots = useAgentRailPortalRoots();
|
|
4532
4777
|
const overlayRoot = portalRoots?.overlayRef ?? null;
|
|
4533
|
-
const cardRef = (0,
|
|
4534
|
-
const closeButtonRef = (0,
|
|
4535
|
-
const previouslyFocusedRef = (0,
|
|
4536
|
-
(0,
|
|
4778
|
+
const cardRef = (0, import_react10.useRef)(null);
|
|
4779
|
+
const closeButtonRef = (0, import_react10.useRef)(null);
|
|
4780
|
+
const previouslyFocusedRef = (0, import_react10.useRef)(null);
|
|
4781
|
+
(0, import_react10.useEffect)(() => {
|
|
4537
4782
|
previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
4538
4783
|
closeButtonRef.current?.focus({ preventScroll: true });
|
|
4539
4784
|
const handleKeyDown = (event) => {
|
|
@@ -4544,9 +4789,7 @@ function AnswerReceiptDialog({
|
|
|
4544
4789
|
return;
|
|
4545
4790
|
}
|
|
4546
4791
|
if (event.key !== "Tab" || !cardRef.current) return;
|
|
4547
|
-
const focusable = cardRef.current.querySelectorAll(
|
|
4548
|
-
FOCUSABLE_SELECTOR
|
|
4549
|
-
);
|
|
4792
|
+
const focusable = cardRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
4550
4793
|
if (focusable.length === 0) return;
|
|
4551
4794
|
const first = focusable.item(0);
|
|
4552
4795
|
const last = focusable.item(focusable.length - 1);
|
|
@@ -4564,8 +4807,8 @@ function AnswerReceiptDialog({
|
|
|
4564
4807
|
previouslyFocusedRef.current?.focus({ preventScroll: true });
|
|
4565
4808
|
};
|
|
4566
4809
|
}, [onClose]);
|
|
4567
|
-
const content = /* @__PURE__ */ (0,
|
|
4568
|
-
/* @__PURE__ */ (0,
|
|
4810
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "agent-receipt-dialog", children: [
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4569
4812
|
"button",
|
|
4570
4813
|
{
|
|
4571
4814
|
type: "button",
|
|
@@ -4575,25 +4818,18 @@ function AnswerReceiptDialog({
|
|
|
4575
4818
|
onClick: onClose
|
|
4576
4819
|
}
|
|
4577
4820
|
),
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4579
4822
|
"div",
|
|
4580
4823
|
{
|
|
4581
4824
|
ref: cardRef,
|
|
4582
4825
|
className: "agent-receipt-dialog__card",
|
|
4583
4826
|
role: "dialog",
|
|
4584
4827
|
"aria-modal": "true",
|
|
4585
|
-
"aria-labelledby":
|
|
4828
|
+
"aria-labelledby": titleId,
|
|
4586
4829
|
children: [
|
|
4587
|
-
/* @__PURE__ */ (0,
|
|
4588
|
-
/* @__PURE__ */ (0,
|
|
4589
|
-
|
|
4590
|
-
{
|
|
4591
|
-
className: "agent-receipt-dialog__title",
|
|
4592
|
-
id: "agent-receipt-dialog-title",
|
|
4593
|
-
children: "How this answer was made"
|
|
4594
|
-
}
|
|
4595
|
-
),
|
|
4596
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4830
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "agent-receipt-dialog__header", children: [
|
|
4831
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "agent-receipt-dialog__title", id: titleId, children: title }),
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4597
4833
|
"button",
|
|
4598
4834
|
{
|
|
4599
4835
|
ref: closeButtonRef,
|
|
@@ -4601,12 +4837,12 @@ function AnswerReceiptDialog({
|
|
|
4601
4837
|
className: "agent-receipt-dialog__close",
|
|
4602
4838
|
"aria-label": "Close",
|
|
4603
4839
|
onClick: onClose,
|
|
4604
|
-
children: /* @__PURE__ */ (0,
|
|
4840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloseIcon, {})
|
|
4605
4841
|
}
|
|
4606
4842
|
)
|
|
4607
4843
|
] }),
|
|
4608
|
-
/* @__PURE__ */ (0,
|
|
4609
|
-
/* @__PURE__ */ (0,
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "agent-receipt-dialog__summary", children: summary ?? workSummary(steps, false, brandLabel) }),
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "agent-receipt-dialog__body", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AgentWorkSteps, { brandLabel, steps }) })
|
|
4610
4846
|
]
|
|
4611
4847
|
}
|
|
4612
4848
|
)
|
|
@@ -4618,11 +4854,11 @@ function AnswerReceiptDialog({
|
|
|
4618
4854
|
}
|
|
4619
4855
|
|
|
4620
4856
|
// src/react/components/Composer/Composer.tsx
|
|
4621
|
-
var
|
|
4622
|
-
var
|
|
4857
|
+
var import_react11 = require("react");
|
|
4858
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4623
4859
|
var FORM_SUBMITTED_MESSAGE = "Shared my details";
|
|
4624
4860
|
function SendIcon() {
|
|
4625
|
-
return /* @__PURE__ */ (0,
|
|
4861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4626
4862
|
"path",
|
|
4627
4863
|
{
|
|
4628
4864
|
d: "M8 12V4M8 4l-3 3M8 4l3 3",
|
|
@@ -4634,7 +4870,7 @@ function SendIcon() {
|
|
|
4634
4870
|
) });
|
|
4635
4871
|
}
|
|
4636
4872
|
function CheckIcon() {
|
|
4637
|
-
return /* @__PURE__ */ (0,
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4638
4874
|
"path",
|
|
4639
4875
|
{
|
|
4640
4876
|
d: "M2.5 6.2l2.3 2.3 4.7-5",
|
|
@@ -4646,7 +4882,7 @@ function CheckIcon() {
|
|
|
4646
4882
|
) });
|
|
4647
4883
|
}
|
|
4648
4884
|
function CollapseIcon() {
|
|
4649
|
-
return /* @__PURE__ */ (0,
|
|
4885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4650
4886
|
"path",
|
|
4651
4887
|
{
|
|
4652
4888
|
d: "M4 10l4-4 4 4",
|
|
@@ -4680,21 +4916,35 @@ function Composer({
|
|
|
4680
4916
|
allowFormResume = true,
|
|
4681
4917
|
onSubmit
|
|
4682
4918
|
}) {
|
|
4683
|
-
const [value, setValue] = (0,
|
|
4684
|
-
const [draft, setDraft] = (0,
|
|
4685
|
-
const
|
|
4686
|
-
const
|
|
4687
|
-
const
|
|
4688
|
-
const
|
|
4919
|
+
const [value, setValue] = (0, import_react11.useState)("");
|
|
4920
|
+
const [draft, setDraft] = (0, import_react11.useState)(() => createDraft(form));
|
|
4921
|
+
const [multiline, setMultiline] = (0, import_react11.useState)(false);
|
|
4922
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
4923
|
+
const firstFieldRef = (0, import_react11.useRef)(null);
|
|
4924
|
+
const formRef = (0, import_react11.useRef)(null);
|
|
4925
|
+
const formId = (0, import_react11.useId)();
|
|
4689
4926
|
if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
|
|
4690
4927
|
const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
|
|
4691
4928
|
const activeForm = !disabled && draft.expanded ? savedForm : null;
|
|
4692
4929
|
const canSend = !disabled && Boolean(value.trim() || activeForm);
|
|
4693
|
-
(0,
|
|
4930
|
+
(0, import_react11.useEffect)(() => {
|
|
4694
4931
|
if (activeForm) firstFieldRef.current?.focus();
|
|
4695
4932
|
else if ((savedForm || draft.submitted) && !disabled)
|
|
4696
4933
|
inputRef.current?.focus();
|
|
4697
4934
|
}, [activeForm?.id, disabled, savedForm?.id, draft.submitted]);
|
|
4935
|
+
(0, import_react11.useEffect)(() => {
|
|
4936
|
+
const input = inputRef.current;
|
|
4937
|
+
if (!input) return;
|
|
4938
|
+
const check = () => {
|
|
4939
|
+
const style = window.getComputedStyle(input);
|
|
4940
|
+
const singleLine = (parseFloat(style.lineHeight) || 20) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + 2;
|
|
4941
|
+
setMultiline(input.offsetHeight > singleLine);
|
|
4942
|
+
};
|
|
4943
|
+
check();
|
|
4944
|
+
const observer = new ResizeObserver(check);
|
|
4945
|
+
observer.observe(input);
|
|
4946
|
+
return () => observer.disconnect();
|
|
4947
|
+
}, []);
|
|
4698
4948
|
function collapseForm() {
|
|
4699
4949
|
setDraft((current) => ({ ...current, expanded: false }));
|
|
4700
4950
|
}
|
|
@@ -4764,8 +5014,8 @@ function Composer({
|
|
|
4764
5014
|
submitForm();
|
|
4765
5015
|
}
|
|
4766
5016
|
}
|
|
4767
|
-
const chatField = /* @__PURE__ */ (0,
|
|
4768
|
-
/* @__PURE__ */ (0,
|
|
5017
|
+
const chatField = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4769
5019
|
"textarea",
|
|
4770
5020
|
{
|
|
4771
5021
|
ref: inputRef,
|
|
@@ -4780,18 +5030,18 @@ function Composer({
|
|
|
4780
5030
|
onKeyDown: handleChatKeyDown
|
|
4781
5031
|
}
|
|
4782
5032
|
),
|
|
4783
|
-
/* @__PURE__ */ (0,
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4784
5034
|
"button",
|
|
4785
5035
|
{
|
|
4786
5036
|
type: "submit",
|
|
4787
5037
|
className: "composer__send",
|
|
4788
5038
|
disabled: !canSend,
|
|
4789
5039
|
"aria-label": "Send message",
|
|
4790
|
-
children: /* @__PURE__ */ (0,
|
|
5040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SendIcon, {})
|
|
4791
5041
|
}
|
|
4792
5042
|
)
|
|
4793
5043
|
] });
|
|
4794
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4795
5045
|
"form",
|
|
4796
5046
|
{
|
|
4797
5047
|
ref: formRef,
|
|
@@ -4799,13 +5049,14 @@ function Composer({
|
|
|
4799
5049
|
className: [
|
|
4800
5050
|
"composer",
|
|
4801
5051
|
variant === "dock" ? "composer--dock" : "",
|
|
4802
|
-
activeForm ? "composer--form" : ""
|
|
5052
|
+
activeForm ? "composer--form" : "",
|
|
5053
|
+
multiline ? "composer--multiline" : ""
|
|
4803
5054
|
].filter(Boolean).join(" "),
|
|
4804
5055
|
onSubmit: handleSubmit,
|
|
4805
5056
|
children: [
|
|
4806
|
-
savedForm ? /* @__PURE__ */ (0,
|
|
4807
|
-
/* @__PURE__ */ (0,
|
|
4808
|
-
!activeForm ? /* @__PURE__ */ (0,
|
|
5057
|
+
savedForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__resume", children: [
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
|
|
5059
|
+
!activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4809
5060
|
"button",
|
|
4810
5061
|
{
|
|
4811
5062
|
type: "button",
|
|
@@ -4815,17 +5066,17 @@ function Composer({
|
|
|
4815
5066
|
}
|
|
4816
5067
|
) : null
|
|
4817
5068
|
] }) : null,
|
|
4818
|
-
activeForm ? /* @__PURE__ */ (0,
|
|
5069
|
+
activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4819
5070
|
"div",
|
|
4820
5071
|
{
|
|
4821
5072
|
className: "composer__sheet",
|
|
4822
5073
|
role: "group",
|
|
4823
5074
|
"aria-label": "Contact details",
|
|
4824
5075
|
children: [
|
|
4825
|
-
/* @__PURE__ */ (0,
|
|
4826
|
-
/* @__PURE__ */ (0,
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
5076
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__form-heading", children: [
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Share your details" }),
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Optional" }),
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4829
5080
|
"button",
|
|
4830
5081
|
{
|
|
4831
5082
|
type: "button",
|
|
@@ -4833,11 +5084,11 @@ function Composer({
|
|
|
4833
5084
|
"aria-label": "Collapse form",
|
|
4834
5085
|
disabled,
|
|
4835
5086
|
onClick: collapseForm,
|
|
4836
|
-
children: /* @__PURE__ */ (0,
|
|
5087
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapseIcon, {})
|
|
4837
5088
|
}
|
|
4838
5089
|
)
|
|
4839
5090
|
] }),
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
5091
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__fields", children: activeForm.fields.map((field, index) => {
|
|
4841
5092
|
const fieldId = `${formId}-${field.id}`;
|
|
4842
5093
|
const fieldValue = draft.values[field.id] ?? "";
|
|
4843
5094
|
const invalid = draft.attempted && !isValidComposerFieldValue(field, fieldValue);
|
|
@@ -4862,7 +5113,7 @@ function Composer({
|
|
|
4862
5113
|
},
|
|
4863
5114
|
onKeyDown: handleFormKeyDown
|
|
4864
5115
|
};
|
|
4865
|
-
return /* @__PURE__ */ (0,
|
|
5116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4866
5117
|
"div",
|
|
4867
5118
|
{
|
|
4868
5119
|
className: [
|
|
@@ -4870,9 +5121,9 @@ function Composer({
|
|
|
4870
5121
|
field.kind === "textarea" ? "composer__row--area" : ""
|
|
4871
5122
|
].filter(Boolean).join(" "),
|
|
4872
5123
|
children: [
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
4874
|
-
/* @__PURE__ */ (0,
|
|
4875
|
-
field.kind === "textarea" ? /* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__line", children: [
|
|
5125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "composer__label", htmlFor: fieldId, children: field.label }),
|
|
5126
|
+
field.kind === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4876
5127
|
"textarea",
|
|
4877
5128
|
{
|
|
4878
5129
|
...controlProps,
|
|
@@ -4882,7 +5133,7 @@ function Composer({
|
|
|
4882
5133
|
className: "composer__control composer__control--area",
|
|
4883
5134
|
rows: 2
|
|
4884
5135
|
}
|
|
4885
|
-
) : /* @__PURE__ */ (0,
|
|
5136
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4886
5137
|
"input",
|
|
4887
5138
|
{
|
|
4888
5139
|
...controlProps,
|
|
@@ -4894,25 +5145,25 @@ function Composer({
|
|
|
4894
5145
|
inputMode: field.kind === "tel" ? "tel" : void 0
|
|
4895
5146
|
}
|
|
4896
5147
|
),
|
|
4897
|
-
complete && field.kind !== "textarea" ? /* @__PURE__ */ (0,
|
|
5148
|
+
complete && field.kind !== "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "composer__check", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckIcon, {}) }) : null
|
|
4898
5149
|
] }),
|
|
4899
|
-
invalid ? /* @__PURE__ */ (0,
|
|
5150
|
+
invalid ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "composer__error", id: `${fieldId}-error`, children: field.kind === "email" ? "Enter a valid email to share your details." : `Add your ${field.label.toLowerCase()} to share your details.` }) : null
|
|
4900
5151
|
]
|
|
4901
5152
|
},
|
|
4902
5153
|
field.id
|
|
4903
5154
|
);
|
|
4904
5155
|
}) }),
|
|
4905
|
-
/* @__PURE__ */ (0,
|
|
5156
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__field composer__field--inset", children: chatField })
|
|
4906
5157
|
]
|
|
4907
5158
|
}
|
|
4908
|
-
) : /* @__PURE__ */ (0,
|
|
5159
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__field", children: chatField })
|
|
4909
5160
|
]
|
|
4910
5161
|
}
|
|
4911
5162
|
);
|
|
4912
5163
|
}
|
|
4913
5164
|
|
|
4914
5165
|
// src/react/components/FollowUpChips/FollowUpChips.tsx
|
|
4915
|
-
var
|
|
5166
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4916
5167
|
function FollowUpChips({
|
|
4917
5168
|
suggestions,
|
|
4918
5169
|
disabled = false,
|
|
@@ -4922,7 +5173,7 @@ function FollowUpChips({
|
|
|
4922
5173
|
}) {
|
|
4923
5174
|
if (suggestions.length === 0) return null;
|
|
4924
5175
|
if (variant === "dock") {
|
|
4925
|
-
return /* @__PURE__ */ (0,
|
|
5176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups followups--dock", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups__scroll", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4926
5177
|
"button",
|
|
4927
5178
|
{
|
|
4928
5179
|
type: "button",
|
|
@@ -4934,9 +5185,9 @@ function FollowUpChips({
|
|
|
4934
5185
|
suggestion.id
|
|
4935
5186
|
)) }) });
|
|
4936
5187
|
}
|
|
4937
|
-
return /* @__PURE__ */ (0,
|
|
4938
|
-
/* @__PURE__ */ (0,
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
5188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "followups", children: [
|
|
5189
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "followups__label", children: label }),
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups__list", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4940
5191
|
"button",
|
|
4941
5192
|
{
|
|
4942
5193
|
type: "button",
|
|
@@ -4951,99 +5202,11 @@ function FollowUpChips({
|
|
|
4951
5202
|
}
|
|
4952
5203
|
|
|
4953
5204
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4954
|
-
var
|
|
4955
|
-
|
|
4956
|
-
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4957
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4958
|
-
function SiteIcon() {
|
|
4959
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4960
|
-
"svg",
|
|
4961
|
-
{
|
|
4962
|
-
viewBox: "0 0 24 24",
|
|
4963
|
-
width: "18",
|
|
4964
|
-
height: "18",
|
|
4965
|
-
fill: "none",
|
|
4966
|
-
stroke: "currentColor",
|
|
4967
|
-
strokeWidth: "1.5",
|
|
4968
|
-
"aria-hidden": "true",
|
|
4969
|
-
children: [
|
|
4970
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4971
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4972
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4973
|
-
]
|
|
4974
|
-
}
|
|
4975
|
-
);
|
|
4976
|
-
}
|
|
4977
|
-
function SearchReferences({
|
|
4978
|
-
results
|
|
4979
|
-
}) {
|
|
4980
|
-
const seenSources = /* @__PURE__ */ new Set();
|
|
4981
|
-
const sources = results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4982
|
-
const url = safeSearchUrl(source.url);
|
|
4983
|
-
const key = url ?? source.id;
|
|
4984
|
-
if (seenSources.has(key)) return [];
|
|
4985
|
-
seenSources.add(key);
|
|
4986
|
-
return [{ ...source, url, key }];
|
|
4987
|
-
});
|
|
4988
|
-
const seenActions = /* @__PURE__ */ new Set();
|
|
4989
|
-
const actions = results.flatMap((result) => {
|
|
4990
|
-
const url = safeSearchUrl(result.cta?.url);
|
|
4991
|
-
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4992
|
-
seenActions.add(url);
|
|
4993
|
-
return [{ label: result.cta.label, url }];
|
|
4994
|
-
});
|
|
4995
|
-
if (!sources.length && !actions.length) return null;
|
|
4996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
|
|
4997
|
-
sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "search-references__disclosure", "aria-label": "Sources", children: [
|
|
4998
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { className: "search-references__heading", children: [
|
|
4999
|
-
"Sources (",
|
|
5000
|
-
sources.length,
|
|
5001
|
-
")"
|
|
5002
|
-
] }),
|
|
5003
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
5004
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
5005
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
|
|
5006
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
|
|
5007
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5008
|
-
"span",
|
|
5009
|
-
{
|
|
5010
|
-
className: "search-references__title",
|
|
5011
|
-
title: source.title,
|
|
5012
|
-
children: source.title
|
|
5013
|
-
}
|
|
5014
|
-
),
|
|
5015
|
-
source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
|
|
5016
|
-
] })
|
|
5017
|
-
] });
|
|
5018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5019
|
-
"a",
|
|
5020
|
-
{
|
|
5021
|
-
className: "search-references__source",
|
|
5022
|
-
href: source.url,
|
|
5023
|
-
target: "_blank",
|
|
5024
|
-
rel: "noopener noreferrer",
|
|
5025
|
-
children: content
|
|
5026
|
-
}
|
|
5027
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
|
|
5028
|
-
}) })
|
|
5029
|
-
] }) : null,
|
|
5030
|
-
actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5031
|
-
"a",
|
|
5032
|
-
{
|
|
5033
|
-
className: "search-references__cta",
|
|
5034
|
-
href: action.url,
|
|
5035
|
-
target: "_blank",
|
|
5036
|
-
rel: "noopener noreferrer",
|
|
5037
|
-
children: action.label
|
|
5038
|
-
},
|
|
5039
|
-
action.url
|
|
5040
|
-
)) }) : null
|
|
5041
|
-
] });
|
|
5042
|
-
}
|
|
5205
|
+
var import_react13 = require("react");
|
|
5043
5206
|
|
|
5044
5207
|
// src/react/components/BookingCard/BookingCard.tsx
|
|
5045
|
-
var
|
|
5046
|
-
var
|
|
5208
|
+
var import_react12 = require("react");
|
|
5209
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5047
5210
|
var BOOKING_STEPS = [
|
|
5048
5211
|
{ id: "date", label: "Date" },
|
|
5049
5212
|
{ id: "time", label: "Time" },
|
|
@@ -5074,22 +5237,22 @@ function calendarCells(year, month) {
|
|
|
5074
5237
|
return cells;
|
|
5075
5238
|
}
|
|
5076
5239
|
function BookingCardLoader() {
|
|
5077
|
-
return /* @__PURE__ */ (0,
|
|
5240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
|
|
5078
5241
|
}
|
|
5079
5242
|
function BookingCard(props) {
|
|
5080
|
-
if (!props.readOnly) return /* @__PURE__ */ (0,
|
|
5081
|
-
return /* @__PURE__ */ (0,
|
|
5082
|
-
/* @__PURE__ */ (0,
|
|
5083
|
-
props.offer.slots.length ? /* @__PURE__ */ (0,
|
|
5243
|
+
if (!props.readOnly) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InteractiveBookingCard, { ...props });
|
|
5244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "booking-card", "aria-label": "Recorded available times", children: [
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: "Available times offered" }),
|
|
5246
|
+
props.offer.slots.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: props.offer.slots.map((slot, index) => {
|
|
5084
5247
|
const eventType = props.offer.eventTypes.find(
|
|
5085
5248
|
(item) => item.uri === slot.eventTypeUri
|
|
5086
5249
|
);
|
|
5087
5250
|
const label = Number.isFinite(Date.parse(slot.startTime)) ? formatSlotLabel(slot.startTime) : "Time unavailable";
|
|
5088
|
-
return /* @__PURE__ */ (0,
|
|
5251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
|
|
5089
5252
|
eventType ? `${eventType.name} \xB7 ` : "",
|
|
5090
5253
|
label
|
|
5091
5254
|
] }, `${slot.eventTypeUri ?? ""}:${slot.startTime}:${index}`);
|
|
5092
|
-
}) }) : /* @__PURE__ */ (0,
|
|
5255
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "No available times were recorded." })
|
|
5093
5256
|
] });
|
|
5094
5257
|
}
|
|
5095
5258
|
function InteractiveBookingCard({
|
|
@@ -5097,27 +5260,27 @@ function InteractiveBookingCard({
|
|
|
5097
5260
|
offer,
|
|
5098
5261
|
onBook
|
|
5099
5262
|
}) {
|
|
5100
|
-
const fieldId = (0,
|
|
5263
|
+
const fieldId = (0, import_react12.useId)();
|
|
5101
5264
|
const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
|
|
5102
|
-
const [step, setStep] = (0,
|
|
5103
|
-
const [eventTypeUri, setEventTypeUri] = (0,
|
|
5104
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
5105
|
-
const [startTime, setStartTime] = (0,
|
|
5106
|
-
const [name, setName] = (0,
|
|
5107
|
-
const [email, setEmail] = (0,
|
|
5108
|
-
const activeStepRef = (0,
|
|
5109
|
-
const previousStepRef = (0,
|
|
5265
|
+
const [step, setStep] = (0, import_react12.useState)("date");
|
|
5266
|
+
const [eventTypeUri, setEventTypeUri] = (0, import_react12.useState)(defaultType);
|
|
5267
|
+
const [selectedDate, setSelectedDate] = (0, import_react12.useState)("");
|
|
5268
|
+
const [startTime, setStartTime] = (0, import_react12.useState)("");
|
|
5269
|
+
const [name, setName] = (0, import_react12.useState)("");
|
|
5270
|
+
const [email, setEmail] = (0, import_react12.useState)("");
|
|
5271
|
+
const activeStepRef = (0, import_react12.useRef)(null);
|
|
5272
|
+
const previousStepRef = (0, import_react12.useRef)(step);
|
|
5110
5273
|
const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
|
|
5111
|
-
(0,
|
|
5274
|
+
(0, import_react12.useEffect)(() => {
|
|
5112
5275
|
if (previousStepRef.current === step) return;
|
|
5113
5276
|
previousStepRef.current = step;
|
|
5114
5277
|
activeStepRef.current?.scrollIntoView({ block: "nearest" });
|
|
5115
5278
|
}, [step]);
|
|
5116
|
-
const slots = (0,
|
|
5279
|
+
const slots = (0, import_react12.useMemo)(
|
|
5117
5280
|
() => bookingSlotsForEventType(offer.slots, eventTypeUri),
|
|
5118
5281
|
[eventTypeUri, offer.slots]
|
|
5119
5282
|
);
|
|
5120
|
-
const availableByDate = (0,
|
|
5283
|
+
const availableByDate = (0, import_react12.useMemo)(() => {
|
|
5121
5284
|
const next = /* @__PURE__ */ new Map();
|
|
5122
5285
|
for (const slot of slots) {
|
|
5123
5286
|
const key = slotDateKey(slot.startTime);
|
|
@@ -5125,7 +5288,7 @@ function InteractiveBookingCard({
|
|
|
5125
5288
|
}
|
|
5126
5289
|
return next;
|
|
5127
5290
|
}, [slots]);
|
|
5128
|
-
const [visibleMonth, setVisibleMonth] = (0,
|
|
5291
|
+
const [visibleMonth, setVisibleMonth] = (0, import_react12.useState)(
|
|
5129
5292
|
() => firstAvailableBookingMonth(slots)
|
|
5130
5293
|
);
|
|
5131
5294
|
function selectEventType(nextType) {
|
|
@@ -5138,7 +5301,7 @@ function InteractiveBookingCard({
|
|
|
5138
5301
|
)
|
|
5139
5302
|
);
|
|
5140
5303
|
}
|
|
5141
|
-
const daySlots = (0,
|
|
5304
|
+
const daySlots = (0, import_react12.useMemo)(
|
|
5142
5305
|
() => slots.filter((slot) => slotDateKey(slot.startTime) === selectedDate),
|
|
5143
5306
|
[selectedDate, slots]
|
|
5144
5307
|
);
|
|
@@ -5147,7 +5310,7 @@ function InteractiveBookingCard({
|
|
|
5147
5310
|
);
|
|
5148
5311
|
const selectedSample = availableByDate.get(selectedDate) ?? startTime;
|
|
5149
5312
|
const timeZone = formatSlotTimeZone(slots[0]?.startTime ?? selectedSample);
|
|
5150
|
-
const weekdays = (0,
|
|
5313
|
+
const weekdays = (0, import_react12.useMemo)(() => weekdayLabels(), []);
|
|
5151
5314
|
const cells = calendarCells(visibleMonth.year, visibleMonth.month);
|
|
5152
5315
|
const canPrevMonth = [...availableByDate.keys()].some((key) => {
|
|
5153
5316
|
const month = monthFromKey(key);
|
|
@@ -5189,14 +5352,14 @@ function InteractiveBookingCard({
|
|
|
5189
5352
|
})
|
|
5190
5353
|
});
|
|
5191
5354
|
}
|
|
5192
|
-
return /* @__PURE__ */ (0,
|
|
5355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5193
5356
|
"section",
|
|
5194
5357
|
{
|
|
5195
5358
|
className: "booking-card",
|
|
5196
5359
|
"aria-busy": disabled || void 0,
|
|
5197
5360
|
"aria-label": "Book a meeting",
|
|
5198
|
-
children: /* @__PURE__ */ (0,
|
|
5199
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5200
5363
|
"li",
|
|
5201
5364
|
{
|
|
5202
5365
|
className: [
|
|
@@ -5206,40 +5369,40 @@ function InteractiveBookingCard({
|
|
|
5206
5369
|
].filter(Boolean).join(" "),
|
|
5207
5370
|
"aria-current": index === stepIndex ? "step" : void 0,
|
|
5208
5371
|
children: [
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5210
|
-
/* @__PURE__ */ (0,
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: item.label })
|
|
5211
5374
|
]
|
|
5212
5375
|
},
|
|
5213
5376
|
item.id
|
|
5214
5377
|
)) }),
|
|
5215
|
-
step === "date" ? /* @__PURE__ */ (0,
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5217
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
5378
|
+
step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
5379
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
|
|
5380
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "booking-card__tz", children: [
|
|
5218
5381
|
"Times in ",
|
|
5219
5382
|
timeZone
|
|
5220
5383
|
] }) : null,
|
|
5221
|
-
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0,
|
|
5384
|
+
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5222
5385
|
"label",
|
|
5223
5386
|
{
|
|
5224
5387
|
className: "booking-card__field",
|
|
5225
5388
|
htmlFor: `${fieldId}-type`,
|
|
5226
5389
|
children: [
|
|
5227
|
-
/* @__PURE__ */ (0,
|
|
5228
|
-
/* @__PURE__ */ (0,
|
|
5390
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Meeting" }),
|
|
5391
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5229
5392
|
"select",
|
|
5230
5393
|
{
|
|
5231
5394
|
id: `${fieldId}-type`,
|
|
5232
5395
|
value: eventTypeUri,
|
|
5233
5396
|
disabled,
|
|
5234
5397
|
onChange: (event) => selectEventType(event.target.value),
|
|
5235
|
-
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0,
|
|
5398
|
+
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: item.uri, children: item.name }, item.uri))
|
|
5236
5399
|
}
|
|
5237
5400
|
)
|
|
5238
5401
|
]
|
|
5239
5402
|
}
|
|
5240
5403
|
) : null,
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5404
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__month", children: [
|
|
5405
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5243
5406
|
"button",
|
|
5244
5407
|
{
|
|
5245
5408
|
type: "button",
|
|
@@ -5250,8 +5413,8 @@ function InteractiveBookingCard({
|
|
|
5250
5413
|
children: "\u2039"
|
|
5251
5414
|
}
|
|
5252
5415
|
),
|
|
5253
|
-
/* @__PURE__ */ (0,
|
|
5254
|
-
/* @__PURE__ */ (0,
|
|
5416
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
|
|
5417
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5255
5418
|
"button",
|
|
5256
5419
|
{
|
|
5257
5420
|
type: "button",
|
|
@@ -5263,9 +5426,9 @@ function InteractiveBookingCard({
|
|
|
5263
5426
|
}
|
|
5264
5427
|
)
|
|
5265
5428
|
] }),
|
|
5266
|
-
/* @__PURE__ */ (0,
|
|
5267
|
-
offer.slots.length === 0 ? /* @__PURE__ */ (0,
|
|
5268
|
-
/* @__PURE__ */ (0,
|
|
5429
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }, label)) }),
|
|
5430
|
+
offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5269
5432
|
"div",
|
|
5270
5433
|
{
|
|
5271
5434
|
className: "booking-card__calendar",
|
|
@@ -5273,7 +5436,7 @@ function InteractiveBookingCard({
|
|
|
5273
5436
|
"aria-label": "Available dates",
|
|
5274
5437
|
children: cells.map((cell, index) => {
|
|
5275
5438
|
if (!cell) {
|
|
5276
|
-
return /* @__PURE__ */ (0,
|
|
5439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5277
5440
|
"span",
|
|
5278
5441
|
{
|
|
5279
5442
|
className: "booking-card__day"
|
|
@@ -5283,7 +5446,7 @@ function InteractiveBookingCard({
|
|
|
5283
5446
|
}
|
|
5284
5447
|
const available = availableByDate.has(cell.key);
|
|
5285
5448
|
const selected = cell.key === selectedDate;
|
|
5286
|
-
return /* @__PURE__ */ (0,
|
|
5449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5287
5450
|
"button",
|
|
5288
5451
|
{
|
|
5289
5452
|
type: "button",
|
|
@@ -5303,9 +5466,9 @@ function InteractiveBookingCard({
|
|
|
5303
5466
|
}
|
|
5304
5467
|
)
|
|
5305
5468
|
] }, "date") : null,
|
|
5306
|
-
step === "time" ? /* @__PURE__ */ (0,
|
|
5307
|
-
/* @__PURE__ */ (0,
|
|
5308
|
-
/* @__PURE__ */ (0,
|
|
5469
|
+
step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
5470
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5309
5472
|
"button",
|
|
5310
5473
|
{
|
|
5311
5474
|
type: "button",
|
|
@@ -5316,15 +5479,15 @@ function InteractiveBookingCard({
|
|
|
5316
5479
|
children: "\u2039"
|
|
5317
5480
|
}
|
|
5318
5481
|
),
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
5482
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
|
|
5484
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "booking-card__tz", children: [
|
|
5322
5485
|
"Times in ",
|
|
5323
5486
|
timeZone
|
|
5324
5487
|
] }) : null
|
|
5325
5488
|
] })
|
|
5326
5489
|
] }),
|
|
5327
|
-
/* @__PURE__ */ (0,
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5328
5491
|
"button",
|
|
5329
5492
|
{
|
|
5330
5493
|
type: "button",
|
|
@@ -5336,9 +5499,9 @@ function InteractiveBookingCard({
|
|
|
5336
5499
|
slot.startTime
|
|
5337
5500
|
)) })
|
|
5338
5501
|
] }, "time") : null,
|
|
5339
|
-
step === "details" ? /* @__PURE__ */ (0,
|
|
5340
|
-
/* @__PURE__ */ (0,
|
|
5341
|
-
/* @__PURE__ */ (0,
|
|
5502
|
+
step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5342
5505
|
"button",
|
|
5343
5506
|
{
|
|
5344
5507
|
type: "button",
|
|
@@ -5349,21 +5512,21 @@ function InteractiveBookingCard({
|
|
|
5349
5512
|
children: "\u2039"
|
|
5350
5513
|
}
|
|
5351
5514
|
),
|
|
5352
|
-
/* @__PURE__ */ (0,
|
|
5353
|
-
/* @__PURE__ */ (0,
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
selectedType?.location ? /* @__PURE__ */ (0,
|
|
5515
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
|
|
5517
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
|
|
5518
|
+
selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
|
|
5356
5519
|
] })
|
|
5357
5520
|
] }),
|
|
5358
|
-
/* @__PURE__ */ (0,
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5521
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__identity", children: [
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5360
5523
|
"label",
|
|
5361
5524
|
{
|
|
5362
5525
|
className: "booking-card__field",
|
|
5363
5526
|
htmlFor: `${fieldId}-name`,
|
|
5364
5527
|
children: [
|
|
5365
|
-
/* @__PURE__ */ (0,
|
|
5366
|
-
/* @__PURE__ */ (0,
|
|
5528
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Name" }),
|
|
5529
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5367
5530
|
"input",
|
|
5368
5531
|
{
|
|
5369
5532
|
id: `${fieldId}-name`,
|
|
@@ -5377,14 +5540,14 @@ function InteractiveBookingCard({
|
|
|
5377
5540
|
]
|
|
5378
5541
|
}
|
|
5379
5542
|
),
|
|
5380
|
-
/* @__PURE__ */ (0,
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5381
5544
|
"label",
|
|
5382
5545
|
{
|
|
5383
5546
|
className: "booking-card__field",
|
|
5384
5547
|
htmlFor: `${fieldId}-email`,
|
|
5385
5548
|
children: [
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Email" }),
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5388
5551
|
"input",
|
|
5389
5552
|
{
|
|
5390
5553
|
id: `${fieldId}-email`,
|
|
@@ -5400,7 +5563,7 @@ function InteractiveBookingCard({
|
|
|
5400
5563
|
}
|
|
5401
5564
|
)
|
|
5402
5565
|
] }),
|
|
5403
|
-
/* @__PURE__ */ (0,
|
|
5566
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5404
5567
|
"button",
|
|
5405
5568
|
{
|
|
5406
5569
|
type: "submit",
|
|
@@ -5418,6 +5581,37 @@ function InteractiveBookingCard({
|
|
|
5418
5581
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
5419
5582
|
var import_streamdown = require("streamdown");
|
|
5420
5583
|
|
|
5584
|
+
// src/react/lib/brand-logo-display.ts
|
|
5585
|
+
var BRAND_LOGO_LAYOUT = {
|
|
5586
|
+
header: { maxHeight: 20, maxWidth: 96, square: 24 },
|
|
5587
|
+
message: { maxHeight: 18, maxWidth: 80, square: 22 },
|
|
5588
|
+
/** Bottom/mobile launcher pill orb — keep in sync with AssistEdgeTab chip CSS. */
|
|
5589
|
+
launcher: { maxHeight: 24, maxWidth: 104, square: 38 }
|
|
5590
|
+
};
|
|
5591
|
+
function isWideBrandLogo(naturalWidth, naturalHeight) {
|
|
5592
|
+
return naturalWidth > naturalHeight * 1.4;
|
|
5593
|
+
}
|
|
5594
|
+
function snapBrandLogoDisplaySize(input) {
|
|
5595
|
+
const { maxHeight, maxWidth } = BRAND_LOGO_LAYOUT[input.surface];
|
|
5596
|
+
const { naturalWidth, naturalHeight } = input;
|
|
5597
|
+
if (naturalWidth <= 0 || naturalHeight <= 0) {
|
|
5598
|
+
return { width: maxWidth, height: maxHeight, wide: false };
|
|
5599
|
+
}
|
|
5600
|
+
const wide = isWideBrandLogo(naturalWidth, naturalHeight);
|
|
5601
|
+
if (!wide) {
|
|
5602
|
+
const size = BRAND_LOGO_LAYOUT[input.surface].square;
|
|
5603
|
+
return { width: size, height: size, wide: false };
|
|
5604
|
+
}
|
|
5605
|
+
const scale = Math.min(
|
|
5606
|
+
maxHeight / naturalHeight,
|
|
5607
|
+
maxWidth / naturalWidth,
|
|
5608
|
+
1
|
|
5609
|
+
);
|
|
5610
|
+
const height = Math.max(1, Math.round(naturalHeight * scale));
|
|
5611
|
+
const width = Math.max(1, Math.round(naturalWidth * scale));
|
|
5612
|
+
return { width, height, wide: true };
|
|
5613
|
+
}
|
|
5614
|
+
|
|
5421
5615
|
// src/react/lib/resolve-message-url.ts
|
|
5422
5616
|
function resolveMessageUrl(safeUrl, baseUrl) {
|
|
5423
5617
|
if (!safeUrl || !baseUrl) return safeUrl;
|
|
@@ -5432,7 +5626,7 @@ function resolveMessageUrl(safeUrl, baseUrl) {
|
|
|
5432
5626
|
|
|
5433
5627
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
5434
5628
|
var import_styles = require("streamdown/styles.css");
|
|
5435
|
-
var
|
|
5629
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5436
5630
|
function normalizeDedupeText(text3) {
|
|
5437
5631
|
return text3.trim().replace(/\s+/g, " ").toLowerCase();
|
|
5438
5632
|
}
|
|
@@ -5473,13 +5667,21 @@ function MessageBubble({
|
|
|
5473
5667
|
brandLogoUrl,
|
|
5474
5668
|
bookingDisabled = false,
|
|
5475
5669
|
showProvenance = false,
|
|
5670
|
+
showSearchReferences = true,
|
|
5476
5671
|
bookingReadOnly = false,
|
|
5477
5672
|
linkBaseUrl,
|
|
5478
5673
|
offer,
|
|
5479
5674
|
onBook
|
|
5480
5675
|
}) {
|
|
5481
5676
|
const resolvedLogoUrl = brandLogoUrl?.trim();
|
|
5482
|
-
const [failedLogoUrl, setFailedLogoUrl] = (0,
|
|
5677
|
+
const [failedLogoUrl, setFailedLogoUrl] = (0, import_react13.useState)(null);
|
|
5678
|
+
const [logoDisplay, setLogoDisplay] = (0, import_react13.useState)(null);
|
|
5679
|
+
(0, import_react13.useEffect)(() => {
|
|
5680
|
+
setFailedLogoUrl(null);
|
|
5681
|
+
}, [resolvedLogoUrl]);
|
|
5682
|
+
const activeLogoDisplay = logoDisplay?.url === resolvedLogoUrl ? logoDisplay : null;
|
|
5683
|
+
const wideLogo = activeLogoDisplay?.wide ?? false;
|
|
5684
|
+
const logoDisplaySize = activeLogoDisplay ? { height: activeLogoDisplay.height, width: activeLogoDisplay.width } : null;
|
|
5483
5685
|
const showBrandLogo = Boolean(resolvedLogoUrl) && failedLogoUrl !== resolvedLogoUrl;
|
|
5484
5686
|
const cards = message.role === "agent" ? extractToolCards(message.text) : [];
|
|
5485
5687
|
const extractedOffers = cards.filter(
|
|
@@ -5494,38 +5696,38 @@ function MessageBubble({
|
|
|
5494
5696
|
if (message.role === "visitor") {
|
|
5495
5697
|
const visitorText = visitorMessageDisplayText(message).trim();
|
|
5496
5698
|
if (!visitorText) return null;
|
|
5497
|
-
return /* @__PURE__ */ (0,
|
|
5699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5498
5700
|
"article",
|
|
5499
5701
|
{
|
|
5500
5702
|
className: "message-bubble message-bubble--visitor",
|
|
5501
5703
|
"aria-label": "Message from visitor",
|
|
5502
5704
|
children: [
|
|
5503
|
-
showProvenance ? /* @__PURE__ */ (0,
|
|
5504
|
-
/* @__PURE__ */ (0,
|
|
5705
|
+
showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "message-bubble__speaker", children: "You" }) : null,
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "message-bubble__text", children: visitorText })
|
|
5505
5707
|
]
|
|
5506
5708
|
}
|
|
5507
5709
|
);
|
|
5508
5710
|
}
|
|
5509
5711
|
if (message.role === "human") {
|
|
5510
|
-
return /* @__PURE__ */ (0,
|
|
5712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5511
5713
|
"article",
|
|
5512
5714
|
{
|
|
5513
5715
|
className: "message-bubble message-bubble--human",
|
|
5514
5716
|
"aria-label": `Message from ${message.representative.name}`,
|
|
5515
5717
|
children: [
|
|
5516
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("strong", { className: "message-bubble__representative", children: [
|
|
5517
5719
|
message.representative.name,
|
|
5518
5720
|
" ",
|
|
5519
|
-
/* @__PURE__ */ (0,
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Human representative" })
|
|
5520
5722
|
] }),
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5723
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "message-bubble__text", children: message.text })
|
|
5522
5724
|
]
|
|
5523
5725
|
}
|
|
5524
5726
|
);
|
|
5525
5727
|
}
|
|
5526
5728
|
const citations = message.citations ?? [];
|
|
5527
|
-
const agentText = /* @__PURE__ */ (0,
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5729
|
+
const agentText = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__text", children: [
|
|
5730
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5529
5731
|
import_streamdown.Streamdown,
|
|
5530
5732
|
{
|
|
5531
5733
|
animated: false,
|
|
@@ -5543,9 +5745,9 @@ function MessageBubble({
|
|
|
5543
5745
|
children: displayText
|
|
5544
5746
|
}
|
|
5545
5747
|
),
|
|
5546
|
-
!isStreaming ? /* @__PURE__ */ (0,
|
|
5547
|
-
!isStreaming && citations.length > 0 ? /* @__PURE__ */ (0,
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
!isStreaming && showSearchReferences ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SearchReferences, { results: message.searchResults ?? [] }) : null,
|
|
5749
|
+
!isStreaming && citations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5549
5751
|
"span",
|
|
5550
5752
|
{
|
|
5551
5753
|
className: "message-bubble__source-icon",
|
|
@@ -5553,32 +5755,63 @@ function MessageBubble({
|
|
|
5553
5755
|
children: "\u25A6"
|
|
5554
5756
|
}
|
|
5555
5757
|
),
|
|
5556
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: citation.label })
|
|
5557
5759
|
] }) }, citation.id)) }) : null
|
|
5558
5760
|
] });
|
|
5559
5761
|
if (!displayText && !message.searchResults?.length && offers.length === 0)
|
|
5560
5762
|
return null;
|
|
5561
|
-
return /* @__PURE__ */ (0,
|
|
5763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5562
5764
|
"article",
|
|
5563
5765
|
{
|
|
5564
5766
|
className: "message-bubble message-bubble--agent",
|
|
5565
5767
|
"aria-label": "Message from AI assistant",
|
|
5566
5768
|
children: [
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5769
|
+
displayText || message.searchResults?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__agent-stack", children: [
|
|
5770
|
+
showProvenance || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__agent-header", children: [
|
|
5771
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5772
|
+
"span",
|
|
5773
|
+
{
|
|
5774
|
+
className: `message-bubble__agent-avatar${wideLogo ? " message-bubble__agent-avatar--wide" : ""}`,
|
|
5775
|
+
"aria-hidden": "true",
|
|
5776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5777
|
+
"img",
|
|
5778
|
+
{
|
|
5779
|
+
className: "as-brand-logo-img",
|
|
5780
|
+
src: resolvedLogoUrl,
|
|
5781
|
+
alt: "",
|
|
5782
|
+
decoding: "async",
|
|
5783
|
+
...logoDisplaySize ? {
|
|
5784
|
+
height: logoDisplaySize.height,
|
|
5785
|
+
width: logoDisplaySize.width
|
|
5786
|
+
} : {},
|
|
5787
|
+
onLoad: (event) => {
|
|
5788
|
+
const img = event.currentTarget;
|
|
5789
|
+
const display = snapBrandLogoDisplaySize({
|
|
5790
|
+
naturalHeight: img.naturalHeight,
|
|
5791
|
+
naturalWidth: img.naturalWidth,
|
|
5792
|
+
surface: "message"
|
|
5793
|
+
});
|
|
5794
|
+
if (!resolvedLogoUrl) return;
|
|
5795
|
+
setLogoDisplay({
|
|
5796
|
+
height: display.height,
|
|
5797
|
+
url: resolvedLogoUrl,
|
|
5798
|
+
wide: display.wide,
|
|
5799
|
+
width: display.width
|
|
5800
|
+
});
|
|
5801
|
+
},
|
|
5802
|
+
onError: () => {
|
|
5803
|
+
setFailedLogoUrl(resolvedLogoUrl ?? null);
|
|
5804
|
+
}
|
|
5805
|
+
},
|
|
5806
|
+
resolvedLogoUrl
|
|
5807
|
+
)
|
|
5576
5808
|
}
|
|
5577
|
-
|
|
5578
|
-
|
|
5809
|
+
) : null,
|
|
5810
|
+
showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "message-bubble__speaker", children: "AI assistant" }) : null
|
|
5811
|
+
] }) : null,
|
|
5579
5812
|
agentText
|
|
5580
|
-
] }) :
|
|
5581
|
-
offers.map((nextOffer, index) => /* @__PURE__ */ (0,
|
|
5813
|
+
] }) : null,
|
|
5814
|
+
offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5582
5815
|
BookingCard,
|
|
5583
5816
|
{
|
|
5584
5817
|
disabled: bookingDisabled,
|
|
@@ -5594,7 +5827,7 @@ function MessageBubble({
|
|
|
5594
5827
|
}
|
|
5595
5828
|
|
|
5596
5829
|
// src/react/components/MessageActions/MessageActions.tsx
|
|
5597
|
-
var
|
|
5830
|
+
var import_react14 = require("react");
|
|
5598
5831
|
var import_react_dom2 = require("react-dom");
|
|
5599
5832
|
|
|
5600
5833
|
// src/react/lib/speech.ts
|
|
@@ -5742,10 +5975,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
|
|
|
5742
5975
|
}
|
|
5743
5976
|
|
|
5744
5977
|
// src/react/components/MessageActions/MessageActions.tsx
|
|
5745
|
-
var
|
|
5978
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5746
5979
|
function CopyIcon() {
|
|
5747
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5749
5982
|
"rect",
|
|
5750
5983
|
{
|
|
5751
5984
|
x: "5.75",
|
|
@@ -5757,7 +5990,7 @@ function CopyIcon() {
|
|
|
5757
5990
|
strokeWidth: "1.5"
|
|
5758
5991
|
}
|
|
5759
5992
|
),
|
|
5760
|
-
/* @__PURE__ */ (0,
|
|
5993
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5761
5994
|
"path",
|
|
5762
5995
|
{
|
|
5763
5996
|
d: "M10.25 5.25V4.5a1.75 1.75 0 0 0-1.75-1.75h-4A1.75 1.75 0 0 0 2.75 4.5v4c0 .97.78 1.75 1.75 1.75h.75",
|
|
@@ -5768,7 +6001,7 @@ function CopyIcon() {
|
|
|
5768
6001
|
] });
|
|
5769
6002
|
}
|
|
5770
6003
|
function CheckIcon2() {
|
|
5771
|
-
return /* @__PURE__ */ (0,
|
|
6004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5772
6005
|
"path",
|
|
5773
6006
|
{
|
|
5774
6007
|
d: "M3.5 8.5l3 3 6-7",
|
|
@@ -5780,8 +6013,8 @@ function CheckIcon2() {
|
|
|
5780
6013
|
) });
|
|
5781
6014
|
}
|
|
5782
6015
|
function ThumbUpIcon() {
|
|
5783
|
-
return /* @__PURE__ */ (0,
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
6016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5785
6018
|
"path",
|
|
5786
6019
|
{
|
|
5787
6020
|
d: "M4.67 6.67v8",
|
|
@@ -5790,7 +6023,7 @@ function ThumbUpIcon() {
|
|
|
5790
6023
|
strokeLinecap: "round"
|
|
5791
6024
|
}
|
|
5792
6025
|
),
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
6026
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5794
6027
|
"path",
|
|
5795
6028
|
{
|
|
5796
6029
|
d: "M10 3.92 9.33 6.67h3.89a1.33 1.33 0 0 1 1.28 1.7l-1.55 5.33a1.33 1.33 0 0 1-1.28.97H2.67a1.33 1.33 0 0 1-1.34-1.34V8a1.33 1.33 0 0 1 1.34-1.33h1.84a1.33 1.33 0 0 0 1.19-.74L8 1.33a2.09 2.09 0 0 1 2 2.59Z",
|
|
@@ -5803,8 +6036,8 @@ function ThumbUpIcon() {
|
|
|
5803
6036
|
] });
|
|
5804
6037
|
}
|
|
5805
6038
|
function ThumbDownIcon() {
|
|
5806
|
-
return /* @__PURE__ */ (0,
|
|
5807
|
-
/* @__PURE__ */ (0,
|
|
6039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { transform: "rotate(180 8 8)", children: [
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5808
6041
|
"path",
|
|
5809
6042
|
{
|
|
5810
6043
|
d: "M4.67 6.67v8",
|
|
@@ -5813,7 +6046,7 @@ function ThumbDownIcon() {
|
|
|
5813
6046
|
strokeLinecap: "round"
|
|
5814
6047
|
}
|
|
5815
6048
|
),
|
|
5816
|
-
/* @__PURE__ */ (0,
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5817
6050
|
"path",
|
|
5818
6051
|
{
|
|
5819
6052
|
d: "M10 3.92 9.33 6.67h3.89a1.33 1.33 0 0 1 1.28 1.7l-1.55 5.33a1.33 1.33 0 0 1-1.28.97H2.67a1.33 1.33 0 0 1-1.34-1.34V8a1.33 1.33 0 0 1 1.34-1.33h1.84a1.33 1.33 0 0 0 1.19-.74L8 1.33a2.09 2.09 0 0 1 2 2.59Z",
|
|
@@ -5826,8 +6059,8 @@ function ThumbDownIcon() {
|
|
|
5826
6059
|
] }) });
|
|
5827
6060
|
}
|
|
5828
6061
|
function RegenerateIcon() {
|
|
5829
|
-
return /* @__PURE__ */ (0,
|
|
5830
|
-
/* @__PURE__ */ (0,
|
|
6062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5831
6064
|
"path",
|
|
5832
6065
|
{
|
|
5833
6066
|
d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
|
|
@@ -5836,7 +6069,7 @@ function RegenerateIcon() {
|
|
|
5836
6069
|
strokeLinecap: "round"
|
|
5837
6070
|
}
|
|
5838
6071
|
),
|
|
5839
|
-
/* @__PURE__ */ (0,
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5840
6073
|
"path",
|
|
5841
6074
|
{
|
|
5842
6075
|
d: "M14 2v3.33h-3.33",
|
|
@@ -5846,7 +6079,7 @@ function RegenerateIcon() {
|
|
|
5846
6079
|
strokeLinejoin: "round"
|
|
5847
6080
|
}
|
|
5848
6081
|
),
|
|
5849
|
-
/* @__PURE__ */ (0,
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5850
6083
|
"path",
|
|
5851
6084
|
{
|
|
5852
6085
|
d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
|
|
@@ -5855,7 +6088,7 @@ function RegenerateIcon() {
|
|
|
5855
6088
|
strokeLinecap: "round"
|
|
5856
6089
|
}
|
|
5857
6090
|
),
|
|
5858
|
-
/* @__PURE__ */ (0,
|
|
6091
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5859
6092
|
"path",
|
|
5860
6093
|
{
|
|
5861
6094
|
d: "M5.33 10.67H2V14",
|
|
@@ -5868,15 +6101,15 @@ function RegenerateIcon() {
|
|
|
5868
6101
|
] });
|
|
5869
6102
|
}
|
|
5870
6103
|
function MoreIcon() {
|
|
5871
|
-
return /* @__PURE__ */ (0,
|
|
5872
|
-
/* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
6104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
6105
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
6106
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
|
|
5875
6108
|
] });
|
|
5876
6109
|
}
|
|
5877
6110
|
function SourcesIcon() {
|
|
5878
|
-
return /* @__PURE__ */ (0,
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
6111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
6112
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5880
6113
|
"path",
|
|
5881
6114
|
{
|
|
5882
6115
|
d: "M8 4.5C6.9 3.4 5.3 3 3.5 3c-.4 0-.8 0-1.2.1-.3 0-.5.3-.5.6v8.1c0 .4.4.7.8.6.3-.1.7-.1 1.1-.1 1.6 0 3.2.4 4.3 1.3 1.1-.9 2.7-1.3 4.3-1.3.4 0 .8 0 1.1.1.4.1.8-.2.8-.6V3.7c0-.3-.2-.6-.5-.6-.4-.1-.8-.1-1.2-.1-1.8 0-3.4.4-4.5 1.5Z",
|
|
@@ -5886,7 +6119,7 @@ function SourcesIcon() {
|
|
|
5886
6119
|
strokeLinejoin: "round"
|
|
5887
6120
|
}
|
|
5888
6121
|
),
|
|
5889
|
-
/* @__PURE__ */ (0,
|
|
6122
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5890
6123
|
"path",
|
|
5891
6124
|
{
|
|
5892
6125
|
d: "M8 4.5v9",
|
|
@@ -5898,8 +6131,8 @@ function SourcesIcon() {
|
|
|
5898
6131
|
] });
|
|
5899
6132
|
}
|
|
5900
6133
|
function ReadAloudIcon() {
|
|
5901
|
-
return /* @__PURE__ */ (0,
|
|
5902
|
-
/* @__PURE__ */ (0,
|
|
6134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
6135
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5903
6136
|
"path",
|
|
5904
6137
|
{
|
|
5905
6138
|
d: "M8.5 3.8 5.8 6H3.5c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2.3l2.7 2.2c.4.3 1 0 1-.5V4.3c0-.5-.6-.8-1-.5Z",
|
|
@@ -5909,7 +6142,7 @@ function ReadAloudIcon() {
|
|
|
5909
6142
|
strokeLinejoin: "round"
|
|
5910
6143
|
}
|
|
5911
6144
|
),
|
|
5912
|
-
/* @__PURE__ */ (0,
|
|
6145
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5913
6146
|
"path",
|
|
5914
6147
|
{
|
|
5915
6148
|
d: "M11 6.2c.5.5.8 1.1.8 1.8s-.3 1.3-.8 1.8M12.8 4.5c.9.8 1.4 2 1.4 3.5s-.5 2.7-1.4 3.5",
|
|
@@ -5921,7 +6154,7 @@ function ReadAloudIcon() {
|
|
|
5921
6154
|
] });
|
|
5922
6155
|
}
|
|
5923
6156
|
function StopIcon() {
|
|
5924
|
-
return /* @__PURE__ */ (0,
|
|
6157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5925
6158
|
"rect",
|
|
5926
6159
|
{
|
|
5927
6160
|
x: "4",
|
|
@@ -5990,26 +6223,26 @@ function MessageActions({
|
|
|
5990
6223
|
speechText
|
|
5991
6224
|
}) {
|
|
5992
6225
|
const menuPortalRoot = useAgentRailMenuPortalRoot();
|
|
5993
|
-
const [copied, setCopied] = (0,
|
|
5994
|
-
const [rating, setRating] = (0,
|
|
5995
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
5996
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
5997
|
-
const [speaking, setSpeaking] = (0,
|
|
5998
|
-
const [speechSupported, setSpeechSupported] = (0,
|
|
5999
|
-
const copyTimerRef = (0,
|
|
6000
|
-
const menuRef = (0,
|
|
6001
|
-
const portaledMenuRef = (0,
|
|
6002
|
-
const moreButtonRef = (0,
|
|
6226
|
+
const [copied, setCopied] = (0, import_react14.useState)(false);
|
|
6227
|
+
const [rating, setRating] = (0, import_react14.useState)(null);
|
|
6228
|
+
const [menuOpen, setMenuOpen] = (0, import_react14.useState)(false);
|
|
6229
|
+
const [menuPosition, setMenuPosition] = (0, import_react14.useState)(null);
|
|
6230
|
+
const [speaking, setSpeaking] = (0, import_react14.useState)(false);
|
|
6231
|
+
const [speechSupported, setSpeechSupported] = (0, import_react14.useState)(null);
|
|
6232
|
+
const copyTimerRef = (0, import_react14.useRef)(null);
|
|
6233
|
+
const menuRef = (0, import_react14.useRef)(null);
|
|
6234
|
+
const portaledMenuRef = (0, import_react14.useRef)(null);
|
|
6235
|
+
const moreButtonRef = (0, import_react14.useRef)(null);
|
|
6003
6236
|
const answeredLabel = formatAnsweredAt(answeredAt ?? 0);
|
|
6004
6237
|
const resolvedSpeechText = speechText ?? toSpeechText(copyText);
|
|
6005
6238
|
const canOpenReceipt = Boolean(receiptSteps) && Boolean(onOpenReceipt);
|
|
6006
6239
|
const readAloudEligible = Boolean(readAloud && resolvedSpeechText);
|
|
6007
6240
|
const canReadAloud = readAloudEligible && speechSupported === true;
|
|
6008
6241
|
const showMenu = canOpenReceipt || (speechSupported === null ? readAloudEligible : canReadAloud);
|
|
6009
|
-
(0,
|
|
6242
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
6010
6243
|
setSpeechSupported(isSpeechSupported());
|
|
6011
6244
|
}, []);
|
|
6012
|
-
(0,
|
|
6245
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
6013
6246
|
if (!menuOpen || !moreButtonRef.current || !portaledMenuRef.current) {
|
|
6014
6247
|
setMenuPosition(null);
|
|
6015
6248
|
return;
|
|
@@ -6026,7 +6259,7 @@ function MessageActions({
|
|
|
6026
6259
|
})
|
|
6027
6260
|
);
|
|
6028
6261
|
}, [menuOpen, menuPortalRoot]);
|
|
6029
|
-
(0,
|
|
6262
|
+
(0, import_react14.useEffect)(() => {
|
|
6030
6263
|
const unsubscribe = subscribeSpeechInterrupts(() => setSpeaking(false));
|
|
6031
6264
|
return () => {
|
|
6032
6265
|
unsubscribe();
|
|
@@ -6036,7 +6269,7 @@ function MessageActions({
|
|
|
6036
6269
|
stopSpeech();
|
|
6037
6270
|
};
|
|
6038
6271
|
}, []);
|
|
6039
|
-
(0,
|
|
6272
|
+
(0, import_react14.useEffect)(() => {
|
|
6040
6273
|
if (!menuOpen) return;
|
|
6041
6274
|
const handlePointerDown = (event) => {
|
|
6042
6275
|
const target = event.target;
|
|
@@ -6085,7 +6318,7 @@ function MessageActions({
|
|
|
6085
6318
|
window.speechSynthesis.speak(utterance);
|
|
6086
6319
|
setSpeaking(true);
|
|
6087
6320
|
}
|
|
6088
|
-
const menu = menuOpen ? /* @__PURE__ */ (0,
|
|
6321
|
+
const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6089
6322
|
"div",
|
|
6090
6323
|
{
|
|
6091
6324
|
className: "agent-message-actions__menu agent-message-actions__menu--portal",
|
|
@@ -6096,11 +6329,11 @@ function MessageActions({
|
|
|
6096
6329
|
top: `${menuPosition.top}px`
|
|
6097
6330
|
} : { visibility: "hidden" },
|
|
6098
6331
|
children: [
|
|
6099
|
-
answeredLabel ? /* @__PURE__ */ (0,
|
|
6332
|
+
answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
|
|
6100
6333
|
"Answered ",
|
|
6101
6334
|
answeredLabel
|
|
6102
6335
|
] }) : null,
|
|
6103
|
-
canOpenReceipt ? /* @__PURE__ */ (0,
|
|
6336
|
+
canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6104
6337
|
"button",
|
|
6105
6338
|
{
|
|
6106
6339
|
type: "button",
|
|
@@ -6111,12 +6344,12 @@ function MessageActions({
|
|
|
6111
6344
|
onOpenReceipt?.();
|
|
6112
6345
|
},
|
|
6113
6346
|
children: [
|
|
6114
|
-
/* @__PURE__ */ (0,
|
|
6115
|
-
"
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SourcesIcon, {}),
|
|
6348
|
+
"How this answer was made"
|
|
6116
6349
|
]
|
|
6117
6350
|
}
|
|
6118
6351
|
) : null,
|
|
6119
|
-
canReadAloud ? /* @__PURE__ */ (0,
|
|
6352
|
+
canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6120
6353
|
"button",
|
|
6121
6354
|
{
|
|
6122
6355
|
type: "button",
|
|
@@ -6124,7 +6357,7 @@ function MessageActions({
|
|
|
6124
6357
|
role: "menuitem",
|
|
6125
6358
|
onClick: handleReadAloud,
|
|
6126
6359
|
children: [
|
|
6127
|
-
speaking ? /* @__PURE__ */ (0,
|
|
6360
|
+
speaking ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ReadAloudIcon, {}),
|
|
6128
6361
|
speaking ? "Stop reading" : "Read aloud"
|
|
6129
6362
|
]
|
|
6130
6363
|
}
|
|
@@ -6132,8 +6365,8 @@ function MessageActions({
|
|
|
6132
6365
|
]
|
|
6133
6366
|
}
|
|
6134
6367
|
) : null;
|
|
6135
|
-
return /* @__PURE__ */ (0,
|
|
6136
|
-
/* @__PURE__ */ (0,
|
|
6368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
|
|
6369
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6137
6370
|
"button",
|
|
6138
6371
|
{
|
|
6139
6372
|
type: "button",
|
|
@@ -6142,10 +6375,10 @@ function MessageActions({
|
|
|
6142
6375
|
title: copied ? "Copied" : "Copy answer",
|
|
6143
6376
|
disabled,
|
|
6144
6377
|
onClick: handleCopy,
|
|
6145
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
6378
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon2, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopyIcon, {})
|
|
6146
6379
|
}
|
|
6147
6380
|
),
|
|
6148
|
-
/* @__PURE__ */ (0,
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6149
6382
|
"button",
|
|
6150
6383
|
{
|
|
6151
6384
|
type: "button",
|
|
@@ -6155,10 +6388,10 @@ function MessageActions({
|
|
|
6155
6388
|
title: "Good answer",
|
|
6156
6389
|
disabled,
|
|
6157
6390
|
onClick: () => handleFeedback("positive"),
|
|
6158
|
-
children: /* @__PURE__ */ (0,
|
|
6391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ThumbUpIcon, {})
|
|
6159
6392
|
}
|
|
6160
6393
|
),
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6162
6395
|
"button",
|
|
6163
6396
|
{
|
|
6164
6397
|
type: "button",
|
|
@@ -6168,10 +6401,10 @@ function MessageActions({
|
|
|
6168
6401
|
title: "Bad answer",
|
|
6169
6402
|
disabled,
|
|
6170
6403
|
onClick: () => handleFeedback("negative"),
|
|
6171
|
-
children: /* @__PURE__ */ (0,
|
|
6404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ThumbDownIcon, {})
|
|
6172
6405
|
}
|
|
6173
6406
|
),
|
|
6174
|
-
onRegenerate ? /* @__PURE__ */ (0,
|
|
6407
|
+
onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6175
6408
|
"button",
|
|
6176
6409
|
{
|
|
6177
6410
|
type: "button",
|
|
@@ -6180,11 +6413,11 @@ function MessageActions({
|
|
|
6180
6413
|
title: "Regenerate answer",
|
|
6181
6414
|
disabled,
|
|
6182
6415
|
onClick: onRegenerate,
|
|
6183
|
-
children: /* @__PURE__ */ (0,
|
|
6416
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RegenerateIcon, {})
|
|
6184
6417
|
}
|
|
6185
6418
|
) : null,
|
|
6186
|
-
showMenu ? /* @__PURE__ */ (0,
|
|
6187
|
-
/* @__PURE__ */ (0,
|
|
6419
|
+
showMenu ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6188
6421
|
"button",
|
|
6189
6422
|
{
|
|
6190
6423
|
ref: moreButtonRef,
|
|
@@ -6196,7 +6429,7 @@ function MessageActions({
|
|
|
6196
6429
|
title: "More actions",
|
|
6197
6430
|
disabled,
|
|
6198
6431
|
onClick: () => setMenuOpen((open) => !open),
|
|
6199
|
-
children: /* @__PURE__ */ (0,
|
|
6432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MoreIcon, {})
|
|
6200
6433
|
}
|
|
6201
6434
|
),
|
|
6202
6435
|
menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
|
|
@@ -6205,10 +6438,10 @@ function MessageActions({
|
|
|
6205
6438
|
}
|
|
6206
6439
|
|
|
6207
6440
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
6208
|
-
var
|
|
6441
|
+
var import_react16 = require("react");
|
|
6209
6442
|
|
|
6210
6443
|
// src/react/components/ConfirmationCard/ConfirmationCard.tsx
|
|
6211
|
-
var
|
|
6444
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6212
6445
|
function ConfirmationCard({
|
|
6213
6446
|
disabled = false,
|
|
6214
6447
|
request,
|
|
@@ -6217,17 +6450,17 @@ function ConfirmationCard({
|
|
|
6217
6450
|
const options = request.options ?? [];
|
|
6218
6451
|
const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
|
|
6219
6452
|
const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
|
|
6220
|
-
return /* @__PURE__ */ (0,
|
|
6453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6221
6454
|
"section",
|
|
6222
6455
|
{
|
|
6223
6456
|
className: "confirmation-card",
|
|
6224
6457
|
"aria-labelledby": `confirmation-${request.requestId}`,
|
|
6225
6458
|
children: [
|
|
6226
|
-
/* @__PURE__ */ (0,
|
|
6227
|
-
/* @__PURE__ */ (0,
|
|
6228
|
-
prompt ? /* @__PURE__ */ (0,
|
|
6459
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "confirmation-card__heading", children: [
|
|
6460
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
|
|
6461
|
+
prompt ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: prompt }) : null
|
|
6229
6462
|
] }),
|
|
6230
|
-
/* @__PURE__ */ (0,
|
|
6463
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6231
6464
|
"button",
|
|
6232
6465
|
{
|
|
6233
6466
|
type: "button",
|
|
@@ -6247,8 +6480,8 @@ function ConfirmationCard({
|
|
|
6247
6480
|
}
|
|
6248
6481
|
|
|
6249
6482
|
// src/react/components/ToolInputCard/ToolInputCard.tsx
|
|
6250
|
-
var
|
|
6251
|
-
var
|
|
6483
|
+
var import_react15 = require("react");
|
|
6484
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6252
6485
|
function isRecord5(value) {
|
|
6253
6486
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6254
6487
|
}
|
|
@@ -6372,7 +6605,7 @@ function FieldDescription({
|
|
|
6372
6605
|
field,
|
|
6373
6606
|
id: id2
|
|
6374
6607
|
}) {
|
|
6375
|
-
return field.description ? /* @__PURE__ */ (0,
|
|
6608
|
+
return field.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: id2, className: "tool-input-card__description", children: field.description }) : null;
|
|
6376
6609
|
}
|
|
6377
6610
|
function ChoiceField({
|
|
6378
6611
|
field,
|
|
@@ -6391,7 +6624,7 @@ function ChoiceField({
|
|
|
6391
6624
|
const selectedIndex = options.findIndex(
|
|
6392
6625
|
(option) => valuesMatch(option.value, value)
|
|
6393
6626
|
);
|
|
6394
|
-
return /* @__PURE__ */ (0,
|
|
6627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6395
6628
|
"select",
|
|
6396
6629
|
{
|
|
6397
6630
|
id: id2,
|
|
@@ -6406,13 +6639,13 @@ function ChoiceField({
|
|
|
6406
6639
|
if (option) onChange(option.value);
|
|
6407
6640
|
},
|
|
6408
6641
|
children: [
|
|
6409
|
-
/* @__PURE__ */ (0,
|
|
6410
|
-
options.map((option, index) => /* @__PURE__ */ (0,
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
|
|
6643
|
+
options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: index, children: option.label }, optionKey(option)))
|
|
6411
6644
|
]
|
|
6412
6645
|
}
|
|
6413
6646
|
);
|
|
6414
6647
|
}
|
|
6415
|
-
return /* @__PURE__ */ (0,
|
|
6648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6416
6649
|
"div",
|
|
6417
6650
|
{
|
|
6418
6651
|
className: "tool-input-card__choices",
|
|
@@ -6423,8 +6656,8 @@ function ChoiceField({
|
|
|
6423
6656
|
"aria-required": field.required,
|
|
6424
6657
|
children: options.map((option, index) => {
|
|
6425
6658
|
const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
|
|
6426
|
-
return /* @__PURE__ */ (0,
|
|
6427
|
-
/* @__PURE__ */ (0,
|
|
6659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "tool-input-card__choice", children: [
|
|
6660
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6428
6661
|
"input",
|
|
6429
6662
|
{
|
|
6430
6663
|
type: multiple ? "checkbox" : "radio",
|
|
@@ -6446,7 +6679,7 @@ function ChoiceField({
|
|
|
6446
6679
|
}
|
|
6447
6680
|
}
|
|
6448
6681
|
),
|
|
6449
|
-
/* @__PURE__ */ (0,
|
|
6682
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: option.label })
|
|
6450
6683
|
] }, optionKey(option));
|
|
6451
6684
|
})
|
|
6452
6685
|
}
|
|
@@ -6466,9 +6699,9 @@ function ToolField({
|
|
|
6466
6699
|
error ? `${id2}-error` : ""
|
|
6467
6700
|
].filter(Boolean).join(" ");
|
|
6468
6701
|
if (field.kind === "checkbox" || field.kind === "confirmation") {
|
|
6469
|
-
return /* @__PURE__ */ (0,
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
6471
|
-
/* @__PURE__ */ (0,
|
|
6702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
6703
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "tool-input-card__check", htmlFor: id2, children: [
|
|
6704
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6472
6705
|
"input",
|
|
6473
6706
|
{
|
|
6474
6707
|
id: id2,
|
|
@@ -6481,17 +6714,17 @@ function ToolField({
|
|
|
6481
6714
|
onChange: (event) => onChange(event.target.checked)
|
|
6482
6715
|
}
|
|
6483
6716
|
),
|
|
6484
|
-
/* @__PURE__ */ (0,
|
|
6485
|
-
/* @__PURE__ */ (0,
|
|
6486
|
-
field.description ? /* @__PURE__ */ (0,
|
|
6717
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
6718
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: field.label }),
|
|
6719
|
+
field.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-description`, children: field.description }) : null
|
|
6487
6720
|
] })
|
|
6488
6721
|
] }),
|
|
6489
|
-
error ? /* @__PURE__ */ (0,
|
|
6722
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
|
|
6490
6723
|
] });
|
|
6491
6724
|
}
|
|
6492
|
-
const label = /* @__PURE__ */ (0,
|
|
6725
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { id: `${id2}-label`, htmlFor: id2, children: [
|
|
6493
6726
|
field.label,
|
|
6494
|
-
field.required ? /* @__PURE__ */ (0,
|
|
6727
|
+
field.required ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
|
|
6495
6728
|
] });
|
|
6496
6729
|
const common = {
|
|
6497
6730
|
id: id2,
|
|
@@ -6503,7 +6736,7 @@ function ToolField({
|
|
|
6503
6736
|
};
|
|
6504
6737
|
let control;
|
|
6505
6738
|
if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
|
|
6506
|
-
control = /* @__PURE__ */ (0,
|
|
6739
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6507
6740
|
ChoiceField,
|
|
6508
6741
|
{
|
|
6509
6742
|
field,
|
|
@@ -6517,7 +6750,7 @@ function ToolField({
|
|
|
6517
6750
|
}
|
|
6518
6751
|
);
|
|
6519
6752
|
} else if (field.kind === "textarea" || field.kind === "json") {
|
|
6520
|
-
control = /* @__PURE__ */ (0,
|
|
6753
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6521
6754
|
"textarea",
|
|
6522
6755
|
{
|
|
6523
6756
|
...common,
|
|
@@ -6531,8 +6764,8 @@ function ToolField({
|
|
|
6531
6764
|
);
|
|
6532
6765
|
} else if (field.kind === "range") {
|
|
6533
6766
|
const numericValue = typeof value === "number" ? value : field.min ?? 0;
|
|
6534
|
-
control = /* @__PURE__ */ (0,
|
|
6535
|
-
/* @__PURE__ */ (0,
|
|
6767
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__range", children: [
|
|
6768
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6536
6769
|
"input",
|
|
6537
6770
|
{
|
|
6538
6771
|
...common,
|
|
@@ -6544,11 +6777,11 @@ function ToolField({
|
|
|
6544
6777
|
onChange: (event) => onChange(Number(event.target.value))
|
|
6545
6778
|
}
|
|
6546
6779
|
),
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("output", { htmlFor: id2, children: numericValue })
|
|
6548
6781
|
] });
|
|
6549
6782
|
} else {
|
|
6550
6783
|
const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
|
|
6551
|
-
control = /* @__PURE__ */ (0,
|
|
6784
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6552
6785
|
"input",
|
|
6553
6786
|
{
|
|
6554
6787
|
...common,
|
|
@@ -6566,11 +6799,11 @@ function ToolField({
|
|
|
6566
6799
|
}
|
|
6567
6800
|
);
|
|
6568
6801
|
}
|
|
6569
|
-
return /* @__PURE__ */ (0,
|
|
6802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
6570
6803
|
label,
|
|
6571
|
-
/* @__PURE__ */ (0,
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldDescription, { field, id: `${id2}-description` }),
|
|
6572
6805
|
control,
|
|
6573
|
-
error ? /* @__PURE__ */ (0,
|
|
6806
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
|
|
6574
6807
|
] });
|
|
6575
6808
|
}
|
|
6576
6809
|
function ToolInputCard({
|
|
@@ -6578,11 +6811,11 @@ function ToolInputCard({
|
|
|
6578
6811
|
surface,
|
|
6579
6812
|
onSubmit
|
|
6580
6813
|
}) {
|
|
6581
|
-
const [values, setValues] = (0,
|
|
6814
|
+
const [values, setValues] = (0, import_react15.useState)(
|
|
6582
6815
|
() => initialValues(surface)
|
|
6583
6816
|
);
|
|
6584
|
-
const [touched, setTouched] = (0,
|
|
6585
|
-
const [submitted, setSubmitted] = (0,
|
|
6817
|
+
const [touched, setTouched] = (0, import_react15.useState)(() => /* @__PURE__ */ new Set());
|
|
6818
|
+
const [submitted, setSubmitted] = (0, import_react15.useState)(false);
|
|
6586
6819
|
const errors = Object.fromEntries(
|
|
6587
6820
|
surface.fields.map((field) => [
|
|
6588
6821
|
field.path,
|
|
@@ -6607,14 +6840,14 @@ function ToolInputCard({
|
|
|
6607
6840
|
onSubmit?.(surface, result);
|
|
6608
6841
|
}
|
|
6609
6842
|
if (submitted) {
|
|
6610
|
-
return /* @__PURE__ */ (0,
|
|
6843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6611
6844
|
"section",
|
|
6612
6845
|
{
|
|
6613
6846
|
className: "tool-input-card tool-input-card--submitted",
|
|
6614
6847
|
role: "status",
|
|
6615
6848
|
children: [
|
|
6616
|
-
/* @__PURE__ */ (0,
|
|
6617
|
-
/* @__PURE__ */ (0,
|
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
|
|
6850
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("strong", { children: [
|
|
6618
6851
|
surface.title,
|
|
6619
6852
|
" submitted"
|
|
6620
6853
|
] })
|
|
@@ -6622,18 +6855,18 @@ function ToolInputCard({
|
|
|
6622
6855
|
}
|
|
6623
6856
|
);
|
|
6624
6857
|
}
|
|
6625
|
-
return /* @__PURE__ */ (0,
|
|
6858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6626
6859
|
"section",
|
|
6627
6860
|
{
|
|
6628
6861
|
className: "tool-input-card",
|
|
6629
6862
|
"aria-labelledby": `tool-input-${surface.id}`,
|
|
6630
6863
|
children: [
|
|
6631
|
-
/* @__PURE__ */ (0,
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
surface.description ? /* @__PURE__ */ (0,
|
|
6864
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__heading", children: [
|
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
|
|
6866
|
+
surface.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: surface.description }) : null
|
|
6634
6867
|
] }),
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
6636
|
-
/* @__PURE__ */ (0,
|
|
6868
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
|
|
6869
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6637
6870
|
ToolField,
|
|
6638
6871
|
{
|
|
6639
6872
|
disabled,
|
|
@@ -6646,8 +6879,8 @@ function ToolInputCard({
|
|
|
6646
6879
|
},
|
|
6647
6880
|
field.path
|
|
6648
6881
|
)) }),
|
|
6649
|
-
/* @__PURE__ */ (0,
|
|
6650
|
-
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0,
|
|
6882
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__actions", children: [
|
|
6883
|
+
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6651
6884
|
"button",
|
|
6652
6885
|
{
|
|
6653
6886
|
type: "button",
|
|
@@ -6660,7 +6893,7 @@ function ToolInputCard({
|
|
|
6660
6893
|
children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
|
|
6661
6894
|
}
|
|
6662
6895
|
) : null,
|
|
6663
|
-
/* @__PURE__ */ (0,
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
|
|
6664
6897
|
] })
|
|
6665
6898
|
] })
|
|
6666
6899
|
]
|
|
@@ -6669,17 +6902,17 @@ function ToolInputCard({
|
|
|
6669
6902
|
}
|
|
6670
6903
|
|
|
6671
6904
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
6672
|
-
var
|
|
6905
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6673
6906
|
function HumanInputCard({
|
|
6674
6907
|
disabled = false,
|
|
6675
6908
|
request,
|
|
6676
6909
|
onRespond
|
|
6677
6910
|
}) {
|
|
6678
|
-
const [text3, setText] = (0,
|
|
6911
|
+
const [text3, setText] = (0, import_react16.useState)("");
|
|
6679
6912
|
const options = request.options ?? [];
|
|
6680
6913
|
const showText = request.display === "text" || request.allowFreeform && options.length === 0;
|
|
6681
6914
|
if (request.ui) {
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
6915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6683
6916
|
ToolInputCard,
|
|
6684
6917
|
{
|
|
6685
6918
|
disabled,
|
|
@@ -6689,7 +6922,7 @@ function HumanInputCard({
|
|
|
6689
6922
|
);
|
|
6690
6923
|
}
|
|
6691
6924
|
if (options.length > 0) {
|
|
6692
|
-
return /* @__PURE__ */ (0,
|
|
6925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6693
6926
|
ConfirmationCard,
|
|
6694
6927
|
{
|
|
6695
6928
|
disabled,
|
|
@@ -6704,17 +6937,17 @@ function HumanInputCard({
|
|
|
6704
6937
|
if (!value || disabled) return;
|
|
6705
6938
|
onRespond?.({ requestId: request.requestId, text: value });
|
|
6706
6939
|
}
|
|
6707
|
-
return /* @__PURE__ */ (0,
|
|
6940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
6708
6941
|
"section",
|
|
6709
6942
|
{
|
|
6710
6943
|
className: "human-input-card",
|
|
6711
6944
|
"aria-labelledby": `human-input-${request.requestId}`,
|
|
6712
6945
|
children: [
|
|
6713
|
-
/* @__PURE__ */ (0,
|
|
6714
|
-
showText ? /* @__PURE__ */ (0,
|
|
6715
|
-
/* @__PURE__ */ (0,
|
|
6716
|
-
/* @__PURE__ */ (0,
|
|
6717
|
-
/* @__PURE__ */ (0,
|
|
6946
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
|
|
6947
|
+
showText ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: submitText, children: [
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
6950
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6718
6951
|
"input",
|
|
6719
6952
|
{
|
|
6720
6953
|
id: `human-input-text-${request.requestId}`,
|
|
@@ -6723,17 +6956,17 @@ function HumanInputCard({
|
|
|
6723
6956
|
onChange: (event) => setText(event.target.value)
|
|
6724
6957
|
}
|
|
6725
6958
|
),
|
|
6726
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "submit", disabled: disabled || !text3.trim(), children: "Send" })
|
|
6727
6960
|
] })
|
|
6728
6961
|
] }) : null,
|
|
6729
|
-
!showText && options.length === 0 ? /* @__PURE__ */ (0,
|
|
6962
|
+
!showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
|
|
6730
6963
|
]
|
|
6731
6964
|
}
|
|
6732
6965
|
);
|
|
6733
6966
|
}
|
|
6734
6967
|
|
|
6735
6968
|
// src/react/components/LocationConsent/LocationConsent.tsx
|
|
6736
|
-
var
|
|
6969
|
+
var import_react17 = require("react");
|
|
6737
6970
|
|
|
6738
6971
|
// src/runtime/location-consent.ts
|
|
6739
6972
|
function isLocationConsentRequest(request) {
|
|
@@ -6776,21 +7009,21 @@ function getPreciseLocation(geolocation) {
|
|
|
6776
7009
|
}
|
|
6777
7010
|
|
|
6778
7011
|
// src/react/components/LocationConsent/LocationConsent.tsx
|
|
6779
|
-
var
|
|
7012
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6780
7013
|
function LocationConsent({
|
|
6781
7014
|
request,
|
|
6782
7015
|
onRespond
|
|
6783
7016
|
}) {
|
|
6784
|
-
const [preference, setPreference] = (0,
|
|
6785
|
-
const [locating, setLocating] = (0,
|
|
6786
|
-
const [error, setError] = (0,
|
|
6787
|
-
const respond = (0,
|
|
6788
|
-
const answered = (0,
|
|
7017
|
+
const [preference, setPreference] = (0, import_react17.useState)("unset");
|
|
7018
|
+
const [locating, setLocating] = (0, import_react17.useState)(false);
|
|
7019
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
7020
|
+
const respond = (0, import_react17.useRef)(onRespond);
|
|
7021
|
+
const answered = (0, import_react17.useRef)(null);
|
|
6789
7022
|
const requestId = request?.requestId;
|
|
6790
|
-
(0,
|
|
7023
|
+
(0, import_react17.useEffect)(() => {
|
|
6791
7024
|
respond.current = onRespond;
|
|
6792
7025
|
}, [onRespond]);
|
|
6793
|
-
(0,
|
|
7026
|
+
(0, import_react17.useEffect)(() => {
|
|
6794
7027
|
if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
|
|
6795
7028
|
return;
|
|
6796
7029
|
if (preference === "off") {
|
|
@@ -6833,13 +7066,13 @@ function LocationConsent({
|
|
|
6833
7066
|
}, [requestId, preference]);
|
|
6834
7067
|
const isLocating = Boolean(requestId) && preference === "on" && locating;
|
|
6835
7068
|
if (!request && preference === "unset") return null;
|
|
6836
|
-
return /* @__PURE__ */ (0,
|
|
6837
|
-
/* @__PURE__ */ (0,
|
|
6838
|
-
/* @__PURE__ */ (0,
|
|
6839
|
-
/* @__PURE__ */ (0,
|
|
7069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "location-consent", "aria-label": "Location sharing", children: [
|
|
7070
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "location-consent__copy", children: [
|
|
7071
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
|
|
7072
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: isLocating ? "Allow location access in your browser." : request ? "Share your precise location" : preference === "on" ? "On for location-aware answers" : "Off for this chat" })
|
|
6840
7073
|
] }),
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
6842
|
-
/* @__PURE__ */ (0,
|
|
7074
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "location-consent__actions", children: [
|
|
7075
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6843
7076
|
"button",
|
|
6844
7077
|
{
|
|
6845
7078
|
type: "button",
|
|
@@ -6853,10 +7086,10 @@ function LocationConsent({
|
|
|
6853
7086
|
setError(null);
|
|
6854
7087
|
setPreference(preference === "on" ? "off" : "on");
|
|
6855
7088
|
},
|
|
6856
|
-
children: /* @__PURE__ */ (0,
|
|
7089
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {})
|
|
6857
7090
|
}
|
|
6858
7091
|
),
|
|
6859
|
-
request && /* @__PURE__ */ (0,
|
|
7092
|
+
request && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6860
7093
|
"button",
|
|
6861
7094
|
{
|
|
6862
7095
|
type: "button",
|
|
@@ -6870,35 +7103,35 @@ function LocationConsent({
|
|
|
6870
7103
|
}
|
|
6871
7104
|
)
|
|
6872
7105
|
] }),
|
|
6873
|
-
error && /* @__PURE__ */ (0,
|
|
7106
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "location-consent__error", children: error })
|
|
6874
7107
|
] });
|
|
6875
7108
|
}
|
|
6876
7109
|
|
|
6877
7110
|
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
6878
|
-
var
|
|
7111
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6879
7112
|
function CollectionResultCard({
|
|
6880
7113
|
result
|
|
6881
7114
|
}) {
|
|
6882
7115
|
const empty = result.items.length === 0;
|
|
6883
|
-
return /* @__PURE__ */ (0,
|
|
7116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6884
7117
|
"section",
|
|
6885
7118
|
{
|
|
6886
7119
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
6887
7120
|
"aria-label": result.title,
|
|
6888
7121
|
role: result.status === "completed" ? "status" : "alert",
|
|
6889
7122
|
children: [
|
|
6890
|
-
/* @__PURE__ */ (0,
|
|
6891
|
-
/* @__PURE__ */ (0,
|
|
6892
|
-
/* @__PURE__ */ (0,
|
|
7123
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
7124
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
7125
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
|
|
6893
7126
|
] }),
|
|
6894
|
-
empty ? /* @__PURE__ */ (0,
|
|
6895
|
-
/* @__PURE__ */ (0,
|
|
6896
|
-
item.description ? /* @__PURE__ */ (0,
|
|
6897
|
-
item.details?.length ? /* @__PURE__ */ (0,
|
|
6898
|
-
/* @__PURE__ */ (0,
|
|
6899
|
-
/* @__PURE__ */ (0,
|
|
7127
|
+
empty ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { children: [
|
|
7128
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
7129
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: item.description }) : null,
|
|
7130
|
+
item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
7131
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: detail.label }),
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: detail.value })
|
|
6900
7133
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
6901
|
-
item.href ? /* @__PURE__ */ (0,
|
|
7134
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
6902
7135
|
] }, item.title)) })
|
|
6903
7136
|
]
|
|
6904
7137
|
}
|
|
@@ -6906,23 +7139,23 @@ function CollectionResultCard({
|
|
|
6906
7139
|
}
|
|
6907
7140
|
|
|
6908
7141
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
6909
|
-
var
|
|
7142
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
6910
7143
|
function EntityResultCard({
|
|
6911
7144
|
result
|
|
6912
7145
|
}) {
|
|
6913
7146
|
const compact = !result.description && !result.details?.length && !result.links?.length;
|
|
6914
7147
|
const collapsible = result.status === "completed" && Boolean(result.details?.length) && !result.links?.length;
|
|
6915
|
-
const heading = /* @__PURE__ */ (0,
|
|
6916
|
-
/* @__PURE__ */ (0,
|
|
6917
|
-
/* @__PURE__ */ (0,
|
|
7148
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "tool-result-card__heading", children: [
|
|
7149
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
7150
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
|
|
6918
7151
|
] });
|
|
6919
|
-
const content = /* @__PURE__ */ (0,
|
|
6920
|
-
result.description ? /* @__PURE__ */ (0,
|
|
6921
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
6922
|
-
/* @__PURE__ */ (0,
|
|
6923
|
-
/* @__PURE__ */ (0,
|
|
7152
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
7153
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
|
|
7154
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
|
|
7156
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
|
|
6924
7157
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
6925
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
7158
|
+
result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6926
7159
|
"a",
|
|
6927
7160
|
{
|
|
6928
7161
|
href: link.href,
|
|
@@ -6934,12 +7167,12 @@ function EntityResultCard({
|
|
|
6934
7167
|
)) }) : null
|
|
6935
7168
|
] });
|
|
6936
7169
|
if (collapsible) {
|
|
6937
|
-
return /* @__PURE__ */ (0,
|
|
6938
|
-
/* @__PURE__ */ (0,
|
|
7170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
|
|
7171
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { role: "status", children: heading }) }),
|
|
6939
7172
|
content
|
|
6940
7173
|
] });
|
|
6941
7174
|
}
|
|
6942
|
-
return /* @__PURE__ */ (0,
|
|
7175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
6943
7176
|
"section",
|
|
6944
7177
|
{
|
|
6945
7178
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}${compact ? " entity-result-card--compact" : ""}`,
|
|
@@ -6954,24 +7187,24 @@ function EntityResultCard({
|
|
|
6954
7187
|
}
|
|
6955
7188
|
|
|
6956
7189
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
6957
|
-
var
|
|
7190
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
6958
7191
|
function SignatureResultCard({
|
|
6959
7192
|
result
|
|
6960
7193
|
}) {
|
|
6961
7194
|
const primaryLink = result.links?.[0];
|
|
6962
|
-
return /* @__PURE__ */ (0,
|
|
7195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6963
7196
|
"section",
|
|
6964
7197
|
{
|
|
6965
7198
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
6966
7199
|
"aria-label": result.title,
|
|
6967
7200
|
children: [
|
|
6968
|
-
/* @__PURE__ */ (0,
|
|
6969
|
-
/* @__PURE__ */ (0,
|
|
6970
|
-
/* @__PURE__ */ (0,
|
|
7201
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
7202
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
7203
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: result.title })
|
|
6971
7204
|
] }),
|
|
6972
|
-
result.statusLabel ? /* @__PURE__ */ (0,
|
|
6973
|
-
result.description ? /* @__PURE__ */ (0,
|
|
6974
|
-
primaryLink ? /* @__PURE__ */ (0,
|
|
7205
|
+
result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
7206
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: result.description }) : null,
|
|
7207
|
+
primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6975
7208
|
"a",
|
|
6976
7209
|
{
|
|
6977
7210
|
className: "signature-result-card__cta",
|
|
@@ -6987,27 +7220,27 @@ function SignatureResultCard({
|
|
|
6987
7220
|
}
|
|
6988
7221
|
|
|
6989
7222
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
6990
|
-
var
|
|
7223
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
6991
7224
|
function ToolResultCard({
|
|
6992
7225
|
result
|
|
6993
7226
|
}) {
|
|
6994
|
-
return /* @__PURE__ */ (0,
|
|
7227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6995
7228
|
"section",
|
|
6996
7229
|
{
|
|
6997
7230
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
6998
7231
|
"aria-label": result.title,
|
|
6999
7232
|
role: result.status === "completed" ? "status" : "alert",
|
|
7000
7233
|
children: [
|
|
7001
|
-
/* @__PURE__ */ (0,
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7234
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
7235
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
7236
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: result.title })
|
|
7004
7237
|
] }),
|
|
7005
|
-
result.description ? /* @__PURE__ */ (0,
|
|
7006
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
7007
|
-
/* @__PURE__ */ (0,
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
7238
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: result.description }) : null,
|
|
7239
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
7240
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: detail.label }),
|
|
7241
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: detail.value })
|
|
7009
7242
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
7010
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
7243
|
+
result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7011
7244
|
"a",
|
|
7012
7245
|
{
|
|
7013
7246
|
href: link.href,
|
|
@@ -7023,14 +7256,14 @@ function ToolResultCard({
|
|
|
7023
7256
|
}
|
|
7024
7257
|
|
|
7025
7258
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
7026
|
-
var
|
|
7259
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7027
7260
|
function VisitorToolResultView({
|
|
7028
7261
|
disabled = false,
|
|
7029
7262
|
onToolInput,
|
|
7030
7263
|
result
|
|
7031
7264
|
}) {
|
|
7032
7265
|
if (result.kind === "input") {
|
|
7033
|
-
return /* @__PURE__ */ (0,
|
|
7266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7034
7267
|
ToolInputCard,
|
|
7035
7268
|
{
|
|
7036
7269
|
disabled,
|
|
@@ -7040,16 +7273,16 @@ function VisitorToolResultView({
|
|
|
7040
7273
|
);
|
|
7041
7274
|
}
|
|
7042
7275
|
if (result.kind === "entity") {
|
|
7043
|
-
return /* @__PURE__ */ (0,
|
|
7276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EntityResultCard, { result });
|
|
7044
7277
|
}
|
|
7045
7278
|
if (result.kind === "collection") {
|
|
7046
|
-
return /* @__PURE__ */ (0,
|
|
7279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CollectionResultCard, { result });
|
|
7047
7280
|
}
|
|
7048
7281
|
if (result.kind === "signature") {
|
|
7049
|
-
return /* @__PURE__ */ (0,
|
|
7282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SignatureResultCard, { result });
|
|
7050
7283
|
}
|
|
7051
7284
|
if (result.kind === "summary") {
|
|
7052
|
-
return /* @__PURE__ */ (0,
|
|
7285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToolResultCard, { result });
|
|
7053
7286
|
}
|
|
7054
7287
|
return null;
|
|
7055
7288
|
}
|
|
@@ -7058,9 +7291,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
7058
7291
|
}
|
|
7059
7292
|
|
|
7060
7293
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
7061
|
-
var
|
|
7294
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7062
7295
|
function MinimizeIcon() {
|
|
7063
|
-
return /* @__PURE__ */ (0,
|
|
7296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7064
7297
|
"path",
|
|
7065
7298
|
{
|
|
7066
7299
|
d: "M3.5 8h9",
|
|
@@ -7071,7 +7304,7 @@ function MinimizeIcon() {
|
|
|
7071
7304
|
) });
|
|
7072
7305
|
}
|
|
7073
7306
|
function CloseIcon2() {
|
|
7074
|
-
return /* @__PURE__ */ (0,
|
|
7307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7075
7308
|
"path",
|
|
7076
7309
|
{
|
|
7077
7310
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -7082,19 +7315,31 @@ function CloseIcon2() {
|
|
|
7082
7315
|
) });
|
|
7083
7316
|
}
|
|
7084
7317
|
function NewChatIcon() {
|
|
7085
|
-
return /* @__PURE__ */ (0,
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
7319
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7320
|
+
"path",
|
|
7321
|
+
{
|
|
7322
|
+
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.86L21 8",
|
|
7323
|
+
stroke: "currentColor",
|
|
7324
|
+
strokeWidth: "2",
|
|
7325
|
+
strokeLinecap: "round",
|
|
7326
|
+
strokeLinejoin: "round"
|
|
7327
|
+
}
|
|
7328
|
+
),
|
|
7329
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7330
|
+
"path",
|
|
7331
|
+
{
|
|
7332
|
+
d: "M21 3v5h-5",
|
|
7333
|
+
stroke: "currentColor",
|
|
7334
|
+
strokeWidth: "2",
|
|
7335
|
+
strokeLinecap: "round",
|
|
7336
|
+
strokeLinejoin: "round"
|
|
7337
|
+
}
|
|
7338
|
+
)
|
|
7339
|
+
] });
|
|
7095
7340
|
}
|
|
7096
7341
|
function ExpandIcon() {
|
|
7097
|
-
return /* @__PURE__ */ (0,
|
|
7342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7098
7343
|
"path",
|
|
7099
7344
|
{
|
|
7100
7345
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -7106,7 +7351,7 @@ function ExpandIcon() {
|
|
|
7106
7351
|
) });
|
|
7107
7352
|
}
|
|
7108
7353
|
function RestoreIcon() {
|
|
7109
|
-
return /* @__PURE__ */ (0,
|
|
7354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7110
7355
|
"path",
|
|
7111
7356
|
{
|
|
7112
7357
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -7118,7 +7363,7 @@ function RestoreIcon() {
|
|
|
7118
7363
|
) });
|
|
7119
7364
|
}
|
|
7120
7365
|
function ChevronDownIcon() {
|
|
7121
|
-
return /* @__PURE__ */ (0,
|
|
7366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7122
7367
|
"path",
|
|
7123
7368
|
{
|
|
7124
7369
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -7142,6 +7387,8 @@ function AgentRail({
|
|
|
7142
7387
|
disclaimerLink,
|
|
7143
7388
|
answerReceipt = false,
|
|
7144
7389
|
readAloud = false,
|
|
7390
|
+
showLearnMore = true,
|
|
7391
|
+
showSources = true,
|
|
7145
7392
|
composerPlaceholder = "Ask anything\u2026",
|
|
7146
7393
|
mobileFullscreen = false,
|
|
7147
7394
|
expanded = false,
|
|
@@ -7158,21 +7405,32 @@ function AgentRail({
|
|
|
7158
7405
|
onInputResponse,
|
|
7159
7406
|
onToolInput
|
|
7160
7407
|
}) {
|
|
7161
|
-
const railRef = (0,
|
|
7162
|
-
const overlayRef = (0,
|
|
7163
|
-
const transcriptRef = (0,
|
|
7164
|
-
const responseRef = (0,
|
|
7165
|
-
const threadRef = (0,
|
|
7166
|
-
const lastScrolledVisitorIdRef = (0,
|
|
7167
|
-
const pinnedToBottomRef = (0,
|
|
7168
|
-
const smoothScrollToLatestRef = (0,
|
|
7169
|
-
const lockedTranscriptScrollTopRef = (0,
|
|
7170
|
-
const [showJumpToLatest, setShowJumpToLatest] = (0,
|
|
7171
|
-
const [receiptOpen, setReceiptOpen] = (0,
|
|
7408
|
+
const railRef = (0, import_react18.useRef)(null);
|
|
7409
|
+
const overlayRef = (0, import_react18.useRef)(null);
|
|
7410
|
+
const transcriptRef = (0, import_react18.useRef)(null);
|
|
7411
|
+
const responseRef = (0, import_react18.useRef)(null);
|
|
7412
|
+
const threadRef = (0, import_react18.useRef)(null);
|
|
7413
|
+
const lastScrolledVisitorIdRef = (0, import_react18.useRef)(void 0);
|
|
7414
|
+
const pinnedToBottomRef = (0, import_react18.useRef)(true);
|
|
7415
|
+
const smoothScrollToLatestRef = (0, import_react18.useRef)(false);
|
|
7416
|
+
const lockedTranscriptScrollTopRef = (0, import_react18.useRef)(null);
|
|
7417
|
+
const [showJumpToLatest, setShowJumpToLatest] = (0, import_react18.useState)(false);
|
|
7418
|
+
const [receiptOpen, setReceiptOpen] = (0, import_react18.useState)(false);
|
|
7419
|
+
const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react18.useState)(null);
|
|
7172
7420
|
const resolvedBrandLabel = brandLabel.trim();
|
|
7173
7421
|
const resolvedBrandLogoUrl = brandLogoUrl?.trim();
|
|
7174
7422
|
const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
|
|
7175
|
-
const [failedLogoUrl, setFailedLogoUrl] = (0,
|
|
7423
|
+
const [failedLogoUrl, setFailedLogoUrl] = (0, import_react18.useState)(null);
|
|
7424
|
+
const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react18.useState)(null);
|
|
7425
|
+
(0, import_react18.useEffect)(() => {
|
|
7426
|
+
setFailedLogoUrl(null);
|
|
7427
|
+
}, [resolvedBrandLogoUrl]);
|
|
7428
|
+
const activeBrandLogoDisplay = brandLogoDisplay?.url === resolvedBrandLogoUrl ? brandLogoDisplay : null;
|
|
7429
|
+
const wideBrandLogo = activeBrandLogoDisplay?.wide ?? false;
|
|
7430
|
+
const brandLogoDisplaySize = activeBrandLogoDisplay ? {
|
|
7431
|
+
height: activeBrandLogoDisplay.height,
|
|
7432
|
+
width: activeBrandLogoDisplay.width
|
|
7433
|
+
} : null;
|
|
7176
7434
|
const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
|
|
7177
7435
|
const resolvedColorScheme = useAgentColorScheme(colorScheme);
|
|
7178
7436
|
const railStyle = agentThemeStyle(theme, resolvedColorScheme);
|
|
@@ -7273,29 +7531,39 @@ function AgentRail({
|
|
|
7273
7531
|
...visibleVisitorToolResults
|
|
7274
7532
|
].reverse().find((result) => result.kind !== "input")?.id;
|
|
7275
7533
|
const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
|
|
7276
|
-
(0,
|
|
7534
|
+
(0, import_react18.useEffect)(() => {
|
|
7277
7535
|
if (state.phase !== "complete") {
|
|
7278
7536
|
setReceiptOpen(false);
|
|
7279
7537
|
}
|
|
7280
7538
|
}, [state.phase]);
|
|
7539
|
+
(0, import_react18.useEffect)(() => {
|
|
7540
|
+
if (state.phase !== "complete" || !showSources) {
|
|
7541
|
+
setExpandedSourcesMessageId(null);
|
|
7542
|
+
}
|
|
7543
|
+
}, [state.phase, showSources]);
|
|
7281
7544
|
function handleSubmit(message, options) {
|
|
7282
7545
|
setReceiptOpen(false);
|
|
7546
|
+
setExpandedSourcesMessageId(null);
|
|
7283
7547
|
onSubmit?.(message, options);
|
|
7284
7548
|
}
|
|
7285
7549
|
function handleRegenerate() {
|
|
7286
7550
|
setReceiptOpen(false);
|
|
7551
|
+
setExpandedSourcesMessageId(null);
|
|
7287
7552
|
onRegenerate?.();
|
|
7288
7553
|
}
|
|
7289
7554
|
function handleReset() {
|
|
7290
7555
|
setReceiptOpen(false);
|
|
7556
|
+
setExpandedSourcesMessageId(null);
|
|
7291
7557
|
onReset?.();
|
|
7292
7558
|
}
|
|
7293
7559
|
function handleFollowUpSelect(label) {
|
|
7294
7560
|
setReceiptOpen(false);
|
|
7295
|
-
|
|
7561
|
+
setExpandedSourcesMessageId(null);
|
|
7562
|
+
if (onFollowUpSelect) onFollowUpSelect(label);
|
|
7563
|
+
else onSubmit?.(label);
|
|
7296
7564
|
}
|
|
7297
7565
|
const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
|
|
7298
|
-
(0,
|
|
7566
|
+
(0, import_react18.useEffect)(() => {
|
|
7299
7567
|
const node = transcriptRef.current;
|
|
7300
7568
|
if (!node) return;
|
|
7301
7569
|
if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
|
|
@@ -7325,7 +7593,7 @@ function AgentRail({
|
|
|
7325
7593
|
state.followUps,
|
|
7326
7594
|
state.journey
|
|
7327
7595
|
]);
|
|
7328
|
-
(0,
|
|
7596
|
+
(0, import_react18.useEffect)(() => {
|
|
7329
7597
|
const node = transcriptRef.current;
|
|
7330
7598
|
if (!node) return;
|
|
7331
7599
|
const handleScroll = () => {
|
|
@@ -7339,7 +7607,7 @@ function AgentRail({
|
|
|
7339
7607
|
handleScroll();
|
|
7340
7608
|
return () => node.removeEventListener("scroll", handleScroll);
|
|
7341
7609
|
}, []);
|
|
7342
|
-
(0,
|
|
7610
|
+
(0, import_react18.useEffect)(() => {
|
|
7343
7611
|
if (!receiptOpen) {
|
|
7344
7612
|
lockedTranscriptScrollTopRef.current = null;
|
|
7345
7613
|
return;
|
|
@@ -7377,7 +7645,7 @@ function AgentRail({
|
|
|
7377
7645
|
window.setTimeout(settle, 900);
|
|
7378
7646
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
7379
7647
|
}
|
|
7380
|
-
return /* @__PURE__ */ (0,
|
|
7648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7381
7649
|
"aside",
|
|
7382
7650
|
{
|
|
7383
7651
|
ref: railRef,
|
|
@@ -7391,44 +7659,72 @@ function AgentRail({
|
|
|
7391
7659
|
autoFocus: mobileFullscreen || expanded,
|
|
7392
7660
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
7393
7661
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
7394
|
-
children: /* @__PURE__ */ (0,
|
|
7395
|
-
/* @__PURE__ */ (0,
|
|
7396
|
-
/* @__PURE__ */ (0,
|
|
7397
|
-
onCollapse ? /* @__PURE__ */ (0,
|
|
7662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(AgentRailOverlayContext.Provider, { value: { railRef, overlayRef }, children: [
|
|
7663
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
7664
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__brand-row", children: [
|
|
7665
|
+
onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7398
7666
|
"button",
|
|
7399
7667
|
{
|
|
7400
7668
|
type: "button",
|
|
7401
7669
|
className: "agent-rail__collapse",
|
|
7402
7670
|
"aria-label": "Collapse assist",
|
|
7403
7671
|
onClick: onCollapse,
|
|
7404
|
-
children: /* @__PURE__ */ (0,
|
|
7672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MinimizeIcon, {})
|
|
7405
7673
|
}
|
|
7406
|
-
) : onClose ? /* @__PURE__ */ (0,
|
|
7674
|
+
) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7407
7675
|
"button",
|
|
7408
7676
|
{
|
|
7409
7677
|
type: "button",
|
|
7410
7678
|
className: "agent-rail__close",
|
|
7411
7679
|
"aria-label": "Close agent",
|
|
7412
7680
|
onClick: onClose,
|
|
7413
|
-
children: /* @__PURE__ */ (0,
|
|
7681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
|
|
7414
7682
|
}
|
|
7415
|
-
) : /* @__PURE__ */ (0,
|
|
7416
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0,
|
|
7417
|
-
showBrandLogo ? /* @__PURE__ */ (0,
|
|
7418
|
-
"
|
|
7683
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
7684
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__identity", children: [
|
|
7685
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7686
|
+
"span",
|
|
7419
7687
|
{
|
|
7420
|
-
className: "agent-rail__brand-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7688
|
+
className: `agent-rail__brand-mark${wideBrandLogo ? " agent-rail__brand-mark--wide" : ""}`,
|
|
7689
|
+
"aria-hidden": "true",
|
|
7690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7691
|
+
"img",
|
|
7692
|
+
{
|
|
7693
|
+
className: "agent-rail__brand-logo as-brand-logo-img",
|
|
7694
|
+
src: resolvedBrandLogoUrl,
|
|
7695
|
+
alt: "",
|
|
7696
|
+
decoding: "async",
|
|
7697
|
+
...brandLogoDisplaySize ? {
|
|
7698
|
+
height: brandLogoDisplaySize.height,
|
|
7699
|
+
width: brandLogoDisplaySize.width
|
|
7700
|
+
} : {},
|
|
7701
|
+
onLoad: (event) => {
|
|
7702
|
+
const img = event.currentTarget;
|
|
7703
|
+
const display = snapBrandLogoDisplaySize({
|
|
7704
|
+
naturalHeight: img.naturalHeight,
|
|
7705
|
+
naturalWidth: img.naturalWidth,
|
|
7706
|
+
surface: "header"
|
|
7707
|
+
});
|
|
7708
|
+
if (!resolvedBrandLogoUrl) return;
|
|
7709
|
+
setBrandLogoDisplay({
|
|
7710
|
+
height: display.height,
|
|
7711
|
+
url: resolvedBrandLogoUrl,
|
|
7712
|
+
wide: display.wide,
|
|
7713
|
+
width: display.width
|
|
7714
|
+
});
|
|
7715
|
+
},
|
|
7716
|
+
onError: () => {
|
|
7717
|
+
setFailedLogoUrl(resolvedBrandLogoUrl ?? null);
|
|
7718
|
+
}
|
|
7719
|
+
},
|
|
7720
|
+
resolvedBrandLogoUrl
|
|
7721
|
+
)
|
|
7426
7722
|
}
|
|
7427
|
-
)
|
|
7428
|
-
resolvedBrandLabel ? /* @__PURE__ */ (0,
|
|
7723
|
+
) : null,
|
|
7724
|
+
resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
7429
7725
|
] }) : null,
|
|
7430
|
-
/* @__PURE__ */ (0,
|
|
7431
|
-
onReset ? /* @__PURE__ */ (0,
|
|
7726
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__actions", children: [
|
|
7727
|
+
onReset ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7432
7728
|
"button",
|
|
7433
7729
|
{
|
|
7434
7730
|
type: "button",
|
|
@@ -7436,36 +7732,34 @@ function AgentRail({
|
|
|
7436
7732
|
"aria-label": "Start a new conversation",
|
|
7437
7733
|
disabled: !hasVisitorMessages2 || handoffActive && !handoff?.canReset,
|
|
7438
7734
|
onClick: handleReset,
|
|
7439
|
-
children: /* @__PURE__ */ (0,
|
|
7735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(NewChatIcon, {})
|
|
7440
7736
|
}
|
|
7441
7737
|
) : null,
|
|
7442
|
-
onExpandToggle ? /* @__PURE__ */ (0,
|
|
7738
|
+
onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7443
7739
|
"button",
|
|
7444
7740
|
{
|
|
7445
7741
|
type: "button",
|
|
7446
7742
|
className: "agent-rail__expand",
|
|
7447
7743
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
7448
7744
|
onClick: onExpandToggle,
|
|
7449
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
7745
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ExpandIcon, {})
|
|
7450
7746
|
}
|
|
7451
7747
|
) : null
|
|
7452
7748
|
] })
|
|
7453
7749
|
] }) }),
|
|
7454
|
-
/* @__PURE__ */ (0,
|
|
7455
|
-
!hasVisitorMessages2 ? /* @__PURE__ */ (0,
|
|
7456
|
-
greeting?.role === "agent" ? /* @__PURE__ */ (0,
|
|
7750
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: threadRef, className: "agent-rail__thread", children: [
|
|
7751
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
7752
|
+
greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7457
7753
|
MessageBubble,
|
|
7458
7754
|
{
|
|
7459
|
-
showProvenance:
|
|
7460
|
-
handoff?.page?.enabled || handoffActive
|
|
7461
|
-
),
|
|
7755
|
+
showProvenance: true,
|
|
7462
7756
|
message: greeting,
|
|
7463
7757
|
bookingDisabled: isBusy || handoffActive,
|
|
7464
7758
|
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
7465
7759
|
onBook
|
|
7466
7760
|
}
|
|
7467
7761
|
) : null,
|
|
7468
|
-
showIdleFollowUps ? /* @__PURE__ */ (0,
|
|
7762
|
+
showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7469
7763
|
FollowUpChips,
|
|
7470
7764
|
{
|
|
7471
7765
|
suggestions: state.followUps,
|
|
@@ -7474,7 +7768,7 @@ function AgentRail({
|
|
|
7474
7768
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
7475
7769
|
}
|
|
7476
7770
|
) }) : null,
|
|
7477
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
7771
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7478
7772
|
AgentActivityBubble,
|
|
7479
7773
|
{
|
|
7480
7774
|
brandLabel: resolvedBrandLabel,
|
|
@@ -7483,7 +7777,7 @@ function AgentRail({
|
|
|
7483
7777
|
steps: activitySteps
|
|
7484
7778
|
}
|
|
7485
7779
|
) : null,
|
|
7486
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
7780
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7487
7781
|
VisitorToolResultView,
|
|
7488
7782
|
{
|
|
7489
7783
|
result,
|
|
@@ -7492,7 +7786,7 @@ function AgentRail({
|
|
|
7492
7786
|
},
|
|
7493
7787
|
result.id
|
|
7494
7788
|
)),
|
|
7495
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
7789
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7496
7790
|
HumanInputCard,
|
|
7497
7791
|
{
|
|
7498
7792
|
request,
|
|
@@ -7501,129 +7795,195 @@ function AgentRail({
|
|
|
7501
7795
|
request.requestId
|
|
7502
7796
|
))
|
|
7503
7797
|
] }) : null,
|
|
7504
|
-
transcriptMessages.map((message, index) =>
|
|
7505
|
-
"
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
result.id
|
|
7516
|
-
)) : null,
|
|
7517
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7518
|
-
MessageBubble,
|
|
7519
|
-
{
|
|
7520
|
-
showProvenance: Boolean(
|
|
7521
|
-
handoff?.page?.enabled || handoffActive
|
|
7522
|
-
),
|
|
7523
|
-
message,
|
|
7524
|
-
bookingDisabled: isBusy || handoffActive,
|
|
7525
|
-
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
7526
|
-
offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
|
|
7527
|
-
onBook
|
|
7528
|
-
}
|
|
7529
|
-
),
|
|
7530
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7531
|
-
MessageActions,
|
|
7532
|
-
{
|
|
7533
|
-
answeredAt: message.createdAt,
|
|
7534
|
-
copyText: hideToolCardFences(message.text).trim() || message.text,
|
|
7535
|
-
readAloud,
|
|
7536
|
-
receiptSteps,
|
|
7537
|
-
onOpenReceipt: receiptSteps ? openReceipt : void 0,
|
|
7538
|
-
onRegenerate: onRegenerate ? handleRegenerate : void 0,
|
|
7539
|
-
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
7540
|
-
}
|
|
7541
|
-
) : null,
|
|
7542
|
-
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
7543
|
-
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7544
|
-
AgentActivityBubble,
|
|
7545
|
-
{
|
|
7546
|
-
brandLabel: resolvedBrandLabel,
|
|
7547
|
-
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
7548
|
-
failed: state.phase === "error",
|
|
7549
|
-
steps: activitySteps
|
|
7550
|
-
}
|
|
7551
|
-
) : null,
|
|
7552
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7798
|
+
transcriptMessages.map((message, index) => {
|
|
7799
|
+
const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
|
|
7800
|
+
const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
|
|
7801
|
+
const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
|
|
7802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7803
|
+
"div",
|
|
7804
|
+
{
|
|
7805
|
+
ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
|
|
7806
|
+
className: "agent-rail__turn-block",
|
|
7807
|
+
children: [
|
|
7808
|
+
message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7553
7809
|
VisitorToolResultView,
|
|
7554
7810
|
{
|
|
7555
|
-
result
|
|
7556
|
-
disabled: semanticSurfaceDisabled,
|
|
7557
|
-
onToolInput
|
|
7811
|
+
result
|
|
7558
7812
|
},
|
|
7559
7813
|
result.id
|
|
7560
|
-
)),
|
|
7561
|
-
|
|
7562
|
-
|
|
7814
|
+
)) : null,
|
|
7815
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7816
|
+
MessageBubble,
|
|
7563
7817
|
{
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7818
|
+
showProvenance: true,
|
|
7819
|
+
message,
|
|
7820
|
+
showSearchReferences: false,
|
|
7821
|
+
bookingDisabled: isBusy || handoffActive,
|
|
7822
|
+
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
7823
|
+
offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
|
|
7824
|
+
onBook
|
|
7825
|
+
}
|
|
7826
|
+
),
|
|
7827
|
+
showAnswerActions || showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
|
|
7828
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-actions", children: [
|
|
7829
|
+
showAnswerActions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7830
|
+
MessageActions,
|
|
7831
|
+
{
|
|
7832
|
+
answeredAt: message.createdAt,
|
|
7833
|
+
copyText: hideToolCardFences(message.text).trim() || message.text,
|
|
7834
|
+
readAloud,
|
|
7835
|
+
receiptSteps,
|
|
7836
|
+
onOpenReceipt: receiptSteps ? () => openReceipt() : void 0,
|
|
7837
|
+
onRegenerate: onRegenerate ? handleRegenerate : void 0,
|
|
7838
|
+
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
7839
|
+
}
|
|
7840
|
+
) : null,
|
|
7841
|
+
showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7842
|
+
"button",
|
|
7843
|
+
{
|
|
7844
|
+
className: "agent-rail__sources-button",
|
|
7845
|
+
type: "button",
|
|
7846
|
+
"aria-expanded": expandedSourcesMessageId === message.id,
|
|
7847
|
+
"aria-controls": `agent-rail-sources-${message.id}`,
|
|
7848
|
+
onClick: () => setExpandedSourcesMessageId(
|
|
7849
|
+
(current) => current === message.id ? null : message.id
|
|
7850
|
+
),
|
|
7851
|
+
children: [
|
|
7852
|
+
"Explore More",
|
|
7853
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7854
|
+
"span",
|
|
7855
|
+
{
|
|
7856
|
+
className: "agent-rail__sources-button-chevron",
|
|
7857
|
+
"aria-hidden": "true",
|
|
7858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon, {})
|
|
7859
|
+
}
|
|
7860
|
+
)
|
|
7861
|
+
]
|
|
7862
|
+
}
|
|
7863
|
+
) : null
|
|
7864
|
+
] }),
|
|
7865
|
+
showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7866
|
+
"div",
|
|
7867
|
+
{
|
|
7868
|
+
id: `agent-rail-sources-${message.id}`,
|
|
7869
|
+
className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
|
|
7870
|
+
role: "region",
|
|
7871
|
+
"aria-label": "Explore More",
|
|
7872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7873
|
+
SearchReferences,
|
|
7874
|
+
{
|
|
7875
|
+
results: message.searchResults ?? [],
|
|
7876
|
+
mode: "sources"
|
|
7877
|
+
}
|
|
7878
|
+
) })
|
|
7879
|
+
}
|
|
7880
|
+
) : null
|
|
7881
|
+
] }) : null,
|
|
7882
|
+
message.role === "agent" && !message.streaming ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7883
|
+
SearchReferences,
|
|
7884
|
+
{
|
|
7885
|
+
results: message.searchResults ?? [],
|
|
7886
|
+
mode: "actions"
|
|
7887
|
+
}
|
|
7888
|
+
) : null,
|
|
7889
|
+
showAnswerActions && !handoffActive && showLearnMore ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7890
|
+
LearnMore,
|
|
7891
|
+
{
|
|
7892
|
+
results: message.searchResults ?? [],
|
|
7893
|
+
disabled: isBusy || !(onFollowUpSelect || onSubmit),
|
|
7894
|
+
onSelect: handleFollowUpSelect
|
|
7895
|
+
}
|
|
7896
|
+
) : null,
|
|
7897
|
+
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7898
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7899
|
+
AgentActivityBubble,
|
|
7900
|
+
{
|
|
7901
|
+
brandLabel: resolvedBrandLabel,
|
|
7902
|
+
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
7903
|
+
failed: state.phase === "error",
|
|
7904
|
+
steps: activitySteps
|
|
7905
|
+
}
|
|
7906
|
+
) : null,
|
|
7907
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7908
|
+
VisitorToolResultView,
|
|
7909
|
+
{
|
|
7910
|
+
result,
|
|
7911
|
+
disabled: semanticSurfaceDisabled,
|
|
7912
|
+
onToolInput
|
|
7913
|
+
},
|
|
7914
|
+
result.id
|
|
7915
|
+
)),
|
|
7916
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7917
|
+
HumanInputCard,
|
|
7918
|
+
{
|
|
7919
|
+
request,
|
|
7920
|
+
onRespond: onInputResponse
|
|
7921
|
+
},
|
|
7922
|
+
request.requestId
|
|
7923
|
+
))
|
|
7924
|
+
] }) : null
|
|
7925
|
+
]
|
|
7926
|
+
},
|
|
7927
|
+
message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
|
|
7928
|
+
);
|
|
7929
|
+
}),
|
|
7930
|
+
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BookingCardLoader, {}) : null,
|
|
7931
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
7932
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
7933
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: "Something went wrong" }),
|
|
7934
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: state.error })
|
|
7579
7935
|
] }),
|
|
7580
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
7936
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
7581
7937
|
] }) : null
|
|
7582
7938
|
] }) }),
|
|
7583
|
-
|
|
7584
|
-
"
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
handoffStatus === "ai" ? /* @__PURE__ */ (0,
|
|
7939
|
+
handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
|
|
7940
|
+
handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
|
|
7941
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7942
|
+
"p",
|
|
7943
|
+
{
|
|
7944
|
+
className: "agent-rail__handoff-status",
|
|
7945
|
+
role: "status",
|
|
7946
|
+
"aria-live": "polite",
|
|
7947
|
+
children: !handoff.page ? "Checking conversation\u2026" : handoffStatus === "human" ? "Connected with support" : handoffStatus === "queued" ? "Waiting for a representative" : handoffStatus === "requesting" ? "Connecting you to support\u2026" : handoffStatus === "resolved" ? "Your conversation with support has ended" : handoffStatus === "failed" ? "We couldn\u2019t connect you to support" : "Need a person?"
|
|
7948
|
+
}
|
|
7949
|
+
),
|
|
7950
|
+
handoffStatus === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7595
7951
|
"button",
|
|
7596
7952
|
{
|
|
7597
7953
|
type: "button",
|
|
7954
|
+
className: "agent-rail__handoff-cta",
|
|
7598
7955
|
disabled: handoff.busy || handoff.hasPending || isBusy,
|
|
7599
7956
|
onClick: () => void handoff.start(),
|
|
7600
7957
|
children: "Talk to a person"
|
|
7601
7958
|
}
|
|
7602
7959
|
) : null,
|
|
7603
|
-
handoffStatus === "resolved" ? /* @__PURE__ */ (0,
|
|
7960
|
+
handoffStatus === "resolved" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7604
7961
|
"button",
|
|
7605
7962
|
{
|
|
7606
7963
|
type: "button",
|
|
7964
|
+
className: "agent-rail__handoff-action",
|
|
7607
7965
|
disabled: handoff.busy || handoff.hasPending,
|
|
7608
7966
|
onClick: () => void handoff.returnToAI(),
|
|
7609
7967
|
children: "Return to AI"
|
|
7610
7968
|
}
|
|
7611
7969
|
) : null,
|
|
7612
|
-
handoffStatus === "failed" && onReset ? /* @__PURE__ */ (0,
|
|
7970
|
+
handoffStatus === "failed" && onReset ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7613
7971
|
"button",
|
|
7614
7972
|
{
|
|
7615
7973
|
type: "button",
|
|
7974
|
+
className: "agent-rail__handoff-action",
|
|
7616
7975
|
disabled: !handoff.canReset,
|
|
7617
7976
|
onClick: handleReset,
|
|
7618
7977
|
children: "Start a new conversation"
|
|
7619
7978
|
}
|
|
7620
7979
|
) : null,
|
|
7621
|
-
handoff.error ? /* @__PURE__ */ (0,
|
|
7622
|
-
|
|
7623
|
-
/* @__PURE__ */ (0,
|
|
7980
|
+
handoff.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__handoff-error", role: "alert", children: [
|
|
7981
|
+
handoff.error,
|
|
7982
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7624
7983
|
"button",
|
|
7625
7984
|
{
|
|
7626
7985
|
type: "button",
|
|
7986
|
+
className: "agent-rail__handoff-action",
|
|
7627
7987
|
disabled: handoff.busy,
|
|
7628
7988
|
onClick: () => void handoff.retry(),
|
|
7629
7989
|
children: "Retry"
|
|
@@ -7631,8 +7991,17 @@ function AgentRail({
|
|
|
7631
7991
|
)
|
|
7632
7992
|
] }) : null
|
|
7633
7993
|
] }) : null,
|
|
7634
|
-
/* @__PURE__ */ (0,
|
|
7635
|
-
|
|
7994
|
+
showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7995
|
+
"a",
|
|
7996
|
+
{
|
|
7997
|
+
href: disclaimerLink,
|
|
7998
|
+
rel: "noopener noreferrer",
|
|
7999
|
+
target: "_blank",
|
|
8000
|
+
children: resolvedDisclaimerLabel
|
|
8001
|
+
}
|
|
8002
|
+
) : resolvedDisclaimerLabel }) }) : null,
|
|
8003
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
|
|
8004
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7636
8005
|
LocationConsent,
|
|
7637
8006
|
{
|
|
7638
8007
|
request: locationRequest,
|
|
@@ -7640,7 +8009,7 @@ function AgentRail({
|
|
|
7640
8009
|
},
|
|
7641
8010
|
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
7642
8011
|
),
|
|
7643
|
-
showJumpToLatest ? /* @__PURE__ */ (0,
|
|
8012
|
+
showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7644
8013
|
"button",
|
|
7645
8014
|
{
|
|
7646
8015
|
type: "button",
|
|
@@ -7648,10 +8017,10 @@ function AgentRail({
|
|
|
7648
8017
|
"aria-label": "Jump to the latest message",
|
|
7649
8018
|
title: "Jump to the latest message",
|
|
7650
8019
|
onClick: scrollToLatest,
|
|
7651
|
-
children: /* @__PURE__ */ (0,
|
|
8020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon, {})
|
|
7652
8021
|
}
|
|
7653
8022
|
) : null,
|
|
7654
|
-
/* @__PURE__ */ (0,
|
|
8023
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7655
8024
|
Composer,
|
|
7656
8025
|
{
|
|
7657
8026
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -7668,11 +8037,11 @@ function AgentRail({
|
|
|
7668
8037
|
},
|
|
7669
8038
|
`${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
|
|
7670
8039
|
),
|
|
7671
|
-
poweredByLabel ? /* @__PURE__ */ (0,
|
|
8040
|
+
poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: poweredByLabel }) }) }) : null
|
|
7672
8041
|
] })
|
|
7673
8042
|
] }),
|
|
7674
|
-
/* @__PURE__ */ (0,
|
|
7675
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */ (0,
|
|
8043
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
8044
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7676
8045
|
AnswerReceiptDialog,
|
|
7677
8046
|
{
|
|
7678
8047
|
brandLabel: resolvedBrandLabel,
|
|
@@ -7686,10 +8055,10 @@ function AgentRail({
|
|
|
7686
8055
|
}
|
|
7687
8056
|
|
|
7688
8057
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
7689
|
-
var
|
|
7690
|
-
var
|
|
8058
|
+
var import_react19 = require("react");
|
|
8059
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7691
8060
|
function ChatSparkIcon() {
|
|
7692
|
-
return /* @__PURE__ */ (0,
|
|
8061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7693
8062
|
"svg",
|
|
7694
8063
|
{
|
|
7695
8064
|
className: "assist-edge-tab__chat-spark",
|
|
@@ -7697,7 +8066,7 @@ function ChatSparkIcon() {
|
|
|
7697
8066
|
fill: "none",
|
|
7698
8067
|
"aria-hidden": "true",
|
|
7699
8068
|
children: [
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
8069
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7701
8070
|
"path",
|
|
7702
8071
|
{
|
|
7703
8072
|
className: "assist-edge-tab__spark assist-edge-tab__spark--a",
|
|
@@ -7705,7 +8074,7 @@ function ChatSparkIcon() {
|
|
|
7705
8074
|
fill: "currentColor"
|
|
7706
8075
|
}
|
|
7707
8076
|
),
|
|
7708
|
-
/* @__PURE__ */ (0,
|
|
8077
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7709
8078
|
"path",
|
|
7710
8079
|
{
|
|
7711
8080
|
className: "assist-edge-tab__spark assist-edge-tab__spark--b",
|
|
@@ -7713,8 +8082,8 @@ function ChatSparkIcon() {
|
|
|
7713
8082
|
fill: "currentColor"
|
|
7714
8083
|
}
|
|
7715
8084
|
),
|
|
7716
|
-
/* @__PURE__ */ (0,
|
|
7717
|
-
/* @__PURE__ */ (0,
|
|
8085
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { className: "assist-edge-tab__bot", children: [
|
|
8086
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7718
8087
|
"path",
|
|
7719
8088
|
{
|
|
7720
8089
|
d: "M11.15 5.2V3.05",
|
|
@@ -7723,8 +8092,8 @@ function ChatSparkIcon() {
|
|
|
7723
8092
|
strokeLinecap: "round"
|
|
7724
8093
|
}
|
|
7725
8094
|
),
|
|
7726
|
-
/* @__PURE__ */ (0,
|
|
7727
|
-
/* @__PURE__ */ (0,
|
|
8095
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
|
|
8096
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7728
8097
|
"rect",
|
|
7729
8098
|
{
|
|
7730
8099
|
x: "3.55",
|
|
@@ -7736,7 +8105,7 @@ function ChatSparkIcon() {
|
|
|
7736
8105
|
strokeWidth: "1.9"
|
|
7737
8106
|
}
|
|
7738
8107
|
),
|
|
7739
|
-
/* @__PURE__ */ (0,
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7740
8109
|
"circle",
|
|
7741
8110
|
{
|
|
7742
8111
|
className: "assist-edge-tab__eye",
|
|
@@ -7746,7 +8115,7 @@ function ChatSparkIcon() {
|
|
|
7746
8115
|
fill: "currentColor"
|
|
7747
8116
|
}
|
|
7748
8117
|
),
|
|
7749
|
-
/* @__PURE__ */ (0,
|
|
8118
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7750
8119
|
"circle",
|
|
7751
8120
|
{
|
|
7752
8121
|
className: "assist-edge-tab__eye assist-edge-tab__eye--r",
|
|
@@ -7763,40 +8132,72 @@ function ChatSparkIcon() {
|
|
|
7763
8132
|
}
|
|
7764
8133
|
function TabMarkIcon({
|
|
7765
8134
|
customIconUrl,
|
|
7766
|
-
logoUrl
|
|
8135
|
+
logoUrl,
|
|
8136
|
+
chip = false
|
|
7767
8137
|
}) {
|
|
7768
8138
|
const custom = customIconUrl?.trim();
|
|
7769
8139
|
const logo = logoUrl?.trim();
|
|
7770
|
-
const [customFailed, setCustomFailed] = (0,
|
|
7771
|
-
const [logoFailed, setLogoFailed] = (0,
|
|
8140
|
+
const [customFailed, setCustomFailed] = (0, import_react19.useState)(false);
|
|
8141
|
+
const [logoFailed, setLogoFailed] = (0, import_react19.useState)(false);
|
|
8142
|
+
const [markDisplay, setMarkDisplay] = (0, import_react19.useState)(null);
|
|
8143
|
+
function applyLauncherLogoSize(img, sourceUrl) {
|
|
8144
|
+
if (!chip) return;
|
|
8145
|
+
const display = snapBrandLogoDisplaySize({
|
|
8146
|
+
naturalHeight: img.naturalHeight,
|
|
8147
|
+
naturalWidth: img.naturalWidth,
|
|
8148
|
+
surface: "launcher"
|
|
8149
|
+
});
|
|
8150
|
+
setMarkDisplay({
|
|
8151
|
+
url: sourceUrl,
|
|
8152
|
+
width: display.width,
|
|
8153
|
+
height: display.height,
|
|
8154
|
+
wide: display.wide
|
|
8155
|
+
});
|
|
8156
|
+
}
|
|
8157
|
+
const chipMarkStyle = chip && markDisplay ? {
|
|
8158
|
+
width: `${markDisplay.width}px`,
|
|
8159
|
+
height: `${markDisplay.height}px`
|
|
8160
|
+
} : void 0;
|
|
7772
8161
|
if (custom && !customFailed) {
|
|
7773
|
-
return /* @__PURE__ */ (0,
|
|
8162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7774
8163
|
"img",
|
|
7775
8164
|
{
|
|
7776
8165
|
alt: "",
|
|
7777
8166
|
"aria-hidden": true,
|
|
7778
|
-
className: "assist-edge-tab__custom-icon"
|
|
8167
|
+
className: `assist-edge-tab__custom-icon as-brand-logo-img${chip ? " assist-edge-tab__custom-icon--chip" : ""}`,
|
|
7779
8168
|
src: custom,
|
|
8169
|
+
decoding: "async",
|
|
8170
|
+
style: markDisplay?.url === custom ? chipMarkStyle : void 0,
|
|
8171
|
+
onLoad: (event) => {
|
|
8172
|
+
if (chip) {
|
|
8173
|
+
applyLauncherLogoSize(event.currentTarget, custom);
|
|
8174
|
+
}
|
|
8175
|
+
},
|
|
7780
8176
|
onError: () => setCustomFailed(true)
|
|
7781
8177
|
}
|
|
7782
8178
|
);
|
|
7783
8179
|
}
|
|
7784
8180
|
if (logo && !logoFailed) {
|
|
7785
|
-
return /* @__PURE__ */ (0,
|
|
8181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7786
8182
|
"img",
|
|
7787
8183
|
{
|
|
7788
8184
|
alt: "",
|
|
7789
8185
|
"aria-hidden": true,
|
|
7790
|
-
className: "assist-edge-tab__logo"
|
|
8186
|
+
className: `assist-edge-tab__logo as-brand-logo-img${chip ? " assist-edge-tab__logo--chip" : ""}${chip && markDisplay?.url === logo && markDisplay.wide ? " assist-edge-tab__logo--wide" : ""}`,
|
|
7791
8187
|
src: logo,
|
|
8188
|
+
decoding: "async",
|
|
8189
|
+
style: markDisplay?.url === logo ? chipMarkStyle : void 0,
|
|
8190
|
+
onLoad: (event) => {
|
|
8191
|
+
applyLauncherLogoSize(event.currentTarget, logo);
|
|
8192
|
+
},
|
|
7792
8193
|
onError: () => setLogoFailed(true)
|
|
7793
8194
|
}
|
|
7794
8195
|
);
|
|
7795
8196
|
}
|
|
7796
|
-
return /* @__PURE__ */ (0,
|
|
8197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChatSparkIcon, {});
|
|
7797
8198
|
}
|
|
7798
8199
|
function ChevronLeftIcon() {
|
|
7799
|
-
return /* @__PURE__ */ (0,
|
|
8200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7800
8201
|
"path",
|
|
7801
8202
|
{
|
|
7802
8203
|
d: "M10 4L6 8l4 4",
|
|
@@ -7808,7 +8209,7 @@ function ChevronLeftIcon() {
|
|
|
7808
8209
|
) });
|
|
7809
8210
|
}
|
|
7810
8211
|
function ChevronDownIcon2() {
|
|
7811
|
-
return /* @__PURE__ */ (0,
|
|
8212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7812
8213
|
"path",
|
|
7813
8214
|
{
|
|
7814
8215
|
d: "M4 6l4 4 4-4",
|
|
@@ -7820,7 +8221,7 @@ function ChevronDownIcon2() {
|
|
|
7820
8221
|
) });
|
|
7821
8222
|
}
|
|
7822
8223
|
function DragDots() {
|
|
7823
|
-
return /* @__PURE__ */ (0,
|
|
8224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("i", {}, index)) });
|
|
7824
8225
|
}
|
|
7825
8226
|
var VARIANT_COPY = {
|
|
7826
8227
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -7864,6 +8265,7 @@ function AssistEdgeTab({
|
|
|
7864
8265
|
"--tab-along": `${along}%`,
|
|
7865
8266
|
"--tab-inset": `${inset}px`,
|
|
7866
8267
|
...resolvedBrandColor ? { "--as-brand": resolvedBrandColor } : {},
|
|
8268
|
+
...pill && resolvedBrandColor ? { "--pill-logo-surface": resolvedBrandColor } : {},
|
|
7867
8269
|
...brandForeground ? { "--as-visitor-text": brandForeground } : {},
|
|
7868
8270
|
...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
|
|
7869
8271
|
...fontFamily ? { "--as-font-display": fontFamily } : {},
|
|
@@ -7875,7 +8277,7 @@ function AssistEdgeTab({
|
|
|
7875
8277
|
...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
7876
8278
|
colorScheme: chromeScheme
|
|
7877
8279
|
};
|
|
7878
|
-
return /* @__PURE__ */ (0,
|
|
8280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7879
8281
|
"button",
|
|
7880
8282
|
{
|
|
7881
8283
|
type: "button",
|
|
@@ -7887,15 +8289,16 @@ function AssistEdgeTab({
|
|
|
7887
8289
|
tabIndex: visible ? 0 : -1,
|
|
7888
8290
|
onClick: onOpen,
|
|
7889
8291
|
children: [
|
|
7890
|
-
pill ? /* @__PURE__ */ (0,
|
|
7891
|
-
/* @__PURE__ */ (0,
|
|
8292
|
+
pill ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
8293
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7892
8294
|
"span",
|
|
7893
8295
|
{
|
|
7894
8296
|
className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
|
|
7895
8297
|
"aria-hidden": "true",
|
|
7896
|
-
children: /* @__PURE__ */ (0,
|
|
8298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7897
8299
|
TabMarkIcon,
|
|
7898
8300
|
{
|
|
8301
|
+
chip: true,
|
|
7899
8302
|
customIconUrl,
|
|
7900
8303
|
logoUrl
|
|
7901
8304
|
},
|
|
@@ -7903,38 +8306,40 @@ function AssistEdgeTab({
|
|
|
7903
8306
|
)
|
|
7904
8307
|
}
|
|
7905
8308
|
),
|
|
7906
|
-
/* @__PURE__ */ (0,
|
|
7907
|
-
/* @__PURE__ */ (0,
|
|
7908
|
-
visibleSubLabel ? /* @__PURE__ */ (0,
|
|
8309
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "assist-edge-tab__text", children: [
|
|
8310
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
8311
|
+
visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
|
|
7909
8312
|
] })
|
|
7910
|
-
] }) : variant === "outline" ? /* @__PURE__ */ (0,
|
|
7911
|
-
/* @__PURE__ */ (0,
|
|
8313
|
+
] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
8314
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7912
8315
|
TabMarkIcon,
|
|
7913
8316
|
{
|
|
8317
|
+
chip: true,
|
|
7914
8318
|
customIconUrl,
|
|
7915
8319
|
logoUrl
|
|
7916
8320
|
},
|
|
7917
8321
|
markSourceKey
|
|
7918
8322
|
) }),
|
|
7919
|
-
/* @__PURE__ */ (0,
|
|
7920
|
-
/* @__PURE__ */ (0,
|
|
8323
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
8324
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronDownIcon2, {})
|
|
7921
8325
|
] }) : null,
|
|
7922
|
-
!pill && variant === "ask" ? /* @__PURE__ */ (0,
|
|
7923
|
-
/* @__PURE__ */ (0,
|
|
7924
|
-
/* @__PURE__ */ (0,
|
|
7925
|
-
/* @__PURE__ */ (0,
|
|
8326
|
+
!pill && variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
8327
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronLeftIcon, {}),
|
|
8328
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
8329
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DragDots, {})
|
|
7926
8330
|
] }) : null,
|
|
7927
|
-
!pill && variant === "fill" ? /* @__PURE__ */ (0,
|
|
7928
|
-
/* @__PURE__ */ (0,
|
|
8331
|
+
!pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
8332
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7929
8333
|
TabMarkIcon,
|
|
7930
8334
|
{
|
|
8335
|
+
chip: true,
|
|
7931
8336
|
customIconUrl,
|
|
7932
8337
|
logoUrl
|
|
7933
8338
|
},
|
|
7934
8339
|
markSourceKey
|
|
7935
8340
|
) }),
|
|
7936
|
-
/* @__PURE__ */ (0,
|
|
7937
|
-
/* @__PURE__ */ (0,
|
|
8341
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
8342
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronLeftIcon, {})
|
|
7938
8343
|
] }) : null
|
|
7939
8344
|
]
|
|
7940
8345
|
}
|
|
@@ -7998,7 +8403,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
|
|
|
7998
8403
|
}
|
|
7999
8404
|
|
|
8000
8405
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
8001
|
-
var
|
|
8406
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8002
8407
|
function AgentWidget({
|
|
8003
8408
|
indexId,
|
|
8004
8409
|
customerId,
|
|
@@ -8018,9 +8423,9 @@ function AgentWidget({
|
|
|
8018
8423
|
}) {
|
|
8019
8424
|
const isMobile = useIsMobile();
|
|
8020
8425
|
const placement = normalizeAgentPlacement(placementInput);
|
|
8021
|
-
const railSlotRef = (0,
|
|
8022
|
-
const [railCollapsed, setRailCollapsed] = (0,
|
|
8023
|
-
const [railExpanded, setRailExpanded] = (0,
|
|
8426
|
+
const railSlotRef = (0, import_react20.useRef)(null);
|
|
8427
|
+
const [railCollapsed, setRailCollapsed] = (0, import_react20.useState)(defaultCollapsed);
|
|
8428
|
+
const [railExpanded, setRailExpanded] = (0, import_react20.useState)(false);
|
|
8024
8429
|
const pageShiftActive = shouldApplyPageShift({
|
|
8025
8430
|
pageShift,
|
|
8026
8431
|
isMobile,
|
|
@@ -8075,7 +8480,7 @@ function AgentWidget({
|
|
|
8075
8480
|
} : {},
|
|
8076
8481
|
...branding?.colors?.border ? { border: branding.colors.border } : {}
|
|
8077
8482
|
};
|
|
8078
|
-
(0,
|
|
8483
|
+
(0, import_react20.useEffect)(() => {
|
|
8079
8484
|
if (!registerPanelController) return;
|
|
8080
8485
|
registerAgentPanelController(customerId, {
|
|
8081
8486
|
open: () => setRailCollapsed(false),
|
|
@@ -8110,7 +8515,7 @@ function AgentWidget({
|
|
|
8110
8515
|
})
|
|
8111
8516
|
);
|
|
8112
8517
|
}
|
|
8113
|
-
(0,
|
|
8518
|
+
(0, import_react20.useEffect)(() => {
|
|
8114
8519
|
if (railCollapsed) return;
|
|
8115
8520
|
const handleKeyDown = (event) => {
|
|
8116
8521
|
if (event.key === "Tab" && (isMobile || railExpanded)) {
|
|
@@ -8144,19 +8549,19 @@ function AgentWidget({
|
|
|
8144
8549
|
window.addEventListener("keydown", handleKeyDown);
|
|
8145
8550
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
8146
8551
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
8147
|
-
return /* @__PURE__ */ (0,
|
|
8148
|
-
/* @__PURE__ */ (0,
|
|
8552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "webless-agent-root", children: [
|
|
8553
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8149
8554
|
"div",
|
|
8150
8555
|
{
|
|
8151
8556
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
8152
|
-
children: /* @__PURE__ */ (0,
|
|
8557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8153
8558
|
"div",
|
|
8154
8559
|
{
|
|
8155
8560
|
ref: railSlotRef,
|
|
8156
8561
|
className: "webless-agent-root__rail-slot",
|
|
8157
8562
|
inert: railCollapsed || void 0,
|
|
8158
8563
|
"aria-hidden": railCollapsed,
|
|
8159
|
-
children: /* @__PURE__ */ (0,
|
|
8564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8160
8565
|
AgentRail,
|
|
8161
8566
|
{
|
|
8162
8567
|
theme,
|
|
@@ -8169,6 +8574,8 @@ function AgentWidget({
|
|
|
8169
8574
|
disclaimerLink: branding?.disclaimerLink,
|
|
8170
8575
|
answerReceipt: branding?.answerReceipt,
|
|
8171
8576
|
readAloud: branding?.readAloud,
|
|
8577
|
+
showLearnMore: branding?.showLearnMore,
|
|
8578
|
+
showSources: branding?.showSources,
|
|
8172
8579
|
state,
|
|
8173
8580
|
handoff,
|
|
8174
8581
|
mobileFullscreen: isMobile && !railCollapsed,
|
|
@@ -8194,7 +8601,7 @@ function AgentWidget({
|
|
|
8194
8601
|
)
|
|
8195
8602
|
}
|
|
8196
8603
|
),
|
|
8197
|
-
railCollapsed ? /* @__PURE__ */ (0,
|
|
8604
|
+
railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8198
8605
|
AssistEdgeTab,
|
|
8199
8606
|
{
|
|
8200
8607
|
variant: placement.variant,
|
|
@@ -8221,10 +8628,10 @@ function AgentWidget({
|
|
|
8221
8628
|
}
|
|
8222
8629
|
|
|
8223
8630
|
// src/react/components/AgentTranscript/AgentTranscript.tsx
|
|
8224
|
-
var
|
|
8631
|
+
var import_react21 = require("react");
|
|
8225
8632
|
|
|
8226
8633
|
// src/react/components/AgentTranscript/TranscriptActivity.tsx
|
|
8227
|
-
var
|
|
8634
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8228
8635
|
var statusLabels = {
|
|
8229
8636
|
started: "No result recorded",
|
|
8230
8637
|
completed: "",
|
|
@@ -8234,33 +8641,33 @@ var statusLabels = {
|
|
|
8234
8641
|
function RecordedResult({
|
|
8235
8642
|
result
|
|
8236
8643
|
}) {
|
|
8237
|
-
if (result.kind === "search") return /* @__PURE__ */ (0,
|
|
8644
|
+
if (result.kind === "search") return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SearchReferences, { results: [result] });
|
|
8238
8645
|
if (result.kind === "booking") {
|
|
8239
8646
|
const card = result.card;
|
|
8240
8647
|
if (card.type === "booking_offer")
|
|
8241
|
-
return /* @__PURE__ */ (0,
|
|
8648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BookingCard, { readOnly: true, offer: card });
|
|
8242
8649
|
if (card.type === "booking_confirmed")
|
|
8243
|
-
return /* @__PURE__ */ (0,
|
|
8650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { children: [
|
|
8244
8651
|
"Booking confirmed",
|
|
8245
8652
|
card.startTime ? ` \xB7 ${card.startTime}` : ""
|
|
8246
8653
|
] });
|
|
8247
|
-
if (card.type === "booking_canceled") return /* @__PURE__ */ (0,
|
|
8248
|
-
return /* @__PURE__ */ (0,
|
|
8654
|
+
if (card.type === "booking_canceled") return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { children: "Booking canceled" });
|
|
8655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { children: "Information requested" });
|
|
8249
8656
|
}
|
|
8250
|
-
return /* @__PURE__ */ (0,
|
|
8657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VisitorToolResultView, { disabled: true, result });
|
|
8251
8658
|
}
|
|
8252
8659
|
function TranscriptActivity({
|
|
8253
8660
|
activity
|
|
8254
8661
|
}) {
|
|
8255
8662
|
const result = activity.result?.kind === "hidden" ? void 0 : activity.result;
|
|
8256
|
-
const heading = /* @__PURE__ */ (0,
|
|
8257
|
-
/* @__PURE__ */ (0,
|
|
8258
|
-
activity.status !== "completed" ? /* @__PURE__ */ (0,
|
|
8663
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
8664
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: activity.category === "specialist" ? `Specialist \xB7 ${activity.label}` : activity.label }),
|
|
8665
|
+
activity.status !== "completed" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "agent-transcript__activity-status", children: statusLabels[activity.status] }) : null
|
|
8259
8666
|
] });
|
|
8260
|
-
return /* @__PURE__ */ (0,
|
|
8261
|
-
/* @__PURE__ */ (0,
|
|
8262
|
-
/* @__PURE__ */ (0,
|
|
8263
|
-
] }) : /* @__PURE__ */ (0,
|
|
8667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "agent-transcript__activity", "data-status": activity.status, children: result ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("details", { children: [
|
|
8668
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("summary", { className: "agent-transcript__activity-heading", children: heading }),
|
|
8669
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "agent-transcript__activity-result", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RecordedResult, { result }) })
|
|
8670
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "agent-transcript__activity-heading", children: heading }) });
|
|
8264
8671
|
}
|
|
8265
8672
|
|
|
8266
8673
|
// src/react/components/AgentTranscript/group-activities.ts
|
|
@@ -8298,7 +8705,7 @@ function groupTranscriptActivities(activities) {
|
|
|
8298
8705
|
}
|
|
8299
8706
|
|
|
8300
8707
|
// src/react/components/AgentTranscript/AgentTranscript.tsx
|
|
8301
|
-
var
|
|
8708
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8302
8709
|
var timestampFormat = new Intl.DateTimeFormat("en-US", {
|
|
8303
8710
|
month: "short",
|
|
8304
8711
|
day: "numeric",
|
|
@@ -8329,7 +8736,7 @@ function AgentTranscript({
|
|
|
8329
8736
|
...activity
|
|
8330
8737
|
}))
|
|
8331
8738
|
].sort((left, right) => left.createdAt - right.createdAt);
|
|
8332
|
-
return /* @__PURE__ */ (0,
|
|
8739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8333
8740
|
"ol",
|
|
8334
8741
|
{
|
|
8335
8742
|
className: "webless-agent-root agent-transcript not-typeset",
|
|
@@ -8342,15 +8749,15 @@ function AgentTranscript({
|
|
|
8342
8749
|
const previous = entries[index - 1];
|
|
8343
8750
|
const validTimestamp = Number.isFinite(date.getTime());
|
|
8344
8751
|
const showTimestamp = validTimestamp && (previous ? entry.createdAt - previous.createdAt >= 5 * 60 * 1e3 || date.toISOString().slice(0, 10) !== new Date(previous.createdAt).toJSON()?.slice(0, 10) : showInitialTimestamp);
|
|
8345
|
-
return /* @__PURE__ */ (0,
|
|
8346
|
-
showTimestamp ? /* @__PURE__ */ (0,
|
|
8347
|
-
entry.kind === "activity" ? /* @__PURE__ */ (0,
|
|
8752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react21.Fragment, { children: [
|
|
8753
|
+
showTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "agent-transcript__time-marker", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("time", { dateTime: date.toISOString(), children: formatTimestamp(entry.createdAt) }) }) : null,
|
|
8754
|
+
entry.kind === "activity" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranscriptActivity, { activity: entry }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
8348
8755
|
"li",
|
|
8349
8756
|
{
|
|
8350
8757
|
className: `agent-transcript__message agent-transcript__message--${entry.role}`,
|
|
8351
8758
|
children: [
|
|
8352
|
-
/* @__PURE__ */ (0,
|
|
8353
|
-
/* @__PURE__ */ (0,
|
|
8759
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "agent-transcript__meta", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: entry.role === "visitor" ? visitorLabel : agentLabel }) }),
|
|
8760
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8354
8761
|
MessageBubble,
|
|
8355
8762
|
{
|
|
8356
8763
|
message: entry.role === "agent" ? { ...entry, streaming: false } : entry,
|