@webless/agent 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/{chunk-GS65OJFL.js → chunk-JZPXXG76.js} +686 -467
- package/dist/chunk-JZPXXG76.js.map +1 -0
- package/dist/embed.cjs +731 -515
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +161 -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 +787 -511
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +161 -0
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.js +64 -2
- package/dist/react.js.map +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,
|
|
@@ -3475,6 +3580,48 @@ var defaultDarkAgentRailTheme = {
|
|
|
3475
3580
|
danger: "#ff8da1"
|
|
3476
3581
|
};
|
|
3477
3582
|
|
|
3583
|
+
// src/react/lib/agent-theme.ts
|
|
3584
|
+
function agentThemeStyle(theme, resolvedColorScheme) {
|
|
3585
|
+
const brandedTheme = { ...defaultAgentRailTheme, ...theme };
|
|
3586
|
+
const resolvedTheme = resolvedColorScheme === "dark" ? {
|
|
3587
|
+
...brandedTheme,
|
|
3588
|
+
brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
|
|
3589
|
+
brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
|
|
3590
|
+
brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
|
|
3591
|
+
border: theme?.border ?? defaultDarkAgentRailTheme.border,
|
|
3592
|
+
danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
|
|
3593
|
+
onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
|
|
3594
|
+
success: theme?.success ?? defaultDarkAgentRailTheme.success,
|
|
3595
|
+
surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
|
|
3596
|
+
surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
|
|
3597
|
+
text: theme?.text ?? defaultDarkAgentRailTheme.text,
|
|
3598
|
+
textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
|
|
3599
|
+
textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
|
|
3600
|
+
visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
|
|
3601
|
+
} : brandedTheme;
|
|
3602
|
+
return {
|
|
3603
|
+
"--rail-width": resolvedTheme.railMaxWidth,
|
|
3604
|
+
"--as-rail-max-width": resolvedTheme.railMaxWidth,
|
|
3605
|
+
"--as-brand": resolvedTheme.brand,
|
|
3606
|
+
"--as-brand-soft": resolvedTheme.brandSoft,
|
|
3607
|
+
"--as-brand-deep": resolvedTheme.brandDeep,
|
|
3608
|
+
"--as-surface": resolvedTheme.surface,
|
|
3609
|
+
"--as-surface-muted": resolvedTheme.surfaceMuted,
|
|
3610
|
+
"--as-text": resolvedTheme.text,
|
|
3611
|
+
"--as-text-muted": resolvedTheme.textMuted,
|
|
3612
|
+
"--as-text-subtle": resolvedTheme.textSubtle,
|
|
3613
|
+
"--as-border": resolvedTheme.border,
|
|
3614
|
+
"--as-visitor-bubble": resolvedTheme.visitorBubble,
|
|
3615
|
+
"--as-visitor-text": resolvedTheme.visitorText,
|
|
3616
|
+
"--as-on-brand": resolvedTheme.onBrand,
|
|
3617
|
+
"--as-success": resolvedTheme.success,
|
|
3618
|
+
"--as-danger": resolvedTheme.danger,
|
|
3619
|
+
"--as-font-body": resolvedTheme.fontBody,
|
|
3620
|
+
"--as-font-display": resolvedTheme.fontDisplay,
|
|
3621
|
+
colorScheme: resolvedColorScheme
|
|
3622
|
+
};
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3478
3625
|
// src/react/hooks/useAgentColorScheme.ts
|
|
3479
3626
|
var import_react4 = require("react");
|
|
3480
3627
|
var DARK_MODE_QUERY = "(prefers-color-scheme: dark)";
|
|
@@ -4085,9 +4232,111 @@ function FollowUpChips({
|
|
|
4085
4232
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4086
4233
|
var import_react10 = require("react");
|
|
4087
4234
|
|
|
4235
|
+
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4236
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4237
|
+
function SiteIcon() {
|
|
4238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4239
|
+
"svg",
|
|
4240
|
+
{
|
|
4241
|
+
viewBox: "0 0 24 24",
|
|
4242
|
+
width: "18",
|
|
4243
|
+
height: "18",
|
|
4244
|
+
fill: "none",
|
|
4245
|
+
stroke: "currentColor",
|
|
4246
|
+
strokeWidth: "1.5",
|
|
4247
|
+
"aria-hidden": "true",
|
|
4248
|
+
children: [
|
|
4249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4252
|
+
]
|
|
4253
|
+
}
|
|
4254
|
+
);
|
|
4255
|
+
}
|
|
4256
|
+
function SearchReferences({
|
|
4257
|
+
results
|
|
4258
|
+
}) {
|
|
4259
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
4260
|
+
const sources = results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4261
|
+
const url = safeSearchUrl(source.url);
|
|
4262
|
+
const key = url ?? source.id;
|
|
4263
|
+
if (seenSources.has(key)) return [];
|
|
4264
|
+
seenSources.add(key);
|
|
4265
|
+
return [{ ...source, url, key }];
|
|
4266
|
+
});
|
|
4267
|
+
const seenActions = /* @__PURE__ */ new Set();
|
|
4268
|
+
const actions = results.flatMap((result) => {
|
|
4269
|
+
const url = safeSearchUrl(result.cta?.url);
|
|
4270
|
+
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4271
|
+
seenActions.add(url);
|
|
4272
|
+
return [{ label: result.cta.label, url }];
|
|
4273
|
+
});
|
|
4274
|
+
if (!sources.length && !actions.length) return null;
|
|
4275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
|
|
4276
|
+
sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": "Sources", children: [
|
|
4277
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { className: "search-references__heading", children: [
|
|
4278
|
+
"Sources",
|
|
4279
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4280
|
+
"svg",
|
|
4281
|
+
{
|
|
4282
|
+
viewBox: "0 0 24 24",
|
|
4283
|
+
width: "14",
|
|
4284
|
+
height: "14",
|
|
4285
|
+
fill: "none",
|
|
4286
|
+
stroke: "currentColor",
|
|
4287
|
+
strokeWidth: "1.75",
|
|
4288
|
+
"aria-hidden": "true",
|
|
4289
|
+
children: [
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 11v6M12 7v1" })
|
|
4292
|
+
]
|
|
4293
|
+
}
|
|
4294
|
+
) })
|
|
4295
|
+
] }),
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
4297
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
|
|
4300
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4301
|
+
"span",
|
|
4302
|
+
{
|
|
4303
|
+
className: "search-references__title",
|
|
4304
|
+
title: source.title,
|
|
4305
|
+
children: source.title
|
|
4306
|
+
}
|
|
4307
|
+
),
|
|
4308
|
+
source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
|
|
4309
|
+
] })
|
|
4310
|
+
] });
|
|
4311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4312
|
+
"a",
|
|
4313
|
+
{
|
|
4314
|
+
className: "search-references__source",
|
|
4315
|
+
href: source.url,
|
|
4316
|
+
target: "_blank",
|
|
4317
|
+
rel: "noopener noreferrer",
|
|
4318
|
+
children: content
|
|
4319
|
+
}
|
|
4320
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
|
|
4321
|
+
}) })
|
|
4322
|
+
] }) : null,
|
|
4323
|
+
actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4324
|
+
"a",
|
|
4325
|
+
{
|
|
4326
|
+
className: "search-references__cta",
|
|
4327
|
+
href: action.url,
|
|
4328
|
+
target: "_blank",
|
|
4329
|
+
rel: "noopener noreferrer",
|
|
4330
|
+
children: action.label
|
|
4331
|
+
},
|
|
4332
|
+
action.url
|
|
4333
|
+
)) }) : null
|
|
4334
|
+
] });
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4088
4337
|
// src/react/components/BookingCard/BookingCard.tsx
|
|
4089
4338
|
var import_react9 = require("react");
|
|
4090
|
-
var
|
|
4339
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4091
4340
|
var BOOKING_STEPS = [
|
|
4092
4341
|
{ id: "date", label: "Date" },
|
|
4093
4342
|
{ id: "time", label: "Time" },
|
|
@@ -4118,7 +4367,7 @@ function calendarCells(year, month) {
|
|
|
4118
4367
|
return cells;
|
|
4119
4368
|
}
|
|
4120
4369
|
function BookingCardLoader() {
|
|
4121
|
-
return /* @__PURE__ */ (0,
|
|
4370
|
+
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
4371
|
}
|
|
4123
4372
|
function BookingCard({
|
|
4124
4373
|
disabled = false,
|
|
@@ -4217,14 +4466,14 @@ function BookingCard({
|
|
|
4217
4466
|
})
|
|
4218
4467
|
});
|
|
4219
4468
|
}
|
|
4220
|
-
return /* @__PURE__ */ (0,
|
|
4469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4221
4470
|
"section",
|
|
4222
4471
|
{
|
|
4223
4472
|
className: "booking-card",
|
|
4224
4473
|
"aria-busy": disabled || void 0,
|
|
4225
4474
|
"aria-label": "Book a meeting",
|
|
4226
|
-
children: /* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
|
|
4476
|
+
/* @__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
4477
|
"li",
|
|
4229
4478
|
{
|
|
4230
4479
|
className: [
|
|
@@ -4234,40 +4483,40 @@ function BookingCard({
|
|
|
4234
4483
|
].filter(Boolean).join(" "),
|
|
4235
4484
|
"aria-current": index === stepIndex ? "step" : void 0,
|
|
4236
4485
|
children: [
|
|
4237
|
-
/* @__PURE__ */ (0,
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label })
|
|
4239
4488
|
]
|
|
4240
4489
|
},
|
|
4241
4490
|
item.id
|
|
4242
4491
|
)) }),
|
|
4243
|
-
step === "date" ? /* @__PURE__ */ (0,
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4245
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4492
|
+
step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4493
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
|
|
4494
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4246
4495
|
"Times in ",
|
|
4247
4496
|
timeZone
|
|
4248
4497
|
] }) : null,
|
|
4249
|
-
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0,
|
|
4498
|
+
offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4250
4499
|
"label",
|
|
4251
4500
|
{
|
|
4252
4501
|
className: "booking-card__field",
|
|
4253
4502
|
htmlFor: `${fieldId}-type`,
|
|
4254
4503
|
children: [
|
|
4255
|
-
/* @__PURE__ */ (0,
|
|
4256
|
-
/* @__PURE__ */ (0,
|
|
4504
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Meeting" }),
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4257
4506
|
"select",
|
|
4258
4507
|
{
|
|
4259
4508
|
id: `${fieldId}-type`,
|
|
4260
4509
|
value: eventTypeUri,
|
|
4261
4510
|
disabled,
|
|
4262
4511
|
onChange: (event) => selectEventType(event.target.value),
|
|
4263
|
-
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0,
|
|
4512
|
+
children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.uri, children: item.name }, item.uri))
|
|
4264
4513
|
}
|
|
4265
4514
|
)
|
|
4266
4515
|
]
|
|
4267
4516
|
}
|
|
4268
4517
|
) : null,
|
|
4269
|
-
/* @__PURE__ */ (0,
|
|
4270
|
-
/* @__PURE__ */ (0,
|
|
4518
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__month", children: [
|
|
4519
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4271
4520
|
"button",
|
|
4272
4521
|
{
|
|
4273
4522
|
type: "button",
|
|
@@ -4278,8 +4527,8 @@ function BookingCard({
|
|
|
4278
4527
|
children: "\u2039"
|
|
4279
4528
|
}
|
|
4280
4529
|
),
|
|
4281
|
-
/* @__PURE__ */ (0,
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
|
|
4531
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4283
4532
|
"button",
|
|
4284
4533
|
{
|
|
4285
4534
|
type: "button",
|
|
@@ -4291,9 +4540,9 @@ function BookingCard({
|
|
|
4291
4540
|
}
|
|
4292
4541
|
)
|
|
4293
4542
|
] }),
|
|
4294
|
-
/* @__PURE__ */ (0,
|
|
4295
|
-
offer.slots.length === 0 ? /* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4543
|
+
/* @__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)) }),
|
|
4544
|
+
offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
|
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4297
4546
|
"div",
|
|
4298
4547
|
{
|
|
4299
4548
|
className: "booking-card__calendar",
|
|
@@ -4301,7 +4550,7 @@ function BookingCard({
|
|
|
4301
4550
|
"aria-label": "Available dates",
|
|
4302
4551
|
children: cells.map((cell, index) => {
|
|
4303
4552
|
if (!cell) {
|
|
4304
|
-
return /* @__PURE__ */ (0,
|
|
4553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4305
4554
|
"span",
|
|
4306
4555
|
{
|
|
4307
4556
|
className: "booking-card__day"
|
|
@@ -4311,7 +4560,7 @@ function BookingCard({
|
|
|
4311
4560
|
}
|
|
4312
4561
|
const available = availableByDate.has(cell.key);
|
|
4313
4562
|
const selected = cell.key === selectedDate;
|
|
4314
|
-
return /* @__PURE__ */ (0,
|
|
4563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4315
4564
|
"button",
|
|
4316
4565
|
{
|
|
4317
4566
|
type: "button",
|
|
@@ -4331,9 +4580,9 @@ function BookingCard({
|
|
|
4331
4580
|
}
|
|
4332
4581
|
)
|
|
4333
4582
|
] }, "date") : null,
|
|
4334
|
-
step === "time" ? /* @__PURE__ */ (0,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4336
|
-
/* @__PURE__ */ (0,
|
|
4583
|
+
step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4585
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4337
4586
|
"button",
|
|
4338
4587
|
{
|
|
4339
4588
|
type: "button",
|
|
@@ -4344,15 +4593,15 @@ function BookingCard({
|
|
|
4344
4593
|
children: "\u2039"
|
|
4345
4594
|
}
|
|
4346
4595
|
),
|
|
4347
|
-
/* @__PURE__ */ (0,
|
|
4348
|
-
/* @__PURE__ */ (0,
|
|
4349
|
-
timeZone ? /* @__PURE__ */ (0,
|
|
4596
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4597
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
|
|
4598
|
+
timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
|
|
4350
4599
|
"Times in ",
|
|
4351
4600
|
timeZone
|
|
4352
4601
|
] }) : null
|
|
4353
4602
|
] })
|
|
4354
4603
|
] }),
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4356
4605
|
"button",
|
|
4357
4606
|
{
|
|
4358
4607
|
type: "button",
|
|
@@ -4364,9 +4613,9 @@ function BookingCard({
|
|
|
4364
4613
|
slot.startTime
|
|
4365
4614
|
)) })
|
|
4366
4615
|
] }, "time") : null,
|
|
4367
|
-
step === "details" ? /* @__PURE__ */ (0,
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4369
|
-
/* @__PURE__ */ (0,
|
|
4616
|
+
step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4370
4619
|
"button",
|
|
4371
4620
|
{
|
|
4372
4621
|
type: "button",
|
|
@@ -4377,21 +4626,21 @@ function BookingCard({
|
|
|
4377
4626
|
children: "\u2039"
|
|
4378
4627
|
}
|
|
4379
4628
|
),
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4381
|
-
/* @__PURE__ */ (0,
|
|
4382
|
-
/* @__PURE__ */ (0,
|
|
4383
|
-
selectedType?.location ? /* @__PURE__ */ (0,
|
|
4629
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
4630
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
|
|
4631
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
|
|
4632
|
+
selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
|
|
4384
4633
|
] })
|
|
4385
4634
|
] }),
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__identity", children: [
|
|
4636
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4388
4637
|
"label",
|
|
4389
4638
|
{
|
|
4390
4639
|
className: "booking-card__field",
|
|
4391
4640
|
htmlFor: `${fieldId}-name`,
|
|
4392
4641
|
children: [
|
|
4393
|
-
/* @__PURE__ */ (0,
|
|
4394
|
-
/* @__PURE__ */ (0,
|
|
4642
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Name" }),
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4395
4644
|
"input",
|
|
4396
4645
|
{
|
|
4397
4646
|
id: `${fieldId}-name`,
|
|
@@ -4405,14 +4654,14 @@ function BookingCard({
|
|
|
4405
4654
|
]
|
|
4406
4655
|
}
|
|
4407
4656
|
),
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4409
4658
|
"label",
|
|
4410
4659
|
{
|
|
4411
4660
|
className: "booking-card__field",
|
|
4412
4661
|
htmlFor: `${fieldId}-email`,
|
|
4413
4662
|
children: [
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4415
|
-
/* @__PURE__ */ (0,
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Email" }),
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4416
4665
|
"input",
|
|
4417
4666
|
{
|
|
4418
4667
|
id: `${fieldId}-email`,
|
|
@@ -4428,7 +4677,7 @@ function BookingCard({
|
|
|
4428
4677
|
}
|
|
4429
4678
|
)
|
|
4430
4679
|
] }),
|
|
4431
|
-
/* @__PURE__ */ (0,
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4432
4681
|
"button",
|
|
4433
4682
|
{
|
|
4434
4683
|
type: "submit",
|
|
@@ -4446,9 +4695,9 @@ function BookingCard({
|
|
|
4446
4695
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4447
4696
|
var import_streamdown = require("streamdown");
|
|
4448
4697
|
var import_styles = require("streamdown/styles.css");
|
|
4449
|
-
var
|
|
4450
|
-
function normalizeDedupeText(
|
|
4451
|
-
return
|
|
4698
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4699
|
+
function normalizeDedupeText(text2) {
|
|
4700
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4452
4701
|
}
|
|
4453
4702
|
function paragraphsAreNearDuplicates(first, second) {
|
|
4454
4703
|
const left = normalizeDedupeText(first);
|
|
@@ -4464,8 +4713,8 @@ function paragraphsShareOpening(first, second) {
|
|
|
4464
4713
|
if (!opening || opening.length < 20) return false;
|
|
4465
4714
|
return second.trim().startsWith(opening);
|
|
4466
4715
|
}
|
|
4467
|
-
function collapseRepeatedText(
|
|
4468
|
-
const trimmed =
|
|
4716
|
+
function collapseRepeatedText(text2) {
|
|
4717
|
+
const trimmed = text2.trim();
|
|
4469
4718
|
if (trimmed.length < 40) return trimmed;
|
|
4470
4719
|
const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
|
|
4471
4720
|
if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
|
|
@@ -4503,11 +4752,11 @@ function MessageBubble({
|
|
|
4503
4752
|
offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
|
|
4504
4753
|
);
|
|
4505
4754
|
if (message.role === "visitor") {
|
|
4506
|
-
return /* @__PURE__ */ (0,
|
|
4755
|
+
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
4756
|
}
|
|
4508
4757
|
const citations = message.citations ?? [];
|
|
4509
|
-
const agentText = /* @__PURE__ */ (0,
|
|
4510
|
-
/* @__PURE__ */ (0,
|
|
4758
|
+
const agentText = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__text", children: [
|
|
4759
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4511
4760
|
import_streamdown.Streamdown,
|
|
4512
4761
|
{
|
|
4513
4762
|
animated: isStreaming,
|
|
@@ -4521,8 +4770,9 @@ function MessageBubble({
|
|
|
4521
4770
|
children: displayText
|
|
4522
4771
|
}
|
|
4523
4772
|
),
|
|
4524
|
-
|
|
4525
|
-
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchReferences, { results: message.searchResults ?? [] }),
|
|
4774
|
+
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: [
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4526
4776
|
"span",
|
|
4527
4777
|
{
|
|
4528
4778
|
className: "message-bubble__source-icon",
|
|
@@ -4530,12 +4780,12 @@ function MessageBubble({
|
|
|
4530
4780
|
children: "\u25A6"
|
|
4531
4781
|
}
|
|
4532
4782
|
),
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
|
|
4534
4784
|
] }) }, citation.id)) }) : null
|
|
4535
4785
|
] });
|
|
4536
|
-
return /* @__PURE__ */ (0,
|
|
4537
|
-
displayText ? showBrandLogo ? /* @__PURE__ */ (0,
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
|
|
4787
|
+
displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4539
4789
|
"img",
|
|
4540
4790
|
{
|
|
4541
4791
|
src: resolvedLogoUrl,
|
|
@@ -4547,7 +4797,7 @@ function MessageBubble({
|
|
|
4547
4797
|
) }),
|
|
4548
4798
|
agentText
|
|
4549
4799
|
] }) : agentText : null,
|
|
4550
|
-
offers.map((nextOffer, index) => /* @__PURE__ */ (0,
|
|
4800
|
+
offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4551
4801
|
BookingCard,
|
|
4552
4802
|
{
|
|
4553
4803
|
disabled: bookingDisabled,
|
|
@@ -4564,8 +4814,8 @@ var import_react11 = require("react");
|
|
|
4564
4814
|
var import_react_dom2 = require("react-dom");
|
|
4565
4815
|
|
|
4566
4816
|
// src/react/lib/speech.ts
|
|
4567
|
-
function toSpeechText(
|
|
4568
|
-
let out = hideToolCardFences(
|
|
4817
|
+
function toSpeechText(text2) {
|
|
4818
|
+
let out = hideToolCardFences(text2);
|
|
4569
4819
|
out = out.replace(/```[\s\S]*?```/g, " ");
|
|
4570
4820
|
out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
4571
4821
|
out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
@@ -4708,10 +4958,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
|
|
|
4708
4958
|
}
|
|
4709
4959
|
|
|
4710
4960
|
// src/react/components/MessageActions/MessageActions.tsx
|
|
4711
|
-
var
|
|
4961
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4712
4962
|
function CopyIcon() {
|
|
4713
|
-
return /* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
4963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4715
4965
|
"rect",
|
|
4716
4966
|
{
|
|
4717
4967
|
x: "5.75",
|
|
@@ -4723,7 +4973,7 @@ function CopyIcon() {
|
|
|
4723
4973
|
strokeWidth: "1.5"
|
|
4724
4974
|
}
|
|
4725
4975
|
),
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4976
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4727
4977
|
"path",
|
|
4728
4978
|
{
|
|
4729
4979
|
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 +4984,7 @@ function CopyIcon() {
|
|
|
4734
4984
|
] });
|
|
4735
4985
|
}
|
|
4736
4986
|
function CheckIcon() {
|
|
4737
|
-
return /* @__PURE__ */ (0,
|
|
4987
|
+
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
4988
|
"path",
|
|
4739
4989
|
{
|
|
4740
4990
|
d: "M3.5 8.5l3 3 6-7",
|
|
@@ -4746,8 +4996,8 @@ function CheckIcon() {
|
|
|
4746
4996
|
) });
|
|
4747
4997
|
}
|
|
4748
4998
|
function ThumbUpIcon() {
|
|
4749
|
-
return /* @__PURE__ */ (0,
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
4999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4751
5001
|
"path",
|
|
4752
5002
|
{
|
|
4753
5003
|
d: "M4.67 6.67v8",
|
|
@@ -4756,7 +5006,7 @@ function ThumbUpIcon() {
|
|
|
4756
5006
|
strokeLinecap: "round"
|
|
4757
5007
|
}
|
|
4758
5008
|
),
|
|
4759
|
-
/* @__PURE__ */ (0,
|
|
5009
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4760
5010
|
"path",
|
|
4761
5011
|
{
|
|
4762
5012
|
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 +5019,8 @@ function ThumbUpIcon() {
|
|
|
4769
5019
|
] });
|
|
4770
5020
|
}
|
|
4771
5021
|
function ThumbDownIcon() {
|
|
4772
|
-
return /* @__PURE__ */ (0,
|
|
4773
|
-
/* @__PURE__ */ (0,
|
|
5022
|
+
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: [
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4774
5024
|
"path",
|
|
4775
5025
|
{
|
|
4776
5026
|
d: "M4.67 6.67v8",
|
|
@@ -4779,7 +5029,7 @@ function ThumbDownIcon() {
|
|
|
4779
5029
|
strokeLinecap: "round"
|
|
4780
5030
|
}
|
|
4781
5031
|
),
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4783
5033
|
"path",
|
|
4784
5034
|
{
|
|
4785
5035
|
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 +5042,8 @@ function ThumbDownIcon() {
|
|
|
4792
5042
|
] }) });
|
|
4793
5043
|
}
|
|
4794
5044
|
function RegenerateIcon() {
|
|
4795
|
-
return /* @__PURE__ */ (0,
|
|
4796
|
-
/* @__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)(
|
|
4797
5047
|
"path",
|
|
4798
5048
|
{
|
|
4799
5049
|
d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
|
|
@@ -4802,7 +5052,7 @@ function RegenerateIcon() {
|
|
|
4802
5052
|
strokeLinecap: "round"
|
|
4803
5053
|
}
|
|
4804
5054
|
),
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
5055
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4806
5056
|
"path",
|
|
4807
5057
|
{
|
|
4808
5058
|
d: "M14 2v3.33h-3.33",
|
|
@@ -4812,7 +5062,7 @@ function RegenerateIcon() {
|
|
|
4812
5062
|
strokeLinejoin: "round"
|
|
4813
5063
|
}
|
|
4814
5064
|
),
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
5065
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4816
5066
|
"path",
|
|
4817
5067
|
{
|
|
4818
5068
|
d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
|
|
@@ -4821,7 +5071,7 @@ function RegenerateIcon() {
|
|
|
4821
5071
|
strokeLinecap: "round"
|
|
4822
5072
|
}
|
|
4823
5073
|
),
|
|
4824
|
-
/* @__PURE__ */ (0,
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4825
5075
|
"path",
|
|
4826
5076
|
{
|
|
4827
5077
|
d: "M5.33 10.67H2V14",
|
|
@@ -4834,15 +5084,15 @@ function RegenerateIcon() {
|
|
|
4834
5084
|
] });
|
|
4835
5085
|
}
|
|
4836
5086
|
function MoreIcon() {
|
|
4837
|
-
return /* @__PURE__ */ (0,
|
|
4838
|
-
/* @__PURE__ */ (0,
|
|
4839
|
-
/* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
5087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
|
|
5090
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
|
|
4841
5091
|
] });
|
|
4842
5092
|
}
|
|
4843
5093
|
function SourcesIcon() {
|
|
4844
|
-
return /* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5095
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4846
5096
|
"path",
|
|
4847
5097
|
{
|
|
4848
5098
|
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 +5102,7 @@ function SourcesIcon() {
|
|
|
4852
5102
|
strokeLinejoin: "round"
|
|
4853
5103
|
}
|
|
4854
5104
|
),
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
5105
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4856
5106
|
"path",
|
|
4857
5107
|
{
|
|
4858
5108
|
d: "M8 4.5v9",
|
|
@@ -4864,8 +5114,8 @@ function SourcesIcon() {
|
|
|
4864
5114
|
] });
|
|
4865
5115
|
}
|
|
4866
5116
|
function ReadAloudIcon() {
|
|
4867
|
-
return /* @__PURE__ */ (0,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
5117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4869
5119
|
"path",
|
|
4870
5120
|
{
|
|
4871
5121
|
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 +5125,7 @@ function ReadAloudIcon() {
|
|
|
4875
5125
|
strokeLinejoin: "round"
|
|
4876
5126
|
}
|
|
4877
5127
|
),
|
|
4878
|
-
/* @__PURE__ */ (0,
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4879
5129
|
"path",
|
|
4880
5130
|
{
|
|
4881
5131
|
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 +5137,7 @@ function ReadAloudIcon() {
|
|
|
4887
5137
|
] });
|
|
4888
5138
|
}
|
|
4889
5139
|
function StopIcon() {
|
|
4890
|
-
return /* @__PURE__ */ (0,
|
|
5140
|
+
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
5141
|
"rect",
|
|
4892
5142
|
{
|
|
4893
5143
|
x: "4",
|
|
@@ -4900,12 +5150,12 @@ function StopIcon() {
|
|
|
4900
5150
|
}
|
|
4901
5151
|
) });
|
|
4902
5152
|
}
|
|
4903
|
-
async function writeToClipboard(
|
|
5153
|
+
async function writeToClipboard(text2) {
|
|
4904
5154
|
try {
|
|
4905
|
-
await navigator.clipboard.writeText(
|
|
5155
|
+
await navigator.clipboard.writeText(text2);
|
|
4906
5156
|
} catch {
|
|
4907
5157
|
const textarea = document.createElement("textarea");
|
|
4908
|
-
textarea.value =
|
|
5158
|
+
textarea.value = text2;
|
|
4909
5159
|
textarea.style.position = "fixed";
|
|
4910
5160
|
textarea.style.opacity = "0";
|
|
4911
5161
|
document.body.appendChild(textarea);
|
|
@@ -5051,7 +5301,7 @@ function MessageActions({
|
|
|
5051
5301
|
window.speechSynthesis.speak(utterance);
|
|
5052
5302
|
setSpeaking(true);
|
|
5053
5303
|
}
|
|
5054
|
-
const menu = menuOpen ? /* @__PURE__ */ (0,
|
|
5304
|
+
const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5055
5305
|
"div",
|
|
5056
5306
|
{
|
|
5057
5307
|
className: "agent-message-actions__menu agent-message-actions__menu--portal",
|
|
@@ -5062,11 +5312,11 @@ function MessageActions({
|
|
|
5062
5312
|
top: `${menuPosition.top}px`
|
|
5063
5313
|
} : { visibility: "hidden" },
|
|
5064
5314
|
children: [
|
|
5065
|
-
answeredLabel ? /* @__PURE__ */ (0,
|
|
5315
|
+
answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
|
|
5066
5316
|
"Answered ",
|
|
5067
5317
|
answeredLabel
|
|
5068
5318
|
] }) : null,
|
|
5069
|
-
canOpenReceipt ? /* @__PURE__ */ (0,
|
|
5319
|
+
canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5070
5320
|
"button",
|
|
5071
5321
|
{
|
|
5072
5322
|
type: "button",
|
|
@@ -5077,12 +5327,12 @@ function MessageActions({
|
|
|
5077
5327
|
onOpenReceipt?.();
|
|
5078
5328
|
},
|
|
5079
5329
|
children: [
|
|
5080
|
-
/* @__PURE__ */ (0,
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SourcesIcon, {}),
|
|
5081
5331
|
"View sources"
|
|
5082
5332
|
]
|
|
5083
5333
|
}
|
|
5084
5334
|
) : null,
|
|
5085
|
-
canReadAloud ? /* @__PURE__ */ (0,
|
|
5335
|
+
canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5086
5336
|
"button",
|
|
5087
5337
|
{
|
|
5088
5338
|
type: "button",
|
|
@@ -5090,7 +5340,7 @@ function MessageActions({
|
|
|
5090
5340
|
role: "menuitem",
|
|
5091
5341
|
onClick: handleReadAloud,
|
|
5092
5342
|
children: [
|
|
5093
|
-
speaking ? /* @__PURE__ */ (0,
|
|
5343
|
+
speaking ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReadAloudIcon, {}),
|
|
5094
5344
|
speaking ? "Stop reading" : "Read aloud"
|
|
5095
5345
|
]
|
|
5096
5346
|
}
|
|
@@ -5098,8 +5348,8 @@ function MessageActions({
|
|
|
5098
5348
|
]
|
|
5099
5349
|
}
|
|
5100
5350
|
) : null;
|
|
5101
|
-
return /* @__PURE__ */ (0,
|
|
5102
|
-
/* @__PURE__ */ (0,
|
|
5351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5103
5353
|
"button",
|
|
5104
5354
|
{
|
|
5105
5355
|
type: "button",
|
|
@@ -5108,10 +5358,10 @@ function MessageActions({
|
|
|
5108
5358
|
title: copied ? "Copied" : "Copy answer",
|
|
5109
5359
|
disabled,
|
|
5110
5360
|
onClick: handleCopy,
|
|
5111
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
5361
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyIcon, {})
|
|
5112
5362
|
}
|
|
5113
5363
|
),
|
|
5114
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5115
5365
|
"button",
|
|
5116
5366
|
{
|
|
5117
5367
|
type: "button",
|
|
@@ -5121,10 +5371,10 @@ function MessageActions({
|
|
|
5121
5371
|
title: "Good answer",
|
|
5122
5372
|
disabled,
|
|
5123
5373
|
onClick: () => handleFeedback("positive"),
|
|
5124
|
-
children: /* @__PURE__ */ (0,
|
|
5374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbUpIcon, {})
|
|
5125
5375
|
}
|
|
5126
5376
|
),
|
|
5127
|
-
/* @__PURE__ */ (0,
|
|
5377
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5128
5378
|
"button",
|
|
5129
5379
|
{
|
|
5130
5380
|
type: "button",
|
|
@@ -5134,10 +5384,10 @@ function MessageActions({
|
|
|
5134
5384
|
title: "Bad answer",
|
|
5135
5385
|
disabled,
|
|
5136
5386
|
onClick: () => handleFeedback("negative"),
|
|
5137
|
-
children: /* @__PURE__ */ (0,
|
|
5387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbDownIcon, {})
|
|
5138
5388
|
}
|
|
5139
5389
|
),
|
|
5140
|
-
onRegenerate ? /* @__PURE__ */ (0,
|
|
5390
|
+
onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5141
5391
|
"button",
|
|
5142
5392
|
{
|
|
5143
5393
|
type: "button",
|
|
@@ -5146,11 +5396,11 @@ function MessageActions({
|
|
|
5146
5396
|
title: "Regenerate answer",
|
|
5147
5397
|
disabled,
|
|
5148
5398
|
onClick: onRegenerate,
|
|
5149
|
-
children: /* @__PURE__ */ (0,
|
|
5399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RegenerateIcon, {})
|
|
5150
5400
|
}
|
|
5151
5401
|
) : null,
|
|
5152
|
-
showMenu ? /* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5402
|
+
showMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
|
|
5403
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5154
5404
|
"button",
|
|
5155
5405
|
{
|
|
5156
5406
|
ref: moreButtonRef,
|
|
@@ -5162,7 +5412,7 @@ function MessageActions({
|
|
|
5162
5412
|
title: "More actions",
|
|
5163
5413
|
disabled,
|
|
5164
5414
|
onClick: () => setMenuOpen((open) => !open),
|
|
5165
|
-
children: /* @__PURE__ */ (0,
|
|
5415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MoreIcon, {})
|
|
5166
5416
|
}
|
|
5167
5417
|
),
|
|
5168
5418
|
menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
|
|
@@ -5174,7 +5424,7 @@ function MessageActions({
|
|
|
5174
5424
|
var import_react13 = require("react");
|
|
5175
5425
|
|
|
5176
5426
|
// src/react/components/ConfirmationCard/ConfirmationCard.tsx
|
|
5177
|
-
var
|
|
5427
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5178
5428
|
function ConfirmationCard({
|
|
5179
5429
|
disabled = false,
|
|
5180
5430
|
request,
|
|
@@ -5183,17 +5433,17 @@ function ConfirmationCard({
|
|
|
5183
5433
|
const options = request.options ?? [];
|
|
5184
5434
|
const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
|
|
5185
5435
|
const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
|
|
5186
|
-
return /* @__PURE__ */ (0,
|
|
5436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5187
5437
|
"section",
|
|
5188
5438
|
{
|
|
5189
5439
|
className: "confirmation-card",
|
|
5190
5440
|
"aria-labelledby": `confirmation-${request.requestId}`,
|
|
5191
5441
|
children: [
|
|
5192
|
-
/* @__PURE__ */ (0,
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5194
|
-
prompt ? /* @__PURE__ */ (0,
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirmation-card__heading", children: [
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
|
|
5444
|
+
prompt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: prompt }) : null
|
|
5195
5445
|
] }),
|
|
5196
|
-
/* @__PURE__ */ (0,
|
|
5446
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5197
5447
|
"button",
|
|
5198
5448
|
{
|
|
5199
5449
|
type: "button",
|
|
@@ -5214,7 +5464,7 @@ function ConfirmationCard({
|
|
|
5214
5464
|
|
|
5215
5465
|
// src/react/components/ToolInputCard/ToolInputCard.tsx
|
|
5216
5466
|
var import_react12 = require("react");
|
|
5217
|
-
var
|
|
5467
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5218
5468
|
function isRecord5(value) {
|
|
5219
5469
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5220
5470
|
}
|
|
@@ -5338,7 +5588,7 @@ function FieldDescription({
|
|
|
5338
5588
|
field,
|
|
5339
5589
|
id
|
|
5340
5590
|
}) {
|
|
5341
|
-
return field.description ? /* @__PURE__ */ (0,
|
|
5591
|
+
return field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
|
|
5342
5592
|
}
|
|
5343
5593
|
function ChoiceField({
|
|
5344
5594
|
field,
|
|
@@ -5357,7 +5607,7 @@ function ChoiceField({
|
|
|
5357
5607
|
const selectedIndex = options.findIndex(
|
|
5358
5608
|
(option) => valuesMatch(option.value, value)
|
|
5359
5609
|
);
|
|
5360
|
-
return /* @__PURE__ */ (0,
|
|
5610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5361
5611
|
"select",
|
|
5362
5612
|
{
|
|
5363
5613
|
id,
|
|
@@ -5372,13 +5622,13 @@ function ChoiceField({
|
|
|
5372
5622
|
if (option) onChange(option.value);
|
|
5373
5623
|
},
|
|
5374
5624
|
children: [
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5376
|
-
options.map((option, index) => /* @__PURE__ */ (0,
|
|
5625
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
|
|
5626
|
+
options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index, children: option.label }, optionKey(option)))
|
|
5377
5627
|
]
|
|
5378
5628
|
}
|
|
5379
5629
|
);
|
|
5380
5630
|
}
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5382
5632
|
"div",
|
|
5383
5633
|
{
|
|
5384
5634
|
className: "tool-input-card__choices",
|
|
@@ -5389,8 +5639,8 @@ function ChoiceField({
|
|
|
5389
5639
|
"aria-required": field.required,
|
|
5390
5640
|
children: options.map((option, index) => {
|
|
5391
5641
|
const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
|
|
5392
|
-
return /* @__PURE__ */ (0,
|
|
5393
|
-
/* @__PURE__ */ (0,
|
|
5642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__choice", children: [
|
|
5643
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5394
5644
|
"input",
|
|
5395
5645
|
{
|
|
5396
5646
|
type: multiple ? "checkbox" : "radio",
|
|
@@ -5412,7 +5662,7 @@ function ChoiceField({
|
|
|
5412
5662
|
}
|
|
5413
5663
|
}
|
|
5414
5664
|
),
|
|
5415
|
-
/* @__PURE__ */ (0,
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.label })
|
|
5416
5666
|
] }, optionKey(option));
|
|
5417
5667
|
})
|
|
5418
5668
|
}
|
|
@@ -5432,9 +5682,9 @@ function ToolField({
|
|
|
5432
5682
|
error ? `${id}-error` : ""
|
|
5433
5683
|
].filter(Boolean).join(" ");
|
|
5434
5684
|
if (field.kind === "checkbox" || field.kind === "confirmation") {
|
|
5435
|
-
return /* @__PURE__ */ (0,
|
|
5436
|
-
/* @__PURE__ */ (0,
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5686
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
|
|
5687
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5438
5688
|
"input",
|
|
5439
5689
|
{
|
|
5440
5690
|
id,
|
|
@@ -5447,17 +5697,17 @@ function ToolField({
|
|
|
5447
5697
|
onChange: (event) => onChange(event.target.checked)
|
|
5448
5698
|
}
|
|
5449
5699
|
),
|
|
5450
|
-
/* @__PURE__ */ (0,
|
|
5451
|
-
/* @__PURE__ */ (0,
|
|
5452
|
-
field.description ? /* @__PURE__ */ (0,
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: field.label }),
|
|
5702
|
+
field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-description`, children: field.description }) : null
|
|
5453
5703
|
] })
|
|
5454
5704
|
] }),
|
|
5455
|
-
error ? /* @__PURE__ */ (0,
|
|
5705
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5456
5706
|
] });
|
|
5457
5707
|
}
|
|
5458
|
-
const label = /* @__PURE__ */ (0,
|
|
5708
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
|
|
5459
5709
|
field.label,
|
|
5460
|
-
field.required ? /* @__PURE__ */ (0,
|
|
5710
|
+
field.required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
|
|
5461
5711
|
] });
|
|
5462
5712
|
const common = {
|
|
5463
5713
|
id,
|
|
@@ -5469,7 +5719,7 @@ function ToolField({
|
|
|
5469
5719
|
};
|
|
5470
5720
|
let control;
|
|
5471
5721
|
if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
|
|
5472
|
-
control = /* @__PURE__ */ (0,
|
|
5722
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5473
5723
|
ChoiceField,
|
|
5474
5724
|
{
|
|
5475
5725
|
field,
|
|
@@ -5483,7 +5733,7 @@ function ToolField({
|
|
|
5483
5733
|
}
|
|
5484
5734
|
);
|
|
5485
5735
|
} else if (field.kind === "textarea" || field.kind === "json") {
|
|
5486
|
-
control = /* @__PURE__ */ (0,
|
|
5736
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5487
5737
|
"textarea",
|
|
5488
5738
|
{
|
|
5489
5739
|
...common,
|
|
@@ -5497,8 +5747,8 @@ function ToolField({
|
|
|
5497
5747
|
);
|
|
5498
5748
|
} else if (field.kind === "range") {
|
|
5499
5749
|
const numericValue = typeof value === "number" ? value : field.min ?? 0;
|
|
5500
|
-
control = /* @__PURE__ */ (0,
|
|
5501
|
-
/* @__PURE__ */ (0,
|
|
5750
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__range", children: [
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5502
5752
|
"input",
|
|
5503
5753
|
{
|
|
5504
5754
|
...common,
|
|
@@ -5510,11 +5760,11 @@ function ToolField({
|
|
|
5510
5760
|
onChange: (event) => onChange(Number(event.target.value))
|
|
5511
5761
|
}
|
|
5512
5762
|
),
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5763
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("output", { htmlFor: id, children: numericValue })
|
|
5514
5764
|
] });
|
|
5515
5765
|
} else {
|
|
5516
5766
|
const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
|
|
5517
|
-
control = /* @__PURE__ */ (0,
|
|
5767
|
+
control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5518
5768
|
"input",
|
|
5519
5769
|
{
|
|
5520
5770
|
...common,
|
|
@@ -5532,11 +5782,11 @@ function ToolField({
|
|
|
5532
5782
|
}
|
|
5533
5783
|
);
|
|
5534
5784
|
}
|
|
5535
|
-
return /* @__PURE__ */ (0,
|
|
5785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
|
|
5536
5786
|
label,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5787
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldDescription, { field, id: `${id}-description` }),
|
|
5538
5788
|
control,
|
|
5539
|
-
error ? /* @__PURE__ */ (0,
|
|
5789
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5540
5790
|
] });
|
|
5541
5791
|
}
|
|
5542
5792
|
function ToolInputCard({
|
|
@@ -5573,14 +5823,14 @@ function ToolInputCard({
|
|
|
5573
5823
|
onSubmit?.(surface, result);
|
|
5574
5824
|
}
|
|
5575
5825
|
if (submitted) {
|
|
5576
|
-
return /* @__PURE__ */ (0,
|
|
5826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5577
5827
|
"section",
|
|
5578
5828
|
{
|
|
5579
5829
|
className: "tool-input-card tool-input-card--submitted",
|
|
5580
5830
|
role: "status",
|
|
5581
5831
|
children: [
|
|
5582
|
-
/* @__PURE__ */ (0,
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5832
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
|
|
5833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { children: [
|
|
5584
5834
|
surface.title,
|
|
5585
5835
|
" submitted"
|
|
5586
5836
|
] })
|
|
@@ -5588,18 +5838,18 @@ function ToolInputCard({
|
|
|
5588
5838
|
}
|
|
5589
5839
|
);
|
|
5590
5840
|
}
|
|
5591
|
-
return /* @__PURE__ */ (0,
|
|
5841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
5592
5842
|
"section",
|
|
5593
5843
|
{
|
|
5594
5844
|
className: "tool-input-card",
|
|
5595
5845
|
"aria-labelledby": `tool-input-${surface.id}`,
|
|
5596
5846
|
children: [
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
surface.description ? /* @__PURE__ */ (0,
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__heading", children: [
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
|
|
5849
|
+
surface.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: surface.description }) : null
|
|
5600
5850
|
] }),
|
|
5601
|
-
/* @__PURE__ */ (0,
|
|
5602
|
-
/* @__PURE__ */ (0,
|
|
5851
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
|
|
5852
|
+
/* @__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
5853
|
ToolField,
|
|
5604
5854
|
{
|
|
5605
5855
|
disabled,
|
|
@@ -5612,8 +5862,8 @@ function ToolInputCard({
|
|
|
5612
5862
|
},
|
|
5613
5863
|
field.path
|
|
5614
5864
|
)) }),
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5616
|
-
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0,
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__actions", children: [
|
|
5866
|
+
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5617
5867
|
"button",
|
|
5618
5868
|
{
|
|
5619
5869
|
type: "button",
|
|
@@ -5626,7 +5876,7 @@ function ToolInputCard({
|
|
|
5626
5876
|
children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
|
|
5627
5877
|
}
|
|
5628
5878
|
) : null,
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
|
|
5630
5880
|
] })
|
|
5631
5881
|
] })
|
|
5632
5882
|
]
|
|
@@ -5635,17 +5885,17 @@ function ToolInputCard({
|
|
|
5635
5885
|
}
|
|
5636
5886
|
|
|
5637
5887
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
5638
|
-
var
|
|
5888
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
5639
5889
|
function HumanInputCard({
|
|
5640
5890
|
disabled = false,
|
|
5641
5891
|
request,
|
|
5642
5892
|
onRespond
|
|
5643
5893
|
}) {
|
|
5644
|
-
const [
|
|
5894
|
+
const [text2, setText] = (0, import_react13.useState)("");
|
|
5645
5895
|
const options = request.options ?? [];
|
|
5646
5896
|
const showText = request.display === "text" || request.allowFreeform && options.length === 0;
|
|
5647
5897
|
if (request.ui) {
|
|
5648
|
-
return /* @__PURE__ */ (0,
|
|
5898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5649
5899
|
ToolInputCard,
|
|
5650
5900
|
{
|
|
5651
5901
|
disabled,
|
|
@@ -5655,7 +5905,7 @@ function HumanInputCard({
|
|
|
5655
5905
|
);
|
|
5656
5906
|
}
|
|
5657
5907
|
if (options.length > 0) {
|
|
5658
|
-
return /* @__PURE__ */ (0,
|
|
5908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5659
5909
|
ConfirmationCard,
|
|
5660
5910
|
{
|
|
5661
5911
|
disabled,
|
|
@@ -5666,62 +5916,62 @@ function HumanInputCard({
|
|
|
5666
5916
|
}
|
|
5667
5917
|
function submitText(event) {
|
|
5668
5918
|
event.preventDefault();
|
|
5669
|
-
const value =
|
|
5919
|
+
const value = text2.trim();
|
|
5670
5920
|
if (!value || disabled) return;
|
|
5671
5921
|
onRespond?.({ requestId: request.requestId, text: value });
|
|
5672
5922
|
}
|
|
5673
|
-
return /* @__PURE__ */ (0,
|
|
5923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5674
5924
|
"section",
|
|
5675
5925
|
{
|
|
5676
5926
|
className: "human-input-card",
|
|
5677
5927
|
"aria-labelledby": `human-input-${request.requestId}`,
|
|
5678
5928
|
children: [
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
showText ? /* @__PURE__ */ (0,
|
|
5681
|
-
/* @__PURE__ */ (0,
|
|
5682
|
-
/* @__PURE__ */ (0,
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5929
|
+
/* @__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 }) }),
|
|
5930
|
+
showText ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: submitText, children: [
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5684
5934
|
"input",
|
|
5685
5935
|
{
|
|
5686
5936
|
id: `human-input-text-${request.requestId}`,
|
|
5687
|
-
value:
|
|
5937
|
+
value: text2,
|
|
5688
5938
|
disabled,
|
|
5689
5939
|
onChange: (event) => setText(event.target.value)
|
|
5690
5940
|
}
|
|
5691
5941
|
),
|
|
5692
|
-
/* @__PURE__ */ (0,
|
|
5942
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
|
|
5693
5943
|
] })
|
|
5694
5944
|
] }) : null,
|
|
5695
|
-
!showText && options.length === 0 ? /* @__PURE__ */ (0,
|
|
5945
|
+
!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
5946
|
]
|
|
5697
5947
|
}
|
|
5698
5948
|
);
|
|
5699
5949
|
}
|
|
5700
5950
|
|
|
5701
5951
|
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
5702
|
-
var
|
|
5952
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5703
5953
|
function CollectionResultCard({
|
|
5704
5954
|
result
|
|
5705
5955
|
}) {
|
|
5706
5956
|
const empty = result.items.length === 0;
|
|
5707
|
-
return /* @__PURE__ */ (0,
|
|
5957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5708
5958
|
"section",
|
|
5709
5959
|
{
|
|
5710
5960
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5711
5961
|
"aria-label": result.title,
|
|
5712
5962
|
children: [
|
|
5713
|
-
/* @__PURE__ */ (0,
|
|
5714
|
-
/* @__PURE__ */ (0,
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5963
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5964
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5965
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
|
|
5716
5966
|
] }),
|
|
5717
|
-
empty ? /* @__PURE__ */ (0,
|
|
5718
|
-
/* @__PURE__ */ (0,
|
|
5719
|
-
item.description ? /* @__PURE__ */ (0,
|
|
5720
|
-
item.details?.length ? /* @__PURE__ */ (0,
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5967
|
+
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: [
|
|
5968
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
5969
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: item.description }) : null,
|
|
5970
|
+
item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
5971
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
|
|
5972
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
|
|
5723
5973
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5724
|
-
item.href ? /* @__PURE__ */ (0,
|
|
5974
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
5725
5975
|
] }, item.title)) })
|
|
5726
5976
|
]
|
|
5727
5977
|
}
|
|
@@ -5729,26 +5979,26 @@ function CollectionResultCard({
|
|
|
5729
5979
|
}
|
|
5730
5980
|
|
|
5731
5981
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
5732
|
-
var
|
|
5982
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5733
5983
|
function EntityResultCard({
|
|
5734
5984
|
result
|
|
5735
5985
|
}) {
|
|
5736
|
-
return /* @__PURE__ */ (0,
|
|
5986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5737
5987
|
"section",
|
|
5738
5988
|
{
|
|
5739
5989
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5740
5990
|
"aria-label": result.title,
|
|
5741
5991
|
children: [
|
|
5742
|
-
/* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
5992
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
5993
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
|
|
5745
5995
|
] }),
|
|
5746
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5747
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
5996
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: result.description }) : null,
|
|
5997
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
|
|
5999
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
|
|
5750
6000
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5751
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6001
|
+
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
6002
|
"a",
|
|
5753
6003
|
{
|
|
5754
6004
|
href: link.href,
|
|
@@ -5764,24 +6014,24 @@ function EntityResultCard({
|
|
|
5764
6014
|
}
|
|
5765
6015
|
|
|
5766
6016
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
5767
|
-
var
|
|
6017
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5768
6018
|
function SignatureResultCard({
|
|
5769
6019
|
result
|
|
5770
6020
|
}) {
|
|
5771
6021
|
const primaryLink = result.links?.[0];
|
|
5772
|
-
return /* @__PURE__ */ (0,
|
|
6022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
5773
6023
|
"section",
|
|
5774
6024
|
{
|
|
5775
6025
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5776
6026
|
"aria-label": result.title,
|
|
5777
6027
|
children: [
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5779
|
-
/* @__PURE__ */ (0,
|
|
5780
|
-
/* @__PURE__ */ (0,
|
|
6028
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
|
|
5781
6031
|
] }),
|
|
5782
|
-
result.statusLabel ? /* @__PURE__ */ (0,
|
|
5783
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5784
|
-
primaryLink ? /* @__PURE__ */ (0,
|
|
6032
|
+
result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
6033
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
|
|
6034
|
+
primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5785
6035
|
"a",
|
|
5786
6036
|
{
|
|
5787
6037
|
className: "signature-result-card__cta",
|
|
@@ -5797,26 +6047,26 @@ function SignatureResultCard({
|
|
|
5797
6047
|
}
|
|
5798
6048
|
|
|
5799
6049
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
5800
|
-
var
|
|
6050
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5801
6051
|
function ToolResultCard({
|
|
5802
6052
|
result
|
|
5803
6053
|
}) {
|
|
5804
|
-
return /* @__PURE__ */ (0,
|
|
6054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5805
6055
|
"section",
|
|
5806
6056
|
{
|
|
5807
6057
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
5808
6058
|
"aria-label": result.title,
|
|
5809
6059
|
children: [
|
|
5810
|
-
/* @__PURE__ */ (0,
|
|
5811
|
-
/* @__PURE__ */ (0,
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6061
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6062
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
|
|
5813
6063
|
] }),
|
|
5814
|
-
result.description ? /* @__PURE__ */ (0,
|
|
5815
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
5816
|
-
/* @__PURE__ */ (0,
|
|
5817
|
-
/* @__PURE__ */ (0,
|
|
6064
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
|
|
6065
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
|
|
6067
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
|
|
5818
6068
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5819
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6069
|
+
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
6070
|
"a",
|
|
5821
6071
|
{
|
|
5822
6072
|
href: link.href,
|
|
@@ -5832,14 +6082,14 @@ function ToolResultCard({
|
|
|
5832
6082
|
}
|
|
5833
6083
|
|
|
5834
6084
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
5835
|
-
var
|
|
6085
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5836
6086
|
function VisitorToolResultView({
|
|
5837
6087
|
disabled = false,
|
|
5838
6088
|
onToolInput,
|
|
5839
6089
|
result
|
|
5840
6090
|
}) {
|
|
5841
6091
|
if (result.kind === "input") {
|
|
5842
|
-
return /* @__PURE__ */ (0,
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5843
6093
|
ToolInputCard,
|
|
5844
6094
|
{
|
|
5845
6095
|
disabled,
|
|
@@ -5849,16 +6099,16 @@ function VisitorToolResultView({
|
|
|
5849
6099
|
);
|
|
5850
6100
|
}
|
|
5851
6101
|
if (result.kind === "entity") {
|
|
5852
|
-
return /* @__PURE__ */ (0,
|
|
6102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EntityResultCard, { result });
|
|
5853
6103
|
}
|
|
5854
6104
|
if (result.kind === "collection") {
|
|
5855
|
-
return /* @__PURE__ */ (0,
|
|
6105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollectionResultCard, { result });
|
|
5856
6106
|
}
|
|
5857
6107
|
if (result.kind === "signature") {
|
|
5858
|
-
return /* @__PURE__ */ (0,
|
|
6108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignatureResultCard, { result });
|
|
5859
6109
|
}
|
|
5860
6110
|
if (result.kind === "summary") {
|
|
5861
|
-
return /* @__PURE__ */ (0,
|
|
6111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolResultCard, { result });
|
|
5862
6112
|
}
|
|
5863
6113
|
return null;
|
|
5864
6114
|
}
|
|
@@ -5867,9 +6117,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
5867
6117
|
}
|
|
5868
6118
|
|
|
5869
6119
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
5870
|
-
var
|
|
6120
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5871
6121
|
function MinimizeIcon() {
|
|
5872
|
-
return /* @__PURE__ */ (0,
|
|
6122
|
+
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
6123
|
"path",
|
|
5874
6124
|
{
|
|
5875
6125
|
d: "M3.5 8h9",
|
|
@@ -5880,7 +6130,7 @@ function MinimizeIcon() {
|
|
|
5880
6130
|
) });
|
|
5881
6131
|
}
|
|
5882
6132
|
function CloseIcon2() {
|
|
5883
|
-
return /* @__PURE__ */ (0,
|
|
6133
|
+
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
6134
|
"path",
|
|
5885
6135
|
{
|
|
5886
6136
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -5891,7 +6141,7 @@ function CloseIcon2() {
|
|
|
5891
6141
|
) });
|
|
5892
6142
|
}
|
|
5893
6143
|
function NewChatIcon() {
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
6144
|
+
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
6145
|
"path",
|
|
5896
6146
|
{
|
|
5897
6147
|
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 +6153,7 @@ function NewChatIcon() {
|
|
|
5903
6153
|
) });
|
|
5904
6154
|
}
|
|
5905
6155
|
function ExpandIcon() {
|
|
5906
|
-
return /* @__PURE__ */ (0,
|
|
6156
|
+
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
6157
|
"path",
|
|
5908
6158
|
{
|
|
5909
6159
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -5915,7 +6165,7 @@ function ExpandIcon() {
|
|
|
5915
6165
|
) });
|
|
5916
6166
|
}
|
|
5917
6167
|
function RestoreIcon() {
|
|
5918
|
-
return /* @__PURE__ */ (0,
|
|
6168
|
+
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
6169
|
"path",
|
|
5920
6170
|
{
|
|
5921
6171
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -5927,7 +6177,7 @@ function RestoreIcon() {
|
|
|
5927
6177
|
) });
|
|
5928
6178
|
}
|
|
5929
6179
|
function ChevronDownIcon() {
|
|
5930
|
-
return /* @__PURE__ */ (0,
|
|
6180
|
+
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
6181
|
"path",
|
|
5932
6182
|
{
|
|
5933
6183
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -5980,44 +6230,7 @@ function AgentRail({
|
|
|
5980
6230
|
const [failedLogoUrl, setFailedLogoUrl] = (0, import_react14.useState)(null);
|
|
5981
6231
|
const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
|
|
5982
6232
|
const resolvedColorScheme = useAgentColorScheme(colorScheme);
|
|
5983
|
-
const
|
|
5984
|
-
const resolvedTheme = resolvedColorScheme === "dark" ? {
|
|
5985
|
-
...brandedTheme,
|
|
5986
|
-
brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
|
|
5987
|
-
brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
|
|
5988
|
-
brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
|
|
5989
|
-
border: theme?.border ?? defaultDarkAgentRailTheme.border,
|
|
5990
|
-
danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
|
|
5991
|
-
onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
|
|
5992
|
-
success: theme?.success ?? defaultDarkAgentRailTheme.success,
|
|
5993
|
-
surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
|
|
5994
|
-
surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
|
|
5995
|
-
text: theme?.text ?? defaultDarkAgentRailTheme.text,
|
|
5996
|
-
textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
|
|
5997
|
-
textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
|
|
5998
|
-
visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
|
|
5999
|
-
} : brandedTheme;
|
|
6000
|
-
const railStyle = {
|
|
6001
|
-
"--rail-width": resolvedTheme.railMaxWidth,
|
|
6002
|
-
"--as-rail-max-width": resolvedTheme.railMaxWidth,
|
|
6003
|
-
"--as-brand": resolvedTheme.brand,
|
|
6004
|
-
"--as-brand-soft": resolvedTheme.brandSoft,
|
|
6005
|
-
"--as-brand-deep": resolvedTheme.brandDeep,
|
|
6006
|
-
"--as-surface": resolvedTheme.surface,
|
|
6007
|
-
"--as-surface-muted": resolvedTheme.surfaceMuted,
|
|
6008
|
-
"--as-text": resolvedTheme.text,
|
|
6009
|
-
"--as-text-muted": resolvedTheme.textMuted,
|
|
6010
|
-
"--as-text-subtle": resolvedTheme.textSubtle,
|
|
6011
|
-
"--as-border": resolvedTheme.border,
|
|
6012
|
-
"--as-visitor-bubble": resolvedTheme.visitorBubble,
|
|
6013
|
-
"--as-visitor-text": resolvedTheme.visitorText,
|
|
6014
|
-
"--as-on-brand": resolvedTheme.onBrand,
|
|
6015
|
-
"--as-success": resolvedTheme.success,
|
|
6016
|
-
"--as-danger": resolvedTheme.danger,
|
|
6017
|
-
"--as-font-body": resolvedTheme.fontBody,
|
|
6018
|
-
"--as-font-display": resolvedTheme.fontDisplay,
|
|
6019
|
-
colorScheme: resolvedColorScheme
|
|
6020
|
-
};
|
|
6233
|
+
const railStyle = agentThemeStyle(theme, resolvedColorScheme);
|
|
6021
6234
|
const pendingInputRequests = (state.pendingInputs ?? []).filter(
|
|
6022
6235
|
(request) => shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
|
|
6023
6236
|
);
|
|
@@ -6064,7 +6277,10 @@ function AgentRail({
|
|
|
6064
6277
|
id: "streaming-response",
|
|
6065
6278
|
role: "agent",
|
|
6066
6279
|
streaming: true,
|
|
6067
|
-
text: state.streamingText
|
|
6280
|
+
text: state.streamingText,
|
|
6281
|
+
searchResults: (state.toolResults ?? []).filter(
|
|
6282
|
+
(result) => result.kind === "search"
|
|
6283
|
+
)
|
|
6068
6284
|
} : state.pendingOffer && !lastIsAgent ? {
|
|
6069
6285
|
createdAt: 0,
|
|
6070
6286
|
id: "pending-booking",
|
|
@@ -6186,7 +6402,7 @@ function AgentRail({
|
|
|
6186
6402
|
window.setTimeout(settle, 900);
|
|
6187
6403
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
6188
6404
|
}
|
|
6189
|
-
return /* @__PURE__ */ (0,
|
|
6405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6190
6406
|
"aside",
|
|
6191
6407
|
{
|
|
6192
6408
|
ref: railRef,
|
|
@@ -6200,34 +6416,34 @@ function AgentRail({
|
|
|
6200
6416
|
autoFocus: mobileFullscreen || expanded,
|
|
6201
6417
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
6202
6418
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
6203
|
-
children: /* @__PURE__ */ (0,
|
|
6419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6204
6420
|
AgentRailOverlayContext.Provider,
|
|
6205
6421
|
{
|
|
6206
6422
|
value: { railRef, overlayRef },
|
|
6207
6423
|
children: [
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6210
|
-
onCollapse ? /* @__PURE__ */ (0,
|
|
6424
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
6425
|
+
/* @__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: [
|
|
6426
|
+
onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6211
6427
|
"button",
|
|
6212
6428
|
{
|
|
6213
6429
|
type: "button",
|
|
6214
6430
|
className: "agent-rail__collapse",
|
|
6215
6431
|
"aria-label": "Collapse assist",
|
|
6216
6432
|
onClick: onCollapse,
|
|
6217
|
-
children: /* @__PURE__ */ (0,
|
|
6433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MinimizeIcon, {})
|
|
6218
6434
|
}
|
|
6219
|
-
) : onClose ? /* @__PURE__ */ (0,
|
|
6435
|
+
) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6220
6436
|
"button",
|
|
6221
6437
|
{
|
|
6222
6438
|
type: "button",
|
|
6223
6439
|
className: "agent-rail__close",
|
|
6224
6440
|
"aria-label": "Close agent",
|
|
6225
6441
|
onClick: onClose,
|
|
6226
|
-
children: /* @__PURE__ */ (0,
|
|
6442
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon2, {})
|
|
6227
6443
|
}
|
|
6228
|
-
) : /* @__PURE__ */ (0,
|
|
6229
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0,
|
|
6230
|
-
showBrandLogo ? /* @__PURE__ */ (0,
|
|
6444
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
6445
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__identity", children: [
|
|
6446
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6231
6447
|
"img",
|
|
6232
6448
|
{
|
|
6233
6449
|
className: "agent-rail__brand-logo",
|
|
@@ -6238,10 +6454,10 @@ function AgentRail({
|
|
|
6238
6454
|
}
|
|
6239
6455
|
}
|
|
6240
6456
|
) }) : null,
|
|
6241
|
-
resolvedBrandLabel ? /* @__PURE__ */ (0,
|
|
6457
|
+
resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
6242
6458
|
] }) : null,
|
|
6243
|
-
/* @__PURE__ */ (0,
|
|
6244
|
-
onReset ? /* @__PURE__ */ (0,
|
|
6459
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__actions", children: [
|
|
6460
|
+
onReset ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6245
6461
|
"button",
|
|
6246
6462
|
{
|
|
6247
6463
|
type: "button",
|
|
@@ -6249,24 +6465,24 @@ function AgentRail({
|
|
|
6249
6465
|
"aria-label": "Start a new conversation",
|
|
6250
6466
|
disabled: !hasVisitorMessages2,
|
|
6251
6467
|
onClick: handleReset,
|
|
6252
|
-
children: /* @__PURE__ */ (0,
|
|
6468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewChatIcon, {})
|
|
6253
6469
|
}
|
|
6254
6470
|
) : null,
|
|
6255
|
-
onExpandToggle ? /* @__PURE__ */ (0,
|
|
6471
|
+
onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6256
6472
|
"button",
|
|
6257
6473
|
{
|
|
6258
6474
|
type: "button",
|
|
6259
6475
|
className: "agent-rail__expand",
|
|
6260
6476
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
6261
6477
|
onClick: onExpandToggle,
|
|
6262
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
6478
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExpandIcon, {})
|
|
6263
6479
|
}
|
|
6264
6480
|
) : null
|
|
6265
6481
|
] })
|
|
6266
6482
|
] }) }),
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
!hasVisitorMessages2 ? /* @__PURE__ */ (0,
|
|
6269
|
-
greeting?.role === "agent" ? /* @__PURE__ */ (0,
|
|
6483
|
+
/* @__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: [
|
|
6484
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
6485
|
+
greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6270
6486
|
MessageBubble,
|
|
6271
6487
|
{
|
|
6272
6488
|
message: greeting,
|
|
@@ -6275,7 +6491,7 @@ function AgentRail({
|
|
|
6275
6491
|
onBook
|
|
6276
6492
|
}
|
|
6277
6493
|
) : null,
|
|
6278
|
-
showIdleFollowUps ? /* @__PURE__ */ (0,
|
|
6494
|
+
showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6279
6495
|
FollowUpChips,
|
|
6280
6496
|
{
|
|
6281
6497
|
suggestions: state.followUps,
|
|
@@ -6284,7 +6500,7 @@ function AgentRail({
|
|
|
6284
6500
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
6285
6501
|
}
|
|
6286
6502
|
) }) : null,
|
|
6287
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6503
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6288
6504
|
AgentActivityBubble,
|
|
6289
6505
|
{
|
|
6290
6506
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6293,7 +6509,7 @@ function AgentRail({
|
|
|
6293
6509
|
steps: state.toolSteps
|
|
6294
6510
|
}
|
|
6295
6511
|
) : null,
|
|
6296
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6512
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6297
6513
|
VisitorToolResultView,
|
|
6298
6514
|
{
|
|
6299
6515
|
result,
|
|
@@ -6302,7 +6518,7 @@ function AgentRail({
|
|
|
6302
6518
|
},
|
|
6303
6519
|
result.id
|
|
6304
6520
|
)),
|
|
6305
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6521
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6306
6522
|
HumanInputCard,
|
|
6307
6523
|
{
|
|
6308
6524
|
request,
|
|
@@ -6311,8 +6527,8 @@ function AgentRail({
|
|
|
6311
6527
|
request.requestId
|
|
6312
6528
|
))
|
|
6313
6529
|
] }) : null,
|
|
6314
|
-
visibleMessages.map((message, index) => /* @__PURE__ */ (0,
|
|
6315
|
-
/* @__PURE__ */ (0,
|
|
6530
|
+
visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__turn-block", children: [
|
|
6531
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6316
6532
|
MessageBubble,
|
|
6317
6533
|
{
|
|
6318
6534
|
message,
|
|
@@ -6322,7 +6538,7 @@ function AgentRail({
|
|
|
6322
6538
|
onBook
|
|
6323
6539
|
}
|
|
6324
6540
|
),
|
|
6325
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0,
|
|
6541
|
+
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6326
6542
|
MessageActions,
|
|
6327
6543
|
{
|
|
6328
6544
|
answeredAt: message.createdAt,
|
|
@@ -6334,8 +6550,8 @@ function AgentRail({
|
|
|
6334
6550
|
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
6335
6551
|
}
|
|
6336
6552
|
) : null,
|
|
6337
|
-
index === lastVisitorIndex ? /* @__PURE__ */ (0,
|
|
6338
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6553
|
+
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
6554
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6339
6555
|
AgentActivityBubble,
|
|
6340
6556
|
{
|
|
6341
6557
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6344,7 +6560,7 @@ function AgentRail({
|
|
|
6344
6560
|
steps: state.toolSteps
|
|
6345
6561
|
}
|
|
6346
6562
|
) : null,
|
|
6347
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6563
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6348
6564
|
VisitorToolResultView,
|
|
6349
6565
|
{
|
|
6350
6566
|
result,
|
|
@@ -6353,7 +6569,7 @@ function AgentRail({
|
|
|
6353
6569
|
},
|
|
6354
6570
|
result.id
|
|
6355
6571
|
)),
|
|
6356
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6572
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6357
6573
|
HumanInputCard,
|
|
6358
6574
|
{
|
|
6359
6575
|
request,
|
|
@@ -6363,7 +6579,7 @@ function AgentRail({
|
|
|
6363
6579
|
))
|
|
6364
6580
|
] }) : null
|
|
6365
6581
|
] }, message.id)),
|
|
6366
|
-
streamingMessage ? /* @__PURE__ */ (0,
|
|
6582
|
+
streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6367
6583
|
MessageBubble,
|
|
6368
6584
|
{
|
|
6369
6585
|
message: streamingMessage,
|
|
@@ -6373,16 +6589,16 @@ function AgentRail({
|
|
|
6373
6589
|
onBook
|
|
6374
6590
|
}
|
|
6375
6591
|
) : null,
|
|
6376
|
-
waitingForBooking ? /* @__PURE__ */ (0,
|
|
6377
|
-
state.error ? /* @__PURE__ */ (0,
|
|
6378
|
-
/* @__PURE__ */ (0,
|
|
6379
|
-
/* @__PURE__ */ (0,
|
|
6380
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
|
|
6593
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "Something went wrong" }),
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: state.error })
|
|
6381
6597
|
] }),
|
|
6382
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
6598
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
6383
6599
|
] }) : null
|
|
6384
6600
|
] }) }),
|
|
6385
|
-
showDisclaimerLabel ? /* @__PURE__ */ (0,
|
|
6601
|
+
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
6602
|
"a",
|
|
6387
6603
|
{
|
|
6388
6604
|
href: disclaimerLink,
|
|
@@ -6391,8 +6607,8 @@ function AgentRail({
|
|
|
6391
6607
|
children: resolvedDisclaimerLabel
|
|
6392
6608
|
}
|
|
6393
6609
|
) : resolvedDisclaimerLabel }) }) : null,
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6395
|
-
showJumpToLatest ? /* @__PURE__ */ (0,
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
|
|
6611
|
+
showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6396
6612
|
"button",
|
|
6397
6613
|
{
|
|
6398
6614
|
type: "button",
|
|
@@ -6400,10 +6616,10 @@ function AgentRail({
|
|
|
6400
6616
|
"aria-label": "Jump to the latest message",
|
|
6401
6617
|
title: "Jump to the latest message",
|
|
6402
6618
|
onClick: scrollToLatest,
|
|
6403
|
-
children: /* @__PURE__ */ (0,
|
|
6619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon, {})
|
|
6404
6620
|
}
|
|
6405
6621
|
) : null,
|
|
6406
|
-
/* @__PURE__ */ (0,
|
|
6622
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6407
6623
|
Composer,
|
|
6408
6624
|
{
|
|
6409
6625
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -6415,11 +6631,11 @@ function AgentRail({
|
|
|
6415
6631
|
},
|
|
6416
6632
|
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
6417
6633
|
),
|
|
6418
|
-
poweredByLabel ? /* @__PURE__ */ (0,
|
|
6634
|
+
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
6635
|
] })
|
|
6420
6636
|
] }),
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6422
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */ (0,
|
|
6637
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
6638
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6423
6639
|
AnswerReceiptDialog,
|
|
6424
6640
|
{
|
|
6425
6641
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6435,9 +6651,9 @@ function AgentRail({
|
|
|
6435
6651
|
}
|
|
6436
6652
|
|
|
6437
6653
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
6438
|
-
var
|
|
6654
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6439
6655
|
function SparklesIcon() {
|
|
6440
|
-
return /* @__PURE__ */ (0,
|
|
6656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6441
6657
|
"svg",
|
|
6442
6658
|
{
|
|
6443
6659
|
className: "assist-edge-tab__sparkles",
|
|
@@ -6445,21 +6661,21 @@ function SparklesIcon() {
|
|
|
6445
6661
|
fill: "none",
|
|
6446
6662
|
"aria-hidden": "true",
|
|
6447
6663
|
children: [
|
|
6448
|
-
/* @__PURE__ */ (0,
|
|
6664
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6449
6665
|
"path",
|
|
6450
6666
|
{
|
|
6451
6667
|
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
6668
|
fill: "currentColor"
|
|
6453
6669
|
}
|
|
6454
6670
|
),
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
6671
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6456
6672
|
"path",
|
|
6457
6673
|
{
|
|
6458
6674
|
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
6675
|
fill: "currentColor"
|
|
6460
6676
|
}
|
|
6461
6677
|
),
|
|
6462
|
-
/* @__PURE__ */ (0,
|
|
6678
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6463
6679
|
"path",
|
|
6464
6680
|
{
|
|
6465
6681
|
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 +6689,7 @@ function SparklesIcon() {
|
|
|
6473
6689
|
function TabMarkIcon({ customIconUrl }) {
|
|
6474
6690
|
const url = customIconUrl?.trim();
|
|
6475
6691
|
if (url) {
|
|
6476
|
-
return /* @__PURE__ */ (0,
|
|
6692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6477
6693
|
"img",
|
|
6478
6694
|
{
|
|
6479
6695
|
alt: "",
|
|
@@ -6483,10 +6699,10 @@ function TabMarkIcon({ customIconUrl }) {
|
|
|
6483
6699
|
}
|
|
6484
6700
|
);
|
|
6485
6701
|
}
|
|
6486
|
-
return /* @__PURE__ */ (0,
|
|
6702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SparklesIcon, {});
|
|
6487
6703
|
}
|
|
6488
6704
|
function ChevronLeftIcon() {
|
|
6489
|
-
return /* @__PURE__ */ (0,
|
|
6705
|
+
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
6706
|
"path",
|
|
6491
6707
|
{
|
|
6492
6708
|
d: "M10 4L6 8l4 4",
|
|
@@ -6498,7 +6714,7 @@ function ChevronLeftIcon() {
|
|
|
6498
6714
|
) });
|
|
6499
6715
|
}
|
|
6500
6716
|
function ChevronDownIcon2() {
|
|
6501
|
-
return /* @__PURE__ */ (0,
|
|
6717
|
+
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
6718
|
"path",
|
|
6503
6719
|
{
|
|
6504
6720
|
d: "M4 6l4 4 4-4",
|
|
@@ -6510,7 +6726,7 @@ function ChevronDownIcon2() {
|
|
|
6510
6726
|
) });
|
|
6511
6727
|
}
|
|
6512
6728
|
function DragDots() {
|
|
6513
|
-
return /* @__PURE__ */ (0,
|
|
6729
|
+
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
6730
|
}
|
|
6515
6731
|
var VARIANT_COPY = {
|
|
6516
6732
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -6556,7 +6772,7 @@ function AssistEdgeTab({
|
|
|
6556
6772
|
...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
6557
6773
|
colorScheme: resolvedColorScheme
|
|
6558
6774
|
};
|
|
6559
|
-
return /* @__PURE__ */ (0,
|
|
6775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6560
6776
|
"button",
|
|
6561
6777
|
{
|
|
6562
6778
|
type: "button",
|
|
@@ -6568,15 +6784,15 @@ function AssistEdgeTab({
|
|
|
6568
6784
|
tabIndex: visible ? 0 : -1,
|
|
6569
6785
|
onClick: onOpen,
|
|
6570
6786
|
children: [
|
|
6571
|
-
mobile ? /* @__PURE__ */ (0,
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6787
|
+
mobile ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6788
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6573
6789
|
"span",
|
|
6574
6790
|
{
|
|
6575
6791
|
className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
|
|
6576
6792
|
"aria-hidden": "true",
|
|
6577
6793
|
children: [
|
|
6578
|
-
/* @__PURE__ */ (0,
|
|
6579
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6794
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6795
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6580
6796
|
"img",
|
|
6581
6797
|
{
|
|
6582
6798
|
className: "assist-edge-tab__logo",
|
|
@@ -6590,11 +6806,11 @@ function AssistEdgeTab({
|
|
|
6590
6806
|
]
|
|
6591
6807
|
}
|
|
6592
6808
|
),
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
] }) : variant === "outline" ? /* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6809
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
|
|
6810
|
+
] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6812
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6813
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6598
6814
|
"img",
|
|
6599
6815
|
{
|
|
6600
6816
|
className: "assist-edge-tab__logo",
|
|
@@ -6606,18 +6822,18 @@ function AssistEdgeTab({
|
|
|
6606
6822
|
}
|
|
6607
6823
|
) : null
|
|
6608
6824
|
] }),
|
|
6609
|
-
/* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6825
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
|
|
6611
6827
|
] }) : null,
|
|
6612
|
-
variant === "ask" ? /* @__PURE__ */ (0,
|
|
6613
|
-
/* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6828
|
+
variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6829
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {}),
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6831
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
|
|
6616
6832
|
] }) : null,
|
|
6617
|
-
variant === "fill" ? /* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6619
|
-
/* @__PURE__ */ (0,
|
|
6620
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
6833
|
+
variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6834
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6835
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
|
|
6836
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6621
6837
|
"img",
|
|
6622
6838
|
{
|
|
6623
6839
|
className: "assist-edge-tab__logo",
|
|
@@ -6629,8 +6845,8 @@ function AssistEdgeTab({
|
|
|
6629
6845
|
}
|
|
6630
6846
|
) : null
|
|
6631
6847
|
] }),
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
|
|
6634
6850
|
] }) : null
|
|
6635
6851
|
]
|
|
6636
6852
|
}
|
|
@@ -6652,8 +6868,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
|
|
|
6652
6868
|
}
|
|
6653
6869
|
return void 0;
|
|
6654
6870
|
}
|
|
6655
|
-
function normalizeAgentFeedbackAnswerText(
|
|
6656
|
-
const normalized =
|
|
6871
|
+
function normalizeAgentFeedbackAnswerText(text2) {
|
|
6872
|
+
const normalized = text2.replace(/\s+/g, " ").trim();
|
|
6657
6873
|
if (!normalized) return void 0;
|
|
6658
6874
|
return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
|
|
6659
6875
|
}
|
|
@@ -6694,7 +6910,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
|
|
|
6694
6910
|
}
|
|
6695
6911
|
|
|
6696
6912
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
6697
|
-
var
|
|
6913
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6698
6914
|
function AgentWidget({
|
|
6699
6915
|
indexId,
|
|
6700
6916
|
customerId,
|
|
@@ -6837,19 +7053,19 @@ function AgentWidget({
|
|
|
6837
7053
|
window.addEventListener("keydown", handleKeyDown);
|
|
6838
7054
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
6839
7055
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
6840
|
-
return /* @__PURE__ */ (0,
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
7056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "webless-agent-root", children: [
|
|
7057
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6842
7058
|
"div",
|
|
6843
7059
|
{
|
|
6844
7060
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
6845
|
-
children: /* @__PURE__ */ (0,
|
|
7061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6846
7062
|
"div",
|
|
6847
7063
|
{
|
|
6848
7064
|
ref: railSlotRef,
|
|
6849
7065
|
className: "webless-agent-root__rail-slot",
|
|
6850
7066
|
inert: railCollapsed || void 0,
|
|
6851
7067
|
"aria-hidden": railCollapsed,
|
|
6852
|
-
children: /* @__PURE__ */ (0,
|
|
7068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6853
7069
|
AgentRail,
|
|
6854
7070
|
{
|
|
6855
7071
|
theme,
|
|
@@ -6886,7 +7102,7 @@ function AgentWidget({
|
|
|
6886
7102
|
)
|
|
6887
7103
|
}
|
|
6888
7104
|
),
|
|
6889
|
-
railCollapsed ? /* @__PURE__ */ (0,
|
|
7105
|
+
railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6890
7106
|
AssistEdgeTab,
|
|
6891
7107
|
{
|
|
6892
7108
|
variant: placement.variant,
|
|
@@ -6925,12 +7141,12 @@ function readUnpublishedPreviewBuildId(href) {
|
|
|
6925
7141
|
}
|
|
6926
7142
|
|
|
6927
7143
|
// src/embed/AgentWidget.tsx
|
|
6928
|
-
var
|
|
7144
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6929
7145
|
function AgentWidget2({
|
|
6930
7146
|
manifest
|
|
6931
7147
|
}) {
|
|
6932
7148
|
const defaultCollapsed = manifest.version !== "unpublished";
|
|
6933
|
-
return /* @__PURE__ */ (0,
|
|
7149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6934
7150
|
AgentWidget,
|
|
6935
7151
|
{
|
|
6936
7152
|
indexId: manifest.indexId,
|
|
@@ -7054,7 +7270,7 @@ function normalizeAgentBranding(branding) {
|
|
|
7054
7270
|
}
|
|
7055
7271
|
|
|
7056
7272
|
// src/embed/mount.tsx
|
|
7057
|
-
var
|
|
7273
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7058
7274
|
var mountedHandles = /* @__PURE__ */ new Map();
|
|
7059
7275
|
var latestCustomerId = null;
|
|
7060
7276
|
function resolveMountHost(manifest, script) {
|
|
@@ -7084,7 +7300,7 @@ function mountAgent(input) {
|
|
|
7084
7300
|
const host = createHost(manifest.customerId);
|
|
7085
7301
|
mountTarget.append(host);
|
|
7086
7302
|
const root = (0, import_client5.createRoot)(host);
|
|
7087
|
-
root.render(/* @__PURE__ */ (0,
|
|
7303
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentWidget2, { manifest }));
|
|
7088
7304
|
const handle = {
|
|
7089
7305
|
customerId: manifest.customerId,
|
|
7090
7306
|
manifest,
|