@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/embed.cjs
CHANGED
|
@@ -1376,10 +1376,10 @@ var AgentSession = class {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
this.session = session;
|
|
1378
1378
|
const inputResponses = responses.map(
|
|
1379
|
-
({ requestId, optionId, text }) => ({
|
|
1379
|
+
({ requestId, optionId, text: text2 }) => ({
|
|
1380
1380
|
requestId,
|
|
1381
1381
|
...optionId ? { optionId } : {},
|
|
1382
|
-
...
|
|
1382
|
+
...text2 ? { text: text2 } : {}
|
|
1383
1383
|
})
|
|
1384
1384
|
);
|
|
1385
1385
|
const response = await withCapabilityRefresh(
|
|
@@ -1607,19 +1607,19 @@ function parseVisitorFormFields(value) {
|
|
|
1607
1607
|
const fields = [];
|
|
1608
1608
|
const seen = /* @__PURE__ */ new Set();
|
|
1609
1609
|
for (const item of value) {
|
|
1610
|
-
const
|
|
1611
|
-
const id = asString(
|
|
1612
|
-
const kind = asString(
|
|
1613
|
-
if (!
|
|
1610
|
+
const record2 = asRecord(item);
|
|
1611
|
+
const id = asString(record2?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
1612
|
+
const kind = asString(record2?.kind);
|
|
1613
|
+
if (!record2 || !id || seen.has(id) || !isFieldKind2(kind)) continue;
|
|
1614
1614
|
seen.add(id);
|
|
1615
|
-
const label = asString(
|
|
1615
|
+
const label = asString(record2.label) || id;
|
|
1616
1616
|
fields.push({
|
|
1617
1617
|
id,
|
|
1618
1618
|
kind,
|
|
1619
1619
|
label,
|
|
1620
|
-
placeholder: asString(
|
|
1621
|
-
required:
|
|
1622
|
-
...asString(
|
|
1620
|
+
placeholder: asString(record2.placeholder) || label,
|
|
1621
|
+
required: record2.required !== false,
|
|
1622
|
+
...asString(record2.autocomplete) ? { autocomplete: asString(record2.autocomplete) } : {}
|
|
1623
1623
|
});
|
|
1624
1624
|
if (fields.length >= MAX_FORM_FIELDS) break;
|
|
1625
1625
|
}
|
|
@@ -1650,52 +1650,52 @@ function formatComposerFormMessage(form, values) {
|
|
|
1650
1650
|
return value ? `${field.label}: ${value}` : "";
|
|
1651
1651
|
}).filter(Boolean).join("\n");
|
|
1652
1652
|
}
|
|
1653
|
-
function looksLikeFieldCollection(
|
|
1653
|
+
function looksLikeFieldCollection(text2) {
|
|
1654
1654
|
return /\b(please|need|send|share|enter|provide|add|collect|what|which|use)\b/i.test(
|
|
1655
|
-
|
|
1656
|
-
) || /:\s*$/m.test(
|
|
1655
|
+
text2
|
|
1656
|
+
) || /:\s*$/m.test(text2) || /^[-*•]\s+/m.test(text2);
|
|
1657
1657
|
}
|
|
1658
|
-
function looksLikeBookingCopy(
|
|
1658
|
+
function looksLikeBookingCopy(text2) {
|
|
1659
1659
|
return /book(ing)? (card|a demo|this time)|pick a (date|time)|available (times|slots)|calendly/i.test(
|
|
1660
|
-
|
|
1660
|
+
text2
|
|
1661
1661
|
);
|
|
1662
1662
|
}
|
|
1663
|
-
function echoedLabeledFieldIds(
|
|
1663
|
+
function echoedLabeledFieldIds(text2) {
|
|
1664
1664
|
const ids = /* @__PURE__ */ new Set();
|
|
1665
|
-
if (/\bname\s*:\s+\S+/i.test(
|
|
1666
|
-
if (/\be-?mail\s*:\s+\S+/i.test(
|
|
1667
|
-
if (/\bphone\s*:\s+\S+/i.test(
|
|
1668
|
-
if (/\bcompany\s*:\s+\S+/i.test(
|
|
1665
|
+
if (/\bname\s*:\s+\S+/i.test(text2)) ids.add("name");
|
|
1666
|
+
if (/\be-?mail\s*:\s+\S+/i.test(text2)) ids.add("email");
|
|
1667
|
+
if (/\bphone\s*:\s+\S+/i.test(text2)) ids.add("phone");
|
|
1668
|
+
if (/\bcompany\s*:\s+\S+/i.test(text2)) ids.add("company");
|
|
1669
1669
|
return ids;
|
|
1670
1670
|
}
|
|
1671
|
-
function matchLibraryFields(
|
|
1671
|
+
function matchLibraryFields(text2) {
|
|
1672
1672
|
return FIELD_LIBRARY.flatMap((field) => {
|
|
1673
|
-
if (field.exclude?.test(
|
|
1674
|
-
const leftover =
|
|
1673
|
+
if (field.exclude?.test(text2)) {
|
|
1674
|
+
const leftover = text2.replace(field.exclude, " ");
|
|
1675
1675
|
if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
|
|
1676
|
-
} else if (!field.patterns.some((pattern) => pattern.test(
|
|
1676
|
+
} else if (!field.patterns.some((pattern) => pattern.test(text2))) {
|
|
1677
1677
|
return [];
|
|
1678
1678
|
}
|
|
1679
1679
|
const { patterns: _patterns, exclude: _exclude, ...next } = field;
|
|
1680
1680
|
return [next];
|
|
1681
1681
|
}).slice(0, MAX_FORM_FIELDS);
|
|
1682
1682
|
}
|
|
1683
|
-
function looksLikeCompletedActionRecap(
|
|
1684
|
-
const confirmingCreate = /\bshould i create this\b/i.test(
|
|
1685
|
-
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(
|
|
1683
|
+
function looksLikeCompletedActionRecap(text2) {
|
|
1684
|
+
const confirmingCreate = /\bshould i create this\b/i.test(text2);
|
|
1685
|
+
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text2) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text2);
|
|
1686
1686
|
if (echoingFilledFields) {
|
|
1687
|
-
if (looksLikeFieldCollection(
|
|
1688
|
-
const echoed = echoedLabeledFieldIds(
|
|
1689
|
-
if (matchLibraryFields(
|
|
1687
|
+
if (looksLikeFieldCollection(text2)) {
|
|
1688
|
+
const echoed = echoedLabeledFieldIds(text2);
|
|
1689
|
+
if (matchLibraryFields(text2).some((field) => !echoed.has(field.id))) {
|
|
1690
1690
|
return false;
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
return true;
|
|
1694
1694
|
}
|
|
1695
|
-
return confirmingCreate && !looksLikeFieldCollection(
|
|
1695
|
+
return confirmingCreate && !looksLikeFieldCollection(text2);
|
|
1696
1696
|
}
|
|
1697
|
-
function inferComposerForm(
|
|
1698
|
-
const cleaned =
|
|
1697
|
+
function inferComposerForm(text2) {
|
|
1698
|
+
const cleaned = text2.trim();
|
|
1699
1699
|
if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
|
|
1700
1700
|
return null;
|
|
1701
1701
|
}
|
|
@@ -1710,8 +1710,8 @@ function resolveComposerForm(input) {
|
|
|
1710
1710
|
if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
|
|
1711
1711
|
return null;
|
|
1712
1712
|
}
|
|
1713
|
-
const
|
|
1714
|
-
if (!
|
|
1713
|
+
const text2 = input.agentText.trim();
|
|
1714
|
+
if (!text2) return null;
|
|
1715
1715
|
const card = input.cards?.find((item) => item.type === "visitor_form");
|
|
1716
1716
|
if (card?.fields && card.fields.length >= MIN_FORM_FIELDS) {
|
|
1717
1717
|
return {
|
|
@@ -1719,7 +1719,7 @@ function resolveComposerForm(input) {
|
|
|
1719
1719
|
fields: card.fields.slice(0, MAX_FORM_FIELDS)
|
|
1720
1720
|
};
|
|
1721
1721
|
}
|
|
1722
|
-
return inferComposerForm(
|
|
1722
|
+
return inferComposerForm(text2);
|
|
1723
1723
|
}
|
|
1724
1724
|
|
|
1725
1725
|
// src/react/lib/tool-card.ts
|
|
@@ -1733,9 +1733,9 @@ function preferBookingOffer(current, next) {
|
|
|
1733
1733
|
}
|
|
1734
1734
|
return next;
|
|
1735
1735
|
}
|
|
1736
|
-
function looksLikeBookingReady(
|
|
1736
|
+
function looksLikeBookingReady(text2) {
|
|
1737
1737
|
return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
|
|
1738
|
-
|
|
1738
|
+
text2
|
|
1739
1739
|
);
|
|
1740
1740
|
}
|
|
1741
1741
|
function bookingOfferIdentityKey(offer) {
|
|
@@ -1759,19 +1759,19 @@ function isEventTypeUri(value) {
|
|
|
1759
1759
|
return /^https:\/\/api\.calendly\.com\/event_types\/[^/]+$/i.test(value);
|
|
1760
1760
|
}
|
|
1761
1761
|
function parseToolCard(value) {
|
|
1762
|
-
const
|
|
1763
|
-
if (!
|
|
1764
|
-
if (
|
|
1765
|
-
const nested = parseToolCard(
|
|
1762
|
+
const record2 = asRecord2(value);
|
|
1763
|
+
if (!record2) return null;
|
|
1764
|
+
if (record2.booking_offer && asString2(record2.type) !== "booking_offer") {
|
|
1765
|
+
const nested = parseToolCard(record2.booking_offer);
|
|
1766
1766
|
if (nested) return nested;
|
|
1767
1767
|
}
|
|
1768
|
-
if (
|
|
1769
|
-
const nested = parseToolCard(
|
|
1768
|
+
if (record2.visitor_booking && asString2(record2.type) !== "booking_confirmed") {
|
|
1769
|
+
const nested = parseToolCard(record2.visitor_booking);
|
|
1770
1770
|
if (nested) return nested;
|
|
1771
1771
|
}
|
|
1772
|
-
const type = asString2(
|
|
1772
|
+
const type = asString2(record2.type);
|
|
1773
1773
|
if (type === "booking_offer") {
|
|
1774
|
-
const eventTypes = Array.isArray(
|
|
1774
|
+
const eventTypes = Array.isArray(record2.eventTypes) ? record2.eventTypes.flatMap((item) => {
|
|
1775
1775
|
const entry = asRecord2(item);
|
|
1776
1776
|
const uri = asString2(entry?.uri);
|
|
1777
1777
|
if (!entry || !uri) return [];
|
|
@@ -1788,7 +1788,7 @@ function parseToolCard(value) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
];
|
|
1790
1790
|
}) : [];
|
|
1791
|
-
const slots = Array.isArray(
|
|
1791
|
+
const slots = Array.isArray(record2.slots) ? record2.slots.flatMap((item) => {
|
|
1792
1792
|
const entry = asRecord2(item);
|
|
1793
1793
|
const startTime = asString2(entry?.startTime);
|
|
1794
1794
|
if (!entry || !startTime) return [];
|
|
@@ -1804,11 +1804,11 @@ function parseToolCard(value) {
|
|
|
1804
1804
|
return { type: "booking_offer", eventTypes, slots };
|
|
1805
1805
|
}
|
|
1806
1806
|
if (type === "booking_confirmed") {
|
|
1807
|
-
const eventUri = asString2(
|
|
1807
|
+
const eventUri = asString2(record2.eventUri);
|
|
1808
1808
|
if (!isEventUri(eventUri)) return null;
|
|
1809
|
-
const inviteeUri = asString2(
|
|
1810
|
-
const inviteeEmail = asString2(
|
|
1811
|
-
const startTime = asString2(
|
|
1809
|
+
const inviteeUri = asString2(record2.inviteeUri);
|
|
1810
|
+
const inviteeEmail = asString2(record2.inviteeEmail);
|
|
1811
|
+
const startTime = asString2(record2.startTime);
|
|
1812
1812
|
return {
|
|
1813
1813
|
type: "booking_confirmed",
|
|
1814
1814
|
eventUri,
|
|
@@ -1818,12 +1818,12 @@ function parseToolCard(value) {
|
|
|
1818
1818
|
};
|
|
1819
1819
|
}
|
|
1820
1820
|
if (type === "booking_canceled") {
|
|
1821
|
-
const eventUri = asString2(
|
|
1821
|
+
const eventUri = asString2(record2.eventUri);
|
|
1822
1822
|
if (!isEventUri(eventUri)) return null;
|
|
1823
1823
|
return { type: "booking_canceled", eventUri };
|
|
1824
1824
|
}
|
|
1825
1825
|
if (type === "visitor_form") {
|
|
1826
|
-
const fields = parseVisitorFormFields(
|
|
1826
|
+
const fields = parseVisitorFormFields(record2.fields);
|
|
1827
1827
|
if (fields.length < 2) return null;
|
|
1828
1828
|
return { type: "visitor_form", fields };
|
|
1829
1829
|
}
|
|
@@ -1841,33 +1841,33 @@ function formatBookingOfferFence(offer) {
|
|
|
1841
1841
|
].join("\n");
|
|
1842
1842
|
}
|
|
1843
1843
|
function bookingCardFromActionOutput(output) {
|
|
1844
|
-
const
|
|
1845
|
-
const data = asRecord2(
|
|
1844
|
+
const record2 = asRecord2(output);
|
|
1845
|
+
const data = asRecord2(record2?.output) ?? asRecord2(record2?.data) ?? record2;
|
|
1846
1846
|
return parseToolCard(data);
|
|
1847
1847
|
}
|
|
1848
|
-
function ensureBookingOfferText(
|
|
1849
|
-
if (!offer) return
|
|
1850
|
-
if (extractToolCards(
|
|
1851
|
-
return
|
|
1848
|
+
function ensureBookingOfferText(text2, offer) {
|
|
1849
|
+
if (!offer) return text2;
|
|
1850
|
+
if (extractToolCards(text2).some((card) => card.type === "booking_offer")) {
|
|
1851
|
+
return text2;
|
|
1852
1852
|
}
|
|
1853
|
-
const visible = stripToolCards(
|
|
1853
|
+
const visible = stripToolCards(text2).trim() || text2.trim();
|
|
1854
1854
|
return `${visible}
|
|
1855
1855
|
|
|
1856
1856
|
${formatBookingOfferFence(offer)}`;
|
|
1857
1857
|
}
|
|
1858
|
-
function hideToolCardFences(
|
|
1859
|
-
return
|
|
1858
|
+
function hideToolCardFences(text2) {
|
|
1859
|
+
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();
|
|
1860
1860
|
}
|
|
1861
1861
|
var BOOKING_CARD_FALLBACK = "Pick a date and time that works for you.";
|
|
1862
|
-
function looksLikeBookingAvailabilityDump(
|
|
1863
|
-
const cleaned =
|
|
1862
|
+
function looksLikeBookingAvailabilityDump(text2) {
|
|
1863
|
+
const cleaned = text2.trim();
|
|
1864
1864
|
if (!cleaned) return false;
|
|
1865
1865
|
const isoCount = (cleaned.match(/\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/g) ?? []).length;
|
|
1866
1866
|
const utcCount = (cleaned.match(/\bUTC\b/g) ?? []).length;
|
|
1867
1867
|
return isoCount >= 2 || utcCount >= 2 || /api\.calendly\.com|calendly\.com\//i.test(cleaned) || /webless-tool-card/i.test(cleaned);
|
|
1868
1868
|
}
|
|
1869
|
-
function sanitizeBookingOfferCopy(
|
|
1870
|
-
const cleaned = hideToolCardFences(
|
|
1869
|
+
function sanitizeBookingOfferCopy(text2) {
|
|
1870
|
+
const cleaned = hideToolCardFences(text2);
|
|
1871
1871
|
if (!cleaned || looksLikeBookingAvailabilityDump(cleaned)) {
|
|
1872
1872
|
return BOOKING_CARD_FALLBACK;
|
|
1873
1873
|
}
|
|
@@ -1880,9 +1880,9 @@ function visitorTimeZone() {
|
|
|
1880
1880
|
return "UTC";
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
|
-
function extractToolCards(
|
|
1883
|
+
function extractToolCards(text2) {
|
|
1884
1884
|
const cards = [];
|
|
1885
|
-
for (const match of
|
|
1885
|
+
for (const match of text2.matchAll(FENCE_PATTERN)) {
|
|
1886
1886
|
try {
|
|
1887
1887
|
const card = parseToolCard(JSON.parse(match[1] ?? ""));
|
|
1888
1888
|
if (card) cards.push(card);
|
|
@@ -1891,8 +1891,8 @@ function extractToolCards(text) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
return cards;
|
|
1893
1893
|
}
|
|
1894
|
-
function stripToolCards(
|
|
1895
|
-
return
|
|
1894
|
+
function stripToolCards(text2) {
|
|
1895
|
+
return text2.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1896
1896
|
}
|
|
1897
1897
|
function localDateKey(date) {
|
|
1898
1898
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -2001,6 +2001,72 @@ function visitorBookingPrefix(booking) {
|
|
|
2001
2001
|
].join("\n");
|
|
2002
2002
|
}
|
|
2003
2003
|
|
|
2004
|
+
// src/runtime/search-discovery.ts
|
|
2005
|
+
function record(value) {
|
|
2006
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
2007
|
+
}
|
|
2008
|
+
function text(value, max = 500) {
|
|
2009
|
+
return typeof value === "string" && value.trim().length > 0 && value.trim().length <= max;
|
|
2010
|
+
}
|
|
2011
|
+
function safeSearchUrl(value) {
|
|
2012
|
+
if (typeof value !== "string") return void 0;
|
|
2013
|
+
try {
|
|
2014
|
+
const url = new URL(value);
|
|
2015
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.href : void 0;
|
|
2016
|
+
} catch {
|
|
2017
|
+
return void 0;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
function parseAgentSearchReferences(value) {
|
|
2021
|
+
const data = record(value);
|
|
2022
|
+
if (!data || !Array.isArray(data.sources) || data.sources.length > 20)
|
|
2023
|
+
return null;
|
|
2024
|
+
const sources = [];
|
|
2025
|
+
for (const value2 of data.sources) {
|
|
2026
|
+
const source = record(value2);
|
|
2027
|
+
if (!source || Object.keys(source).some(
|
|
2028
|
+
(key) => !["id", "title", "url"].includes(key)
|
|
2029
|
+
) || !text(source.id, Infinity) || !text(source.title) || source.url !== void 0 && typeof source.url !== "string")
|
|
2030
|
+
return null;
|
|
2031
|
+
const url = safeSearchUrl(source.url);
|
|
2032
|
+
sources.push({
|
|
2033
|
+
id: source.id.trim(),
|
|
2034
|
+
title: source.title.trim(),
|
|
2035
|
+
...url ? { url } : {}
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
let cta;
|
|
2039
|
+
if (data.cta !== void 0) {
|
|
2040
|
+
const action = record(data.cta);
|
|
2041
|
+
if (!action || Object.keys(action).some((key) => !["label", "url"].includes(key)) || !text(action.label) || action.url !== void 0 && typeof action.url !== "string")
|
|
2042
|
+
return null;
|
|
2043
|
+
const url = safeSearchUrl(action.url);
|
|
2044
|
+
cta = { label: action.label.trim(), ...url ? { url } : {} };
|
|
2045
|
+
}
|
|
2046
|
+
return { sources, ...cta ? { cta } : {} };
|
|
2047
|
+
}
|
|
2048
|
+
function parseAgentSearchDiscoveryOutput(value) {
|
|
2049
|
+
let decoded = value;
|
|
2050
|
+
if (typeof value === "string") {
|
|
2051
|
+
try {
|
|
2052
|
+
decoded = JSON.parse(value);
|
|
2053
|
+
} catch {
|
|
2054
|
+
return null;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
const data = record(decoded);
|
|
2058
|
+
if (!data || Object.keys(data).some(
|
|
2059
|
+
(key) => !["answer", "sources", "cta", "suggestions"].includes(key)
|
|
2060
|
+
) || !text(data.answer, 5e4) || !Array.isArray(data.suggestions) || data.suggestions.length > 8 || !data.suggestions.every((item) => text(item)))
|
|
2061
|
+
return null;
|
|
2062
|
+
const references = parseAgentSearchReferences(data);
|
|
2063
|
+
return references ? {
|
|
2064
|
+
...references,
|
|
2065
|
+
answer: data.answer.trim(),
|
|
2066
|
+
suggestions: data.suggestions.map((item) => item.trim())
|
|
2067
|
+
} : null;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2004
2070
|
// src/react/persisted-conversation.ts
|
|
2005
2071
|
var CONVERSATION_VERSION = 3;
|
|
2006
2072
|
function conversationKey(storageKeyPrefix, visitorSessionId) {
|
|
@@ -2008,82 +2074,87 @@ function conversationKey(storageKeyPrefix, visitorSessionId) {
|
|
|
2008
2074
|
}
|
|
2009
2075
|
function parseMessage(value) {
|
|
2010
2076
|
if (typeof value !== "object" || value === null) return null;
|
|
2011
|
-
const
|
|
2012
|
-
if (typeof
|
|
2077
|
+
const record2 = value;
|
|
2078
|
+
if (typeof record2.id !== "string" || record2.role !== "agent" && record2.role !== "visitor" || typeof record2.text !== "string" || typeof record2.createdAt !== "number" || !Number.isFinite(record2.createdAt)) {
|
|
2013
2079
|
return null;
|
|
2014
2080
|
}
|
|
2015
|
-
if (
|
|
2081
|
+
if (record2.role === "visitor") {
|
|
2016
2082
|
return {
|
|
2017
|
-
id:
|
|
2083
|
+
id: record2.id,
|
|
2018
2084
|
role: "visitor",
|
|
2019
|
-
text:
|
|
2020
|
-
createdAt:
|
|
2021
|
-
...typeof
|
|
2085
|
+
text: record2.text,
|
|
2086
|
+
createdAt: record2.createdAt,
|
|
2087
|
+
...typeof record2.runtimeText === "string" && record2.runtimeText ? { runtimeText: record2.runtimeText } : {}
|
|
2022
2088
|
};
|
|
2023
2089
|
}
|
|
2090
|
+
const searchResults = Array.isArray(record2.searchResults) ? record2.searchResults.flatMap((value2) => {
|
|
2091
|
+
const result = parseToolResult(value2);
|
|
2092
|
+
return result?.kind === "search" ? [result] : [];
|
|
2093
|
+
}) : [];
|
|
2024
2094
|
return {
|
|
2025
|
-
id:
|
|
2095
|
+
id: record2.id,
|
|
2026
2096
|
role: "agent",
|
|
2027
|
-
|
|
2028
|
-
|
|
2097
|
+
...searchResults.length ? { searchResults } : {},
|
|
2098
|
+
text: record2.text,
|
|
2099
|
+
createdAt: record2.createdAt
|
|
2029
2100
|
};
|
|
2030
2101
|
}
|
|
2031
2102
|
function parseToolStep(value) {
|
|
2032
2103
|
if (typeof value !== "object" || value === null) return null;
|
|
2033
|
-
const
|
|
2034
|
-
if (typeof
|
|
2104
|
+
const record2 = value;
|
|
2105
|
+
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") {
|
|
2035
2106
|
return null;
|
|
2036
2107
|
}
|
|
2037
2108
|
return {
|
|
2038
|
-
id:
|
|
2039
|
-
kind:
|
|
2040
|
-
label:
|
|
2041
|
-
state:
|
|
2042
|
-
...typeof
|
|
2109
|
+
id: record2.id,
|
|
2110
|
+
kind: record2.kind,
|
|
2111
|
+
label: record2.label,
|
|
2112
|
+
state: record2.state,
|
|
2113
|
+
...typeof record2.detail === "string" && record2.detail ? { detail: record2.detail } : {}
|
|
2043
2114
|
};
|
|
2044
2115
|
}
|
|
2045
2116
|
function parseInputOption(value) {
|
|
2046
2117
|
if (typeof value !== "object" || value === null) return null;
|
|
2047
|
-
const
|
|
2048
|
-
if (typeof
|
|
2118
|
+
const record2 = value;
|
|
2119
|
+
if (typeof record2.id !== "string" || typeof record2.label !== "string") {
|
|
2049
2120
|
return null;
|
|
2050
2121
|
}
|
|
2051
2122
|
return {
|
|
2052
|
-
id:
|
|
2053
|
-
label:
|
|
2054
|
-
...typeof
|
|
2055
|
-
...
|
|
2123
|
+
id: record2.id,
|
|
2124
|
+
label: record2.label,
|
|
2125
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2126
|
+
...record2.style === "default" || record2.style === "primary" || record2.style === "danger" ? { style: record2.style } : {}
|
|
2056
2127
|
};
|
|
2057
2128
|
}
|
|
2058
2129
|
function parseInputRequest(value) {
|
|
2059
2130
|
if (typeof value !== "object" || value === null) return null;
|
|
2060
|
-
const
|
|
2061
|
-
if (typeof
|
|
2131
|
+
const record2 = value;
|
|
2132
|
+
if (typeof record2.requestId !== "string" || record2.kind !== "question" && record2.kind !== "session-limit" && record2.kind !== "tool-approval" || typeof record2.prompt !== "string") {
|
|
2062
2133
|
return null;
|
|
2063
2134
|
}
|
|
2064
|
-
const action =
|
|
2135
|
+
const action = record2.action;
|
|
2065
2136
|
if (typeof action !== "object" || action === null) return null;
|
|
2066
2137
|
const actionRecord = action;
|
|
2067
2138
|
if (typeof actionRecord.callId !== "string" || actionRecord.kind !== "tool-call" || typeof actionRecord.toolName !== "string") {
|
|
2068
2139
|
return null;
|
|
2069
2140
|
}
|
|
2070
|
-
const options = Array.isArray(
|
|
2071
|
-
if (Array.isArray(
|
|
2141
|
+
const options = Array.isArray(record2.options) ? record2.options.map(parseInputOption) : void 0;
|
|
2142
|
+
if (Array.isArray(record2.options) && options?.some((option) => option === null)) {
|
|
2072
2143
|
return null;
|
|
2073
2144
|
}
|
|
2074
|
-
const ui =
|
|
2075
|
-
if (
|
|
2145
|
+
const ui = record2.ui ? parseAgentToolUiSurface(record2.ui) : void 0;
|
|
2146
|
+
if (record2.ui && !ui) return null;
|
|
2076
2147
|
return {
|
|
2077
|
-
requestId:
|
|
2078
|
-
kind:
|
|
2079
|
-
prompt:
|
|
2148
|
+
requestId: record2.requestId,
|
|
2149
|
+
kind: record2.kind,
|
|
2150
|
+
prompt: record2.prompt,
|
|
2080
2151
|
action: {
|
|
2081
2152
|
callId: actionRecord.callId,
|
|
2082
2153
|
kind: "tool-call",
|
|
2083
2154
|
toolName: actionRecord.toolName
|
|
2084
2155
|
},
|
|
2085
|
-
...
|
|
2086
|
-
...
|
|
2156
|
+
...record2.display === "confirmation" || record2.display === "select" || record2.display === "text" ? { display: record2.display } : {},
|
|
2157
|
+
...record2.allowFreeform === true ? { allowFreeform: true } : {},
|
|
2087
2158
|
...options && options.length > 0 ? {
|
|
2088
2159
|
options: options.filter(
|
|
2089
2160
|
(option) => option !== null
|
|
@@ -2094,40 +2165,50 @@ function parseInputRequest(value) {
|
|
|
2094
2165
|
}
|
|
2095
2166
|
function parseToolResult(value) {
|
|
2096
2167
|
if (typeof value !== "object" || value === null) return null;
|
|
2097
|
-
const
|
|
2098
|
-
if (typeof
|
|
2168
|
+
const record2 = value;
|
|
2169
|
+
if (typeof record2.id !== "string" || typeof record2.toolName !== "string" || record2.status !== "completed" && record2.status !== "failed" && record2.status !== "rejected") {
|
|
2099
2170
|
return null;
|
|
2100
2171
|
}
|
|
2101
|
-
if (
|
|
2172
|
+
if (record2.kind === "search" && record2.toolName === "search_discovery" && record2.status === "completed") {
|
|
2173
|
+
const references = parseAgentSearchReferences(record2);
|
|
2174
|
+
return references ? {
|
|
2175
|
+
id: record2.id,
|
|
2176
|
+
toolName: "search_discovery",
|
|
2177
|
+
status: "completed",
|
|
2178
|
+
kind: "search",
|
|
2179
|
+
...references
|
|
2180
|
+
} : null;
|
|
2181
|
+
}
|
|
2182
|
+
if (record2.kind === "input") {
|
|
2102
2183
|
const surface = parseAgentToolUiSurface(
|
|
2103
|
-
|
|
2184
|
+
record2.surface
|
|
2104
2185
|
);
|
|
2105
2186
|
return surface ? {
|
|
2106
|
-
id:
|
|
2107
|
-
toolName:
|
|
2108
|
-
status:
|
|
2187
|
+
id: record2.id,
|
|
2188
|
+
toolName: record2.toolName,
|
|
2189
|
+
status: record2.status,
|
|
2109
2190
|
kind: "input",
|
|
2110
2191
|
surface
|
|
2111
2192
|
} : null;
|
|
2112
2193
|
}
|
|
2113
|
-
if (
|
|
2194
|
+
if (record2.kind === "entity" && typeof record2.title === "string") {
|
|
2114
2195
|
return {
|
|
2115
|
-
id:
|
|
2116
|
-
toolName:
|
|
2117
|
-
status:
|
|
2196
|
+
id: record2.id,
|
|
2197
|
+
toolName: record2.toolName,
|
|
2198
|
+
status: record2.status,
|
|
2118
2199
|
kind: "entity",
|
|
2119
|
-
title:
|
|
2120
|
-
...typeof
|
|
2200
|
+
title: record2.title,
|
|
2201
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2121
2202
|
};
|
|
2122
2203
|
}
|
|
2123
|
-
if (
|
|
2204
|
+
if (record2.kind === "collection" && typeof record2.title === "string" && Array.isArray(record2.items)) {
|
|
2124
2205
|
return {
|
|
2125
|
-
id:
|
|
2126
|
-
toolName:
|
|
2127
|
-
status:
|
|
2206
|
+
id: record2.id,
|
|
2207
|
+
toolName: record2.toolName,
|
|
2208
|
+
status: record2.status,
|
|
2128
2209
|
kind: "collection",
|
|
2129
|
-
title:
|
|
2130
|
-
items:
|
|
2210
|
+
title: record2.title,
|
|
2211
|
+
items: record2.items.flatMap((item) => {
|
|
2131
2212
|
if (typeof item !== "object" || item === null) return [];
|
|
2132
2213
|
const entry = item;
|
|
2133
2214
|
if (typeof entry.title !== "string") return [];
|
|
@@ -2141,26 +2222,26 @@ function parseToolResult(value) {
|
|
|
2141
2222
|
})
|
|
2142
2223
|
};
|
|
2143
2224
|
}
|
|
2144
|
-
if (
|
|
2225
|
+
if (record2.kind === "signature" && typeof record2.title === "string") {
|
|
2145
2226
|
return {
|
|
2146
|
-
id:
|
|
2147
|
-
toolName:
|
|
2148
|
-
status:
|
|
2227
|
+
id: record2.id,
|
|
2228
|
+
toolName: record2.toolName,
|
|
2229
|
+
status: record2.status,
|
|
2149
2230
|
kind: "signature",
|
|
2150
|
-
title:
|
|
2151
|
-
...typeof
|
|
2152
|
-
...typeof
|
|
2231
|
+
title: record2.title,
|
|
2232
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2233
|
+
...typeof record2.statusLabel === "string" ? { statusLabel: record2.statusLabel } : {}
|
|
2153
2234
|
};
|
|
2154
2235
|
}
|
|
2155
|
-
if (
|
|
2236
|
+
if (record2.kind !== "summary" || typeof record2.title !== "string")
|
|
2156
2237
|
return null;
|
|
2157
2238
|
return {
|
|
2158
|
-
id:
|
|
2159
|
-
toolName:
|
|
2160
|
-
status:
|
|
2239
|
+
id: record2.id,
|
|
2240
|
+
toolName: record2.toolName,
|
|
2241
|
+
status: record2.status,
|
|
2161
2242
|
kind: "summary",
|
|
2162
|
-
title:
|
|
2163
|
-
...typeof
|
|
2243
|
+
title: record2.title,
|
|
2244
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2164
2245
|
};
|
|
2165
2246
|
}
|
|
2166
2247
|
function visitorTurnText(message) {
|
|
@@ -2175,29 +2256,29 @@ function loadPersistedAgentConversation(storageKeyPrefix, visitorSessionId) {
|
|
|
2175
2256
|
try {
|
|
2176
2257
|
const value = JSON.parse(raw);
|
|
2177
2258
|
if (typeof value !== "object" || value === null) return null;
|
|
2178
|
-
const
|
|
2179
|
-
if (
|
|
2259
|
+
const record2 = value;
|
|
2260
|
+
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)) {
|
|
2180
2261
|
return null;
|
|
2181
2262
|
}
|
|
2182
|
-
const messages =
|
|
2263
|
+
const messages = record2.messages.map(parseMessage);
|
|
2183
2264
|
if (messages.some((message) => message === null)) return null;
|
|
2184
|
-
const storedToolSteps = (
|
|
2265
|
+
const storedToolSteps = (record2.version === 2 || record2.version === CONVERSATION_VERSION) && Array.isArray(record2.toolSteps) ? record2.toolSteps : [];
|
|
2185
2266
|
const toolSteps = storedToolSteps.map(parseToolStep);
|
|
2186
2267
|
if (toolSteps.some((step) => step === null)) return null;
|
|
2187
|
-
const storedToolResults =
|
|
2268
|
+
const storedToolResults = record2.version === CONVERSATION_VERSION && Array.isArray(record2.toolResults) ? record2.toolResults : [];
|
|
2188
2269
|
const toolResults = storedToolResults.map(parseToolResult);
|
|
2189
2270
|
if (toolResults.some((result) => result === null)) return null;
|
|
2190
|
-
const storedPendingInputs = Array.isArray(
|
|
2271
|
+
const storedPendingInputs = Array.isArray(record2.pendingInputs) ? record2.pendingInputs : [];
|
|
2191
2272
|
const pendingInputs = storedPendingInputs.map(parseInputRequest);
|
|
2192
2273
|
if (pendingInputs.some((request) => request === null)) return null;
|
|
2193
2274
|
return {
|
|
2194
2275
|
messages: messages.filter(
|
|
2195
2276
|
(message) => message !== null
|
|
2196
2277
|
),
|
|
2197
|
-
pending:
|
|
2198
|
-
streamingText:
|
|
2278
|
+
pending: record2.pending,
|
|
2279
|
+
streamingText: record2.streamingText,
|
|
2199
2280
|
toolSteps: toolSteps.filter((step) => step !== null),
|
|
2200
|
-
...Array.isArray(
|
|
2281
|
+
...Array.isArray(record2.toolResults) ? {
|
|
2201
2282
|
toolResults: toolResults.filter(
|
|
2202
2283
|
(result) => result !== null
|
|
2203
2284
|
)
|
|
@@ -2238,13 +2319,13 @@ function loadPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
|
|
|
2238
2319
|
try {
|
|
2239
2320
|
const value = JSON.parse(raw);
|
|
2240
2321
|
if (typeof value !== "object" || value === null) return null;
|
|
2241
|
-
const
|
|
2242
|
-
if (typeof
|
|
2322
|
+
const record2 = value;
|
|
2323
|
+
if (typeof record2.eventUri !== "string" || !record2.eventUri) return null;
|
|
2243
2324
|
return {
|
|
2244
|
-
eventUri:
|
|
2245
|
-
...typeof
|
|
2246
|
-
...typeof
|
|
2247
|
-
...typeof
|
|
2325
|
+
eventUri: record2.eventUri,
|
|
2326
|
+
...typeof record2.inviteeUri === "string" && record2.inviteeUri ? { inviteeUri: record2.inviteeUri } : {},
|
|
2327
|
+
...typeof record2.inviteeEmail === "string" && record2.inviteeEmail ? { inviteeEmail: record2.inviteeEmail } : {},
|
|
2328
|
+
...typeof record2.startTime === "string" && record2.startTime ? { startTime: record2.startTime } : {}
|
|
2248
2329
|
};
|
|
2249
2330
|
} catch {
|
|
2250
2331
|
return null;
|
|
@@ -2332,10 +2413,10 @@ function safeText(value) {
|
|
|
2332
2413
|
return value.trim().slice(0, MAX_TEXT_LENGTH);
|
|
2333
2414
|
}
|
|
2334
2415
|
function safeHref(value) {
|
|
2335
|
-
const
|
|
2336
|
-
if (!
|
|
2416
|
+
const text2 = safeText(value);
|
|
2417
|
+
if (!text2) return "";
|
|
2337
2418
|
try {
|
|
2338
|
-
const url = new URL(
|
|
2419
|
+
const url = new URL(text2);
|
|
2339
2420
|
return url.protocol === "https:" ? url.toString() : "";
|
|
2340
2421
|
} catch {
|
|
2341
2422
|
return "";
|
|
@@ -2555,6 +2636,22 @@ function finalizeSummaryPresentation(result, proposed) {
|
|
|
2555
2636
|
};
|
|
2556
2637
|
}
|
|
2557
2638
|
function presentVisitorToolResult(result, registry = []) {
|
|
2639
|
+
if (result.toolName === "search_discovery" && result.status === "completed") {
|
|
2640
|
+
const envelope2 = parseAgentToolResultEnvelope(result.output);
|
|
2641
|
+
const search = parseAgentSearchDiscoveryOutput(
|
|
2642
|
+
envelope2?.output ?? result.output
|
|
2643
|
+
);
|
|
2644
|
+
if (search) {
|
|
2645
|
+
return {
|
|
2646
|
+
id: result.callId,
|
|
2647
|
+
toolName: "search_discovery",
|
|
2648
|
+
status: "completed",
|
|
2649
|
+
kind: "search",
|
|
2650
|
+
sources: search.sources,
|
|
2651
|
+
...search.cta ? { cta: search.cta } : {}
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2558
2655
|
const envelope = parseAgentToolResultEnvelope(result.output) ?? providerErrorEnvelope(result.output) ?? legacyBookingEnvelope(result.output);
|
|
2559
2656
|
const proposed = envelope ? resolvePresenterOutput(result, envelope, registry) : null;
|
|
2560
2657
|
if (proposed?.kind === "booking") {
|
|
@@ -2619,8 +2716,8 @@ function presentVisitorToolResult(result, registry = []) {
|
|
|
2619
2716
|
return finalizeSummaryPresentation(result, proposed);
|
|
2620
2717
|
}
|
|
2621
2718
|
function providerErrorEnvelope(output) {
|
|
2622
|
-
const
|
|
2623
|
-
const providerError = asRecord3(
|
|
2719
|
+
const record2 = asRecord3(output);
|
|
2720
|
+
const providerError = asRecord3(record2?.providerError);
|
|
2624
2721
|
const message = safeText(providerError?.message);
|
|
2625
2722
|
const action = safeText(providerError?.action);
|
|
2626
2723
|
if (!message || !action) return null;
|
|
@@ -2676,15 +2773,15 @@ function appendChatCollectiblePrompts(messages, requests) {
|
|
|
2676
2773
|
}
|
|
2677
2774
|
return next;
|
|
2678
2775
|
}
|
|
2679
|
-
function chatInputResponseForText(requests,
|
|
2680
|
-
const trimmed =
|
|
2776
|
+
function chatInputResponseForText(requests, text2) {
|
|
2777
|
+
const trimmed = text2.trim();
|
|
2681
2778
|
if (!trimmed) return null;
|
|
2682
2779
|
const pending = requests.find(isChatCollectibleInputRequest);
|
|
2683
2780
|
if (!pending) return null;
|
|
2684
2781
|
return { requestId: pending.requestId, text: trimmed };
|
|
2685
2782
|
}
|
|
2686
|
-
function normalizeAssistantDedupeKey(
|
|
2687
|
-
return
|
|
2783
|
+
function normalizeAssistantDedupeKey(text2) {
|
|
2784
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
2688
2785
|
}
|
|
2689
2786
|
function isNearDuplicateAssistantText(left, right) {
|
|
2690
2787
|
const a = normalizeAssistantDedupeKey(left);
|
|
@@ -2698,13 +2795,14 @@ function isNearDuplicateAssistantText(left, right) {
|
|
|
2698
2795
|
shorter.slice(0, Math.floor(shorter.length * 0.85))
|
|
2699
2796
|
);
|
|
2700
2797
|
}
|
|
2701
|
-
function appendAgentTurnMessage(messages, displayText) {
|
|
2798
|
+
function appendAgentTurnMessage(messages, displayText, searchResults = []) {
|
|
2702
2799
|
const trimmed = displayText.trim();
|
|
2703
|
-
if (!trimmed) return [...messages];
|
|
2800
|
+
if (!trimmed && searchResults.length === 0) return [...messages];
|
|
2704
2801
|
const agentMessage = {
|
|
2705
2802
|
id: `agent-${Date.now()}`,
|
|
2706
2803
|
role: "agent",
|
|
2707
2804
|
text: trimmed,
|
|
2805
|
+
...searchResults.length ? { searchResults } : {},
|
|
2708
2806
|
createdAt: Date.now()
|
|
2709
2807
|
};
|
|
2710
2808
|
const last = messages.at(-1);
|
|
@@ -3083,7 +3181,14 @@ function useAgentChat({
|
|
|
3083
3181
|
setState((prev) => ({
|
|
3084
3182
|
...prev,
|
|
3085
3183
|
phase: (prev.pendingInputs ?? []).some(shouldRenderVisitorInputCard) ? "waiting-input" : "complete",
|
|
3086
|
-
messages: appendAgentTurnMessage(
|
|
3184
|
+
messages: appendAgentTurnMessage(
|
|
3185
|
+
prev.messages,
|
|
3186
|
+
displayText,
|
|
3187
|
+
(prev.toolResults ?? []).filter((result) => result.kind === "search")
|
|
3188
|
+
),
|
|
3189
|
+
toolResults: (prev.toolResults ?? []).filter(
|
|
3190
|
+
(result) => result.kind !== "search"
|
|
3191
|
+
),
|
|
3087
3192
|
toolSteps: completeActivePlanning(prev.toolSteps),
|
|
3088
3193
|
streamingText: "",
|
|
3089
3194
|
pendingOffer: bookingConfirmed ? null : capturedOffers.at(-1) ?? prev.pendingOffer,
|
|
@@ -4085,9 +4190,111 @@ function FollowUpChips({
|
|
|
4085
4190
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4086
4191
|
var import_react10 = require("react");
|
|
4087
4192
|
|
|
4193
|
+
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4194
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4195
|
+
function SiteIcon() {
|
|
4196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4197
|
+
"svg",
|
|
4198
|
+
{
|
|
4199
|
+
viewBox: "0 0 24 24",
|
|
4200
|
+
width: "18",
|
|
4201
|
+
height: "18",
|
|
4202
|
+
fill: "none",
|
|
4203
|
+
stroke: "currentColor",
|
|
4204
|
+
strokeWidth: "1.5",
|
|
4205
|
+
"aria-hidden": "true",
|
|
4206
|
+
children: [
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4209
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4210
|
+
]
|
|
4211
|
+
}
|
|
4212
|
+
);
|
|
4213
|
+
}
|
|
4214
|
+
function SearchReferences({
|
|
4215
|
+
results
|
|
4216
|
+
}) {
|
|
4217
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
4218
|
+
const sources = results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4219
|
+
const url = safeSearchUrl(source.url);
|
|
4220
|
+
const key = url ?? source.id;
|
|
4221
|
+
if (seenSources.has(key)) return [];
|
|
4222
|
+
seenSources.add(key);
|
|
4223
|
+
return [{ ...source, url, key }];
|
|
4224
|
+
});
|
|
4225
|
+
const seenActions = /* @__PURE__ */ new Set();
|
|
4226
|
+
const actions = results.flatMap((result) => {
|
|
4227
|
+
const url = safeSearchUrl(result.cta?.url);
|
|
4228
|
+
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4229
|
+
seenActions.add(url);
|
|
4230
|
+
return [{ label: result.cta.label, url }];
|
|
4231
|
+
});
|
|
4232
|
+
if (!sources.length && !actions.length) return null;
|
|
4233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
|
|
4234
|
+
sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": "Sources", children: [
|
|
4235
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { className: "search-references__heading", children: [
|
|
4236
|
+
"Sources",
|
|
4237
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4238
|
+
"svg",
|
|
4239
|
+
{
|
|
4240
|
+
viewBox: "0 0 24 24",
|
|
4241
|
+
width: "14",
|
|
4242
|
+
height: "14",
|
|
4243
|
+
fill: "none",
|
|
4244
|
+
stroke: "currentColor",
|
|
4245
|
+
strokeWidth: "1.75",
|
|
4246
|
+
"aria-hidden": "true",
|
|
4247
|
+
children: [
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 11v6M12 7v1" })
|
|
4250
|
+
]
|
|
4251
|
+
}
|
|
4252
|
+
) })
|
|
4253
|
+
] }),
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
4255
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
4256
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
|
|
4257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
|
|
4258
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4259
|
+
"span",
|
|
4260
|
+
{
|
|
4261
|
+
className: "search-references__title",
|
|
4262
|
+
title: source.title,
|
|
4263
|
+
children: source.title
|
|
4264
|
+
}
|
|
4265
|
+
),
|
|
4266
|
+
source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
|
|
4267
|
+
] })
|
|
4268
|
+
] });
|
|
4269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4270
|
+
"a",
|
|
4271
|
+
{
|
|
4272
|
+
className: "search-references__source",
|
|
4273
|
+
href: source.url,
|
|
4274
|
+
target: "_blank",
|
|
4275
|
+
rel: "noopener noreferrer",
|
|
4276
|
+
children: content
|
|
4277
|
+
}
|
|
4278
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
|
|
4279
|
+
}) })
|
|
4280
|
+
] }) : null,
|
|
4281
|
+
actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4282
|
+
"a",
|
|
4283
|
+
{
|
|
4284
|
+
className: "search-references__cta",
|
|
4285
|
+
href: action.url,
|
|
4286
|
+
target: "_blank",
|
|
4287
|
+
rel: "noopener noreferrer",
|
|
4288
|
+
children: action.label
|
|
4289
|
+
},
|
|
4290
|
+
action.url
|
|
4291
|
+
)) }) : null
|
|
4292
|
+
] });
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4088
4295
|
// src/react/components/BookingCard/BookingCard.tsx
|
|
4089
4296
|
var import_react9 = require("react");
|
|
4090
|
-
var
|
|
4297
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4091
4298
|
var BOOKING_STEPS = [
|
|
4092
4299
|
{ id: "date", label: "Date" },
|
|
4093
4300
|
{ id: "time", label: "Time" },
|
|
@@ -4118,7 +4325,7 @@ function calendarCells(year, month) {
|
|
|
4118
4325
|
return cells;
|
|
4119
4326
|
}
|
|
4120
4327
|
function BookingCardLoader() {
|
|
4121
|
-
return /* @__PURE__ */ (0,
|
|
4328
|
+
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" }) });
|
|
4122
4329
|
}
|
|
4123
4330
|
function BookingCard({
|
|
4124
4331
|
disabled = false,
|
|
@@ -4217,14 +4424,14 @@ function BookingCard({
|
|
|
4217
4424
|
})
|
|
4218
4425
|
});
|
|
4219
4426
|
}
|
|
4220
|
-
return /* @__PURE__ */ (0,
|
|
4427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4221
4428
|
"section",
|
|
4222
4429
|
{
|
|
4223
4430
|
className: "booking-card",
|
|
4224
4431
|
"aria-busy": disabled || void 0,
|
|
4225
4432
|
"aria-label": "Book a meeting",
|
|
4226
|
-
children: /* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
|
|
4434
|
+
/* @__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)(
|
|
4228
4435
|
"li",
|
|
4229
4436
|
{
|
|
4230
4437
|
className: [
|
|
@@ -4234,40 +4441,40 @@ function BookingCard({
|
|
|
4234
4441
|
].filter(Boolean).join(" "),
|
|
4235
4442
|
"aria-current": index === stepIndex ? "step" : void 0,
|
|
4236
4443
|
children: [
|
|
4237
|
-
/* @__PURE__ */ (0,
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
|
|
4445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label })
|
|
4239
4446
|
]
|
|
4240
4447
|
},
|
|
4241
4448
|
item.id
|
|
4242
4449
|
)) }),
|
|
4243
|
-
step === "date" ? /* @__PURE__ */ (0,
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4245
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4450
|
+
step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
|
|
4452
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4246
4453
|
"Times in ",
|
|
4247
4454
|
timeZone
|
|
4248
4455
|
] }) : null,
|
|
4249
|
-
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0,
|
|
4456
|
+
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4250
4457
|
"label",
|
|
4251
4458
|
{
|
|
4252
4459
|
className: "booking-card__field",
|
|
4253
4460
|
htmlFor: `${fieldId}-type`,
|
|
4254
4461
|
children: [
|
|
4255
|
-
/* @__PURE__ */ (0,
|
|
4256
|
-
/* @__PURE__ */ (0,
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Meeting" }),
|
|
4463
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4257
4464
|
"select",
|
|
4258
4465
|
{
|
|
4259
4466
|
id: `${fieldId}-type`,
|
|
4260
4467
|
value: eventTypeUri,
|
|
4261
4468
|
disabled,
|
|
4262
4469
|
onChange: (event) => selectEventType(event.target.value),
|
|
4263
|
-
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0,
|
|
4470
|
+
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.uri, children: item.name }, item.uri))
|
|
4264
4471
|
}
|
|
4265
4472
|
)
|
|
4266
4473
|
]
|
|
4267
4474
|
}
|
|
4268
4475
|
) : null,
|
|
4269
|
-
/* @__PURE__ */ (0,
|
|
4270
|
-
/* @__PURE__ */ (0,
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__month", children: [
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4271
4478
|
"button",
|
|
4272
4479
|
{
|
|
4273
4480
|
type: "button",
|
|
@@ -4278,8 +4485,8 @@ function BookingCard({
|
|
|
4278
4485
|
children: "\u2039"
|
|
4279
4486
|
}
|
|
4280
4487
|
),
|
|
4281
|
-
/* @__PURE__ */ (0,
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4283
4490
|
"button",
|
|
4284
4491
|
{
|
|
4285
4492
|
type: "button",
|
|
@@ -4291,9 +4498,9 @@ function BookingCard({
|
|
|
4291
4498
|
}
|
|
4292
4499
|
)
|
|
4293
4500
|
] }),
|
|
4294
|
-
/* @__PURE__ */ (0,
|
|
4295
|
-
offer.slots.length === 0 ? /* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4501
|
+
/* @__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)) }),
|
|
4502
|
+
offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4297
4504
|
"div",
|
|
4298
4505
|
{
|
|
4299
4506
|
className: "booking-card__calendar",
|
|
@@ -4301,7 +4508,7 @@ function BookingCard({
|
|
|
4301
4508
|
"aria-label": "Available dates",
|
|
4302
4509
|
children: cells.map((cell, index) => {
|
|
4303
4510
|
if (!cell) {
|
|
4304
|
-
return /* @__PURE__ */ (0,
|
|
4511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4305
4512
|
"span",
|
|
4306
4513
|
{
|
|
4307
4514
|
className: "booking-card__day"
|
|
@@ -4311,7 +4518,7 @@ function BookingCard({
|
|
|
4311
4518
|
}
|
|
4312
4519
|
const available = availableByDate.has(cell.key);
|
|
4313
4520
|
const selected = cell.key === selectedDate;
|
|
4314
|
-
return /* @__PURE__ */ (0,
|
|
4521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4315
4522
|
"button",
|
|
4316
4523
|
{
|
|
4317
4524
|
type: "button",
|
|
@@ -4331,9 +4538,9 @@ function BookingCard({
|
|
|
4331
4538
|
}
|
|
4332
4539
|
)
|
|
4333
4540
|
] }, "date") : null,
|
|
4334
|
-
step === "time" ? /* @__PURE__ */ (0,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4336
|
-
/* @__PURE__ */ (0,
|
|
4541
|
+
step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4542
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4543
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4337
4544
|
"button",
|
|
4338
4545
|
{
|
|
4339
4546
|
type: "button",
|
|
@@ -4344,15 +4551,15 @@ function BookingCard({
|
|
|
4344
4551
|
children: "\u2039"
|
|
4345
4552
|
}
|
|
4346
4553
|
),
|
|
4347
|
-
/* @__PURE__ */ (0,
|
|
4348
|
-
/* @__PURE__ */ (0,
|
|
4349
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4554
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
|
|
4556
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4350
4557
|
"Times in ",
|
|
4351
4558
|
timeZone
|
|
4352
4559
|
] }) : null
|
|
4353
4560
|
] })
|
|
4354
4561
|
] }),
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
4562
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4356
4563
|
"button",
|
|
4357
4564
|
{
|
|
4358
4565
|
type: "button",
|
|
@@ -4364,9 +4571,9 @@ function BookingCard({
|
|
|
4364
4571
|
slot.startTime
|
|
4365
4572
|
)) })
|
|
4366
4573
|
] }, "time") : null,
|
|
4367
|
-
step === "details" ? /* @__PURE__ */ (0,
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4369
|
-
/* @__PURE__ */ (0,
|
|
4574
|
+
step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4575
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4576
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4370
4577
|
"button",
|
|
4371
4578
|
{
|
|
4372
4579
|
type: "button",
|
|
@@ -4377,21 +4584,21 @@ function BookingCard({
|
|
|
4377
4584
|
children: "\u2039"
|
|
4378
4585
|
}
|
|
4379
4586
|
),
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4381
|
-
/* @__PURE__ */ (0,
|
|
4382
|
-
/* @__PURE__ */ (0,
|
|
4383
|
-
selectedType?.location ? /* @__PURE__ */ (0,
|
|
4587
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
|
|
4590
|
+
selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
|
|
4384
4591
|
] })
|
|
4385
4592
|
] }),
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4593
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__identity", children: [
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4388
4595
|
"label",
|
|
4389
4596
|
{
|
|
4390
4597
|
className: "booking-card__field",
|
|
4391
4598
|
htmlFor: `${fieldId}-name`,
|
|
4392
4599
|
children: [
|
|
4393
|
-
/* @__PURE__ */ (0,
|
|
4394
|
-
/* @__PURE__ */ (0,
|
|
4600
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Name" }),
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4395
4602
|
"input",
|
|
4396
4603
|
{
|
|
4397
4604
|
id: `${fieldId}-name`,
|
|
@@ -4405,14 +4612,14 @@ function BookingCard({
|
|
|
4405
4612
|
]
|
|
4406
4613
|
}
|
|
4407
4614
|
),
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4615
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4409
4616
|
"label",
|
|
4410
4617
|
{
|
|
4411
4618
|
className: "booking-card__field",
|
|
4412
4619
|
htmlFor: `${fieldId}-email`,
|
|
4413
4620
|
children: [
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4415
|
-
/* @__PURE__ */ (0,
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Email" }),
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4416
4623
|
"input",
|
|
4417
4624
|
{
|
|
4418
4625
|
id: `${fieldId}-email`,
|
|
@@ -4428,7 +4635,7 @@ function BookingCard({
|
|
|
4428
4635
|
}
|
|
4429
4636
|
)
|
|
4430
4637
|
] }),
|
|
4431
|
-
/* @__PURE__ */ (0,
|
|
4638
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4432
4639
|
"button",
|
|
4433
4640
|
{
|
|
4434
4641
|
type: "submit",
|
|
@@ -4446,9 +4653,9 @@ function BookingCard({
|
|
|
4446
4653
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4447
4654
|
var import_streamdown = require("streamdown");
|
|
4448
4655
|
var import_styles = require("streamdown/styles.css");
|
|
4449
|
-
var
|
|
4450
|
-
function normalizeDedupeText(
|
|
4451
|
-
return
|
|
4656
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4657
|
+
function normalizeDedupeText(text2) {
|
|
4658
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4452
4659
|
}
|
|
4453
4660
|
function paragraphsAreNearDuplicates(first, second) {
|
|
4454
4661
|
const left = normalizeDedupeText(first);
|
|
@@ -4464,8 +4671,8 @@ function paragraphsShareOpening(first, second) {
|
|
|
4464
4671
|
if (!opening || opening.length < 20) return false;
|
|
4465
4672
|
return second.trim().startsWith(opening);
|
|
4466
4673
|
}
|
|
4467
|
-
function collapseRepeatedText(
|
|
4468
|
-
const trimmed =
|
|
4674
|
+
function collapseRepeatedText(text2) {
|
|
4675
|
+
const trimmed = text2.trim();
|
|
4469
4676
|
if (trimmed.length < 40) return trimmed;
|
|
4470
4677
|
const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
|
|
4471
4678
|
if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
|
|
@@ -4503,11 +4710,11 @@ function MessageBubble({
|
|
|
4503
4710
|
offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
|
|
4504
4711
|
);
|
|
4505
4712
|
if (message.role === "visitor") {
|
|
4506
|
-
return /* @__PURE__ */ (0,
|
|
4713
|
+
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 }) });
|
|
4507
4714
|
}
|
|
4508
4715
|
const citations = message.citations ?? [];
|
|
4509
|
-
const agentText = /* @__PURE__ */ (0,
|
|
4510
|
-
/* @__PURE__ */ (0,
|
|
4716
|
+
const agentText = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__text", children: [
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4511
4718
|
import_streamdown.Streamdown,
|
|
4512
4719
|
{
|
|
4513
4720
|
animated: isStreaming,
|
|
@@ -4521,8 +4728,9 @@ function MessageBubble({
|
|
|
4521
4728
|
children: displayText
|
|
4522
4729
|
}
|
|
4523
4730
|
),
|
|
4524
|
-
|
|
4525
|
-
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchReferences, { results: message.searchResults ?? [] }),
|
|
4732
|
+
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: [
|
|
4733
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4526
4734
|
"span",
|
|
4527
4735
|
{
|
|
4528
4736
|
className: "message-bubble__source-icon",
|
|
@@ -4530,12 +4738,12 @@ function MessageBubble({
|
|
|
4530
4738
|
children: "\u25A6"
|
|
4531
4739
|
}
|
|
4532
4740
|
),
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4741
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
|
|
4534
4742
|
] }) }, citation.id)) }) : null
|
|
4535
4743
|
] });
|
|
4536
|
-
return /* @__PURE__ */ (0,
|
|
4537
|
-
displayText ? showBrandLogo ? /* @__PURE__ */ (0,
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
|
|
4745
|
+
displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4539
4747
|
"img",
|
|
4540
4748
|
{
|
|
4541
4749
|
src: resolvedLogoUrl,
|
|
@@ -4547,7 +4755,7 @@ function MessageBubble({
|
|
|
4547
4755
|
) }),
|
|
4548
4756
|
agentText
|
|
4549
4757
|
] }) : agentText : null,
|
|
4550
|
-
offers.map((nextOffer, index) => /* @__PURE__ */ (0,
|
|
4758
|
+
offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4551
4759
|
BookingCard,
|
|
4552
4760
|
{
|
|
4553
4761
|
disabled: bookingDisabled,
|
|
@@ -4564,8 +4772,8 @@ var import_react11 = require("react");
|
|
|
4564
4772
|
var import_react_dom2 = require("react-dom");
|
|
4565
4773
|
|
|
4566
4774
|
// src/react/lib/speech.ts
|
|
4567
|
-
function toSpeechText(
|
|
4568
|
-
let out = hideToolCardFences(
|
|
4775
|
+
function toSpeechText(text2) {
|
|
4776
|
+
let out = hideToolCardFences(text2);
|
|
4569
4777
|
out = out.replace(/```[\s\S]*?```/g, " ");
|
|
4570
4778
|
out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
4571
4779
|
out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
@@ -4708,10 +4916,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
|
|
|
4708
4916
|
}
|
|
4709
4917
|
|
|
4710
4918
|
// src/react/components/MessageActions/MessageActions.tsx
|
|
4711
|
-
var
|
|
4919
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4712
4920
|
function CopyIcon() {
|
|
4713
|
-
return /* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
4921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4715
4923
|
"rect",
|
|
4716
4924
|
{
|
|
4717
4925
|
x: "5.75",
|
|
@@ -4723,7 +4931,7 @@ function CopyIcon() {
|
|
|
4723
4931
|
strokeWidth: "1.5"
|
|
4724
4932
|
}
|
|
4725
4933
|
),
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4727
4935
|
"path",
|
|
4728
4936
|
{
|
|
4729
4937
|
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",
|
|
@@ -4734,7 +4942,7 @@ function CopyIcon() {
|
|
|
4734
4942
|
] });
|
|
4735
4943
|
}
|
|
4736
4944
|
function CheckIcon() {
|
|
4737
|
-
return /* @__PURE__ */ (0,
|
|
4945
|
+
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)(
|
|
4738
4946
|
"path",
|
|
4739
4947
|
{
|
|
4740
4948
|
d: "M3.5 8.5l3 3 6-7",
|
|
@@ -4746,8 +4954,8 @@ function CheckIcon() {
|
|
|
4746
4954
|
) });
|
|
4747
4955
|
}
|
|
4748
4956
|
function ThumbUpIcon() {
|
|
4749
|
-
return /* @__PURE__ */ (0,
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
4957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4751
4959
|
"path",
|
|
4752
4960
|
{
|
|
4753
4961
|
d: "M4.67 6.67v8",
|
|
@@ -4756,7 +4964,7 @@ function ThumbUpIcon() {
|
|
|
4756
4964
|
strokeLinecap: "round"
|
|
4757
4965
|
}
|
|
4758
4966
|
),
|
|
4759
|
-
/* @__PURE__ */ (0,
|
|
4967
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4760
4968
|
"path",
|
|
4761
4969
|
{
|
|
4762
4970
|
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",
|
|
@@ -4769,8 +4977,8 @@ function ThumbUpIcon() {
|
|
|
4769
4977
|
] });
|
|
4770
4978
|
}
|
|
4771
4979
|
function ThumbDownIcon() {
|
|
4772
|
-
return /* @__PURE__ */ (0,
|
|
4773
|
-
/* @__PURE__ */ (0,
|
|
4980
|
+
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: [
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4774
4982
|
"path",
|
|
4775
4983
|
{
|
|
4776
4984
|
d: "M4.67 6.67v8",
|
|
@@ -4779,7 +4987,7 @@ function ThumbDownIcon() {
|
|
|
4779
4987
|
strokeLinecap: "round"
|
|
4780
4988
|
}
|
|
4781
4989
|
),
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
4990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4783
4991
|
"path",
|
|
4784
4992
|
{
|
|
4785
4993
|
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",
|
|
@@ -4792,8 +5000,8 @@ function ThumbDownIcon() {
|
|
|
4792
5000
|
] }) });
|
|
4793
5001
|
}
|
|
4794
5002
|
function RegenerateIcon() {
|
|
4795
|
-
return /* @__PURE__ */ (0,
|
|
4796
|
-
/* @__PURE__ */ (0,
|
|
5003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4797
5005
|
"path",
|
|
4798
5006
|
{
|
|
4799
5007
|
d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
|
|
@@ -4802,7 +5010,7 @@ function RegenerateIcon() {
|
|
|
4802
5010
|
strokeLinecap: "round"
|
|
4803
5011
|
}
|
|
4804
5012
|
),
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
5013
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4806
5014
|
"path",
|
|
4807
5015
|
{
|
|
4808
5016
|
d: "M14 2v3.33h-3.33",
|
|
@@ -4812,7 +5020,7 @@ function RegenerateIcon() {
|
|
|
4812
5020
|
strokeLinejoin: "round"
|
|
4813
5021
|
}
|
|
4814
5022
|
),
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4816
5024
|
"path",
|
|
4817
5025
|
{
|
|
4818
5026
|
d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
|
|
@@ -4821,7 +5029,7 @@ function RegenerateIcon() {
|
|
|
4821
5029
|
strokeLinecap: "round"
|
|
4822
5030
|
}
|
|
4823
5031
|
),
|
|
4824
|
-
/* @__PURE__ */ (0,
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4825
5033
|
"path",
|
|
4826
5034
|
{
|
|
4827
5035
|
d: "M5.33 10.67H2V14",
|
|
@@ -4834,15 +5042,15 @@ function RegenerateIcon() {
|
|
|
4834
5042
|
] });
|
|
4835
5043
|
}
|
|
4836
5044
|
function MoreIcon() {
|
|
4837
|
-
return /* @__PURE__ */ (0,
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
4839
|
-
/* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
5045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5046
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5047
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5048
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
|
|
4841
5049
|
] });
|
|
4842
5050
|
}
|
|
4843
5051
|
function SourcesIcon() {
|
|
4844
|
-
return /* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
5052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4846
5054
|
"path",
|
|
4847
5055
|
{
|
|
4848
5056
|
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",
|
|
@@ -4852,7 +5060,7 @@ function SourcesIcon() {
|
|
|
4852
5060
|
strokeLinejoin: "round"
|
|
4853
5061
|
}
|
|
4854
5062
|
),
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4856
5064
|
"path",
|
|
4857
5065
|
{
|
|
4858
5066
|
d: "M8 4.5v9",
|
|
@@ -4864,8 +5072,8 @@ function SourcesIcon() {
|
|
|
4864
5072
|
] });
|
|
4865
5073
|
}
|
|
4866
5074
|
function ReadAloudIcon() {
|
|
4867
|
-
return /* @__PURE__ */ (0,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5076
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4869
5077
|
"path",
|
|
4870
5078
|
{
|
|
4871
5079
|
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",
|
|
@@ -4875,7 +5083,7 @@ function ReadAloudIcon() {
|
|
|
4875
5083
|
strokeLinejoin: "round"
|
|
4876
5084
|
}
|
|
4877
5085
|
),
|
|
4878
|
-
/* @__PURE__ */ (0,
|
|
5086
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4879
5087
|
"path",
|
|
4880
5088
|
{
|
|
4881
5089
|
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",
|
|
@@ -4887,7 +5095,7 @@ function ReadAloudIcon() {
|
|
|
4887
5095
|
] });
|
|
4888
5096
|
}
|
|
4889
5097
|
function StopIcon() {
|
|
4890
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
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)(
|
|
4891
5099
|
"rect",
|
|
4892
5100
|
{
|
|
4893
5101
|
x: "4",
|
|
@@ -4900,12 +5108,12 @@ function StopIcon() {
|
|
|
4900
5108
|
}
|
|
4901
5109
|
) });
|
|
4902
5110
|
}
|
|
4903
|
-
async function writeToClipboard(
|
|
5111
|
+
async function writeToClipboard(text2) {
|
|
4904
5112
|
try {
|
|
4905
|
-
await navigator.clipboard.writeText(
|
|
5113
|
+
await navigator.clipboard.writeText(text2);
|
|
4906
5114
|
} catch {
|
|
4907
5115
|
const textarea = document.createElement("textarea");
|
|
4908
|
-
textarea.value =
|
|
5116
|
+
textarea.value = text2;
|
|
4909
5117
|
textarea.style.position = "fixed";
|
|
4910
5118
|
textarea.style.opacity = "0";
|
|
4911
5119
|
document.body.appendChild(textarea);
|
|
@@ -5051,7 +5259,7 @@ function MessageActions({
|
|
|
5051
5259
|
window.speechSynthesis.speak(utterance);
|
|
5052
5260
|
setSpeaking(true);
|
|
5053
5261
|
}
|
|
5054
|
-
const menu = menuOpen ? /* @__PURE__ */ (0,
|
|
5262
|
+
const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5055
5263
|
"div",
|
|
5056
5264
|
{
|
|
5057
5265
|
className: "agent-message-actions__menu agent-message-actions__menu--portal",
|
|
@@ -5062,11 +5270,11 @@ function MessageActions({
|
|
|
5062
5270
|
top: `${menuPosition.top}px`
|
|
5063
5271
|
} : { visibility: "hidden" },
|
|
5064
5272
|
children: [
|
|
5065
|
-
answeredLabel ? /* @__PURE__ */ (0,
|
|
5273
|
+
answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
|
|
5066
5274
|
"Answered ",
|
|
5067
5275
|
answeredLabel
|
|
5068
5276
|
] }) : null,
|
|
5069
|
-
canOpenReceipt ? /* @__PURE__ */ (0,
|
|
5277
|
+
canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5070
5278
|
"button",
|
|
5071
5279
|
{
|
|
5072
5280
|
type: "button",
|
|
@@ -5077,12 +5285,12 @@ function MessageActions({
|
|
|
5077
5285
|
onOpenReceipt?.();
|
|
5078
5286
|
},
|
|
5079
5287
|
children: [
|
|
5080
|
-
/* @__PURE__ */ (0,
|
|
5288
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SourcesIcon, {}),
|
|
5081
5289
|
"View sources"
|
|
5082
5290
|
]
|
|
5083
5291
|
}
|
|
5084
5292
|
) : null,
|
|
5085
|
-
canReadAloud ? /* @__PURE__ */ (0,
|
|
5293
|
+
canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5086
5294
|
"button",
|
|
5087
5295
|
{
|
|
5088
5296
|
type: "button",
|
|
@@ -5090,7 +5298,7 @@ function MessageActions({
|
|
|
5090
5298
|
role: "menuitem",
|
|
5091
5299
|
onClick: handleReadAloud,
|
|
5092
5300
|
children: [
|
|
5093
|
-
speaking ? /* @__PURE__ */ (0,
|
|
5301
|
+
speaking ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReadAloudIcon, {}),
|
|
5094
5302
|
speaking ? "Stop reading" : "Read aloud"
|
|
5095
5303
|
]
|
|
5096
5304
|
}
|
|
@@ -5098,8 +5306,8 @@ function MessageActions({
|
|
|
5098
5306
|
]
|
|
5099
5307
|
}
|
|
5100
5308
|
) : null;
|
|
5101
|
-
return /* @__PURE__ */ (0,
|
|
5102
|
-
/* @__PURE__ */ (0,
|
|
5309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
|
|
5310
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5103
5311
|
"button",
|
|
5104
5312
|
{
|
|
5105
5313
|
type: "button",
|
|
@@ -5108,10 +5316,10 @@ function MessageActions({
|
|
|
5108
5316
|
title: copied ? "Copied" : "Copy answer",
|
|
5109
5317
|
disabled,
|
|
5110
5318
|
onClick: handleCopy,
|
|
5111
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
5319
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyIcon, {})
|
|
5112
5320
|
}
|
|
5113
5321
|
),
|
|
5114
|
-
/* @__PURE__ */ (0,
|
|
5322
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5115
5323
|
"button",
|
|
5116
5324
|
{
|
|
5117
5325
|
type: "button",
|
|
@@ -5121,10 +5329,10 @@ function MessageActions({
|
|
|
5121
5329
|
title: "Good answer",
|
|
5122
5330
|
disabled,
|
|
5123
5331
|
onClick: () => handleFeedback("positive"),
|
|
5124
|
-
children: /* @__PURE__ */ (0,
|
|
5332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbUpIcon, {})
|
|
5125
5333
|
}
|
|
5126
5334
|
),
|
|
5127
|
-
/* @__PURE__ */ (0,
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5128
5336
|
"button",
|
|
5129
5337
|
{
|
|
5130
5338
|
type: "button",
|
|
@@ -5134,10 +5342,10 @@ function MessageActions({
|
|
|
5134
5342
|
title: "Bad answer",
|
|
5135
5343
|
disabled,
|
|
5136
5344
|
onClick: () => handleFeedback("negative"),
|
|
5137
|
-
children: /* @__PURE__ */ (0,
|
|
5345
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbDownIcon, {})
|
|
5138
5346
|
}
|
|
5139
5347
|
),
|
|
5140
|
-
onRegenerate ? /* @__PURE__ */ (0,
|
|
5348
|
+
onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5141
5349
|
"button",
|
|
5142
5350
|
{
|
|
5143
5351
|
type: "button",
|
|
@@ -5146,11 +5354,11 @@ function MessageActions({
|
|
|
5146
5354
|
title: "Regenerate answer",
|
|
5147
5355
|
disabled,
|
|
5148
5356
|
onClick: onRegenerate,
|
|
5149
|
-
children: /* @__PURE__ */ (0,
|
|
5357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RegenerateIcon, {})
|
|
5150
5358
|
}
|
|
5151
5359
|
) : null,
|
|
5152
|
-
showMenu ? /* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5360
|
+
showMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5154
5362
|
"button",
|
|
5155
5363
|
{
|
|
5156
5364
|
ref: moreButtonRef,
|
|
@@ -5162,7 +5370,7 @@ function MessageActions({
|
|
|
5162
5370
|
title: "More actions",
|
|
5163
5371
|
disabled,
|
|
5164
5372
|
onClick: () => setMenuOpen((open) => !open),
|
|
5165
|
-
children: /* @__PURE__ */ (0,
|
|
5373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MoreIcon, {})
|
|
5166
5374
|
}
|
|
5167
5375
|
),
|
|
5168
5376
|
menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
|
|
@@ -5174,7 +5382,7 @@ function MessageActions({
|
|
|
5174
5382
|
var import_react13 = require("react");
|
|
5175
5383
|
|
|
5176
5384
|
// src/react/components/ConfirmationCard/ConfirmationCard.tsx
|
|
5177
|
-
var
|
|
5385
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5178
5386
|
function ConfirmationCard({
|
|
5179
5387
|
disabled = false,
|
|
5180
5388
|
request,
|
|
@@ -5183,17 +5391,17 @@ function ConfirmationCard({
|
|
|
5183
5391
|
const options = request.options ?? [];
|
|
5184
5392
|
const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
|
|
5185
5393
|
const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
|
|
5186
|
-
return /* @__PURE__ */ (0,
|
|
5394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5187
5395
|
"section",
|
|
5188
5396
|
{
|
|
5189
5397
|
className: "confirmation-card",
|
|
5190
5398
|
"aria-labelledby": `confirmation-${request.requestId}`,
|
|
5191
5399
|
children: [
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5194
|
-
prompt ? /* @__PURE__ */ (0,
|
|
5400
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirmation-card__heading", children: [
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
|
|
5402
|
+
prompt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: prompt }) : null
|
|
5195
5403
|
] }),
|
|
5196
|
-
/* @__PURE__ */ (0,
|
|
5404
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5197
5405
|
"button",
|
|
5198
5406
|
{
|
|
5199
5407
|
type: "button",
|
|
@@ -5214,7 +5422,7 @@ function ConfirmationCard({
|
|
|
5214
5422
|
|
|
5215
5423
|
// src/react/components/ToolInputCard/ToolInputCard.tsx
|
|
5216
5424
|
var import_react12 = require("react");
|
|
5217
|
-
var
|
|
5425
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5218
5426
|
function isRecord5(value) {
|
|
5219
5427
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5220
5428
|
}
|
|
@@ -5338,7 +5546,7 @@ function FieldDescription({
|
|
|
5338
5546
|
field,
|
|
5339
5547
|
id
|
|
5340
5548
|
}) {
|
|
5341
|
-
return field.description ? /* @__PURE__ */ (0,
|
|
5549
|
+
return field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
|
|
5342
5550
|
}
|
|
5343
5551
|
function ChoiceField({
|
|
5344
5552
|
field,
|
|
@@ -5357,7 +5565,7 @@ function ChoiceField({
|
|
|
5357
5565
|
const selectedIndex = options.findIndex(
|
|
5358
5566
|
(option) => valuesMatch(option.value, value)
|
|
5359
5567
|
);
|
|
5360
|
-
return /* @__PURE__ */ (0,
|
|
5568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5361
5569
|
"select",
|
|
5362
5570
|
{
|
|
5363
5571
|
id,
|
|
@@ -5372,13 +5580,13 @@ function ChoiceField({
|
|
|
5372
5580
|
if (option) onChange(option.value);
|
|
5373
5581
|
},
|
|
5374
5582
|
children: [
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5376
|
-
options.map((option, index) => /* @__PURE__ */ (0,
|
|
5583
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
|
|
5584
|
+
options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index, children: option.label }, optionKey(option)))
|
|
5377
5585
|
]
|
|
5378
5586
|
}
|
|
5379
5587
|
);
|
|
5380
5588
|
}
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5382
5590
|
"div",
|
|
5383
5591
|
{
|
|
5384
5592
|
className: "tool-input-card__choices",
|
|
@@ -5389,8 +5597,8 @@ function ChoiceField({
|
|
|
5389
5597
|
"aria-required": field.required,
|
|
5390
5598
|
children: options.map((option, index) => {
|
|
5391
5599
|
const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
|
|
5392
|
-
return /* @__PURE__ */ (0,
|
|
5393
|
-
/* @__PURE__ */ (0,
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__choice", children: [
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5394
5602
|
"input",
|
|
5395
5603
|
{
|
|
5396
5604
|
type: multiple ? "checkbox" : "radio",
|
|
@@ -5412,7 +5620,7 @@ function ChoiceField({
|
|
|
5412
5620
|
}
|
|
5413
5621
|
}
|
|
5414
5622
|
),
|
|
5415
|
-
/* @__PURE__ */ (0,
|
|
5623
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.label })
|
|
5416
5624
|
] }, optionKey(option));
|
|
5417
5625
|
})
|
|
5418
5626
|
}
|
|
@@ -5432,9 +5640,9 @@ function ToolField({
|
|
|
5432
5640
|
error ? `${id}-error` : ""
|
|
5433
5641
|
].filter(Boolean).join(" ");
|
|
5434
5642
|
if (field.kind === "checkbox" || field.kind === "confirmation") {
|
|
5435
|
-
return /* @__PURE__ */ (0,
|
|
5436
|
-
/* @__PURE__ */ (0,
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
|
|
5645
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5438
5646
|
"input",
|
|
5439
5647
|
{
|
|
5440
5648
|
id,
|
|
@@ -5447,17 +5655,17 @@ function ToolField({
|
|
|
5447
5655
|
onChange: (event) => onChange(event.target.checked)
|
|
5448
5656
|
}
|
|
5449
5657
|
),
|
|
5450
|
-
/* @__PURE__ */ (0,
|
|
5451
|
-
/* @__PURE__ */ (0,
|
|
5452
|
-
field.description ? /* @__PURE__ */ (0,
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
5659
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: field.label }),
|
|
5660
|
+
field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-description`, children: field.description }) : null
|
|
5453
5661
|
] })
|
|
5454
5662
|
] }),
|
|
5455
|
-
error ? /* @__PURE__ */ (0,
|
|
5663
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5456
5664
|
] });
|
|
5457
5665
|
}
|
|
5458
|
-
const label = /* @__PURE__ */ (0,
|
|
5666
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
|
|
5459
5667
|
field.label,
|
|
5460
|
-
field.required ? /* @__PURE__ */ (0,
|
|
5668
|
+
field.required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
|
|
5461
5669
|
] });
|
|
5462
5670
|
const common = {
|
|
5463
5671
|
id,
|
|
@@ -5469,7 +5677,7 @@ function ToolField({
|
|
|
5469
5677
|
};
|
|
5470
5678
|
let control;
|
|
5471
5679
|
if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
|
|
5472
|
-
control = /* @__PURE__ */ (0,
|
|
5680
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5473
5681
|
ChoiceField,
|
|
5474
5682
|
{
|
|
5475
5683
|
field,
|
|
@@ -5483,7 +5691,7 @@ function ToolField({
|
|
|
5483
5691
|
}
|
|
5484
5692
|
);
|
|
5485
5693
|
} else if (field.kind === "textarea" || field.kind === "json") {
|
|
5486
|
-
control = /* @__PURE__ */ (0,
|
|
5694
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5487
5695
|
"textarea",
|
|
5488
5696
|
{
|
|
5489
5697
|
...common,
|
|
@@ -5497,8 +5705,8 @@ function ToolField({
|
|
|
5497
5705
|
);
|
|
5498
5706
|
} else if (field.kind === "range") {
|
|
5499
5707
|
const numericValue = typeof value === "number" ? value : field.min ?? 0;
|
|
5500
|
-
control = /* @__PURE__ */ (0,
|
|
5501
|
-
/* @__PURE__ */ (0,
|
|
5708
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__range", children: [
|
|
5709
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5502
5710
|
"input",
|
|
5503
5711
|
{
|
|
5504
5712
|
...common,
|
|
@@ -5510,11 +5718,11 @@ function ToolField({
|
|
|
5510
5718
|
onChange: (event) => onChange(Number(event.target.value))
|
|
5511
5719
|
}
|
|
5512
5720
|
),
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("output", { htmlFor: id, children: numericValue })
|
|
5514
5722
|
] });
|
|
5515
5723
|
} else {
|
|
5516
5724
|
const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
|
|
5517
|
-
control = /* @__PURE__ */ (0,
|
|
5725
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5518
5726
|
"input",
|
|
5519
5727
|
{
|
|
5520
5728
|
...common,
|
|
@@ -5532,11 +5740,11 @@ function ToolField({
|
|
|
5532
5740
|
}
|
|
5533
5741
|
);
|
|
5534
5742
|
}
|
|
5535
|
-
return /* @__PURE__ */ (0,
|
|
5743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5536
5744
|
label,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldDescription, { field, id: `${id}-description` }),
|
|
5538
5746
|
control,
|
|
5539
|
-
error ? /* @__PURE__ */ (0,
|
|
5747
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5540
5748
|
] });
|
|
5541
5749
|
}
|
|
5542
5750
|
function ToolInputCard({
|
|
@@ -5573,14 +5781,14 @@ function ToolInputCard({
|
|
|
5573
5781
|
onSubmit?.(surface, result);
|
|
5574
5782
|
}
|
|
5575
5783
|
if (submitted) {
|
|
5576
|
-
return /* @__PURE__ */ (0,
|
|
5784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5577
5785
|
"section",
|
|
5578
5786
|
{
|
|
5579
5787
|
className: "tool-input-card tool-input-card--submitted",
|
|
5580
5788
|
role: "status",
|
|
5581
5789
|
children: [
|
|
5582
|
-
/* @__PURE__ */ (0,
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { children: [
|
|
5584
5792
|
surface.title,
|
|
5585
5793
|
" submitted"
|
|
5586
5794
|
] })
|
|
@@ -5588,18 +5796,18 @@ function ToolInputCard({
|
|
|
5588
5796
|
}
|
|
5589
5797
|
);
|
|
5590
5798
|
}
|
|
5591
|
-
return /* @__PURE__ */ (0,
|
|
5799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5592
5800
|
"section",
|
|
5593
5801
|
{
|
|
5594
5802
|
className: "tool-input-card",
|
|
5595
5803
|
"aria-labelledby": `tool-input-${surface.id}`,
|
|
5596
5804
|
children: [
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
surface.description ? /* @__PURE__ */ (0,
|
|
5805
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__heading", children: [
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
|
|
5807
|
+
surface.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: surface.description }) : null
|
|
5600
5808
|
] }),
|
|
5601
|
-
/* @__PURE__ */ (0,
|
|
5602
|
-
/* @__PURE__ */ (0,
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
|
|
5810
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5603
5811
|
ToolField,
|
|
5604
5812
|
{
|
|
5605
5813
|
disabled,
|
|
@@ -5612,8 +5820,8 @@ function ToolInputCard({
|
|
|
5612
5820
|
},
|
|
5613
5821
|
field.path
|
|
5614
5822
|
)) }),
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5616
|
-
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0,
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__actions", children: [
|
|
5824
|
+
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5617
5825
|
"button",
|
|
5618
5826
|
{
|
|
5619
5827
|
type: "button",
|
|
@@ -5626,7 +5834,7 @@ function ToolInputCard({
|
|
|
5626
5834
|
children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
|
|
5627
5835
|
}
|
|
5628
5836
|
) : null,
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5837
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
|
|
5630
5838
|
] })
|
|
5631
5839
|
] })
|
|
5632
5840
|
]
|
|
@@ -5635,17 +5843,17 @@ function ToolInputCard({
|
|
|
5635
5843
|
}
|
|
5636
5844
|
|
|
5637
5845
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
5638
|
-
var
|
|
5846
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
5639
5847
|
function HumanInputCard({
|
|
5640
5848
|
disabled = false,
|
|
5641
5849
|
request,
|
|
5642
5850
|
onRespond
|
|
5643
5851
|
}) {
|
|
5644
|
-
const [
|
|
5852
|
+
const [text2, setText] = (0, import_react13.useState)("");
|
|
5645
5853
|
const options = request.options ?? [];
|
|
5646
5854
|
const showText = request.display === "text" || request.allowFreeform && options.length === 0;
|
|
5647
5855
|
if (request.ui) {
|
|
5648
|
-
return /* @__PURE__ */ (0,
|
|
5856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5649
5857
|
ToolInputCard,
|
|
5650
5858
|
{
|
|
5651
5859
|
disabled,
|
|
@@ -5655,7 +5863,7 @@ function HumanInputCard({
|
|
|
5655
5863
|
);
|
|
5656
5864
|
}
|
|
5657
5865
|
if (options.length > 0) {
|
|
5658
|
-
return /* @__PURE__ */ (0,
|
|
5866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5659
5867
|
ConfirmationCard,
|
|
5660
5868
|
{
|
|
5661
5869
|
disabled,
|
|
@@ -5666,62 +5874,62 @@ function HumanInputCard({
|
|
|
5666
5874
|
}
|
|
5667
5875
|
function submitText(event) {
|
|
5668
5876
|
event.preventDefault();
|
|
5669
|
-
const value =
|
|
5877
|
+
const value = text2.trim();
|
|
5670
5878
|
if (!value || disabled) return;
|
|
5671
5879
|
onRespond?.({ requestId: request.requestId, text: value });
|
|
5672
5880
|
}
|
|
5673
|
-
return /* @__PURE__ */ (0,
|
|
5881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5674
5882
|
"section",
|
|
5675
5883
|
{
|
|
5676
5884
|
className: "human-input-card",
|
|
5677
5885
|
"aria-labelledby": `human-input-${request.requestId}`,
|
|
5678
5886
|
children: [
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
showText ? /* @__PURE__ */ (0,
|
|
5681
|
-
/* @__PURE__ */ (0,
|
|
5682
|
-
/* @__PURE__ */ (0,
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5887
|
+
/* @__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 }) }),
|
|
5888
|
+
showText ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: submitText, children: [
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
|
|
5890
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5684
5892
|
"input",
|
|
5685
5893
|
{
|
|
5686
5894
|
id: `human-input-text-${request.requestId}`,
|
|
5687
|
-
value:
|
|
5895
|
+
value: text2,
|
|
5688
5896
|
disabled,
|
|
5689
5897
|
onChange: (event) => setText(event.target.value)
|
|
5690
5898
|
}
|
|
5691
5899
|
),
|
|
5692
|
-
/* @__PURE__ */ (0,
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
|
|
5693
5901
|
] })
|
|
5694
5902
|
] }) : null,
|
|
5695
|
-
!showText && options.length === 0 ? /* @__PURE__ */ (0,
|
|
5903
|
+
!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
|
|
5696
5904
|
]
|
|
5697
5905
|
}
|
|
5698
5906
|
);
|
|
5699
5907
|
}
|
|
5700
5908
|
|
|
5701
5909
|
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
5702
|
-
var
|
|
5910
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5703
5911
|
function CollectionResultCard({
|
|
5704
5912
|
result
|
|
5705
5913
|
}) {
|
|
5706
5914
|
const empty = result.items.length === 0;
|
|
5707
|
-
return /* @__PURE__ */ (0,
|
|
5915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5708
5916
|
"section",
|
|
5709
5917
|
{
|
|
5710
5918
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5711
5919
|
"aria-label": result.title,
|
|
5712
5920
|
children: [
|
|
5713
|
-
/* @__PURE__ */ (0,
|
|
5714
|
-
/* @__PURE__ */ (0,
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5921
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
|
|
5716
5924
|
] }),
|
|
5717
|
-
empty ? /* @__PURE__ */ (0,
|
|
5718
|
-
/* @__PURE__ */ (0,
|
|
5719
|
-
item.description ? /* @__PURE__ */ (0,
|
|
5720
|
-
item.details?.length ? /* @__PURE__ */ (0,
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5925
|
+
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: [
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
5927
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: item.description }) : null,
|
|
5928
|
+
item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
|
|
5723
5931
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5724
|
-
item.href ? /* @__PURE__ */ (0,
|
|
5932
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
5725
5933
|
] }, item.title)) })
|
|
5726
5934
|
]
|
|
5727
5935
|
}
|
|
@@ -5729,26 +5937,26 @@ function CollectionResultCard({
|
|
|
5729
5937
|
}
|
|
5730
5938
|
|
|
5731
5939
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
5732
|
-
var
|
|
5940
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5733
5941
|
function EntityResultCard({
|
|
5734
5942
|
result
|
|
5735
5943
|
}) {
|
|
5736
|
-
return /* @__PURE__ */ (0,
|
|
5944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5737
5945
|
"section",
|
|
5738
5946
|
{
|
|
5739
5947
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5740
5948
|
"aria-label": result.title,
|
|
5741
5949
|
children: [
|
|
5742
|
-
/* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
|
|
5745
5953
|
] }),
|
|
5746
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5747
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
5954
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: result.description }) : null,
|
|
5955
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
5956
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
|
|
5957
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
|
|
5750
5958
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5751
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
5959
|
+
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)(
|
|
5752
5960
|
"a",
|
|
5753
5961
|
{
|
|
5754
5962
|
href: link.href,
|
|
@@ -5764,24 +5972,24 @@ function EntityResultCard({
|
|
|
5764
5972
|
}
|
|
5765
5973
|
|
|
5766
5974
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
5767
|
-
var
|
|
5975
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5768
5976
|
function SignatureResultCard({
|
|
5769
5977
|
result
|
|
5770
5978
|
}) {
|
|
5771
5979
|
const primaryLink = result.links?.[0];
|
|
5772
|
-
return /* @__PURE__ */ (0,
|
|
5980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
5773
5981
|
"section",
|
|
5774
5982
|
{
|
|
5775
5983
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5776
5984
|
"aria-label": result.title,
|
|
5777
5985
|
children: [
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5779
|
-
/* @__PURE__ */ (0,
|
|
5780
|
-
/* @__PURE__ */ (0,
|
|
5986
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5987
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
|
|
5781
5989
|
] }),
|
|
5782
|
-
result.statusLabel ? /* @__PURE__ */ (0,
|
|
5783
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5784
|
-
primaryLink ? /* @__PURE__ */ (0,
|
|
5990
|
+
result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
5991
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
|
|
5992
|
+
primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5785
5993
|
"a",
|
|
5786
5994
|
{
|
|
5787
5995
|
className: "signature-result-card__cta",
|
|
@@ -5797,26 +6005,26 @@ function SignatureResultCard({
|
|
|
5797
6005
|
}
|
|
5798
6006
|
|
|
5799
6007
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
5800
|
-
var
|
|
6008
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5801
6009
|
function ToolResultCard({
|
|
5802
6010
|
result
|
|
5803
6011
|
}) {
|
|
5804
|
-
return /* @__PURE__ */ (0,
|
|
6012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5805
6013
|
"section",
|
|
5806
6014
|
{
|
|
5807
6015
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
5808
6016
|
"aria-label": result.title,
|
|
5809
6017
|
children: [
|
|
5810
|
-
/* @__PURE__ */ (0,
|
|
5811
|
-
/* @__PURE__ */ (0,
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
6018
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6019
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
|
|
5813
6021
|
] }),
|
|
5814
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5815
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5816
|
-
/* @__PURE__ */ (0,
|
|
5817
|
-
/* @__PURE__ */ (0,
|
|
6022
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
|
|
6023
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
|
|
6025
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
|
|
5818
6026
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5819
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6027
|
+
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)(
|
|
5820
6028
|
"a",
|
|
5821
6029
|
{
|
|
5822
6030
|
href: link.href,
|
|
@@ -5832,14 +6040,14 @@ function ToolResultCard({
|
|
|
5832
6040
|
}
|
|
5833
6041
|
|
|
5834
6042
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
5835
|
-
var
|
|
6043
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5836
6044
|
function VisitorToolResultView({
|
|
5837
6045
|
disabled = false,
|
|
5838
6046
|
onToolInput,
|
|
5839
6047
|
result
|
|
5840
6048
|
}) {
|
|
5841
6049
|
if (result.kind === "input") {
|
|
5842
|
-
return /* @__PURE__ */ (0,
|
|
6050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5843
6051
|
ToolInputCard,
|
|
5844
6052
|
{
|
|
5845
6053
|
disabled,
|
|
@@ -5849,16 +6057,16 @@ function VisitorToolResultView({
|
|
|
5849
6057
|
);
|
|
5850
6058
|
}
|
|
5851
6059
|
if (result.kind === "entity") {
|
|
5852
|
-
return /* @__PURE__ */ (0,
|
|
6060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EntityResultCard, { result });
|
|
5853
6061
|
}
|
|
5854
6062
|
if (result.kind === "collection") {
|
|
5855
|
-
return /* @__PURE__ */ (0,
|
|
6063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollectionResultCard, { result });
|
|
5856
6064
|
}
|
|
5857
6065
|
if (result.kind === "signature") {
|
|
5858
|
-
return /* @__PURE__ */ (0,
|
|
6066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignatureResultCard, { result });
|
|
5859
6067
|
}
|
|
5860
6068
|
if (result.kind === "summary") {
|
|
5861
|
-
return /* @__PURE__ */ (0,
|
|
6069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolResultCard, { result });
|
|
5862
6070
|
}
|
|
5863
6071
|
return null;
|
|
5864
6072
|
}
|
|
@@ -5867,9 +6075,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
5867
6075
|
}
|
|
5868
6076
|
|
|
5869
6077
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
5870
|
-
var
|
|
6078
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5871
6079
|
function MinimizeIcon() {
|
|
5872
|
-
return /* @__PURE__ */ (0,
|
|
6080
|
+
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)(
|
|
5873
6081
|
"path",
|
|
5874
6082
|
{
|
|
5875
6083
|
d: "M3.5 8h9",
|
|
@@ -5880,7 +6088,7 @@ function MinimizeIcon() {
|
|
|
5880
6088
|
) });
|
|
5881
6089
|
}
|
|
5882
6090
|
function CloseIcon2() {
|
|
5883
|
-
return /* @__PURE__ */ (0,
|
|
6091
|
+
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)(
|
|
5884
6092
|
"path",
|
|
5885
6093
|
{
|
|
5886
6094
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -5891,7 +6099,7 @@ function CloseIcon2() {
|
|
|
5891
6099
|
) });
|
|
5892
6100
|
}
|
|
5893
6101
|
function NewChatIcon() {
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
6102
|
+
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)(
|
|
5895
6103
|
"path",
|
|
5896
6104
|
{
|
|
5897
6105
|
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",
|
|
@@ -5903,7 +6111,7 @@ function NewChatIcon() {
|
|
|
5903
6111
|
) });
|
|
5904
6112
|
}
|
|
5905
6113
|
function ExpandIcon() {
|
|
5906
|
-
return /* @__PURE__ */ (0,
|
|
6114
|
+
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)(
|
|
5907
6115
|
"path",
|
|
5908
6116
|
{
|
|
5909
6117
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -5915,7 +6123,7 @@ function ExpandIcon() {
|
|
|
5915
6123
|
) });
|
|
5916
6124
|
}
|
|
5917
6125
|
function RestoreIcon() {
|
|
5918
|
-
return /* @__PURE__ */ (0,
|
|
6126
|
+
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)(
|
|
5919
6127
|
"path",
|
|
5920
6128
|
{
|
|
5921
6129
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -5927,7 +6135,7 @@ function RestoreIcon() {
|
|
|
5927
6135
|
) });
|
|
5928
6136
|
}
|
|
5929
6137
|
function ChevronDownIcon() {
|
|
5930
|
-
return /* @__PURE__ */ (0,
|
|
6138
|
+
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)(
|
|
5931
6139
|
"path",
|
|
5932
6140
|
{
|
|
5933
6141
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -6064,7 +6272,10 @@ function AgentRail({
|
|
|
6064
6272
|
id: "streaming-response",
|
|
6065
6273
|
role: "agent",
|
|
6066
6274
|
streaming: true,
|
|
6067
|
-
text: state.streamingText
|
|
6275
|
+
text: state.streamingText,
|
|
6276
|
+
searchResults: (state.toolResults ?? []).filter(
|
|
6277
|
+
(result) => result.kind === "search"
|
|
6278
|
+
)
|
|
6068
6279
|
} : state.pendingOffer && !lastIsAgent ? {
|
|
6069
6280
|
createdAt: 0,
|
|
6070
6281
|
id: "pending-booking",
|
|
@@ -6186,7 +6397,7 @@ function AgentRail({
|
|
|
6186
6397
|
window.setTimeout(settle, 900);
|
|
6187
6398
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
6188
6399
|
}
|
|
6189
|
-
return /* @__PURE__ */ (0,
|
|
6400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6190
6401
|
"aside",
|
|
6191
6402
|
{
|
|
6192
6403
|
ref: railRef,
|
|
@@ -6200,34 +6411,34 @@ function AgentRail({
|
|
|
6200
6411
|
autoFocus: mobileFullscreen || expanded,
|
|
6201
6412
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
6202
6413
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
6203
|
-
children: /* @__PURE__ */ (0,
|
|
6414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6204
6415
|
AgentRailOverlayContext.Provider,
|
|
6205
6416
|
{
|
|
6206
6417
|
value: { railRef, overlayRef },
|
|
6207
6418
|
children: [
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
onCollapse ? /* @__PURE__ */ (0,
|
|
6419
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
6420
|
+
/* @__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: [
|
|
6421
|
+
onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6211
6422
|
"button",
|
|
6212
6423
|
{
|
|
6213
6424
|
type: "button",
|
|
6214
6425
|
className: "agent-rail__collapse",
|
|
6215
6426
|
"aria-label": "Collapse assist",
|
|
6216
6427
|
onClick: onCollapse,
|
|
6217
|
-
children: /* @__PURE__ */ (0,
|
|
6428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MinimizeIcon, {})
|
|
6218
6429
|
}
|
|
6219
|
-
) : onClose ? /* @__PURE__ */ (0,
|
|
6430
|
+
) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6220
6431
|
"button",
|
|
6221
6432
|
{
|
|
6222
6433
|
type: "button",
|
|
6223
6434
|
className: "agent-rail__close",
|
|
6224
6435
|
"aria-label": "Close agent",
|
|
6225
6436
|
onClick: onClose,
|
|
6226
|
-
children: /* @__PURE__ */ (0,
|
|
6437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon2, {})
|
|
6227
6438
|
}
|
|
6228
|
-
) : /* @__PURE__ */ (0,
|
|
6229
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0,
|
|
6230
|
-
showBrandLogo ? /* @__PURE__ */ (0,
|
|
6439
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
6440
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__identity", children: [
|
|
6441
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6231
6442
|
"img",
|
|
6232
6443
|
{
|
|
6233
6444
|
className: "agent-rail__brand-logo",
|
|
@@ -6238,10 +6449,10 @@ function AgentRail({
|
|
|
6238
6449
|
}
|
|
6239
6450
|
}
|
|
6240
6451
|
) }) : null,
|
|
6241
|
-
resolvedBrandLabel ? /* @__PURE__ */ (0,
|
|
6452
|
+
resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
6242
6453
|
] }) : null,
|
|
6243
|
-
/* @__PURE__ */ (0,
|
|
6244
|
-
onReset ? /* @__PURE__ */ (0,
|
|
6454
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__actions", children: [
|
|
6455
|
+
onReset ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6245
6456
|
"button",
|
|
6246
6457
|
{
|
|
6247
6458
|
type: "button",
|
|
@@ -6249,24 +6460,24 @@ function AgentRail({
|
|
|
6249
6460
|
"aria-label": "Start a new conversation",
|
|
6250
6461
|
disabled: !hasVisitorMessages2,
|
|
6251
6462
|
onClick: handleReset,
|
|
6252
|
-
children: /* @__PURE__ */ (0,
|
|
6463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewChatIcon, {})
|
|
6253
6464
|
}
|
|
6254
6465
|
) : null,
|
|
6255
|
-
onExpandToggle ? /* @__PURE__ */ (0,
|
|
6466
|
+
onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6256
6467
|
"button",
|
|
6257
6468
|
{
|
|
6258
6469
|
type: "button",
|
|
6259
6470
|
className: "agent-rail__expand",
|
|
6260
6471
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
6261
6472
|
onClick: onExpandToggle,
|
|
6262
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
6473
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExpandIcon, {})
|
|
6263
6474
|
}
|
|
6264
6475
|
) : null
|
|
6265
6476
|
] })
|
|
6266
6477
|
] }) }),
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
!hasVisitorMessages2 ? /* @__PURE__ */ (0,
|
|
6269
|
-
greeting?.role === "agent" ? /* @__PURE__ */ (0,
|
|
6478
|
+
/* @__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: [
|
|
6479
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
6480
|
+
greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6270
6481
|
MessageBubble,
|
|
6271
6482
|
{
|
|
6272
6483
|
message: greeting,
|
|
@@ -6275,7 +6486,7 @@ function AgentRail({
|
|
|
6275
6486
|
onBook
|
|
6276
6487
|
}
|
|
6277
6488
|
) : null,
|
|
6278
|
-
showIdleFollowUps ? /* @__PURE__ */ (0,
|
|
6489
|
+
showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6279
6490
|
FollowUpChips,
|
|
6280
6491
|
{
|
|
6281
6492
|
suggestions: state.followUps,
|
|
@@ -6284,7 +6495,7 @@ function AgentRail({
|
|
|
6284
6495
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
6285
6496
|
}
|
|
6286
6497
|
) }) : null,
|
|
6287
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6498
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6288
6499
|
AgentActivityBubble,
|
|
6289
6500
|
{
|
|
6290
6501
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6293,7 +6504,7 @@ function AgentRail({
|
|
|
6293
6504
|
steps: state.toolSteps
|
|
6294
6505
|
}
|
|
6295
6506
|
) : null,
|
|
6296
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6507
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6297
6508
|
VisitorToolResultView,
|
|
6298
6509
|
{
|
|
6299
6510
|
result,
|
|
@@ -6302,7 +6513,7 @@ function AgentRail({
|
|
|
6302
6513
|
},
|
|
6303
6514
|
result.id
|
|
6304
6515
|
)),
|
|
6305
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6516
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6306
6517
|
HumanInputCard,
|
|
6307
6518
|
{
|
|
6308
6519
|
request,
|
|
@@ -6311,8 +6522,8 @@ function AgentRail({
|
|
|
6311
6522
|
request.requestId
|
|
6312
6523
|
))
|
|
6313
6524
|
] }) : null,
|
|
6314
|
-
visibleMessages.map((message, index) => /* @__PURE__ */ (0,
|
|
6315
|
-
/* @__PURE__ */ (0,
|
|
6525
|
+
visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__turn-block", children: [
|
|
6526
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6316
6527
|
MessageBubble,
|
|
6317
6528
|
{
|
|
6318
6529
|
message,
|
|
@@ -6322,7 +6533,7 @@ function AgentRail({
|
|
|
6322
6533
|
onBook
|
|
6323
6534
|
}
|
|
6324
6535
|
),
|
|
6325
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0,
|
|
6536
|
+
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6326
6537
|
MessageActions,
|
|
6327
6538
|
{
|
|
6328
6539
|
answeredAt: message.createdAt,
|
|
@@ -6334,8 +6545,8 @@ function AgentRail({
|
|
|
6334
6545
|
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
6335
6546
|
}
|
|
6336
6547
|
) : null,
|
|
6337
|
-
index === lastVisitorIndex ? /* @__PURE__ */ (0,
|
|
6338
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6548
|
+
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
6549
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6339
6550
|
AgentActivityBubble,
|
|
6340
6551
|
{
|
|
6341
6552
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6344,7 +6555,7 @@ function AgentRail({
|
|
|
6344
6555
|
steps: state.toolSteps
|
|
6345
6556
|
}
|
|
6346
6557
|
) : null,
|
|
6347
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6558
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6348
6559
|
VisitorToolResultView,
|
|
6349
6560
|
{
|
|
6350
6561
|
result,
|
|
@@ -6353,7 +6564,7 @@ function AgentRail({
|
|
|
6353
6564
|
},
|
|
6354
6565
|
result.id
|
|
6355
6566
|
)),
|
|
6356
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6567
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6357
6568
|
HumanInputCard,
|
|
6358
6569
|
{
|
|
6359
6570
|
request,
|
|
@@ -6363,7 +6574,7 @@ function AgentRail({
|
|
|
6363
6574
|
))
|
|
6364
6575
|
] }) : null
|
|
6365
6576
|
] }, message.id)),
|
|
6366
|
-
streamingMessage ? /* @__PURE__ */ (0,
|
|
6577
|
+
streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6367
6578
|
MessageBubble,
|
|
6368
6579
|
{
|
|
6369
6580
|
message: streamingMessage,
|
|
@@ -6373,16 +6584,16 @@ function AgentRail({
|
|
|
6373
6584
|
onBook
|
|
6374
6585
|
}
|
|
6375
6586
|
) : null,
|
|
6376
|
-
waitingForBooking ? /* @__PURE__ */ (0,
|
|
6377
|
-
state.error ? /* @__PURE__ */ (0,
|
|
6378
|
-
/* @__PURE__ */ (0,
|
|
6379
|
-
/* @__PURE__ */ (0,
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6587
|
+
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
|
|
6588
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6589
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
6590
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "Something went wrong" }),
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: state.error })
|
|
6381
6592
|
] }),
|
|
6382
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
6593
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
6383
6594
|
] }) : null
|
|
6384
6595
|
] }) }),
|
|
6385
|
-
showDisclaimerLabel ? /* @__PURE__ */ (0,
|
|
6596
|
+
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)(
|
|
6386
6597
|
"a",
|
|
6387
6598
|
{
|
|
6388
6599
|
href: disclaimerLink,
|
|
@@ -6391,8 +6602,8 @@ function AgentRail({
|
|
|
6391
6602
|
children: resolvedDisclaimerLabel
|
|
6392
6603
|
}
|
|
6393
6604
|
) : resolvedDisclaimerLabel }) }) : null,
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6395
|
-
showJumpToLatest ? /* @__PURE__ */ (0,
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
|
|
6606
|
+
showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6396
6607
|
"button",
|
|
6397
6608
|
{
|
|
6398
6609
|
type: "button",
|
|
@@ -6400,10 +6611,10 @@ function AgentRail({
|
|
|
6400
6611
|
"aria-label": "Jump to the latest message",
|
|
6401
6612
|
title: "Jump to the latest message",
|
|
6402
6613
|
onClick: scrollToLatest,
|
|
6403
|
-
children: /* @__PURE__ */ (0,
|
|
6614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon, {})
|
|
6404
6615
|
}
|
|
6405
6616
|
) : null,
|
|
6406
|
-
/* @__PURE__ */ (0,
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6407
6618
|
Composer,
|
|
6408
6619
|
{
|
|
6409
6620
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -6415,11 +6626,11 @@ function AgentRail({
|
|
|
6415
6626
|
},
|
|
6416
6627
|
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
6417
6628
|
),
|
|
6418
|
-
poweredByLabel ? /* @__PURE__ */ (0,
|
|
6629
|
+
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
|
|
6419
6630
|
] })
|
|
6420
6631
|
] }),
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6422
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */ (0,
|
|
6632
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
6633
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6423
6634
|
AnswerReceiptDialog,
|
|
6424
6635
|
{
|
|
6425
6636
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6435,9 +6646,9 @@ function AgentRail({
|
|
|
6435
6646
|
}
|
|
6436
6647
|
|
|
6437
6648
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
6438
|
-
var
|
|
6649
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6439
6650
|
function SparklesIcon() {
|
|
6440
|
-
return /* @__PURE__ */ (0,
|
|
6651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6441
6652
|
"svg",
|
|
6442
6653
|
{
|
|
6443
6654
|
className: "assist-edge-tab__sparkles",
|
|
@@ -6445,21 +6656,21 @@ function SparklesIcon() {
|
|
|
6445
6656
|
fill: "none",
|
|
6446
6657
|
"aria-hidden": "true",
|
|
6447
6658
|
children: [
|
|
6448
|
-
/* @__PURE__ */ (0,
|
|
6659
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6449
6660
|
"path",
|
|
6450
6661
|
{
|
|
6451
6662
|
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",
|
|
6452
6663
|
fill: "currentColor"
|
|
6453
6664
|
}
|
|
6454
6665
|
),
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6456
6667
|
"path",
|
|
6457
6668
|
{
|
|
6458
6669
|
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",
|
|
6459
6670
|
fill: "currentColor"
|
|
6460
6671
|
}
|
|
6461
6672
|
),
|
|
6462
|
-
/* @__PURE__ */ (0,
|
|
6673
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6463
6674
|
"path",
|
|
6464
6675
|
{
|
|
6465
6676
|
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",
|
|
@@ -6473,7 +6684,7 @@ function SparklesIcon() {
|
|
|
6473
6684
|
function TabMarkIcon({ customIconUrl }) {
|
|
6474
6685
|
const url = customIconUrl?.trim();
|
|
6475
6686
|
if (url) {
|
|
6476
|
-
return /* @__PURE__ */ (0,
|
|
6687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6477
6688
|
"img",
|
|
6478
6689
|
{
|
|
6479
6690
|
alt: "",
|
|
@@ -6483,10 +6694,10 @@ function TabMarkIcon({ customIconUrl }) {
|
|
|
6483
6694
|
}
|
|
6484
6695
|
);
|
|
6485
6696
|
}
|
|
6486
|
-
return /* @__PURE__ */ (0,
|
|
6697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SparklesIcon, {});
|
|
6487
6698
|
}
|
|
6488
6699
|
function ChevronLeftIcon() {
|
|
6489
|
-
return /* @__PURE__ */ (0,
|
|
6700
|
+
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)(
|
|
6490
6701
|
"path",
|
|
6491
6702
|
{
|
|
6492
6703
|
d: "M10 4L6 8l4 4",
|
|
@@ -6498,7 +6709,7 @@ function ChevronLeftIcon() {
|
|
|
6498
6709
|
) });
|
|
6499
6710
|
}
|
|
6500
6711
|
function ChevronDownIcon2() {
|
|
6501
|
-
return /* @__PURE__ */ (0,
|
|
6712
|
+
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)(
|
|
6502
6713
|
"path",
|
|
6503
6714
|
{
|
|
6504
6715
|
d: "M4 6l4 4 4-4",
|
|
@@ -6510,7 +6721,7 @@ function ChevronDownIcon2() {
|
|
|
6510
6721
|
) });
|
|
6511
6722
|
}
|
|
6512
6723
|
function DragDots() {
|
|
6513
|
-
return /* @__PURE__ */ (0,
|
|
6724
|
+
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)) });
|
|
6514
6725
|
}
|
|
6515
6726
|
var VARIANT_COPY = {
|
|
6516
6727
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -6556,7 +6767,7 @@ function AssistEdgeTab({
|
|
|
6556
6767
|
...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
6557
6768
|
colorScheme: resolvedColorScheme
|
|
6558
6769
|
};
|
|
6559
|
-
return /* @__PURE__ */ (0,
|
|
6770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6560
6771
|
"button",
|
|
6561
6772
|
{
|
|
6562
6773
|
type: "button",
|
|
@@ -6568,15 +6779,15 @@ function AssistEdgeTab({
|
|
|
6568
6779
|
tabIndex: visible ? 0 : -1,
|
|
6569
6780
|
onClick: onOpen,
|
|
6570
6781
|
children: [
|
|
6571
|
-
mobile ? /* @__PURE__ */ (0,
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6782
|
+
mobile ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6783
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6573
6784
|
"span",
|
|
6574
6785
|
{
|
|
6575
6786
|
className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
|
|
6576
6787
|
"aria-hidden": "true",
|
|
6577
6788
|
children: [
|
|
6578
|
-
/* @__PURE__ */ (0,
|
|
6579
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6790
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6580
6791
|
"img",
|
|
6581
6792
|
{
|
|
6582
6793
|
className: "assist-edge-tab__logo",
|
|
@@ -6590,11 +6801,11 @@ function AssistEdgeTab({
|
|
|
6590
6801
|
]
|
|
6591
6802
|
}
|
|
6592
6803
|
),
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
] }) : variant === "outline" ? /* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
|
|
6805
|
+
] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6806
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6807
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6808
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6598
6809
|
"img",
|
|
6599
6810
|
{
|
|
6600
6811
|
className: "assist-edge-tab__logo",
|
|
@@ -6606,18 +6817,18 @@ function AssistEdgeTab({
|
|
|
6606
6817
|
}
|
|
6607
6818
|
) : null
|
|
6608
6819
|
] }),
|
|
6609
|
-
/* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6820
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6821
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
|
|
6611
6822
|
] }) : null,
|
|
6612
|
-
variant === "ask" ? /* @__PURE__ */ (0,
|
|
6613
|
-
/* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6823
|
+
variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6824
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {}),
|
|
6825
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
|
|
6616
6827
|
] }) : null,
|
|
6617
|
-
variant === "fill" ? /* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6619
|
-
/* @__PURE__ */ (0,
|
|
6620
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6828
|
+
variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6829
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6831
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6621
6832
|
"img",
|
|
6622
6833
|
{
|
|
6623
6834
|
className: "assist-edge-tab__logo",
|
|
@@ -6629,8 +6840,8 @@ function AssistEdgeTab({
|
|
|
6629
6840
|
}
|
|
6630
6841
|
) : null
|
|
6631
6842
|
] }),
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6843
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6844
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
|
|
6634
6845
|
] }) : null
|
|
6635
6846
|
]
|
|
6636
6847
|
}
|
|
@@ -6652,8 +6863,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
|
|
|
6652
6863
|
}
|
|
6653
6864
|
return void 0;
|
|
6654
6865
|
}
|
|
6655
|
-
function normalizeAgentFeedbackAnswerText(
|
|
6656
|
-
const normalized =
|
|
6866
|
+
function normalizeAgentFeedbackAnswerText(text2) {
|
|
6867
|
+
const normalized = text2.replace(/\s+/g, " ").trim();
|
|
6657
6868
|
if (!normalized) return void 0;
|
|
6658
6869
|
return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
|
|
6659
6870
|
}
|
|
@@ -6694,7 +6905,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
|
|
|
6694
6905
|
}
|
|
6695
6906
|
|
|
6696
6907
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
6697
|
-
var
|
|
6908
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6698
6909
|
function AgentWidget({
|
|
6699
6910
|
indexId,
|
|
6700
6911
|
customerId,
|
|
@@ -6837,19 +7048,19 @@ function AgentWidget({
|
|
|
6837
7048
|
window.addEventListener("keydown", handleKeyDown);
|
|
6838
7049
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
6839
7050
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
6840
|
-
return /* @__PURE__ */ (0,
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
7051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "webless-agent-root", children: [
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6842
7053
|
"div",
|
|
6843
7054
|
{
|
|
6844
7055
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
6845
|
-
children: /* @__PURE__ */ (0,
|
|
7056
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6846
7057
|
"div",
|
|
6847
7058
|
{
|
|
6848
7059
|
ref: railSlotRef,
|
|
6849
7060
|
className: "webless-agent-root__rail-slot",
|
|
6850
7061
|
inert: railCollapsed || void 0,
|
|
6851
7062
|
"aria-hidden": railCollapsed,
|
|
6852
|
-
children: /* @__PURE__ */ (0,
|
|
7063
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6853
7064
|
AgentRail,
|
|
6854
7065
|
{
|
|
6855
7066
|
theme,
|
|
@@ -6886,7 +7097,7 @@ function AgentWidget({
|
|
|
6886
7097
|
)
|
|
6887
7098
|
}
|
|
6888
7099
|
),
|
|
6889
|
-
railCollapsed ? /* @__PURE__ */ (0,
|
|
7100
|
+
railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6890
7101
|
AssistEdgeTab,
|
|
6891
7102
|
{
|
|
6892
7103
|
variant: placement.variant,
|
|
@@ -6925,12 +7136,12 @@ function readUnpublishedPreviewBuildId(href) {
|
|
|
6925
7136
|
}
|
|
6926
7137
|
|
|
6927
7138
|
// src/embed/AgentWidget.tsx
|
|
6928
|
-
var
|
|
7139
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6929
7140
|
function AgentWidget2({
|
|
6930
7141
|
manifest
|
|
6931
7142
|
}) {
|
|
6932
7143
|
const defaultCollapsed = manifest.version !== "unpublished";
|
|
6933
|
-
return /* @__PURE__ */ (0,
|
|
7144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6934
7145
|
AgentWidget,
|
|
6935
7146
|
{
|
|
6936
7147
|
indexId: manifest.indexId,
|
|
@@ -7054,7 +7265,7 @@ function normalizeAgentBranding(branding) {
|
|
|
7054
7265
|
}
|
|
7055
7266
|
|
|
7056
7267
|
// src/embed/mount.tsx
|
|
7057
|
-
var
|
|
7268
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7058
7269
|
var mountedHandles = /* @__PURE__ */ new Map();
|
|
7059
7270
|
var latestCustomerId = null;
|
|
7060
7271
|
function resolveMountHost(manifest, script) {
|
|
@@ -7084,7 +7295,7 @@ function mountAgent(input) {
|
|
|
7084
7295
|
const host = createHost(manifest.customerId);
|
|
7085
7296
|
mountTarget.append(host);
|
|
7086
7297
|
const root = (0, import_client5.createRoot)(host);
|
|
7087
|
-
root.render(/* @__PURE__ */ (0,
|
|
7298
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentWidget2, { manifest }));
|
|
7088
7299
|
const handle = {
|
|
7089
7300
|
customerId: manifest.customerId,
|
|
7090
7301
|
manifest,
|