@webless/agent 0.7.4 → 0.7.5
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 +1 -0
- package/dist/{chunk-GS65OJFL.js → chunk-CD6TKXGT.js} +640 -429
- package/dist/chunk-CD6TKXGT.js.map +1 -0
- package/dist/embed.cjs +688 -477
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +105 -0
- 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 +1 -1
- package/dist/{manifest-sR_C4rh_.d.cts → manifest-DgjT8-tW.d.cts} +23 -3
- package/dist/{manifest-sR_C4rh_.d.ts → manifest-DgjT8-tW.d.ts} +23 -3
- package/dist/react.cjs +684 -473
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +105 -0
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GS65OJFL.js.map +0 -1
package/dist/react.cjs
CHANGED
|
@@ -1357,10 +1357,10 @@ var AgentSession = class {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
this.session = session;
|
|
1359
1359
|
const inputResponses = responses.map(
|
|
1360
|
-
({ requestId, optionId, text }) => ({
|
|
1360
|
+
({ requestId, optionId, text: text2 }) => ({
|
|
1361
1361
|
requestId,
|
|
1362
1362
|
...optionId ? { optionId } : {},
|
|
1363
|
-
...
|
|
1363
|
+
...text2 ? { text: text2 } : {}
|
|
1364
1364
|
})
|
|
1365
1365
|
);
|
|
1366
1366
|
const response = await withCapabilityRefresh(
|
|
@@ -1588,19 +1588,19 @@ function parseVisitorFormFields(value) {
|
|
|
1588
1588
|
const fields = [];
|
|
1589
1589
|
const seen = /* @__PURE__ */ new Set();
|
|
1590
1590
|
for (const item of value) {
|
|
1591
|
-
const
|
|
1592
|
-
const id = asString(
|
|
1593
|
-
const kind = asString(
|
|
1594
|
-
if (!
|
|
1591
|
+
const record2 = asRecord(item);
|
|
1592
|
+
const id = asString(record2?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
1593
|
+
const kind = asString(record2?.kind);
|
|
1594
|
+
if (!record2 || !id || seen.has(id) || !isFieldKind2(kind)) continue;
|
|
1595
1595
|
seen.add(id);
|
|
1596
|
-
const label = asString(
|
|
1596
|
+
const label = asString(record2.label) || id;
|
|
1597
1597
|
fields.push({
|
|
1598
1598
|
id,
|
|
1599
1599
|
kind,
|
|
1600
1600
|
label,
|
|
1601
|
-
placeholder: asString(
|
|
1602
|
-
required:
|
|
1603
|
-
...asString(
|
|
1601
|
+
placeholder: asString(record2.placeholder) || label,
|
|
1602
|
+
required: record2.required !== false,
|
|
1603
|
+
...asString(record2.autocomplete) ? { autocomplete: asString(record2.autocomplete) } : {}
|
|
1604
1604
|
});
|
|
1605
1605
|
if (fields.length >= MAX_FORM_FIELDS) break;
|
|
1606
1606
|
}
|
|
@@ -1631,52 +1631,52 @@ function formatComposerFormMessage(form, values) {
|
|
|
1631
1631
|
return value ? `${field.label}: ${value}` : "";
|
|
1632
1632
|
}).filter(Boolean).join("\n");
|
|
1633
1633
|
}
|
|
1634
|
-
function looksLikeFieldCollection(
|
|
1634
|
+
function looksLikeFieldCollection(text2) {
|
|
1635
1635
|
return /\b(please|need|send|share|enter|provide|add|collect|what|which|use)\b/i.test(
|
|
1636
|
-
|
|
1637
|
-
) || /:\s*$/m.test(
|
|
1636
|
+
text2
|
|
1637
|
+
) || /:\s*$/m.test(text2) || /^[-*•]\s+/m.test(text2);
|
|
1638
1638
|
}
|
|
1639
|
-
function looksLikeBookingCopy(
|
|
1639
|
+
function looksLikeBookingCopy(text2) {
|
|
1640
1640
|
return /book(ing)? (card|a demo|this time)|pick a (date|time)|available (times|slots)|calendly/i.test(
|
|
1641
|
-
|
|
1641
|
+
text2
|
|
1642
1642
|
);
|
|
1643
1643
|
}
|
|
1644
|
-
function echoedLabeledFieldIds(
|
|
1644
|
+
function echoedLabeledFieldIds(text2) {
|
|
1645
1645
|
const ids = /* @__PURE__ */ new Set();
|
|
1646
|
-
if (/\bname\s*:\s+\S+/i.test(
|
|
1647
|
-
if (/\be-?mail\s*:\s+\S+/i.test(
|
|
1648
|
-
if (/\bphone\s*:\s+\S+/i.test(
|
|
1649
|
-
if (/\bcompany\s*:\s+\S+/i.test(
|
|
1646
|
+
if (/\bname\s*:\s+\S+/i.test(text2)) ids.add("name");
|
|
1647
|
+
if (/\be-?mail\s*:\s+\S+/i.test(text2)) ids.add("email");
|
|
1648
|
+
if (/\bphone\s*:\s+\S+/i.test(text2)) ids.add("phone");
|
|
1649
|
+
if (/\bcompany\s*:\s+\S+/i.test(text2)) ids.add("company");
|
|
1650
1650
|
return ids;
|
|
1651
1651
|
}
|
|
1652
|
-
function matchLibraryFields(
|
|
1652
|
+
function matchLibraryFields(text2) {
|
|
1653
1653
|
return FIELD_LIBRARY.flatMap((field) => {
|
|
1654
|
-
if (field.exclude?.test(
|
|
1655
|
-
const leftover =
|
|
1654
|
+
if (field.exclude?.test(text2)) {
|
|
1655
|
+
const leftover = text2.replace(field.exclude, " ");
|
|
1656
1656
|
if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
|
|
1657
|
-
} else if (!field.patterns.some((pattern) => pattern.test(
|
|
1657
|
+
} else if (!field.patterns.some((pattern) => pattern.test(text2))) {
|
|
1658
1658
|
return [];
|
|
1659
1659
|
}
|
|
1660
1660
|
const { patterns: _patterns, exclude: _exclude, ...next } = field;
|
|
1661
1661
|
return [next];
|
|
1662
1662
|
}).slice(0, MAX_FORM_FIELDS);
|
|
1663
1663
|
}
|
|
1664
|
-
function looksLikeCompletedActionRecap(
|
|
1665
|
-
const confirmingCreate = /\bshould i create this\b/i.test(
|
|
1666
|
-
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(
|
|
1664
|
+
function looksLikeCompletedActionRecap(text2) {
|
|
1665
|
+
const confirmingCreate = /\bshould i create this\b/i.test(text2);
|
|
1666
|
+
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text2) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text2);
|
|
1667
1667
|
if (echoingFilledFields) {
|
|
1668
|
-
if (looksLikeFieldCollection(
|
|
1669
|
-
const echoed = echoedLabeledFieldIds(
|
|
1670
|
-
if (matchLibraryFields(
|
|
1668
|
+
if (looksLikeFieldCollection(text2)) {
|
|
1669
|
+
const echoed = echoedLabeledFieldIds(text2);
|
|
1670
|
+
if (matchLibraryFields(text2).some((field) => !echoed.has(field.id))) {
|
|
1671
1671
|
return false;
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
1674
|
return true;
|
|
1675
1675
|
}
|
|
1676
|
-
return confirmingCreate && !looksLikeFieldCollection(
|
|
1676
|
+
return confirmingCreate && !looksLikeFieldCollection(text2);
|
|
1677
1677
|
}
|
|
1678
|
-
function inferComposerForm(
|
|
1679
|
-
const cleaned =
|
|
1678
|
+
function inferComposerForm(text2) {
|
|
1679
|
+
const cleaned = text2.trim();
|
|
1680
1680
|
if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
|
|
1681
1681
|
return null;
|
|
1682
1682
|
}
|
|
@@ -1691,8 +1691,8 @@ function resolveComposerForm(input) {
|
|
|
1691
1691
|
if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
|
|
1692
1692
|
return null;
|
|
1693
1693
|
}
|
|
1694
|
-
const
|
|
1695
|
-
if (!
|
|
1694
|
+
const text2 = input.agentText.trim();
|
|
1695
|
+
if (!text2) return null;
|
|
1696
1696
|
const card = input.cards?.find((item) => item.type === "visitor_form");
|
|
1697
1697
|
if (card?.fields && card.fields.length >= MIN_FORM_FIELDS) {
|
|
1698
1698
|
return {
|
|
@@ -1700,7 +1700,7 @@ function resolveComposerForm(input) {
|
|
|
1700
1700
|
fields: card.fields.slice(0, MAX_FORM_FIELDS)
|
|
1701
1701
|
};
|
|
1702
1702
|
}
|
|
1703
|
-
return inferComposerForm(
|
|
1703
|
+
return inferComposerForm(text2);
|
|
1704
1704
|
}
|
|
1705
1705
|
|
|
1706
1706
|
// src/react/lib/tool-card.ts
|
|
@@ -1714,9 +1714,9 @@ function preferBookingOffer(current, next) {
|
|
|
1714
1714
|
}
|
|
1715
1715
|
return next;
|
|
1716
1716
|
}
|
|
1717
|
-
function looksLikeBookingReady(
|
|
1717
|
+
function looksLikeBookingReady(text2) {
|
|
1718
1718
|
return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
|
|
1719
|
-
|
|
1719
|
+
text2
|
|
1720
1720
|
);
|
|
1721
1721
|
}
|
|
1722
1722
|
function bookingOfferIdentityKey(offer) {
|
|
@@ -1740,19 +1740,19 @@ function isEventTypeUri(value) {
|
|
|
1740
1740
|
return /^https:\/\/api\.calendly\.com\/event_types\/[^/]+$/i.test(value);
|
|
1741
1741
|
}
|
|
1742
1742
|
function parseToolCard(value) {
|
|
1743
|
-
const
|
|
1744
|
-
if (!
|
|
1745
|
-
if (
|
|
1746
|
-
const nested = parseToolCard(
|
|
1743
|
+
const record2 = asRecord2(value);
|
|
1744
|
+
if (!record2) return null;
|
|
1745
|
+
if (record2.booking_offer && asString2(record2.type) !== "booking_offer") {
|
|
1746
|
+
const nested = parseToolCard(record2.booking_offer);
|
|
1747
1747
|
if (nested) return nested;
|
|
1748
1748
|
}
|
|
1749
|
-
if (
|
|
1750
|
-
const nested = parseToolCard(
|
|
1749
|
+
if (record2.visitor_booking && asString2(record2.type) !== "booking_confirmed") {
|
|
1750
|
+
const nested = parseToolCard(record2.visitor_booking);
|
|
1751
1751
|
if (nested) return nested;
|
|
1752
1752
|
}
|
|
1753
|
-
const type = asString2(
|
|
1753
|
+
const type = asString2(record2.type);
|
|
1754
1754
|
if (type === "booking_offer") {
|
|
1755
|
-
const eventTypes = Array.isArray(
|
|
1755
|
+
const eventTypes = Array.isArray(record2.eventTypes) ? record2.eventTypes.flatMap((item) => {
|
|
1756
1756
|
const entry = asRecord2(item);
|
|
1757
1757
|
const uri = asString2(entry?.uri);
|
|
1758
1758
|
if (!entry || !uri) return [];
|
|
@@ -1769,7 +1769,7 @@ function parseToolCard(value) {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
];
|
|
1771
1771
|
}) : [];
|
|
1772
|
-
const slots = Array.isArray(
|
|
1772
|
+
const slots = Array.isArray(record2.slots) ? record2.slots.flatMap((item) => {
|
|
1773
1773
|
const entry = asRecord2(item);
|
|
1774
1774
|
const startTime = asString2(entry?.startTime);
|
|
1775
1775
|
if (!entry || !startTime) return [];
|
|
@@ -1785,11 +1785,11 @@ function parseToolCard(value) {
|
|
|
1785
1785
|
return { type: "booking_offer", eventTypes, slots };
|
|
1786
1786
|
}
|
|
1787
1787
|
if (type === "booking_confirmed") {
|
|
1788
|
-
const eventUri = asString2(
|
|
1788
|
+
const eventUri = asString2(record2.eventUri);
|
|
1789
1789
|
if (!isEventUri(eventUri)) return null;
|
|
1790
|
-
const inviteeUri = asString2(
|
|
1791
|
-
const inviteeEmail = asString2(
|
|
1792
|
-
const startTime = asString2(
|
|
1790
|
+
const inviteeUri = asString2(record2.inviteeUri);
|
|
1791
|
+
const inviteeEmail = asString2(record2.inviteeEmail);
|
|
1792
|
+
const startTime = asString2(record2.startTime);
|
|
1793
1793
|
return {
|
|
1794
1794
|
type: "booking_confirmed",
|
|
1795
1795
|
eventUri,
|
|
@@ -1799,12 +1799,12 @@ function parseToolCard(value) {
|
|
|
1799
1799
|
};
|
|
1800
1800
|
}
|
|
1801
1801
|
if (type === "booking_canceled") {
|
|
1802
|
-
const eventUri = asString2(
|
|
1802
|
+
const eventUri = asString2(record2.eventUri);
|
|
1803
1803
|
if (!isEventUri(eventUri)) return null;
|
|
1804
1804
|
return { type: "booking_canceled", eventUri };
|
|
1805
1805
|
}
|
|
1806
1806
|
if (type === "visitor_form") {
|
|
1807
|
-
const fields = parseVisitorFormFields(
|
|
1807
|
+
const fields = parseVisitorFormFields(record2.fields);
|
|
1808
1808
|
if (fields.length < 2) return null;
|
|
1809
1809
|
return { type: "visitor_form", fields };
|
|
1810
1810
|
}
|
|
@@ -1822,33 +1822,33 @@ function formatBookingOfferFence(offer) {
|
|
|
1822
1822
|
].join("\n");
|
|
1823
1823
|
}
|
|
1824
1824
|
function bookingCardFromActionOutput(output) {
|
|
1825
|
-
const
|
|
1826
|
-
const data = asRecord2(
|
|
1825
|
+
const record2 = asRecord2(output);
|
|
1826
|
+
const data = asRecord2(record2?.output) ?? asRecord2(record2?.data) ?? record2;
|
|
1827
1827
|
return parseToolCard(data);
|
|
1828
1828
|
}
|
|
1829
|
-
function ensureBookingOfferText(
|
|
1830
|
-
if (!offer) return
|
|
1831
|
-
if (extractToolCards(
|
|
1832
|
-
return
|
|
1829
|
+
function ensureBookingOfferText(text2, offer) {
|
|
1830
|
+
if (!offer) return text2;
|
|
1831
|
+
if (extractToolCards(text2).some((card) => card.type === "booking_offer")) {
|
|
1832
|
+
return text2;
|
|
1833
1833
|
}
|
|
1834
|
-
const visible = stripToolCards(
|
|
1834
|
+
const visible = stripToolCards(text2).trim() || text2.trim();
|
|
1835
1835
|
return `${visible}
|
|
1836
1836
|
|
|
1837
1837
|
${formatBookingOfferFence(offer)}`;
|
|
1838
1838
|
}
|
|
1839
|
-
function hideToolCardFences(
|
|
1840
|
-
return
|
|
1839
|
+
function hideToolCardFences(text2) {
|
|
1840
|
+
return text2.replace(/```(?:webless-tool-card|json)\s*[\s\S]*?```/gi, "").replace(/```(?:webless-tool-card|json)[\s\S]*$/i, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1841
1841
|
}
|
|
1842
1842
|
var BOOKING_CARD_FALLBACK = "Pick a date and time that works for you.";
|
|
1843
|
-
function looksLikeBookingAvailabilityDump(
|
|
1844
|
-
const cleaned =
|
|
1843
|
+
function looksLikeBookingAvailabilityDump(text2) {
|
|
1844
|
+
const cleaned = text2.trim();
|
|
1845
1845
|
if (!cleaned) return false;
|
|
1846
1846
|
const isoCount = (cleaned.match(/\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/g) ?? []).length;
|
|
1847
1847
|
const utcCount = (cleaned.match(/\bUTC\b/g) ?? []).length;
|
|
1848
1848
|
return isoCount >= 2 || utcCount >= 2 || /api\.calendly\.com|calendly\.com\//i.test(cleaned) || /webless-tool-card/i.test(cleaned);
|
|
1849
1849
|
}
|
|
1850
|
-
function sanitizeBookingOfferCopy(
|
|
1851
|
-
const cleaned = hideToolCardFences(
|
|
1850
|
+
function sanitizeBookingOfferCopy(text2) {
|
|
1851
|
+
const cleaned = hideToolCardFences(text2);
|
|
1852
1852
|
if (!cleaned || looksLikeBookingAvailabilityDump(cleaned)) {
|
|
1853
1853
|
return BOOKING_CARD_FALLBACK;
|
|
1854
1854
|
}
|
|
@@ -1861,9 +1861,9 @@ function visitorTimeZone() {
|
|
|
1861
1861
|
return "UTC";
|
|
1862
1862
|
}
|
|
1863
1863
|
}
|
|
1864
|
-
function extractToolCards(
|
|
1864
|
+
function extractToolCards(text2) {
|
|
1865
1865
|
const cards = [];
|
|
1866
|
-
for (const match of
|
|
1866
|
+
for (const match of text2.matchAll(FENCE_PATTERN)) {
|
|
1867
1867
|
try {
|
|
1868
1868
|
const card = parseToolCard(JSON.parse(match[1] ?? ""));
|
|
1869
1869
|
if (card) cards.push(card);
|
|
@@ -1872,8 +1872,8 @@ function extractToolCards(text) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return cards;
|
|
1874
1874
|
}
|
|
1875
|
-
function stripToolCards(
|
|
1876
|
-
return
|
|
1875
|
+
function stripToolCards(text2) {
|
|
1876
|
+
return text2.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1877
1877
|
}
|
|
1878
1878
|
function localDateKey(date) {
|
|
1879
1879
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -1982,6 +1982,72 @@ function visitorBookingPrefix(booking) {
|
|
|
1982
1982
|
].join("\n");
|
|
1983
1983
|
}
|
|
1984
1984
|
|
|
1985
|
+
// src/runtime/search-discovery.ts
|
|
1986
|
+
function record(value) {
|
|
1987
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
1988
|
+
}
|
|
1989
|
+
function text(value, max = 500) {
|
|
1990
|
+
return typeof value === "string" && value.trim().length > 0 && value.trim().length <= max;
|
|
1991
|
+
}
|
|
1992
|
+
function safeSearchUrl(value) {
|
|
1993
|
+
if (typeof value !== "string") return void 0;
|
|
1994
|
+
try {
|
|
1995
|
+
const url = new URL(value);
|
|
1996
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.href : void 0;
|
|
1997
|
+
} catch {
|
|
1998
|
+
return void 0;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
function parseAgentSearchReferences(value) {
|
|
2002
|
+
const data = record(value);
|
|
2003
|
+
if (!data || !Array.isArray(data.sources) || data.sources.length > 20)
|
|
2004
|
+
return null;
|
|
2005
|
+
const sources = [];
|
|
2006
|
+
for (const value2 of data.sources) {
|
|
2007
|
+
const source = record(value2);
|
|
2008
|
+
if (!source || Object.keys(source).some(
|
|
2009
|
+
(key) => !["id", "title", "url"].includes(key)
|
|
2010
|
+
) || !text(source.id, Infinity) || !text(source.title) || source.url !== void 0 && typeof source.url !== "string")
|
|
2011
|
+
return null;
|
|
2012
|
+
const url = safeSearchUrl(source.url);
|
|
2013
|
+
sources.push({
|
|
2014
|
+
id: source.id.trim(),
|
|
2015
|
+
title: source.title.trim(),
|
|
2016
|
+
...url ? { url } : {}
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
let cta;
|
|
2020
|
+
if (data.cta !== void 0) {
|
|
2021
|
+
const action = record(data.cta);
|
|
2022
|
+
if (!action || Object.keys(action).some((key) => !["label", "url"].includes(key)) || !text(action.label) || action.url !== void 0 && typeof action.url !== "string")
|
|
2023
|
+
return null;
|
|
2024
|
+
const url = safeSearchUrl(action.url);
|
|
2025
|
+
cta = { label: action.label.trim(), ...url ? { url } : {} };
|
|
2026
|
+
}
|
|
2027
|
+
return { sources, ...cta ? { cta } : {} };
|
|
2028
|
+
}
|
|
2029
|
+
function parseAgentSearchDiscoveryOutput(value) {
|
|
2030
|
+
let decoded = value;
|
|
2031
|
+
if (typeof value === "string") {
|
|
2032
|
+
try {
|
|
2033
|
+
decoded = JSON.parse(value);
|
|
2034
|
+
} catch {
|
|
2035
|
+
return null;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
const data = record(decoded);
|
|
2039
|
+
if (!data || Object.keys(data).some(
|
|
2040
|
+
(key) => !["answer", "sources", "cta", "suggestions"].includes(key)
|
|
2041
|
+
) || !text(data.answer, 5e4) || !Array.isArray(data.suggestions) || data.suggestions.length > 8 || !data.suggestions.every((item) => text(item)))
|
|
2042
|
+
return null;
|
|
2043
|
+
const references = parseAgentSearchReferences(data);
|
|
2044
|
+
return references ? {
|
|
2045
|
+
...references,
|
|
2046
|
+
answer: data.answer.trim(),
|
|
2047
|
+
suggestions: data.suggestions.map((item) => item.trim())
|
|
2048
|
+
} : null;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
1985
2051
|
// src/react/persisted-conversation.ts
|
|
1986
2052
|
var CONVERSATION_VERSION = 3;
|
|
1987
2053
|
function conversationKey(storageKeyPrefix, visitorSessionId) {
|
|
@@ -1989,82 +2055,87 @@ function conversationKey(storageKeyPrefix, visitorSessionId) {
|
|
|
1989
2055
|
}
|
|
1990
2056
|
function parseMessage(value) {
|
|
1991
2057
|
if (typeof value !== "object" || value === null) return null;
|
|
1992
|
-
const
|
|
1993
|
-
if (typeof
|
|
2058
|
+
const record2 = value;
|
|
2059
|
+
if (typeof record2.id !== "string" || record2.role !== "agent" && record2.role !== "visitor" || typeof record2.text !== "string" || typeof record2.createdAt !== "number" || !Number.isFinite(record2.createdAt)) {
|
|
1994
2060
|
return null;
|
|
1995
2061
|
}
|
|
1996
|
-
if (
|
|
2062
|
+
if (record2.role === "visitor") {
|
|
1997
2063
|
return {
|
|
1998
|
-
id:
|
|
2064
|
+
id: record2.id,
|
|
1999
2065
|
role: "visitor",
|
|
2000
|
-
text:
|
|
2001
|
-
createdAt:
|
|
2002
|
-
...typeof
|
|
2066
|
+
text: record2.text,
|
|
2067
|
+
createdAt: record2.createdAt,
|
|
2068
|
+
...typeof record2.runtimeText === "string" && record2.runtimeText ? { runtimeText: record2.runtimeText } : {}
|
|
2003
2069
|
};
|
|
2004
2070
|
}
|
|
2071
|
+
const searchResults = Array.isArray(record2.searchResults) ? record2.searchResults.flatMap((value2) => {
|
|
2072
|
+
const result = parseToolResult(value2);
|
|
2073
|
+
return result?.kind === "search" ? [result] : [];
|
|
2074
|
+
}) : [];
|
|
2005
2075
|
return {
|
|
2006
|
-
id:
|
|
2076
|
+
id: record2.id,
|
|
2007
2077
|
role: "agent",
|
|
2008
|
-
|
|
2009
|
-
|
|
2078
|
+
...searchResults.length ? { searchResults } : {},
|
|
2079
|
+
text: record2.text,
|
|
2080
|
+
createdAt: record2.createdAt
|
|
2010
2081
|
};
|
|
2011
2082
|
}
|
|
2012
2083
|
function parseToolStep(value) {
|
|
2013
2084
|
if (typeof value !== "object" || value === null) return null;
|
|
2014
|
-
const
|
|
2015
|
-
if (typeof
|
|
2085
|
+
const record2 = value;
|
|
2086
|
+
if (typeof record2.id !== "string" || record2.kind !== "planning" && record2.kind !== "search" && record2.kind !== "specialist" || typeof record2.label !== "string" || record2.state !== "completed" && record2.state !== "active" && record2.state !== "pending" && record2.state !== "error") {
|
|
2016
2087
|
return null;
|
|
2017
2088
|
}
|
|
2018
2089
|
return {
|
|
2019
|
-
id:
|
|
2020
|
-
kind:
|
|
2021
|
-
label:
|
|
2022
|
-
state:
|
|
2023
|
-
...typeof
|
|
2090
|
+
id: record2.id,
|
|
2091
|
+
kind: record2.kind,
|
|
2092
|
+
label: record2.label,
|
|
2093
|
+
state: record2.state,
|
|
2094
|
+
...typeof record2.detail === "string" && record2.detail ? { detail: record2.detail } : {}
|
|
2024
2095
|
};
|
|
2025
2096
|
}
|
|
2026
2097
|
function parseInputOption(value) {
|
|
2027
2098
|
if (typeof value !== "object" || value === null) return null;
|
|
2028
|
-
const
|
|
2029
|
-
if (typeof
|
|
2099
|
+
const record2 = value;
|
|
2100
|
+
if (typeof record2.id !== "string" || typeof record2.label !== "string") {
|
|
2030
2101
|
return null;
|
|
2031
2102
|
}
|
|
2032
2103
|
return {
|
|
2033
|
-
id:
|
|
2034
|
-
label:
|
|
2035
|
-
...typeof
|
|
2036
|
-
...
|
|
2104
|
+
id: record2.id,
|
|
2105
|
+
label: record2.label,
|
|
2106
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2107
|
+
...record2.style === "default" || record2.style === "primary" || record2.style === "danger" ? { style: record2.style } : {}
|
|
2037
2108
|
};
|
|
2038
2109
|
}
|
|
2039
2110
|
function parseInputRequest(value) {
|
|
2040
2111
|
if (typeof value !== "object" || value === null) return null;
|
|
2041
|
-
const
|
|
2042
|
-
if (typeof
|
|
2112
|
+
const record2 = value;
|
|
2113
|
+
if (typeof record2.requestId !== "string" || record2.kind !== "question" && record2.kind !== "session-limit" && record2.kind !== "tool-approval" || typeof record2.prompt !== "string") {
|
|
2043
2114
|
return null;
|
|
2044
2115
|
}
|
|
2045
|
-
const action =
|
|
2116
|
+
const action = record2.action;
|
|
2046
2117
|
if (typeof action !== "object" || action === null) return null;
|
|
2047
2118
|
const actionRecord = action;
|
|
2048
2119
|
if (typeof actionRecord.callId !== "string" || actionRecord.kind !== "tool-call" || typeof actionRecord.toolName !== "string") {
|
|
2049
2120
|
return null;
|
|
2050
2121
|
}
|
|
2051
|
-
const options = Array.isArray(
|
|
2052
|
-
if (Array.isArray(
|
|
2122
|
+
const options = Array.isArray(record2.options) ? record2.options.map(parseInputOption) : void 0;
|
|
2123
|
+
if (Array.isArray(record2.options) && options?.some((option) => option === null)) {
|
|
2053
2124
|
return null;
|
|
2054
2125
|
}
|
|
2055
|
-
const ui =
|
|
2056
|
-
if (
|
|
2126
|
+
const ui = record2.ui ? parseAgentToolUiSurface(record2.ui) : void 0;
|
|
2127
|
+
if (record2.ui && !ui) return null;
|
|
2057
2128
|
return {
|
|
2058
|
-
requestId:
|
|
2059
|
-
kind:
|
|
2060
|
-
prompt:
|
|
2129
|
+
requestId: record2.requestId,
|
|
2130
|
+
kind: record2.kind,
|
|
2131
|
+
prompt: record2.prompt,
|
|
2061
2132
|
action: {
|
|
2062
2133
|
callId: actionRecord.callId,
|
|
2063
2134
|
kind: "tool-call",
|
|
2064
2135
|
toolName: actionRecord.toolName
|
|
2065
2136
|
},
|
|
2066
|
-
...
|
|
2067
|
-
...
|
|
2137
|
+
...record2.display === "confirmation" || record2.display === "select" || record2.display === "text" ? { display: record2.display } : {},
|
|
2138
|
+
...record2.allowFreeform === true ? { allowFreeform: true } : {},
|
|
2068
2139
|
...options && options.length > 0 ? {
|
|
2069
2140
|
options: options.filter(
|
|
2070
2141
|
(option) => option !== null
|
|
@@ -2075,40 +2146,50 @@ function parseInputRequest(value) {
|
|
|
2075
2146
|
}
|
|
2076
2147
|
function parseToolResult(value) {
|
|
2077
2148
|
if (typeof value !== "object" || value === null) return null;
|
|
2078
|
-
const
|
|
2079
|
-
if (typeof
|
|
2149
|
+
const record2 = value;
|
|
2150
|
+
if (typeof record2.id !== "string" || typeof record2.toolName !== "string" || record2.status !== "completed" && record2.status !== "failed" && record2.status !== "rejected") {
|
|
2080
2151
|
return null;
|
|
2081
2152
|
}
|
|
2082
|
-
if (
|
|
2153
|
+
if (record2.kind === "search" && record2.toolName === "search_discovery" && record2.status === "completed") {
|
|
2154
|
+
const references = parseAgentSearchReferences(record2);
|
|
2155
|
+
return references ? {
|
|
2156
|
+
id: record2.id,
|
|
2157
|
+
toolName: "search_discovery",
|
|
2158
|
+
status: "completed",
|
|
2159
|
+
kind: "search",
|
|
2160
|
+
...references
|
|
2161
|
+
} : null;
|
|
2162
|
+
}
|
|
2163
|
+
if (record2.kind === "input") {
|
|
2083
2164
|
const surface = parseAgentToolUiSurface(
|
|
2084
|
-
|
|
2165
|
+
record2.surface
|
|
2085
2166
|
);
|
|
2086
2167
|
return surface ? {
|
|
2087
|
-
id:
|
|
2088
|
-
toolName:
|
|
2089
|
-
status:
|
|
2168
|
+
id: record2.id,
|
|
2169
|
+
toolName: record2.toolName,
|
|
2170
|
+
status: record2.status,
|
|
2090
2171
|
kind: "input",
|
|
2091
2172
|
surface
|
|
2092
2173
|
} : null;
|
|
2093
2174
|
}
|
|
2094
|
-
if (
|
|
2175
|
+
if (record2.kind === "entity" && typeof record2.title === "string") {
|
|
2095
2176
|
return {
|
|
2096
|
-
id:
|
|
2097
|
-
toolName:
|
|
2098
|
-
status:
|
|
2177
|
+
id: record2.id,
|
|
2178
|
+
toolName: record2.toolName,
|
|
2179
|
+
status: record2.status,
|
|
2099
2180
|
kind: "entity",
|
|
2100
|
-
title:
|
|
2101
|
-
...typeof
|
|
2181
|
+
title: record2.title,
|
|
2182
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2102
2183
|
};
|
|
2103
2184
|
}
|
|
2104
|
-
if (
|
|
2185
|
+
if (record2.kind === "collection" && typeof record2.title === "string" && Array.isArray(record2.items)) {
|
|
2105
2186
|
return {
|
|
2106
|
-
id:
|
|
2107
|
-
toolName:
|
|
2108
|
-
status:
|
|
2187
|
+
id: record2.id,
|
|
2188
|
+
toolName: record2.toolName,
|
|
2189
|
+
status: record2.status,
|
|
2109
2190
|
kind: "collection",
|
|
2110
|
-
title:
|
|
2111
|
-
items:
|
|
2191
|
+
title: record2.title,
|
|
2192
|
+
items: record2.items.flatMap((item) => {
|
|
2112
2193
|
if (typeof item !== "object" || item === null) return [];
|
|
2113
2194
|
const entry = item;
|
|
2114
2195
|
if (typeof entry.title !== "string") return [];
|
|
@@ -2122,26 +2203,26 @@ function parseToolResult(value) {
|
|
|
2122
2203
|
})
|
|
2123
2204
|
};
|
|
2124
2205
|
}
|
|
2125
|
-
if (
|
|
2206
|
+
if (record2.kind === "signature" && typeof record2.title === "string") {
|
|
2126
2207
|
return {
|
|
2127
|
-
id:
|
|
2128
|
-
toolName:
|
|
2129
|
-
status:
|
|
2208
|
+
id: record2.id,
|
|
2209
|
+
toolName: record2.toolName,
|
|
2210
|
+
status: record2.status,
|
|
2130
2211
|
kind: "signature",
|
|
2131
|
-
title:
|
|
2132
|
-
...typeof
|
|
2133
|
-
...typeof
|
|
2212
|
+
title: record2.title,
|
|
2213
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2214
|
+
...typeof record2.statusLabel === "string" ? { statusLabel: record2.statusLabel } : {}
|
|
2134
2215
|
};
|
|
2135
2216
|
}
|
|
2136
|
-
if (
|
|
2217
|
+
if (record2.kind !== "summary" || typeof record2.title !== "string")
|
|
2137
2218
|
return null;
|
|
2138
2219
|
return {
|
|
2139
|
-
id:
|
|
2140
|
-
toolName:
|
|
2141
|
-
status:
|
|
2220
|
+
id: record2.id,
|
|
2221
|
+
toolName: record2.toolName,
|
|
2222
|
+
status: record2.status,
|
|
2142
2223
|
kind: "summary",
|
|
2143
|
-
title:
|
|
2144
|
-
...typeof
|
|
2224
|
+
title: record2.title,
|
|
2225
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2145
2226
|
};
|
|
2146
2227
|
}
|
|
2147
2228
|
function visitorTurnText(message) {
|
|
@@ -2156,29 +2237,29 @@ function loadPersistedAgentConversation(storageKeyPrefix, visitorSessionId) {
|
|
|
2156
2237
|
try {
|
|
2157
2238
|
const value = JSON.parse(raw);
|
|
2158
2239
|
if (typeof value !== "object" || value === null) return null;
|
|
2159
|
-
const
|
|
2160
|
-
if (
|
|
2240
|
+
const record2 = value;
|
|
2241
|
+
if (record2.version !== 1 && record2.version !== 2 && record2.version !== CONVERSATION_VERSION || !Array.isArray(record2.messages) || typeof record2.pending !== "boolean" || typeof record2.streamingText !== "string" || record2.version === CONVERSATION_VERSION && !Array.isArray(record2.toolSteps)) {
|
|
2161
2242
|
return null;
|
|
2162
2243
|
}
|
|
2163
|
-
const messages =
|
|
2244
|
+
const messages = record2.messages.map(parseMessage);
|
|
2164
2245
|
if (messages.some((message) => message === null)) return null;
|
|
2165
|
-
const storedToolSteps = (
|
|
2246
|
+
const storedToolSteps = (record2.version === 2 || record2.version === CONVERSATION_VERSION) && Array.isArray(record2.toolSteps) ? record2.toolSteps : [];
|
|
2166
2247
|
const toolSteps = storedToolSteps.map(parseToolStep);
|
|
2167
2248
|
if (toolSteps.some((step) => step === null)) return null;
|
|
2168
|
-
const storedToolResults =
|
|
2249
|
+
const storedToolResults = record2.version === CONVERSATION_VERSION && Array.isArray(record2.toolResults) ? record2.toolResults : [];
|
|
2169
2250
|
const toolResults = storedToolResults.map(parseToolResult);
|
|
2170
2251
|
if (toolResults.some((result) => result === null)) return null;
|
|
2171
|
-
const storedPendingInputs = Array.isArray(
|
|
2252
|
+
const storedPendingInputs = Array.isArray(record2.pendingInputs) ? record2.pendingInputs : [];
|
|
2172
2253
|
const pendingInputs = storedPendingInputs.map(parseInputRequest);
|
|
2173
2254
|
if (pendingInputs.some((request) => request === null)) return null;
|
|
2174
2255
|
return {
|
|
2175
2256
|
messages: messages.filter(
|
|
2176
2257
|
(message) => message !== null
|
|
2177
2258
|
),
|
|
2178
|
-
pending:
|
|
2179
|
-
streamingText:
|
|
2259
|
+
pending: record2.pending,
|
|
2260
|
+
streamingText: record2.streamingText,
|
|
2180
2261
|
toolSteps: toolSteps.filter((step) => step !== null),
|
|
2181
|
-
...Array.isArray(
|
|
2262
|
+
...Array.isArray(record2.toolResults) ? {
|
|
2182
2263
|
toolResults: toolResults.filter(
|
|
2183
2264
|
(result) => result !== null
|
|
2184
2265
|
)
|
|
@@ -2219,13 +2300,13 @@ function loadPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
|
|
|
2219
2300
|
try {
|
|
2220
2301
|
const value = JSON.parse(raw);
|
|
2221
2302
|
if (typeof value !== "object" || value === null) return null;
|
|
2222
|
-
const
|
|
2223
|
-
if (typeof
|
|
2303
|
+
const record2 = value;
|
|
2304
|
+
if (typeof record2.eventUri !== "string" || !record2.eventUri) return null;
|
|
2224
2305
|
return {
|
|
2225
|
-
eventUri:
|
|
2226
|
-
...typeof
|
|
2227
|
-
...typeof
|
|
2228
|
-
...typeof
|
|
2306
|
+
eventUri: record2.eventUri,
|
|
2307
|
+
...typeof record2.inviteeUri === "string" && record2.inviteeUri ? { inviteeUri: record2.inviteeUri } : {},
|
|
2308
|
+
...typeof record2.inviteeEmail === "string" && record2.inviteeEmail ? { inviteeEmail: record2.inviteeEmail } : {},
|
|
2309
|
+
...typeof record2.startTime === "string" && record2.startTime ? { startTime: record2.startTime } : {}
|
|
2229
2310
|
};
|
|
2230
2311
|
} catch {
|
|
2231
2312
|
return null;
|
|
@@ -2313,10 +2394,10 @@ function safeText(value) {
|
|
|
2313
2394
|
return value.trim().slice(0, MAX_TEXT_LENGTH);
|
|
2314
2395
|
}
|
|
2315
2396
|
function safeHref(value) {
|
|
2316
|
-
const
|
|
2317
|
-
if (!
|
|
2397
|
+
const text2 = safeText(value);
|
|
2398
|
+
if (!text2) return "";
|
|
2318
2399
|
try {
|
|
2319
|
-
const url = new URL(
|
|
2400
|
+
const url = new URL(text2);
|
|
2320
2401
|
return url.protocol === "https:" ? url.toString() : "";
|
|
2321
2402
|
} catch {
|
|
2322
2403
|
return "";
|
|
@@ -2536,6 +2617,22 @@ function finalizeSummaryPresentation(result, proposed) {
|
|
|
2536
2617
|
};
|
|
2537
2618
|
}
|
|
2538
2619
|
function presentVisitorToolResult(result, registry = []) {
|
|
2620
|
+
if (result.toolName === "search_discovery" && result.status === "completed") {
|
|
2621
|
+
const envelope2 = parseAgentToolResultEnvelope(result.output);
|
|
2622
|
+
const search = parseAgentSearchDiscoveryOutput(
|
|
2623
|
+
envelope2?.output ?? result.output
|
|
2624
|
+
);
|
|
2625
|
+
if (search) {
|
|
2626
|
+
return {
|
|
2627
|
+
id: result.callId,
|
|
2628
|
+
toolName: "search_discovery",
|
|
2629
|
+
status: "completed",
|
|
2630
|
+
kind: "search",
|
|
2631
|
+
sources: search.sources,
|
|
2632
|
+
...search.cta ? { cta: search.cta } : {}
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2539
2636
|
const envelope = parseAgentToolResultEnvelope(result.output) ?? providerErrorEnvelope(result.output) ?? legacyBookingEnvelope(result.output);
|
|
2540
2637
|
const proposed = envelope ? resolvePresenterOutput(result, envelope, registry) : null;
|
|
2541
2638
|
if (proposed?.kind === "booking") {
|
|
@@ -2600,8 +2697,8 @@ function presentVisitorToolResult(result, registry = []) {
|
|
|
2600
2697
|
return finalizeSummaryPresentation(result, proposed);
|
|
2601
2698
|
}
|
|
2602
2699
|
function providerErrorEnvelope(output) {
|
|
2603
|
-
const
|
|
2604
|
-
const providerError = asRecord3(
|
|
2700
|
+
const record2 = asRecord3(output);
|
|
2701
|
+
const providerError = asRecord3(record2?.providerError);
|
|
2605
2702
|
const message = safeText(providerError?.message);
|
|
2606
2703
|
const action = safeText(providerError?.action);
|
|
2607
2704
|
if (!message || !action) return null;
|
|
@@ -2657,15 +2754,15 @@ function appendChatCollectiblePrompts(messages, requests) {
|
|
|
2657
2754
|
}
|
|
2658
2755
|
return next;
|
|
2659
2756
|
}
|
|
2660
|
-
function chatInputResponseForText(requests,
|
|
2661
|
-
const trimmed =
|
|
2757
|
+
function chatInputResponseForText(requests, text2) {
|
|
2758
|
+
const trimmed = text2.trim();
|
|
2662
2759
|
if (!trimmed) return null;
|
|
2663
2760
|
const pending = requests.find(isChatCollectibleInputRequest);
|
|
2664
2761
|
if (!pending) return null;
|
|
2665
2762
|
return { requestId: pending.requestId, text: trimmed };
|
|
2666
2763
|
}
|
|
2667
|
-
function normalizeAssistantDedupeKey(
|
|
2668
|
-
return
|
|
2764
|
+
function normalizeAssistantDedupeKey(text2) {
|
|
2765
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
2669
2766
|
}
|
|
2670
2767
|
function isNearDuplicateAssistantText(left, right) {
|
|
2671
2768
|
const a = normalizeAssistantDedupeKey(left);
|
|
@@ -2679,13 +2776,14 @@ function isNearDuplicateAssistantText(left, right) {
|
|
|
2679
2776
|
shorter.slice(0, Math.floor(shorter.length * 0.85))
|
|
2680
2777
|
);
|
|
2681
2778
|
}
|
|
2682
|
-
function appendAgentTurnMessage(messages, displayText) {
|
|
2779
|
+
function appendAgentTurnMessage(messages, displayText, searchResults = []) {
|
|
2683
2780
|
const trimmed = displayText.trim();
|
|
2684
|
-
if (!trimmed) return [...messages];
|
|
2781
|
+
if (!trimmed && searchResults.length === 0) return [...messages];
|
|
2685
2782
|
const agentMessage = {
|
|
2686
2783
|
id: `agent-${Date.now()}`,
|
|
2687
2784
|
role: "agent",
|
|
2688
2785
|
text: trimmed,
|
|
2786
|
+
...searchResults.length ? { searchResults } : {},
|
|
2689
2787
|
createdAt: Date.now()
|
|
2690
2788
|
};
|
|
2691
2789
|
const last = messages.at(-1);
|
|
@@ -3064,7 +3162,14 @@ function useAgentChat({
|
|
|
3064
3162
|
setState((prev) => ({
|
|
3065
3163
|
...prev,
|
|
3066
3164
|
phase: (prev.pendingInputs ?? []).some(shouldRenderVisitorInputCard) ? "waiting-input" : "complete",
|
|
3067
|
-
messages: appendAgentTurnMessage(
|
|
3165
|
+
messages: appendAgentTurnMessage(
|
|
3166
|
+
prev.messages,
|
|
3167
|
+
displayText,
|
|
3168
|
+
(prev.toolResults ?? []).filter((result) => result.kind === "search")
|
|
3169
|
+
),
|
|
3170
|
+
toolResults: (prev.toolResults ?? []).filter(
|
|
3171
|
+
(result) => result.kind !== "search"
|
|
3172
|
+
),
|
|
3068
3173
|
toolSteps: completeActivePlanning(prev.toolSteps),
|
|
3069
3174
|
streamingText: "",
|
|
3070
3175
|
pendingOffer: bookingConfirmed ? null : capturedOffers.at(-1) ?? prev.pendingOffer,
|
|
@@ -4082,9 +4187,111 @@ function FollowUpChips({
|
|
|
4082
4187
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4083
4188
|
var import_react10 = require("react");
|
|
4084
4189
|
|
|
4190
|
+
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4191
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4192
|
+
function SiteIcon() {
|
|
4193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4194
|
+
"svg",
|
|
4195
|
+
{
|
|
4196
|
+
viewBox: "0 0 24 24",
|
|
4197
|
+
width: "18",
|
|
4198
|
+
height: "18",
|
|
4199
|
+
fill: "none",
|
|
4200
|
+
stroke: "currentColor",
|
|
4201
|
+
strokeWidth: "1.5",
|
|
4202
|
+
"aria-hidden": "true",
|
|
4203
|
+
children: [
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4207
|
+
]
|
|
4208
|
+
}
|
|
4209
|
+
);
|
|
4210
|
+
}
|
|
4211
|
+
function SearchReferences({
|
|
4212
|
+
results
|
|
4213
|
+
}) {
|
|
4214
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
4215
|
+
const sources = results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4216
|
+
const url = safeSearchUrl(source.url);
|
|
4217
|
+
const key = url ?? source.id;
|
|
4218
|
+
if (seenSources.has(key)) return [];
|
|
4219
|
+
seenSources.add(key);
|
|
4220
|
+
return [{ ...source, url, key }];
|
|
4221
|
+
});
|
|
4222
|
+
const seenActions = /* @__PURE__ */ new Set();
|
|
4223
|
+
const actions = results.flatMap((result) => {
|
|
4224
|
+
const url = safeSearchUrl(result.cta?.url);
|
|
4225
|
+
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4226
|
+
seenActions.add(url);
|
|
4227
|
+
return [{ label: result.cta.label, url }];
|
|
4228
|
+
});
|
|
4229
|
+
if (!sources.length && !actions.length) return null;
|
|
4230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
|
|
4231
|
+
sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": "Sources", children: [
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { className: "search-references__heading", children: [
|
|
4233
|
+
"Sources",
|
|
4234
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4235
|
+
"svg",
|
|
4236
|
+
{
|
|
4237
|
+
viewBox: "0 0 24 24",
|
|
4238
|
+
width: "14",
|
|
4239
|
+
height: "14",
|
|
4240
|
+
fill: "none",
|
|
4241
|
+
stroke: "currentColor",
|
|
4242
|
+
strokeWidth: "1.75",
|
|
4243
|
+
"aria-hidden": "true",
|
|
4244
|
+
children: [
|
|
4245
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 11v6M12 7v1" })
|
|
4247
|
+
]
|
|
4248
|
+
}
|
|
4249
|
+
) })
|
|
4250
|
+
] }),
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
4252
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
4253
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
|
|
4255
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4256
|
+
"span",
|
|
4257
|
+
{
|
|
4258
|
+
className: "search-references__title",
|
|
4259
|
+
title: source.title,
|
|
4260
|
+
children: source.title
|
|
4261
|
+
}
|
|
4262
|
+
),
|
|
4263
|
+
source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
|
|
4264
|
+
] })
|
|
4265
|
+
] });
|
|
4266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4267
|
+
"a",
|
|
4268
|
+
{
|
|
4269
|
+
className: "search-references__source",
|
|
4270
|
+
href: source.url,
|
|
4271
|
+
target: "_blank",
|
|
4272
|
+
rel: "noopener noreferrer",
|
|
4273
|
+
children: content
|
|
4274
|
+
}
|
|
4275
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
|
|
4276
|
+
}) })
|
|
4277
|
+
] }) : null,
|
|
4278
|
+
actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4279
|
+
"a",
|
|
4280
|
+
{
|
|
4281
|
+
className: "search-references__cta",
|
|
4282
|
+
href: action.url,
|
|
4283
|
+
target: "_blank",
|
|
4284
|
+
rel: "noopener noreferrer",
|
|
4285
|
+
children: action.label
|
|
4286
|
+
},
|
|
4287
|
+
action.url
|
|
4288
|
+
)) }) : null
|
|
4289
|
+
] });
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4085
4292
|
// src/react/components/BookingCard/BookingCard.tsx
|
|
4086
4293
|
var import_react9 = require("react");
|
|
4087
|
-
var
|
|
4294
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4088
4295
|
var BOOKING_STEPS = [
|
|
4089
4296
|
{ id: "date", label: "Date" },
|
|
4090
4297
|
{ id: "time", label: "Time" },
|
|
@@ -4115,7 +4322,7 @@ function calendarCells(year, month) {
|
|
|
4115
4322
|
return cells;
|
|
4116
4323
|
}
|
|
4117
4324
|
function BookingCardLoader() {
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
|
|
4119
4326
|
}
|
|
4120
4327
|
function BookingCard({
|
|
4121
4328
|
disabled = false,
|
|
@@ -4214,14 +4421,14 @@ function BookingCard({
|
|
|
4214
4421
|
})
|
|
4215
4422
|
});
|
|
4216
4423
|
}
|
|
4217
|
-
return /* @__PURE__ */ (0,
|
|
4424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4218
4425
|
"section",
|
|
4219
4426
|
{
|
|
4220
4427
|
className: "booking-card",
|
|
4221
4428
|
"aria-busy": disabled || void 0,
|
|
4222
4429
|
"aria-label": "Book a meeting",
|
|
4223
|
-
children: /* @__PURE__ */ (0,
|
|
4224
|
-
/* @__PURE__ */ (0,
|
|
4430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4225
4432
|
"li",
|
|
4226
4433
|
{
|
|
4227
4434
|
className: [
|
|
@@ -4231,40 +4438,40 @@ function BookingCard({
|
|
|
4231
4438
|
].filter(Boolean).join(" "),
|
|
4232
4439
|
"aria-current": index === stepIndex ? "step" : void 0,
|
|
4233
4440
|
children: [
|
|
4234
|
-
/* @__PURE__ */ (0,
|
|
4235
|
-
/* @__PURE__ */ (0,
|
|
4441
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label })
|
|
4236
4443
|
]
|
|
4237
4444
|
},
|
|
4238
4445
|
item.id
|
|
4239
4446
|
)) }),
|
|
4240
|
-
step === "date" ? /* @__PURE__ */ (0,
|
|
4241
|
-
/* @__PURE__ */ (0,
|
|
4242
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4447
|
+
step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
|
|
4449
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4243
4450
|
"Times in ",
|
|
4244
4451
|
timeZone
|
|
4245
4452
|
] }) : null,
|
|
4246
|
-
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0,
|
|
4453
|
+
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4247
4454
|
"label",
|
|
4248
4455
|
{
|
|
4249
4456
|
className: "booking-card__field",
|
|
4250
4457
|
htmlFor: `${fieldId}-type`,
|
|
4251
4458
|
children: [
|
|
4252
|
-
/* @__PURE__ */ (0,
|
|
4253
|
-
/* @__PURE__ */ (0,
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Meeting" }),
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4254
4461
|
"select",
|
|
4255
4462
|
{
|
|
4256
4463
|
id: `${fieldId}-type`,
|
|
4257
4464
|
value: eventTypeUri,
|
|
4258
4465
|
disabled,
|
|
4259
4466
|
onChange: (event) => selectEventType(event.target.value),
|
|
4260
|
-
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0,
|
|
4467
|
+
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.uri, children: item.name }, item.uri))
|
|
4261
4468
|
}
|
|
4262
4469
|
)
|
|
4263
4470
|
]
|
|
4264
4471
|
}
|
|
4265
4472
|
) : null,
|
|
4266
|
-
/* @__PURE__ */ (0,
|
|
4267
|
-
/* @__PURE__ */ (0,
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__month", children: [
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4268
4475
|
"button",
|
|
4269
4476
|
{
|
|
4270
4477
|
type: "button",
|
|
@@ -4275,8 +4482,8 @@ function BookingCard({
|
|
|
4275
4482
|
children: "\u2039"
|
|
4276
4483
|
}
|
|
4277
4484
|
),
|
|
4278
|
-
/* @__PURE__ */ (0,
|
|
4279
|
-
/* @__PURE__ */ (0,
|
|
4485
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4280
4487
|
"button",
|
|
4281
4488
|
{
|
|
4282
4489
|
type: "button",
|
|
@@ -4288,9 +4495,9 @@ function BookingCard({
|
|
|
4288
4495
|
}
|
|
4289
4496
|
)
|
|
4290
4497
|
] }),
|
|
4291
|
-
/* @__PURE__ */ (0,
|
|
4292
|
-
offer.slots.length === 0 ? /* @__PURE__ */ (0,
|
|
4293
|
-
/* @__PURE__ */ (0,
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: label }, label)) }),
|
|
4499
|
+
offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4294
4501
|
"div",
|
|
4295
4502
|
{
|
|
4296
4503
|
className: "booking-card__calendar",
|
|
@@ -4298,7 +4505,7 @@ function BookingCard({
|
|
|
4298
4505
|
"aria-label": "Available dates",
|
|
4299
4506
|
children: cells.map((cell, index) => {
|
|
4300
4507
|
if (!cell) {
|
|
4301
|
-
return /* @__PURE__ */ (0,
|
|
4508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4302
4509
|
"span",
|
|
4303
4510
|
{
|
|
4304
4511
|
className: "booking-card__day"
|
|
@@ -4308,7 +4515,7 @@ function BookingCard({
|
|
|
4308
4515
|
}
|
|
4309
4516
|
const available = availableByDate.has(cell.key);
|
|
4310
4517
|
const selected = cell.key === selectedDate;
|
|
4311
|
-
return /* @__PURE__ */ (0,
|
|
4518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4312
4519
|
"button",
|
|
4313
4520
|
{
|
|
4314
4521
|
type: "button",
|
|
@@ -4328,9 +4535,9 @@ function BookingCard({
|
|
|
4328
4535
|
}
|
|
4329
4536
|
)
|
|
4330
4537
|
] }, "date") : null,
|
|
4331
|
-
step === "time" ? /* @__PURE__ */ (0,
|
|
4332
|
-
/* @__PURE__ */ (0,
|
|
4333
|
-
/* @__PURE__ */ (0,
|
|
4538
|
+
step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4539
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4334
4541
|
"button",
|
|
4335
4542
|
{
|
|
4336
4543
|
type: "button",
|
|
@@ -4341,15 +4548,15 @@ function BookingCard({
|
|
|
4341
4548
|
children: "\u2039"
|
|
4342
4549
|
}
|
|
4343
4550
|
),
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4345
|
-
/* @__PURE__ */ (0,
|
|
4346
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4551
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4552
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
|
|
4553
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4347
4554
|
"Times in ",
|
|
4348
4555
|
timeZone
|
|
4349
4556
|
] }) : null
|
|
4350
4557
|
] })
|
|
4351
4558
|
] }),
|
|
4352
|
-
/* @__PURE__ */ (0,
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4353
4560
|
"button",
|
|
4354
4561
|
{
|
|
4355
4562
|
type: "button",
|
|
@@ -4361,9 +4568,9 @@ function BookingCard({
|
|
|
4361
4568
|
slot.startTime
|
|
4362
4569
|
)) })
|
|
4363
4570
|
] }, "time") : null,
|
|
4364
|
-
step === "details" ? /* @__PURE__ */ (0,
|
|
4365
|
-
/* @__PURE__ */ (0,
|
|
4366
|
-
/* @__PURE__ */ (0,
|
|
4571
|
+
step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4572
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4367
4574
|
"button",
|
|
4368
4575
|
{
|
|
4369
4576
|
type: "button",
|
|
@@ -4374,21 +4581,21 @@ function BookingCard({
|
|
|
4374
4581
|
children: "\u2039"
|
|
4375
4582
|
}
|
|
4376
4583
|
),
|
|
4377
|
-
/* @__PURE__ */ (0,
|
|
4378
|
-
/* @__PURE__ */ (0,
|
|
4379
|
-
/* @__PURE__ */ (0,
|
|
4380
|
-
selectedType?.location ? /* @__PURE__ */ (0,
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
|
|
4587
|
+
selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
|
|
4381
4588
|
] })
|
|
4382
4589
|
] }),
|
|
4383
|
-
/* @__PURE__ */ (0,
|
|
4384
|
-
/* @__PURE__ */ (0,
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__identity", children: [
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4385
4592
|
"label",
|
|
4386
4593
|
{
|
|
4387
4594
|
className: "booking-card__field",
|
|
4388
4595
|
htmlFor: `${fieldId}-name`,
|
|
4389
4596
|
children: [
|
|
4390
|
-
/* @__PURE__ */ (0,
|
|
4391
|
-
/* @__PURE__ */ (0,
|
|
4597
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Name" }),
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4392
4599
|
"input",
|
|
4393
4600
|
{
|
|
4394
4601
|
id: `${fieldId}-name`,
|
|
@@ -4402,14 +4609,14 @@ function BookingCard({
|
|
|
4402
4609
|
]
|
|
4403
4610
|
}
|
|
4404
4611
|
),
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4612
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4406
4613
|
"label",
|
|
4407
4614
|
{
|
|
4408
4615
|
className: "booking-card__field",
|
|
4409
4616
|
htmlFor: `${fieldId}-email`,
|
|
4410
4617
|
children: [
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Email" }),
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4413
4620
|
"input",
|
|
4414
4621
|
{
|
|
4415
4622
|
id: `${fieldId}-email`,
|
|
@@ -4425,7 +4632,7 @@ function BookingCard({
|
|
|
4425
4632
|
}
|
|
4426
4633
|
)
|
|
4427
4634
|
] }),
|
|
4428
|
-
/* @__PURE__ */ (0,
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4429
4636
|
"button",
|
|
4430
4637
|
{
|
|
4431
4638
|
type: "submit",
|
|
@@ -4443,9 +4650,9 @@ function BookingCard({
|
|
|
4443
4650
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4444
4651
|
var import_streamdown = require("streamdown");
|
|
4445
4652
|
var import_styles = require("streamdown/styles.css");
|
|
4446
|
-
var
|
|
4447
|
-
function normalizeDedupeText(
|
|
4448
|
-
return
|
|
4653
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4654
|
+
function normalizeDedupeText(text2) {
|
|
4655
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4449
4656
|
}
|
|
4450
4657
|
function paragraphsAreNearDuplicates(first, second) {
|
|
4451
4658
|
const left = normalizeDedupeText(first);
|
|
@@ -4461,8 +4668,8 @@ function paragraphsShareOpening(first, second) {
|
|
|
4461
4668
|
if (!opening || opening.length < 20) return false;
|
|
4462
4669
|
return second.trim().startsWith(opening);
|
|
4463
4670
|
}
|
|
4464
|
-
function collapseRepeatedText(
|
|
4465
|
-
const trimmed =
|
|
4671
|
+
function collapseRepeatedText(text2) {
|
|
4672
|
+
const trimmed = text2.trim();
|
|
4466
4673
|
if (trimmed.length < 40) return trimmed;
|
|
4467
4674
|
const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
|
|
4468
4675
|
if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
|
|
@@ -4500,11 +4707,11 @@ function MessageBubble({
|
|
|
4500
4707
|
offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
|
|
4501
4708
|
);
|
|
4502
4709
|
if (message.role === "visitor") {
|
|
4503
|
-
return /* @__PURE__ */ (0,
|
|
4710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "message-bubble__text", children: message.text }) });
|
|
4504
4711
|
}
|
|
4505
4712
|
const citations = message.citations ?? [];
|
|
4506
|
-
const agentText = /* @__PURE__ */ (0,
|
|
4507
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
const agentText = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__text", children: [
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4508
4715
|
import_streamdown.Streamdown,
|
|
4509
4716
|
{
|
|
4510
4717
|
animated: isStreaming,
|
|
@@ -4518,8 +4725,9 @@ function MessageBubble({
|
|
|
4518
4725
|
children: displayText
|
|
4519
4726
|
}
|
|
4520
4727
|
),
|
|
4521
|
-
|
|
4522
|
-
|
|
4728
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchReferences, { results: message.searchResults ?? [] }),
|
|
4729
|
+
citations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4523
4731
|
"span",
|
|
4524
4732
|
{
|
|
4525
4733
|
className: "message-bubble__source-icon",
|
|
@@ -4527,12 +4735,12 @@ function MessageBubble({
|
|
|
4527
4735
|
children: "\u25A6"
|
|
4528
4736
|
}
|
|
4529
4737
|
),
|
|
4530
|
-
/* @__PURE__ */ (0,
|
|
4738
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
|
|
4531
4739
|
] }) }, citation.id)) }) : null
|
|
4532
4740
|
] });
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
4534
|
-
displayText ? showBrandLogo ? /* @__PURE__ */ (0,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
|
|
4742
|
+
displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
|
|
4743
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4536
4744
|
"img",
|
|
4537
4745
|
{
|
|
4538
4746
|
src: resolvedLogoUrl,
|
|
@@ -4544,7 +4752,7 @@ function MessageBubble({
|
|
|
4544
4752
|
) }),
|
|
4545
4753
|
agentText
|
|
4546
4754
|
] }) : agentText : null,
|
|
4547
|
-
offers.map((nextOffer, index) => /* @__PURE__ */ (0,
|
|
4755
|
+
offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4548
4756
|
BookingCard,
|
|
4549
4757
|
{
|
|
4550
4758
|
disabled: bookingDisabled,
|
|
@@ -4561,8 +4769,8 @@ var import_react11 = require("react");
|
|
|
4561
4769
|
var import_react_dom2 = require("react-dom");
|
|
4562
4770
|
|
|
4563
4771
|
// src/react/lib/speech.ts
|
|
4564
|
-
function toSpeechText(
|
|
4565
|
-
let out = hideToolCardFences(
|
|
4772
|
+
function toSpeechText(text2) {
|
|
4773
|
+
let out = hideToolCardFences(text2);
|
|
4566
4774
|
out = out.replace(/```[\s\S]*?```/g, " ");
|
|
4567
4775
|
out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
4568
4776
|
out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
@@ -4705,10 +4913,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
|
|
|
4705
4913
|
}
|
|
4706
4914
|
|
|
4707
4915
|
// src/react/components/MessageActions/MessageActions.tsx
|
|
4708
|
-
var
|
|
4916
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4709
4917
|
function CopyIcon() {
|
|
4710
|
-
return /* @__PURE__ */ (0,
|
|
4711
|
-
/* @__PURE__ */ (0,
|
|
4918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4712
4920
|
"rect",
|
|
4713
4921
|
{
|
|
4714
4922
|
x: "5.75",
|
|
@@ -4720,7 +4928,7 @@ function CopyIcon() {
|
|
|
4720
4928
|
strokeWidth: "1.5"
|
|
4721
4929
|
}
|
|
4722
4930
|
),
|
|
4723
|
-
/* @__PURE__ */ (0,
|
|
4931
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4724
4932
|
"path",
|
|
4725
4933
|
{
|
|
4726
4934
|
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",
|
|
@@ -4731,7 +4939,7 @@ function CopyIcon() {
|
|
|
4731
4939
|
] });
|
|
4732
4940
|
}
|
|
4733
4941
|
function CheckIcon() {
|
|
4734
|
-
return /* @__PURE__ */ (0,
|
|
4942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4735
4943
|
"path",
|
|
4736
4944
|
{
|
|
4737
4945
|
d: "M3.5 8.5l3 3 6-7",
|
|
@@ -4743,8 +4951,8 @@ function CheckIcon() {
|
|
|
4743
4951
|
) });
|
|
4744
4952
|
}
|
|
4745
4953
|
function ThumbUpIcon() {
|
|
4746
|
-
return /* @__PURE__ */ (0,
|
|
4747
|
-
/* @__PURE__ */ (0,
|
|
4954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4748
4956
|
"path",
|
|
4749
4957
|
{
|
|
4750
4958
|
d: "M4.67 6.67v8",
|
|
@@ -4753,7 +4961,7 @@ function ThumbUpIcon() {
|
|
|
4753
4961
|
strokeLinecap: "round"
|
|
4754
4962
|
}
|
|
4755
4963
|
),
|
|
4756
|
-
/* @__PURE__ */ (0,
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4757
4965
|
"path",
|
|
4758
4966
|
{
|
|
4759
4967
|
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",
|
|
@@ -4766,8 +4974,8 @@ function ThumbUpIcon() {
|
|
|
4766
4974
|
] });
|
|
4767
4975
|
}
|
|
4768
4976
|
function ThumbDownIcon() {
|
|
4769
|
-
return /* @__PURE__ */ (0,
|
|
4770
|
-
/* @__PURE__ */ (0,
|
|
4977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("g", { transform: "rotate(180 8 8)", children: [
|
|
4978
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4771
4979
|
"path",
|
|
4772
4980
|
{
|
|
4773
4981
|
d: "M4.67 6.67v8",
|
|
@@ -4776,7 +4984,7 @@ function ThumbDownIcon() {
|
|
|
4776
4984
|
strokeLinecap: "round"
|
|
4777
4985
|
}
|
|
4778
4986
|
),
|
|
4779
|
-
/* @__PURE__ */ (0,
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4780
4988
|
"path",
|
|
4781
4989
|
{
|
|
4782
4990
|
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",
|
|
@@ -4789,8 +4997,8 @@ function ThumbDownIcon() {
|
|
|
4789
4997
|
] }) });
|
|
4790
4998
|
}
|
|
4791
4999
|
function RegenerateIcon() {
|
|
4792
|
-
return /* @__PURE__ */ (0,
|
|
4793
|
-
/* @__PURE__ */ (0,
|
|
5000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4794
5002
|
"path",
|
|
4795
5003
|
{
|
|
4796
5004
|
d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
|
|
@@ -4799,7 +5007,7 @@ function RegenerateIcon() {
|
|
|
4799
5007
|
strokeLinecap: "round"
|
|
4800
5008
|
}
|
|
4801
5009
|
),
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4803
5011
|
"path",
|
|
4804
5012
|
{
|
|
4805
5013
|
d: "M14 2v3.33h-3.33",
|
|
@@ -4809,7 +5017,7 @@ function RegenerateIcon() {
|
|
|
4809
5017
|
strokeLinejoin: "round"
|
|
4810
5018
|
}
|
|
4811
5019
|
),
|
|
4812
|
-
/* @__PURE__ */ (0,
|
|
5020
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4813
5021
|
"path",
|
|
4814
5022
|
{
|
|
4815
5023
|
d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
|
|
@@ -4818,7 +5026,7 @@ function RegenerateIcon() {
|
|
|
4818
5026
|
strokeLinecap: "round"
|
|
4819
5027
|
}
|
|
4820
5028
|
),
|
|
4821
|
-
/* @__PURE__ */ (0,
|
|
5029
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4822
5030
|
"path",
|
|
4823
5031
|
{
|
|
4824
5032
|
d: "M5.33 10.67H2V14",
|
|
@@ -4831,15 +5039,15 @@ function RegenerateIcon() {
|
|
|
4831
5039
|
] });
|
|
4832
5040
|
}
|
|
4833
5041
|
function MoreIcon() {
|
|
4834
|
-
return /* @__PURE__ */ (0,
|
|
4835
|
-
/* @__PURE__ */ (0,
|
|
4836
|
-
/* @__PURE__ */ (0,
|
|
4837
|
-
/* @__PURE__ */ (0,
|
|
5042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5043
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5045
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
|
|
4838
5046
|
] });
|
|
4839
5047
|
}
|
|
4840
5048
|
function SourcesIcon() {
|
|
4841
|
-
return /* @__PURE__ */ (0,
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
5049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4843
5051
|
"path",
|
|
4844
5052
|
{
|
|
4845
5053
|
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",
|
|
@@ -4849,7 +5057,7 @@ function SourcesIcon() {
|
|
|
4849
5057
|
strokeLinejoin: "round"
|
|
4850
5058
|
}
|
|
4851
5059
|
),
|
|
4852
|
-
/* @__PURE__ */ (0,
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4853
5061
|
"path",
|
|
4854
5062
|
{
|
|
4855
5063
|
d: "M8 4.5v9",
|
|
@@ -4861,8 +5069,8 @@ function SourcesIcon() {
|
|
|
4861
5069
|
] });
|
|
4862
5070
|
}
|
|
4863
5071
|
function ReadAloudIcon() {
|
|
4864
|
-
return /* @__PURE__ */ (0,
|
|
4865
|
-
/* @__PURE__ */ (0,
|
|
5072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5073
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4866
5074
|
"path",
|
|
4867
5075
|
{
|
|
4868
5076
|
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",
|
|
@@ -4872,7 +5080,7 @@ function ReadAloudIcon() {
|
|
|
4872
5080
|
strokeLinejoin: "round"
|
|
4873
5081
|
}
|
|
4874
5082
|
),
|
|
4875
|
-
/* @__PURE__ */ (0,
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4876
5084
|
"path",
|
|
4877
5085
|
{
|
|
4878
5086
|
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",
|
|
@@ -4884,7 +5092,7 @@ function ReadAloudIcon() {
|
|
|
4884
5092
|
] });
|
|
4885
5093
|
}
|
|
4886
5094
|
function StopIcon() {
|
|
4887
|
-
return /* @__PURE__ */ (0,
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4888
5096
|
"rect",
|
|
4889
5097
|
{
|
|
4890
5098
|
x: "4",
|
|
@@ -4897,12 +5105,12 @@ function StopIcon() {
|
|
|
4897
5105
|
}
|
|
4898
5106
|
) });
|
|
4899
5107
|
}
|
|
4900
|
-
async function writeToClipboard(
|
|
5108
|
+
async function writeToClipboard(text2) {
|
|
4901
5109
|
try {
|
|
4902
|
-
await navigator.clipboard.writeText(
|
|
5110
|
+
await navigator.clipboard.writeText(text2);
|
|
4903
5111
|
} catch {
|
|
4904
5112
|
const textarea = document.createElement("textarea");
|
|
4905
|
-
textarea.value =
|
|
5113
|
+
textarea.value = text2;
|
|
4906
5114
|
textarea.style.position = "fixed";
|
|
4907
5115
|
textarea.style.opacity = "0";
|
|
4908
5116
|
document.body.appendChild(textarea);
|
|
@@ -5048,7 +5256,7 @@ function MessageActions({
|
|
|
5048
5256
|
window.speechSynthesis.speak(utterance);
|
|
5049
5257
|
setSpeaking(true);
|
|
5050
5258
|
}
|
|
5051
|
-
const menu = menuOpen ? /* @__PURE__ */ (0,
|
|
5259
|
+
const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5052
5260
|
"div",
|
|
5053
5261
|
{
|
|
5054
5262
|
className: "agent-message-actions__menu agent-message-actions__menu--portal",
|
|
@@ -5059,11 +5267,11 @@ function MessageActions({
|
|
|
5059
5267
|
top: `${menuPosition.top}px`
|
|
5060
5268
|
} : { visibility: "hidden" },
|
|
5061
5269
|
children: [
|
|
5062
|
-
answeredLabel ? /* @__PURE__ */ (0,
|
|
5270
|
+
answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
|
|
5063
5271
|
"Answered ",
|
|
5064
5272
|
answeredLabel
|
|
5065
5273
|
] }) : null,
|
|
5066
|
-
canOpenReceipt ? /* @__PURE__ */ (0,
|
|
5274
|
+
canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5067
5275
|
"button",
|
|
5068
5276
|
{
|
|
5069
5277
|
type: "button",
|
|
@@ -5074,12 +5282,12 @@ function MessageActions({
|
|
|
5074
5282
|
onOpenReceipt?.();
|
|
5075
5283
|
},
|
|
5076
5284
|
children: [
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SourcesIcon, {}),
|
|
5078
5286
|
"View sources"
|
|
5079
5287
|
]
|
|
5080
5288
|
}
|
|
5081
5289
|
) : null,
|
|
5082
|
-
canReadAloud ? /* @__PURE__ */ (0,
|
|
5290
|
+
canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5083
5291
|
"button",
|
|
5084
5292
|
{
|
|
5085
5293
|
type: "button",
|
|
@@ -5087,7 +5295,7 @@ function MessageActions({
|
|
|
5087
5295
|
role: "menuitem",
|
|
5088
5296
|
onClick: handleReadAloud,
|
|
5089
5297
|
children: [
|
|
5090
|
-
speaking ? /* @__PURE__ */ (0,
|
|
5298
|
+
speaking ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReadAloudIcon, {}),
|
|
5091
5299
|
speaking ? "Stop reading" : "Read aloud"
|
|
5092
5300
|
]
|
|
5093
5301
|
}
|
|
@@ -5095,8 +5303,8 @@ function MessageActions({
|
|
|
5095
5303
|
]
|
|
5096
5304
|
}
|
|
5097
5305
|
) : null;
|
|
5098
|
-
return /* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
|
|
5307
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5100
5308
|
"button",
|
|
5101
5309
|
{
|
|
5102
5310
|
type: "button",
|
|
@@ -5105,10 +5313,10 @@ function MessageActions({
|
|
|
5105
5313
|
title: copied ? "Copied" : "Copy answer",
|
|
5106
5314
|
disabled,
|
|
5107
5315
|
onClick: handleCopy,
|
|
5108
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
5316
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyIcon, {})
|
|
5109
5317
|
}
|
|
5110
5318
|
),
|
|
5111
|
-
/* @__PURE__ */ (0,
|
|
5319
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5112
5320
|
"button",
|
|
5113
5321
|
{
|
|
5114
5322
|
type: "button",
|
|
@@ -5118,10 +5326,10 @@ function MessageActions({
|
|
|
5118
5326
|
title: "Good answer",
|
|
5119
5327
|
disabled,
|
|
5120
5328
|
onClick: () => handleFeedback("positive"),
|
|
5121
|
-
children: /* @__PURE__ */ (0,
|
|
5329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbUpIcon, {})
|
|
5122
5330
|
}
|
|
5123
5331
|
),
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5332
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5125
5333
|
"button",
|
|
5126
5334
|
{
|
|
5127
5335
|
type: "button",
|
|
@@ -5131,10 +5339,10 @@ function MessageActions({
|
|
|
5131
5339
|
title: "Bad answer",
|
|
5132
5340
|
disabled,
|
|
5133
5341
|
onClick: () => handleFeedback("negative"),
|
|
5134
|
-
children: /* @__PURE__ */ (0,
|
|
5342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbDownIcon, {})
|
|
5135
5343
|
}
|
|
5136
5344
|
),
|
|
5137
|
-
onRegenerate ? /* @__PURE__ */ (0,
|
|
5345
|
+
onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5138
5346
|
"button",
|
|
5139
5347
|
{
|
|
5140
5348
|
type: "button",
|
|
@@ -5143,11 +5351,11 @@ function MessageActions({
|
|
|
5143
5351
|
title: "Regenerate answer",
|
|
5144
5352
|
disabled,
|
|
5145
5353
|
onClick: onRegenerate,
|
|
5146
|
-
children: /* @__PURE__ */ (0,
|
|
5354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RegenerateIcon, {})
|
|
5147
5355
|
}
|
|
5148
5356
|
) : null,
|
|
5149
|
-
showMenu ? /* @__PURE__ */ (0,
|
|
5150
|
-
/* @__PURE__ */ (0,
|
|
5357
|
+
showMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5151
5359
|
"button",
|
|
5152
5360
|
{
|
|
5153
5361
|
ref: moreButtonRef,
|
|
@@ -5159,7 +5367,7 @@ function MessageActions({
|
|
|
5159
5367
|
title: "More actions",
|
|
5160
5368
|
disabled,
|
|
5161
5369
|
onClick: () => setMenuOpen((open) => !open),
|
|
5162
|
-
children: /* @__PURE__ */ (0,
|
|
5370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MoreIcon, {})
|
|
5163
5371
|
}
|
|
5164
5372
|
),
|
|
5165
5373
|
menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
|
|
@@ -5171,7 +5379,7 @@ function MessageActions({
|
|
|
5171
5379
|
var import_react13 = require("react");
|
|
5172
5380
|
|
|
5173
5381
|
// src/react/components/ConfirmationCard/ConfirmationCard.tsx
|
|
5174
|
-
var
|
|
5382
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5175
5383
|
function ConfirmationCard({
|
|
5176
5384
|
disabled = false,
|
|
5177
5385
|
request,
|
|
@@ -5180,17 +5388,17 @@ function ConfirmationCard({
|
|
|
5180
5388
|
const options = request.options ?? [];
|
|
5181
5389
|
const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
|
|
5182
5390
|
const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
|
|
5183
|
-
return /* @__PURE__ */ (0,
|
|
5391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5184
5392
|
"section",
|
|
5185
5393
|
{
|
|
5186
5394
|
className: "confirmation-card",
|
|
5187
5395
|
"aria-labelledby": `confirmation-${request.requestId}`,
|
|
5188
5396
|
children: [
|
|
5189
|
-
/* @__PURE__ */ (0,
|
|
5190
|
-
/* @__PURE__ */ (0,
|
|
5191
|
-
prompt ? /* @__PURE__ */ (0,
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirmation-card__heading", children: [
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
|
|
5399
|
+
prompt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: prompt }) : null
|
|
5192
5400
|
] }),
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5194
5402
|
"button",
|
|
5195
5403
|
{
|
|
5196
5404
|
type: "button",
|
|
@@ -5211,7 +5419,7 @@ function ConfirmationCard({
|
|
|
5211
5419
|
|
|
5212
5420
|
// src/react/components/ToolInputCard/ToolInputCard.tsx
|
|
5213
5421
|
var import_react12 = require("react");
|
|
5214
|
-
var
|
|
5422
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5215
5423
|
function isRecord5(value) {
|
|
5216
5424
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5217
5425
|
}
|
|
@@ -5335,7 +5543,7 @@ function FieldDescription({
|
|
|
5335
5543
|
field,
|
|
5336
5544
|
id
|
|
5337
5545
|
}) {
|
|
5338
|
-
return field.description ? /* @__PURE__ */ (0,
|
|
5546
|
+
return field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
|
|
5339
5547
|
}
|
|
5340
5548
|
function ChoiceField({
|
|
5341
5549
|
field,
|
|
@@ -5354,7 +5562,7 @@ function ChoiceField({
|
|
|
5354
5562
|
const selectedIndex = options.findIndex(
|
|
5355
5563
|
(option) => valuesMatch(option.value, value)
|
|
5356
5564
|
);
|
|
5357
|
-
return /* @__PURE__ */ (0,
|
|
5565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5358
5566
|
"select",
|
|
5359
5567
|
{
|
|
5360
5568
|
id,
|
|
@@ -5369,13 +5577,13 @@ function ChoiceField({
|
|
|
5369
5577
|
if (option) onChange(option.value);
|
|
5370
5578
|
},
|
|
5371
5579
|
children: [
|
|
5372
|
-
/* @__PURE__ */ (0,
|
|
5373
|
-
options.map((option, index) => /* @__PURE__ */ (0,
|
|
5580
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
|
|
5581
|
+
options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index, children: option.label }, optionKey(option)))
|
|
5374
5582
|
]
|
|
5375
5583
|
}
|
|
5376
5584
|
);
|
|
5377
5585
|
}
|
|
5378
|
-
return /* @__PURE__ */ (0,
|
|
5586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5379
5587
|
"div",
|
|
5380
5588
|
{
|
|
5381
5589
|
className: "tool-input-card__choices",
|
|
@@ -5386,8 +5594,8 @@ function ChoiceField({
|
|
|
5386
5594
|
"aria-required": field.required,
|
|
5387
5595
|
children: options.map((option, index) => {
|
|
5388
5596
|
const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
|
|
5389
|
-
return /* @__PURE__ */ (0,
|
|
5390
|
-
/* @__PURE__ */ (0,
|
|
5597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__choice", children: [
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5391
5599
|
"input",
|
|
5392
5600
|
{
|
|
5393
5601
|
type: multiple ? "checkbox" : "radio",
|
|
@@ -5409,7 +5617,7 @@ function ChoiceField({
|
|
|
5409
5617
|
}
|
|
5410
5618
|
}
|
|
5411
5619
|
),
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5620
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.label })
|
|
5413
5621
|
] }, optionKey(option));
|
|
5414
5622
|
})
|
|
5415
5623
|
}
|
|
@@ -5429,9 +5637,9 @@ function ToolField({
|
|
|
5429
5637
|
error ? `${id}-error` : ""
|
|
5430
5638
|
].filter(Boolean).join(" ");
|
|
5431
5639
|
if (field.kind === "checkbox" || field.kind === "confirmation") {
|
|
5432
|
-
return /* @__PURE__ */ (0,
|
|
5433
|
-
/* @__PURE__ */ (0,
|
|
5434
|
-
/* @__PURE__ */ (0,
|
|
5640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5435
5643
|
"input",
|
|
5436
5644
|
{
|
|
5437
5645
|
id,
|
|
@@ -5444,17 +5652,17 @@ function ToolField({
|
|
|
5444
5652
|
onChange: (event) => onChange(event.target.checked)
|
|
5445
5653
|
}
|
|
5446
5654
|
),
|
|
5447
|
-
/* @__PURE__ */ (0,
|
|
5448
|
-
/* @__PURE__ */ (0,
|
|
5449
|
-
field.description ? /* @__PURE__ */ (0,
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: field.label }),
|
|
5657
|
+
field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-description`, children: field.description }) : null
|
|
5450
5658
|
] })
|
|
5451
5659
|
] }),
|
|
5452
|
-
error ? /* @__PURE__ */ (0,
|
|
5660
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5453
5661
|
] });
|
|
5454
5662
|
}
|
|
5455
|
-
const label = /* @__PURE__ */ (0,
|
|
5663
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
|
|
5456
5664
|
field.label,
|
|
5457
|
-
field.required ? /* @__PURE__ */ (0,
|
|
5665
|
+
field.required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
|
|
5458
5666
|
] });
|
|
5459
5667
|
const common = {
|
|
5460
5668
|
id,
|
|
@@ -5466,7 +5674,7 @@ function ToolField({
|
|
|
5466
5674
|
};
|
|
5467
5675
|
let control;
|
|
5468
5676
|
if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
|
|
5469
|
-
control = /* @__PURE__ */ (0,
|
|
5677
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5470
5678
|
ChoiceField,
|
|
5471
5679
|
{
|
|
5472
5680
|
field,
|
|
@@ -5480,7 +5688,7 @@ function ToolField({
|
|
|
5480
5688
|
}
|
|
5481
5689
|
);
|
|
5482
5690
|
} else if (field.kind === "textarea" || field.kind === "json") {
|
|
5483
|
-
control = /* @__PURE__ */ (0,
|
|
5691
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5484
5692
|
"textarea",
|
|
5485
5693
|
{
|
|
5486
5694
|
...common,
|
|
@@ -5494,8 +5702,8 @@ function ToolField({
|
|
|
5494
5702
|
);
|
|
5495
5703
|
} else if (field.kind === "range") {
|
|
5496
5704
|
const numericValue = typeof value === "number" ? value : field.min ?? 0;
|
|
5497
|
-
control = /* @__PURE__ */ (0,
|
|
5498
|
-
/* @__PURE__ */ (0,
|
|
5705
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__range", children: [
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5499
5707
|
"input",
|
|
5500
5708
|
{
|
|
5501
5709
|
...common,
|
|
@@ -5507,11 +5715,11 @@ function ToolField({
|
|
|
5507
5715
|
onChange: (event) => onChange(Number(event.target.value))
|
|
5508
5716
|
}
|
|
5509
5717
|
),
|
|
5510
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("output", { htmlFor: id, children: numericValue })
|
|
5511
5719
|
] });
|
|
5512
5720
|
} else {
|
|
5513
5721
|
const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
|
|
5514
|
-
control = /* @__PURE__ */ (0,
|
|
5722
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5515
5723
|
"input",
|
|
5516
5724
|
{
|
|
5517
5725
|
...common,
|
|
@@ -5529,11 +5737,11 @@ function ToolField({
|
|
|
5529
5737
|
}
|
|
5530
5738
|
);
|
|
5531
5739
|
}
|
|
5532
|
-
return /* @__PURE__ */ (0,
|
|
5740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5533
5741
|
label,
|
|
5534
|
-
/* @__PURE__ */ (0,
|
|
5742
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldDescription, { field, id: `${id}-description` }),
|
|
5535
5743
|
control,
|
|
5536
|
-
error ? /* @__PURE__ */ (0,
|
|
5744
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5537
5745
|
] });
|
|
5538
5746
|
}
|
|
5539
5747
|
function ToolInputCard({
|
|
@@ -5570,14 +5778,14 @@ function ToolInputCard({
|
|
|
5570
5778
|
onSubmit?.(surface, result);
|
|
5571
5779
|
}
|
|
5572
5780
|
if (submitted) {
|
|
5573
|
-
return /* @__PURE__ */ (0,
|
|
5781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5574
5782
|
"section",
|
|
5575
5783
|
{
|
|
5576
5784
|
className: "tool-input-card tool-input-card--submitted",
|
|
5577
5785
|
role: "status",
|
|
5578
5786
|
children: [
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
|
|
5788
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { children: [
|
|
5581
5789
|
surface.title,
|
|
5582
5790
|
" submitted"
|
|
5583
5791
|
] })
|
|
@@ -5585,18 +5793,18 @@ function ToolInputCard({
|
|
|
5585
5793
|
}
|
|
5586
5794
|
);
|
|
5587
5795
|
}
|
|
5588
|
-
return /* @__PURE__ */ (0,
|
|
5796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5589
5797
|
"section",
|
|
5590
5798
|
{
|
|
5591
5799
|
className: "tool-input-card",
|
|
5592
5800
|
"aria-labelledby": `tool-input-${surface.id}`,
|
|
5593
5801
|
children: [
|
|
5594
|
-
/* @__PURE__ */ (0,
|
|
5595
|
-
/* @__PURE__ */ (0,
|
|
5596
|
-
surface.description ? /* @__PURE__ */ (0,
|
|
5802
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__heading", children: [
|
|
5803
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
|
|
5804
|
+
surface.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: surface.description }) : null
|
|
5597
5805
|
] }),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
|
|
5807
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5600
5808
|
ToolField,
|
|
5601
5809
|
{
|
|
5602
5810
|
disabled,
|
|
@@ -5609,8 +5817,8 @@ function ToolInputCard({
|
|
|
5609
5817
|
},
|
|
5610
5818
|
field.path
|
|
5611
5819
|
)) }),
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5613
|
-
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0,
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__actions", children: [
|
|
5821
|
+
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5614
5822
|
"button",
|
|
5615
5823
|
{
|
|
5616
5824
|
type: "button",
|
|
@@ -5623,7 +5831,7 @@ function ToolInputCard({
|
|
|
5623
5831
|
children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
|
|
5624
5832
|
}
|
|
5625
5833
|
) : null,
|
|
5626
|
-
/* @__PURE__ */ (0,
|
|
5834
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
|
|
5627
5835
|
] })
|
|
5628
5836
|
] })
|
|
5629
5837
|
]
|
|
@@ -5632,17 +5840,17 @@ function ToolInputCard({
|
|
|
5632
5840
|
}
|
|
5633
5841
|
|
|
5634
5842
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
5635
|
-
var
|
|
5843
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
5636
5844
|
function HumanInputCard({
|
|
5637
5845
|
disabled = false,
|
|
5638
5846
|
request,
|
|
5639
5847
|
onRespond
|
|
5640
5848
|
}) {
|
|
5641
|
-
const [
|
|
5849
|
+
const [text2, setText] = (0, import_react13.useState)("");
|
|
5642
5850
|
const options = request.options ?? [];
|
|
5643
5851
|
const showText = request.display === "text" || request.allowFreeform && options.length === 0;
|
|
5644
5852
|
if (request.ui) {
|
|
5645
|
-
return /* @__PURE__ */ (0,
|
|
5853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5646
5854
|
ToolInputCard,
|
|
5647
5855
|
{
|
|
5648
5856
|
disabled,
|
|
@@ -5652,7 +5860,7 @@ function HumanInputCard({
|
|
|
5652
5860
|
);
|
|
5653
5861
|
}
|
|
5654
5862
|
if (options.length > 0) {
|
|
5655
|
-
return /* @__PURE__ */ (0,
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5656
5864
|
ConfirmationCard,
|
|
5657
5865
|
{
|
|
5658
5866
|
disabled,
|
|
@@ -5663,62 +5871,62 @@ function HumanInputCard({
|
|
|
5663
5871
|
}
|
|
5664
5872
|
function submitText(event) {
|
|
5665
5873
|
event.preventDefault();
|
|
5666
|
-
const value =
|
|
5874
|
+
const value = text2.trim();
|
|
5667
5875
|
if (!value || disabled) return;
|
|
5668
5876
|
onRespond?.({ requestId: request.requestId, text: value });
|
|
5669
5877
|
}
|
|
5670
|
-
return /* @__PURE__ */ (0,
|
|
5878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5671
5879
|
"section",
|
|
5672
5880
|
{
|
|
5673
5881
|
className: "human-input-card",
|
|
5674
5882
|
"aria-labelledby": `human-input-${request.requestId}`,
|
|
5675
5883
|
children: [
|
|
5676
|
-
/* @__PURE__ */ (0,
|
|
5677
|
-
showText ? /* @__PURE__ */ (0,
|
|
5678
|
-
/* @__PURE__ */ (0,
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
|
|
5885
|
+
showText ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: submitText, children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
5888
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5681
5889
|
"input",
|
|
5682
5890
|
{
|
|
5683
5891
|
id: `human-input-text-${request.requestId}`,
|
|
5684
|
-
value:
|
|
5892
|
+
value: text2,
|
|
5685
5893
|
disabled,
|
|
5686
5894
|
onChange: (event) => setText(event.target.value)
|
|
5687
5895
|
}
|
|
5688
5896
|
),
|
|
5689
|
-
/* @__PURE__ */ (0,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
|
|
5690
5898
|
] })
|
|
5691
5899
|
] }) : null,
|
|
5692
|
-
!showText && options.length === 0 ? /* @__PURE__ */ (0,
|
|
5900
|
+
!showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
|
|
5693
5901
|
]
|
|
5694
5902
|
}
|
|
5695
5903
|
);
|
|
5696
5904
|
}
|
|
5697
5905
|
|
|
5698
5906
|
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
5699
|
-
var
|
|
5907
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5700
5908
|
function CollectionResultCard({
|
|
5701
5909
|
result
|
|
5702
5910
|
}) {
|
|
5703
5911
|
const empty = result.items.length === 0;
|
|
5704
|
-
return /* @__PURE__ */ (0,
|
|
5912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5705
5913
|
"section",
|
|
5706
5914
|
{
|
|
5707
5915
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5708
5916
|
"aria-label": result.title,
|
|
5709
5917
|
children: [
|
|
5710
|
-
/* @__PURE__ */ (0,
|
|
5711
|
-
/* @__PURE__ */ (0,
|
|
5712
|
-
/* @__PURE__ */ (0,
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5919
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5920
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
|
|
5713
5921
|
] }),
|
|
5714
|
-
empty ? /* @__PURE__ */ (0,
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5716
|
-
item.description ? /* @__PURE__ */ (0,
|
|
5717
|
-
item.details?.length ? /* @__PURE__ */ (0,
|
|
5718
|
-
/* @__PURE__ */ (0,
|
|
5719
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
empty ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
5924
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: item.description }) : null,
|
|
5925
|
+
item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
|
|
5927
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
|
|
5720
5928
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5721
|
-
item.href ? /* @__PURE__ */ (0,
|
|
5929
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
5722
5930
|
] }, item.title)) })
|
|
5723
5931
|
]
|
|
5724
5932
|
}
|
|
@@ -5726,26 +5934,26 @@ function CollectionResultCard({
|
|
|
5726
5934
|
}
|
|
5727
5935
|
|
|
5728
5936
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
5729
|
-
var
|
|
5937
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5730
5938
|
function EntityResultCard({
|
|
5731
5939
|
result
|
|
5732
5940
|
}) {
|
|
5733
|
-
return /* @__PURE__ */ (0,
|
|
5941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5734
5942
|
"section",
|
|
5735
5943
|
{
|
|
5736
5944
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5737
5945
|
"aria-label": result.title,
|
|
5738
5946
|
children: [
|
|
5739
|
-
/* @__PURE__ */ (0,
|
|
5740
|
-
/* @__PURE__ */ (0,
|
|
5741
|
-
/* @__PURE__ */ (0,
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5948
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
|
|
5742
5950
|
] }),
|
|
5743
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5744
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5745
|
-
/* @__PURE__ */ (0,
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
5951
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: result.description }) : null,
|
|
5952
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
5953
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
|
|
5747
5955
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5748
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
5956
|
+
result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5749
5957
|
"a",
|
|
5750
5958
|
{
|
|
5751
5959
|
href: link.href,
|
|
@@ -5761,24 +5969,24 @@ function EntityResultCard({
|
|
|
5761
5969
|
}
|
|
5762
5970
|
|
|
5763
5971
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
5764
|
-
var
|
|
5972
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5765
5973
|
function SignatureResultCard({
|
|
5766
5974
|
result
|
|
5767
5975
|
}) {
|
|
5768
5976
|
const primaryLink = result.links?.[0];
|
|
5769
|
-
return /* @__PURE__ */ (0,
|
|
5977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
5770
5978
|
"section",
|
|
5771
5979
|
{
|
|
5772
5980
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5773
5981
|
"aria-label": result.title,
|
|
5774
5982
|
children: [
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
5776
|
-
/* @__PURE__ */ (0,
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5985
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
|
|
5778
5986
|
] }),
|
|
5779
|
-
result.statusLabel ? /* @__PURE__ */ (0,
|
|
5780
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5781
|
-
primaryLink ? /* @__PURE__ */ (0,
|
|
5987
|
+
result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
5988
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
|
|
5989
|
+
primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5782
5990
|
"a",
|
|
5783
5991
|
{
|
|
5784
5992
|
className: "signature-result-card__cta",
|
|
@@ -5794,26 +6002,26 @@ function SignatureResultCard({
|
|
|
5794
6002
|
}
|
|
5795
6003
|
|
|
5796
6004
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
5797
|
-
var
|
|
6005
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5798
6006
|
function ToolResultCard({
|
|
5799
6007
|
result
|
|
5800
6008
|
}) {
|
|
5801
|
-
return /* @__PURE__ */ (0,
|
|
6009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5802
6010
|
"section",
|
|
5803
6011
|
{
|
|
5804
6012
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
5805
6013
|
"aria-label": result.title,
|
|
5806
6014
|
children: [
|
|
5807
|
-
/* @__PURE__ */ (0,
|
|
5808
|
-
/* @__PURE__ */ (0,
|
|
5809
|
-
/* @__PURE__ */ (0,
|
|
6015
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6016
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
|
|
5810
6018
|
] }),
|
|
5811
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5812
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5814
|
-
/* @__PURE__ */ (0,
|
|
6019
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
|
|
6020
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
6021
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
|
|
5815
6023
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5816
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6024
|
+
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)(
|
|
5817
6025
|
"a",
|
|
5818
6026
|
{
|
|
5819
6027
|
href: link.href,
|
|
@@ -5829,14 +6037,14 @@ function ToolResultCard({
|
|
|
5829
6037
|
}
|
|
5830
6038
|
|
|
5831
6039
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
5832
|
-
var
|
|
6040
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5833
6041
|
function VisitorToolResultView({
|
|
5834
6042
|
disabled = false,
|
|
5835
6043
|
onToolInput,
|
|
5836
6044
|
result
|
|
5837
6045
|
}) {
|
|
5838
6046
|
if (result.kind === "input") {
|
|
5839
|
-
return /* @__PURE__ */ (0,
|
|
6047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5840
6048
|
ToolInputCard,
|
|
5841
6049
|
{
|
|
5842
6050
|
disabled,
|
|
@@ -5846,16 +6054,16 @@ function VisitorToolResultView({
|
|
|
5846
6054
|
);
|
|
5847
6055
|
}
|
|
5848
6056
|
if (result.kind === "entity") {
|
|
5849
|
-
return /* @__PURE__ */ (0,
|
|
6057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EntityResultCard, { result });
|
|
5850
6058
|
}
|
|
5851
6059
|
if (result.kind === "collection") {
|
|
5852
|
-
return /* @__PURE__ */ (0,
|
|
6060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollectionResultCard, { result });
|
|
5853
6061
|
}
|
|
5854
6062
|
if (result.kind === "signature") {
|
|
5855
|
-
return /* @__PURE__ */ (0,
|
|
6063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignatureResultCard, { result });
|
|
5856
6064
|
}
|
|
5857
6065
|
if (result.kind === "summary") {
|
|
5858
|
-
return /* @__PURE__ */ (0,
|
|
6066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolResultCard, { result });
|
|
5859
6067
|
}
|
|
5860
6068
|
return null;
|
|
5861
6069
|
}
|
|
@@ -5864,9 +6072,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
5864
6072
|
}
|
|
5865
6073
|
|
|
5866
6074
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
5867
|
-
var
|
|
6075
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5868
6076
|
function MinimizeIcon() {
|
|
5869
|
-
return /* @__PURE__ */ (0,
|
|
6077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5870
6078
|
"path",
|
|
5871
6079
|
{
|
|
5872
6080
|
d: "M3.5 8h9",
|
|
@@ -5877,7 +6085,7 @@ function MinimizeIcon() {
|
|
|
5877
6085
|
) });
|
|
5878
6086
|
}
|
|
5879
6087
|
function CloseIcon2() {
|
|
5880
|
-
return /* @__PURE__ */ (0,
|
|
6088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5881
6089
|
"path",
|
|
5882
6090
|
{
|
|
5883
6091
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -5888,7 +6096,7 @@ function CloseIcon2() {
|
|
|
5888
6096
|
) });
|
|
5889
6097
|
}
|
|
5890
6098
|
function NewChatIcon() {
|
|
5891
|
-
return /* @__PURE__ */ (0,
|
|
6099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5892
6100
|
"path",
|
|
5893
6101
|
{
|
|
5894
6102
|
d: "M9.5 3.5h3v3M12.25 3.75 8 8M7 4H4.5A1.5 1.5 0 0 0 3 5.5v6A1.5 1.5 0 0 0 4.5 13h6a1.5 1.5 0 0 0 1.5-1.5V9",
|
|
@@ -5900,7 +6108,7 @@ function NewChatIcon() {
|
|
|
5900
6108
|
) });
|
|
5901
6109
|
}
|
|
5902
6110
|
function ExpandIcon() {
|
|
5903
|
-
return /* @__PURE__ */ (0,
|
|
6111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5904
6112
|
"path",
|
|
5905
6113
|
{
|
|
5906
6114
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -5912,7 +6120,7 @@ function ExpandIcon() {
|
|
|
5912
6120
|
) });
|
|
5913
6121
|
}
|
|
5914
6122
|
function RestoreIcon() {
|
|
5915
|
-
return /* @__PURE__ */ (0,
|
|
6123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5916
6124
|
"path",
|
|
5917
6125
|
{
|
|
5918
6126
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -5924,7 +6132,7 @@ function RestoreIcon() {
|
|
|
5924
6132
|
) });
|
|
5925
6133
|
}
|
|
5926
6134
|
function ChevronDownIcon() {
|
|
5927
|
-
return /* @__PURE__ */ (0,
|
|
6135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5928
6136
|
"path",
|
|
5929
6137
|
{
|
|
5930
6138
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -6061,7 +6269,10 @@ function AgentRail({
|
|
|
6061
6269
|
id: "streaming-response",
|
|
6062
6270
|
role: "agent",
|
|
6063
6271
|
streaming: true,
|
|
6064
|
-
text: state.streamingText
|
|
6272
|
+
text: state.streamingText,
|
|
6273
|
+
searchResults: (state.toolResults ?? []).filter(
|
|
6274
|
+
(result) => result.kind === "search"
|
|
6275
|
+
)
|
|
6065
6276
|
} : state.pendingOffer && !lastIsAgent ? {
|
|
6066
6277
|
createdAt: 0,
|
|
6067
6278
|
id: "pending-booking",
|
|
@@ -6183,7 +6394,7 @@ function AgentRail({
|
|
|
6183
6394
|
window.setTimeout(settle, 900);
|
|
6184
6395
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
6185
6396
|
}
|
|
6186
|
-
return /* @__PURE__ */ (0,
|
|
6397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6187
6398
|
"aside",
|
|
6188
6399
|
{
|
|
6189
6400
|
ref: railRef,
|
|
@@ -6197,34 +6408,34 @@ function AgentRail({
|
|
|
6197
6408
|
autoFocus: mobileFullscreen || expanded,
|
|
6198
6409
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
6199
6410
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
6200
|
-
children: /* @__PURE__ */ (0,
|
|
6411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6201
6412
|
AgentRailOverlayContext.Provider,
|
|
6202
6413
|
{
|
|
6203
6414
|
value: { railRef, overlayRef },
|
|
6204
6415
|
children: [
|
|
6205
|
-
/* @__PURE__ */ (0,
|
|
6206
|
-
/* @__PURE__ */ (0,
|
|
6207
|
-
onCollapse ? /* @__PURE__ */ (0,
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
6417
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__brand-row", children: [
|
|
6418
|
+
onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6208
6419
|
"button",
|
|
6209
6420
|
{
|
|
6210
6421
|
type: "button",
|
|
6211
6422
|
className: "agent-rail__collapse",
|
|
6212
6423
|
"aria-label": "Collapse assist",
|
|
6213
6424
|
onClick: onCollapse,
|
|
6214
|
-
children: /* @__PURE__ */ (0,
|
|
6425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MinimizeIcon, {})
|
|
6215
6426
|
}
|
|
6216
|
-
) : onClose ? /* @__PURE__ */ (0,
|
|
6427
|
+
) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6217
6428
|
"button",
|
|
6218
6429
|
{
|
|
6219
6430
|
type: "button",
|
|
6220
6431
|
className: "agent-rail__close",
|
|
6221
6432
|
"aria-label": "Close agent",
|
|
6222
6433
|
onClick: onClose,
|
|
6223
|
-
children: /* @__PURE__ */ (0,
|
|
6434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon2, {})
|
|
6224
6435
|
}
|
|
6225
|
-
) : /* @__PURE__ */ (0,
|
|
6226
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0,
|
|
6227
|
-
showBrandLogo ? /* @__PURE__ */ (0,
|
|
6436
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
6437
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__identity", children: [
|
|
6438
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6228
6439
|
"img",
|
|
6229
6440
|
{
|
|
6230
6441
|
className: "agent-rail__brand-logo",
|
|
@@ -6235,10 +6446,10 @@ function AgentRail({
|
|
|
6235
6446
|
}
|
|
6236
6447
|
}
|
|
6237
6448
|
) }) : null,
|
|
6238
|
-
resolvedBrandLabel ? /* @__PURE__ */ (0,
|
|
6449
|
+
resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
6239
6450
|
] }) : null,
|
|
6240
|
-
/* @__PURE__ */ (0,
|
|
6241
|
-
onReset ? /* @__PURE__ */ (0,
|
|
6451
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__actions", children: [
|
|
6452
|
+
onReset ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6242
6453
|
"button",
|
|
6243
6454
|
{
|
|
6244
6455
|
type: "button",
|
|
@@ -6246,24 +6457,24 @@ function AgentRail({
|
|
|
6246
6457
|
"aria-label": "Start a new conversation",
|
|
6247
6458
|
disabled: !hasVisitorMessages2,
|
|
6248
6459
|
onClick: handleReset,
|
|
6249
|
-
children: /* @__PURE__ */ (0,
|
|
6460
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewChatIcon, {})
|
|
6250
6461
|
}
|
|
6251
6462
|
) : null,
|
|
6252
|
-
onExpandToggle ? /* @__PURE__ */ (0,
|
|
6463
|
+
onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6253
6464
|
"button",
|
|
6254
6465
|
{
|
|
6255
6466
|
type: "button",
|
|
6256
6467
|
className: "agent-rail__expand",
|
|
6257
6468
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
6258
6469
|
onClick: onExpandToggle,
|
|
6259
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
6470
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExpandIcon, {})
|
|
6260
6471
|
}
|
|
6261
6472
|
) : null
|
|
6262
6473
|
] })
|
|
6263
6474
|
] }) }),
|
|
6264
|
-
/* @__PURE__ */ (0,
|
|
6265
|
-
!hasVisitorMessages2 ? /* @__PURE__ */ (0,
|
|
6266
|
-
greeting?.role === "agent" ? /* @__PURE__ */ (0,
|
|
6475
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__thread", children: [
|
|
6476
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
6477
|
+
greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6267
6478
|
MessageBubble,
|
|
6268
6479
|
{
|
|
6269
6480
|
message: greeting,
|
|
@@ -6272,7 +6483,7 @@ function AgentRail({
|
|
|
6272
6483
|
onBook
|
|
6273
6484
|
}
|
|
6274
6485
|
) : null,
|
|
6275
|
-
showIdleFollowUps ? /* @__PURE__ */ (0,
|
|
6486
|
+
showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6276
6487
|
FollowUpChips,
|
|
6277
6488
|
{
|
|
6278
6489
|
suggestions: state.followUps,
|
|
@@ -6281,7 +6492,7 @@ function AgentRail({
|
|
|
6281
6492
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
6282
6493
|
}
|
|
6283
6494
|
) }) : null,
|
|
6284
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6495
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6285
6496
|
AgentActivityBubble,
|
|
6286
6497
|
{
|
|
6287
6498
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6290,7 +6501,7 @@ function AgentRail({
|
|
|
6290
6501
|
steps: state.toolSteps
|
|
6291
6502
|
}
|
|
6292
6503
|
) : null,
|
|
6293
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6504
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6294
6505
|
VisitorToolResultView,
|
|
6295
6506
|
{
|
|
6296
6507
|
result,
|
|
@@ -6299,7 +6510,7 @@ function AgentRail({
|
|
|
6299
6510
|
},
|
|
6300
6511
|
result.id
|
|
6301
6512
|
)),
|
|
6302
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6513
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6303
6514
|
HumanInputCard,
|
|
6304
6515
|
{
|
|
6305
6516
|
request,
|
|
@@ -6308,8 +6519,8 @@ function AgentRail({
|
|
|
6308
6519
|
request.requestId
|
|
6309
6520
|
))
|
|
6310
6521
|
] }) : null,
|
|
6311
|
-
visibleMessages.map((message, index) => /* @__PURE__ */ (0,
|
|
6312
|
-
/* @__PURE__ */ (0,
|
|
6522
|
+
visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__turn-block", children: [
|
|
6523
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6313
6524
|
MessageBubble,
|
|
6314
6525
|
{
|
|
6315
6526
|
message,
|
|
@@ -6319,7 +6530,7 @@ function AgentRail({
|
|
|
6319
6530
|
onBook
|
|
6320
6531
|
}
|
|
6321
6532
|
),
|
|
6322
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0,
|
|
6533
|
+
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6323
6534
|
MessageActions,
|
|
6324
6535
|
{
|
|
6325
6536
|
answeredAt: message.createdAt,
|
|
@@ -6331,8 +6542,8 @@ function AgentRail({
|
|
|
6331
6542
|
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
6332
6543
|
}
|
|
6333
6544
|
) : null,
|
|
6334
|
-
index === lastVisitorIndex ? /* @__PURE__ */ (0,
|
|
6335
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6545
|
+
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
6546
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6336
6547
|
AgentActivityBubble,
|
|
6337
6548
|
{
|
|
6338
6549
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6341,7 +6552,7 @@ function AgentRail({
|
|
|
6341
6552
|
steps: state.toolSteps
|
|
6342
6553
|
}
|
|
6343
6554
|
) : null,
|
|
6344
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6555
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6345
6556
|
VisitorToolResultView,
|
|
6346
6557
|
{
|
|
6347
6558
|
result,
|
|
@@ -6350,7 +6561,7 @@ function AgentRail({
|
|
|
6350
6561
|
},
|
|
6351
6562
|
result.id
|
|
6352
6563
|
)),
|
|
6353
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6564
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6354
6565
|
HumanInputCard,
|
|
6355
6566
|
{
|
|
6356
6567
|
request,
|
|
@@ -6360,7 +6571,7 @@ function AgentRail({
|
|
|
6360
6571
|
))
|
|
6361
6572
|
] }) : null
|
|
6362
6573
|
] }, message.id)),
|
|
6363
|
-
streamingMessage ? /* @__PURE__ */ (0,
|
|
6574
|
+
streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6364
6575
|
MessageBubble,
|
|
6365
6576
|
{
|
|
6366
6577
|
message: streamingMessage,
|
|
@@ -6370,16 +6581,16 @@ function AgentRail({
|
|
|
6370
6581
|
onBook
|
|
6371
6582
|
}
|
|
6372
6583
|
) : null,
|
|
6373
|
-
waitingForBooking ? /* @__PURE__ */ (0,
|
|
6374
|
-
state.error ? /* @__PURE__ */ (0,
|
|
6375
|
-
/* @__PURE__ */ (0,
|
|
6376
|
-
/* @__PURE__ */ (0,
|
|
6377
|
-
/* @__PURE__ */ (0,
|
|
6584
|
+
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
|
|
6585
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "Something went wrong" }),
|
|
6588
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: state.error })
|
|
6378
6589
|
] }),
|
|
6379
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
6590
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
6380
6591
|
] }) : null
|
|
6381
6592
|
] }) }),
|
|
6382
|
-
showDisclaimerLabel ? /* @__PURE__ */ (0,
|
|
6593
|
+
showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6383
6594
|
"a",
|
|
6384
6595
|
{
|
|
6385
6596
|
href: disclaimerLink,
|
|
@@ -6388,8 +6599,8 @@ function AgentRail({
|
|
|
6388
6599
|
children: resolvedDisclaimerLabel
|
|
6389
6600
|
}
|
|
6390
6601
|
) : resolvedDisclaimerLabel }) }) : null,
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6392
|
-
showJumpToLatest ? /* @__PURE__ */ (0,
|
|
6602
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
|
|
6603
|
+
showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6393
6604
|
"button",
|
|
6394
6605
|
{
|
|
6395
6606
|
type: "button",
|
|
@@ -6397,10 +6608,10 @@ function AgentRail({
|
|
|
6397
6608
|
"aria-label": "Jump to the latest message",
|
|
6398
6609
|
title: "Jump to the latest message",
|
|
6399
6610
|
onClick: scrollToLatest,
|
|
6400
|
-
children: /* @__PURE__ */ (0,
|
|
6611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon, {})
|
|
6401
6612
|
}
|
|
6402
6613
|
) : null,
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6404
6615
|
Composer,
|
|
6405
6616
|
{
|
|
6406
6617
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -6412,11 +6623,11 @@ function AgentRail({
|
|
|
6412
6623
|
},
|
|
6413
6624
|
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
6414
6625
|
),
|
|
6415
|
-
poweredByLabel ? /* @__PURE__ */ (0,
|
|
6626
|
+
poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: poweredByLabel }) }) }) : null
|
|
6416
6627
|
] })
|
|
6417
6628
|
] }),
|
|
6418
|
-
/* @__PURE__ */ (0,
|
|
6419
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */ (0,
|
|
6629
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
6630
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6420
6631
|
AnswerReceiptDialog,
|
|
6421
6632
|
{
|
|
6422
6633
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6432,9 +6643,9 @@ function AgentRail({
|
|
|
6432
6643
|
}
|
|
6433
6644
|
|
|
6434
6645
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
6435
|
-
var
|
|
6646
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6436
6647
|
function SparklesIcon() {
|
|
6437
|
-
return /* @__PURE__ */ (0,
|
|
6648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6438
6649
|
"svg",
|
|
6439
6650
|
{
|
|
6440
6651
|
className: "assist-edge-tab__sparkles",
|
|
@@ -6442,21 +6653,21 @@ function SparklesIcon() {
|
|
|
6442
6653
|
fill: "none",
|
|
6443
6654
|
"aria-hidden": "true",
|
|
6444
6655
|
children: [
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6656
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6446
6657
|
"path",
|
|
6447
6658
|
{
|
|
6448
6659
|
d: "M8 1.2l.95 2.7 2.85.05-2.25 1.75.8 2.75L8 6.7 5.65 8.45l.8-2.75L4.2 3.95l2.85-.05L8 1.2z",
|
|
6449
6660
|
fill: "currentColor"
|
|
6450
6661
|
}
|
|
6451
6662
|
),
|
|
6452
|
-
/* @__PURE__ */ (0,
|
|
6663
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6453
6664
|
"path",
|
|
6454
6665
|
{
|
|
6455
6666
|
d: "M14.2 6.4l.55 1.55 1.65.03-1.3 1 .46 1.58-1.36-1-1.36 1 .46-1.58-1.3-1 1.65-.03.55-1.55z",
|
|
6456
6667
|
fill: "currentColor"
|
|
6457
6668
|
}
|
|
6458
6669
|
),
|
|
6459
|
-
/* @__PURE__ */ (0,
|
|
6670
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6460
6671
|
"path",
|
|
6461
6672
|
{
|
|
6462
6673
|
d: "M3.1 9.1l.4 1.15 1.22.02-.96.74.34 1.17-1-.74-1 .74.34-1.17-.96-.74 1.22-.02.4-1.15z",
|
|
@@ -6470,7 +6681,7 @@ function SparklesIcon() {
|
|
|
6470
6681
|
function TabMarkIcon({ customIconUrl }) {
|
|
6471
6682
|
const url = customIconUrl?.trim();
|
|
6472
6683
|
if (url) {
|
|
6473
|
-
return /* @__PURE__ */ (0,
|
|
6684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6474
6685
|
"img",
|
|
6475
6686
|
{
|
|
6476
6687
|
alt: "",
|
|
@@ -6480,10 +6691,10 @@ function TabMarkIcon({ customIconUrl }) {
|
|
|
6480
6691
|
}
|
|
6481
6692
|
);
|
|
6482
6693
|
}
|
|
6483
|
-
return /* @__PURE__ */ (0,
|
|
6694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SparklesIcon, {});
|
|
6484
6695
|
}
|
|
6485
6696
|
function ChevronLeftIcon() {
|
|
6486
|
-
return /* @__PURE__ */ (0,
|
|
6697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6487
6698
|
"path",
|
|
6488
6699
|
{
|
|
6489
6700
|
d: "M10 4L6 8l4 4",
|
|
@@ -6495,7 +6706,7 @@ function ChevronLeftIcon() {
|
|
|
6495
6706
|
) });
|
|
6496
6707
|
}
|
|
6497
6708
|
function ChevronDownIcon2() {
|
|
6498
|
-
return /* @__PURE__ */ (0,
|
|
6709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6499
6710
|
"path",
|
|
6500
6711
|
{
|
|
6501
6712
|
d: "M4 6l4 4 4-4",
|
|
@@ -6507,7 +6718,7 @@ function ChevronDownIcon2() {
|
|
|
6507
6718
|
) });
|
|
6508
6719
|
}
|
|
6509
6720
|
function DragDots() {
|
|
6510
|
-
return /* @__PURE__ */ (0,
|
|
6721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("i", {}, index)) });
|
|
6511
6722
|
}
|
|
6512
6723
|
var VARIANT_COPY = {
|
|
6513
6724
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -6553,7 +6764,7 @@ function AssistEdgeTab({
|
|
|
6553
6764
|
...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
6554
6765
|
colorScheme: resolvedColorScheme
|
|
6555
6766
|
};
|
|
6556
|
-
return /* @__PURE__ */ (0,
|
|
6767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6557
6768
|
"button",
|
|
6558
6769
|
{
|
|
6559
6770
|
type: "button",
|
|
@@ -6565,15 +6776,15 @@ function AssistEdgeTab({
|
|
|
6565
6776
|
tabIndex: visible ? 0 : -1,
|
|
6566
6777
|
onClick: onOpen,
|
|
6567
6778
|
children: [
|
|
6568
|
-
mobile ? /* @__PURE__ */ (0,
|
|
6569
|
-
/* @__PURE__ */ (0,
|
|
6779
|
+
mobile ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6570
6781
|
"span",
|
|
6571
6782
|
{
|
|
6572
6783
|
className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
|
|
6573
6784
|
"aria-hidden": "true",
|
|
6574
6785
|
children: [
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6576
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6786
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6787
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6577
6788
|
"img",
|
|
6578
6789
|
{
|
|
6579
6790
|
className: "assist-edge-tab__logo",
|
|
@@ -6587,11 +6798,11 @@ function AssistEdgeTab({
|
|
|
6587
6798
|
]
|
|
6588
6799
|
}
|
|
6589
6800
|
),
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
] }) : variant === "outline" ? /* @__PURE__ */ (0,
|
|
6592
|
-
/* @__PURE__ */ (0,
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
|
|
6802
|
+
] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6805
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6595
6806
|
"img",
|
|
6596
6807
|
{
|
|
6597
6808
|
className: "assist-edge-tab__logo",
|
|
@@ -6603,18 +6814,18 @@ function AssistEdgeTab({
|
|
|
6603
6814
|
}
|
|
6604
6815
|
) : null
|
|
6605
6816
|
] }),
|
|
6606
|
-
/* @__PURE__ */ (0,
|
|
6607
|
-
/* @__PURE__ */ (0,
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6818
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
|
|
6608
6819
|
] }) : null,
|
|
6609
|
-
variant === "ask" ? /* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6611
|
-
/* @__PURE__ */ (0,
|
|
6612
|
-
/* @__PURE__ */ (0,
|
|
6820
|
+
variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6821
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {}),
|
|
6822
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6823
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
|
|
6613
6824
|
] }) : null,
|
|
6614
|
-
variant === "fill" ? /* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6616
|
-
/* @__PURE__ */ (0,
|
|
6617
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6825
|
+
variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6828
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6618
6829
|
"img",
|
|
6619
6830
|
{
|
|
6620
6831
|
className: "assist-edge-tab__logo",
|
|
@@ -6626,8 +6837,8 @@ function AssistEdgeTab({
|
|
|
6626
6837
|
}
|
|
6627
6838
|
) : null
|
|
6628
6839
|
] }),
|
|
6629
|
-
/* @__PURE__ */ (0,
|
|
6630
|
-
/* @__PURE__ */ (0,
|
|
6840
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6841
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
|
|
6631
6842
|
] }) : null
|
|
6632
6843
|
]
|
|
6633
6844
|
}
|
|
@@ -6649,8 +6860,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
|
|
|
6649
6860
|
}
|
|
6650
6861
|
return void 0;
|
|
6651
6862
|
}
|
|
6652
|
-
function normalizeAgentFeedbackAnswerText(
|
|
6653
|
-
const normalized =
|
|
6863
|
+
function normalizeAgentFeedbackAnswerText(text2) {
|
|
6864
|
+
const normalized = text2.replace(/\s+/g, " ").trim();
|
|
6654
6865
|
if (!normalized) return void 0;
|
|
6655
6866
|
return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
|
|
6656
6867
|
}
|
|
@@ -6691,7 +6902,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
|
|
|
6691
6902
|
}
|
|
6692
6903
|
|
|
6693
6904
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
6694
|
-
var
|
|
6905
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6695
6906
|
function AgentWidget({
|
|
6696
6907
|
indexId,
|
|
6697
6908
|
customerId,
|
|
@@ -6834,19 +7045,19 @@ function AgentWidget({
|
|
|
6834
7045
|
window.addEventListener("keydown", handleKeyDown);
|
|
6835
7046
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
6836
7047
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
6837
|
-
return /* @__PURE__ */ (0,
|
|
6838
|
-
/* @__PURE__ */ (0,
|
|
7048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "webless-agent-root", children: [
|
|
7049
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6839
7050
|
"div",
|
|
6840
7051
|
{
|
|
6841
7052
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
6842
|
-
children: /* @__PURE__ */ (0,
|
|
7053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6843
7054
|
"div",
|
|
6844
7055
|
{
|
|
6845
7056
|
ref: railSlotRef,
|
|
6846
7057
|
className: "webless-agent-root__rail-slot",
|
|
6847
7058
|
inert: railCollapsed || void 0,
|
|
6848
7059
|
"aria-hidden": railCollapsed,
|
|
6849
|
-
children: /* @__PURE__ */ (0,
|
|
7060
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6850
7061
|
AgentRail,
|
|
6851
7062
|
{
|
|
6852
7063
|
theme,
|
|
@@ -6883,7 +7094,7 @@ function AgentWidget({
|
|
|
6883
7094
|
)
|
|
6884
7095
|
}
|
|
6885
7096
|
),
|
|
6886
|
-
railCollapsed ? /* @__PURE__ */ (0,
|
|
7097
|
+
railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6887
7098
|
AssistEdgeTab,
|
|
6888
7099
|
{
|
|
6889
7100
|
variant: placement.variant,
|