@webless/agent 0.10.4 → 0.11.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 +11 -0
- package/dist/{chunk-74CSWSC5.js → chunk-NW37MHU7.js} +353 -186
- package/dist/chunk-NW37MHU7.js.map +1 -0
- package/dist/embed.cjs +351 -184
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +87 -0
- package/dist/embed.css.map +1 -1
- package/dist/embed.js +1 -1
- package/dist/index.cjs +20 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/presentation.cjs +3 -0
- package/dist/presentation.cjs.map +1 -1
- package/dist/presentation.d.cts +1 -1
- package/dist/presentation.d.ts +1 -1
- package/dist/presentation.js +3 -0
- package/dist/presentation.js.map +1 -1
- package/dist/react.cjs +369 -202
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +87 -0
- package/dist/react.css.map +1 -1
- package/dist/react.js +1 -1
- package/dist/{types-sLEIYDqm.d.cts → types-B2j6hbI5.d.cts} +2 -0
- package/dist/{types-sLEIYDqm.d.ts → types-B2j6hbI5.d.ts} +2 -0
- package/package.json +1 -1
- package/dist/chunk-74CSWSC5.js.map +0 -1
package/dist/react.cjs
CHANGED
|
@@ -46,7 +46,7 @@ __export(react_exports, {
|
|
|
46
46
|
module.exports = __toCommonJS(react_exports);
|
|
47
47
|
|
|
48
48
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
49
|
-
var
|
|
49
|
+
var import_react17 = require("react");
|
|
50
50
|
|
|
51
51
|
// src/react/page-shift.ts
|
|
52
52
|
var import_react = require("react");
|
|
@@ -526,18 +526,26 @@ function createAgentRuntimeCapability(options) {
|
|
|
526
526
|
);
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
const bootstrapBody =
|
|
529
|
+
const bootstrapBody = {
|
|
530
530
|
clientSessionId: options.visitorSessionId,
|
|
531
531
|
indexId: options.indexId,
|
|
532
532
|
...previewBuildId ? { previewBuildId } : {},
|
|
533
533
|
...previewGrant ? { previewGrant } : {},
|
|
534
534
|
version: options.version
|
|
535
|
-
}
|
|
536
|
-
const postBootstrap = (origin) =>
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
535
|
+
};
|
|
536
|
+
const postBootstrap = async (origin) => {
|
|
537
|
+
const send = (advertiseLocation) => fetchImplementation(`${origin}/webless/v1/bootstrap`, {
|
|
538
|
+
body: JSON.stringify({ ...bootstrapBody, ...advertiseLocation ? { locationConsent: "v1" } : {} }),
|
|
539
|
+
headers: { "content-type": "application/json" },
|
|
540
|
+
method: "POST"
|
|
541
|
+
});
|
|
542
|
+
const response2 = await send(Boolean(options.locationConsent));
|
|
543
|
+
if (options.locationConsent && response2.status === 400) {
|
|
544
|
+
const error = await response2.clone().json().catch(() => null);
|
|
545
|
+
if (isRecord3(error) && error.code === "invalid_request") return send(false);
|
|
546
|
+
}
|
|
547
|
+
return response2;
|
|
548
|
+
};
|
|
541
549
|
let response;
|
|
542
550
|
let lastError;
|
|
543
551
|
for (const origin of localBootstrapOrigins(options.runtimeOrigin)) {
|
|
@@ -1072,6 +1080,7 @@ function specialistNameFromInput(input) {
|
|
|
1072
1080
|
return match?.[1]?.trim() || void 0;
|
|
1073
1081
|
}
|
|
1074
1082
|
function requestedWorkItem(action) {
|
|
1083
|
+
if (action.kind === "tool-call" && action.toolName === "request_location") return null;
|
|
1075
1084
|
if (action.kind === "tool-call" && action.toolName === "search_discovery") {
|
|
1076
1085
|
return {
|
|
1077
1086
|
id: action.callId,
|
|
@@ -1177,13 +1186,14 @@ function applyWorkEvent(event, handlers, workItems) {
|
|
|
1177
1186
|
);
|
|
1178
1187
|
}
|
|
1179
1188
|
var AgentSession = class {
|
|
1180
|
-
constructor(indexId, version, runtimeOrigin, visitorSessionId, storeOptions, previewBuildId, getUnpublishedPreviewGrant) {
|
|
1189
|
+
constructor(indexId, version, runtimeOrigin, visitorSessionId, storeOptions, previewBuildId, getUnpublishedPreviewGrant, locationConsent) {
|
|
1181
1190
|
this.indexId = indexId;
|
|
1182
1191
|
this.version = version;
|
|
1183
1192
|
this.runtimeOrigin = runtimeOrigin;
|
|
1184
1193
|
this.visitorSessionId = visitorSessionId;
|
|
1185
1194
|
this.storeOptions = storeOptions;
|
|
1186
1195
|
this.capability = createAgentRuntimeCapability({
|
|
1196
|
+
locationConsent,
|
|
1187
1197
|
getUnpublishedPreviewGrant,
|
|
1188
1198
|
indexId,
|
|
1189
1199
|
previewBuildId,
|
|
@@ -1575,7 +1585,8 @@ function createAgentClient(options) {
|
|
|
1575
1585
|
visitorSessionId,
|
|
1576
1586
|
storeOptions,
|
|
1577
1587
|
options.previewBuildId,
|
|
1578
|
-
options.getUnpublishedPreviewGrant
|
|
1588
|
+
options.getUnpublishedPreviewGrant,
|
|
1589
|
+
options.locationConsent
|
|
1579
1590
|
);
|
|
1580
1591
|
return {
|
|
1581
1592
|
indexId,
|
|
@@ -2724,6 +2735,9 @@ function finalizeSummaryPresentation(result, proposed) {
|
|
|
2724
2735
|
};
|
|
2725
2736
|
}
|
|
2726
2737
|
function presentVisitorToolResult(result, registry = []) {
|
|
2738
|
+
if (result.toolName === "request_location") {
|
|
2739
|
+
return { id: result.callId, toolName: result.toolName, status: result.status, kind: "hidden" };
|
|
2740
|
+
}
|
|
2727
2741
|
if (result.status === "completed" && toolResultFailed(result)) {
|
|
2728
2742
|
result = { ...result, status: "failed" };
|
|
2729
2743
|
}
|
|
@@ -3042,6 +3056,7 @@ function useAgentChat({
|
|
|
3042
3056
|
const runRef = (0, import_react2.useRef)(null);
|
|
3043
3057
|
const clientRef = (0, import_react2.useRef)(
|
|
3044
3058
|
createAgentClient({
|
|
3059
|
+
locationConsent: true,
|
|
3045
3060
|
customerId,
|
|
3046
3061
|
getUnpublishedPreviewGrant: resolveUnpublishedPreviewGrant,
|
|
3047
3062
|
indexId,
|
|
@@ -3062,6 +3077,7 @@ function useAgentChat({
|
|
|
3062
3077
|
runRef.current?.abort();
|
|
3063
3078
|
runRef.current = null;
|
|
3064
3079
|
clientRef.current = createAgentClient({
|
|
3080
|
+
locationConsent: true,
|
|
3065
3081
|
customerId,
|
|
3066
3082
|
getUnpublishedPreviewGrant: resolveUnpublishedPreviewGrant,
|
|
3067
3083
|
indexId,
|
|
@@ -3668,7 +3684,7 @@ function unregisterAgentPanelController(customerId) {
|
|
|
3668
3684
|
}
|
|
3669
3685
|
|
|
3670
3686
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
3671
|
-
var
|
|
3687
|
+
var import_react15 = require("react");
|
|
3672
3688
|
|
|
3673
3689
|
// src/react/types/conversation.ts
|
|
3674
3690
|
var defaultAgentRailTheme = {
|
|
@@ -6151,31 +6167,173 @@ function HumanInputCard({
|
|
|
6151
6167
|
);
|
|
6152
6168
|
}
|
|
6153
6169
|
|
|
6154
|
-
// src/react/components/
|
|
6170
|
+
// src/react/components/LocationConsent/LocationConsent.tsx
|
|
6171
|
+
var import_react14 = require("react");
|
|
6172
|
+
|
|
6173
|
+
// src/runtime/location-consent.ts
|
|
6174
|
+
function isLocationConsentRequest(request) {
|
|
6175
|
+
return request.kind === "tool-approval" && request.action.toolName === "request_location";
|
|
6176
|
+
}
|
|
6177
|
+
function preciseLocationResponse(requestId, position) {
|
|
6178
|
+
const { latitude, longitude, accuracy } = position.coords;
|
|
6179
|
+
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90 || !Number.isFinite(longitude) || longitude < -180 || longitude > 180 || !Number.isFinite(accuracy) || accuracy < 0 || !Number.isFinite(position.timestamp)) {
|
|
6180
|
+
throw new Error("Your device returned an invalid location.");
|
|
6181
|
+
}
|
|
6182
|
+
return {
|
|
6183
|
+
requestId,
|
|
6184
|
+
optionId: "approve",
|
|
6185
|
+
text: JSON.stringify({
|
|
6186
|
+
status: "shared",
|
|
6187
|
+
location: {
|
|
6188
|
+
source: "device",
|
|
6189
|
+
latitude,
|
|
6190
|
+
longitude,
|
|
6191
|
+
accuracyMeters: accuracy,
|
|
6192
|
+
capturedAt: new Date(position.timestamp).toISOString(),
|
|
6193
|
+
consentedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6194
|
+
scope: "conversation"
|
|
6195
|
+
}
|
|
6196
|
+
})
|
|
6197
|
+
};
|
|
6198
|
+
}
|
|
6199
|
+
function getPreciseLocation(geolocation) {
|
|
6200
|
+
return new Promise(
|
|
6201
|
+
(resolve, reject) => geolocation.getCurrentPosition(
|
|
6202
|
+
resolve,
|
|
6203
|
+
(error) => reject(
|
|
6204
|
+
new Error(
|
|
6205
|
+
error.code === 1 ? "Location access is blocked. Allow it in your browser, or continue without sharing." : "Your location couldn\u2019t be found. Try again or continue without sharing."
|
|
6206
|
+
)
|
|
6207
|
+
),
|
|
6208
|
+
{ enableHighAccuracy: true, maximumAge: 0, timeout: 1e4 }
|
|
6209
|
+
)
|
|
6210
|
+
);
|
|
6211
|
+
}
|
|
6212
|
+
|
|
6213
|
+
// src/react/components/LocationConsent/LocationConsent.tsx
|
|
6155
6214
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6215
|
+
function LocationConsent({
|
|
6216
|
+
request,
|
|
6217
|
+
onRespond
|
|
6218
|
+
}) {
|
|
6219
|
+
const [preference, setPreference] = (0, import_react14.useState)("unset");
|
|
6220
|
+
const [locating, setLocating] = (0, import_react14.useState)(false);
|
|
6221
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
6222
|
+
const respond = (0, import_react14.useRef)(onRespond);
|
|
6223
|
+
const answered = (0, import_react14.useRef)(null);
|
|
6224
|
+
const requestId = request?.requestId;
|
|
6225
|
+
(0, import_react14.useEffect)(() => {
|
|
6226
|
+
respond.current = onRespond;
|
|
6227
|
+
}, [onRespond]);
|
|
6228
|
+
(0, import_react14.useEffect)(() => {
|
|
6229
|
+
if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
|
|
6230
|
+
return;
|
|
6231
|
+
if (preference === "off") {
|
|
6232
|
+
setLocating(false);
|
|
6233
|
+
answered.current = requestId;
|
|
6234
|
+
respond.current({
|
|
6235
|
+
requestId,
|
|
6236
|
+
optionId: "approve",
|
|
6237
|
+
text: JSON.stringify({ status: "declined" })
|
|
6238
|
+
});
|
|
6239
|
+
return;
|
|
6240
|
+
}
|
|
6241
|
+
let cancelled = false;
|
|
6242
|
+
const pendingId = requestId;
|
|
6243
|
+
setLocating(true);
|
|
6244
|
+
setError(null);
|
|
6245
|
+
async function locate() {
|
|
6246
|
+
try {
|
|
6247
|
+
if (!Reflect.has(navigator, "geolocation"))
|
|
6248
|
+
throw new Error("Location sharing isn\u2019t available in this browser.");
|
|
6249
|
+
const position = await getPreciseLocation(navigator.geolocation);
|
|
6250
|
+
if (cancelled) return;
|
|
6251
|
+
const response = preciseLocationResponse(pendingId, position);
|
|
6252
|
+
answered.current = pendingId;
|
|
6253
|
+
respond.current?.(response);
|
|
6254
|
+
} catch (failure) {
|
|
6255
|
+
if (cancelled) return;
|
|
6256
|
+
setPreference("unset");
|
|
6257
|
+
setError(
|
|
6258
|
+
failure instanceof Error ? failure.message : "Location sharing failed. Try again or continue without sharing."
|
|
6259
|
+
);
|
|
6260
|
+
} finally {
|
|
6261
|
+
if (!cancelled) setLocating(false);
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
void locate();
|
|
6265
|
+
return () => {
|
|
6266
|
+
cancelled = true;
|
|
6267
|
+
};
|
|
6268
|
+
}, [requestId, preference]);
|
|
6269
|
+
const isLocating = Boolean(requestId) && preference === "on" && locating;
|
|
6270
|
+
if (!request && preference === "unset") return null;
|
|
6271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: "location-consent", "aria-label": "Location sharing", children: [
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "location-consent__copy", children: [
|
|
6273
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
|
|
6274
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: isLocating ? "Allow location access in your browser." : request ? "Share your precise location" : preference === "on" ? "On for location-aware answers" : "Off for this chat" })
|
|
6275
|
+
] }),
|
|
6276
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "location-consent__actions", children: [
|
|
6277
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6278
|
+
"button",
|
|
6279
|
+
{
|
|
6280
|
+
type: "button",
|
|
6281
|
+
role: "switch",
|
|
6282
|
+
className: "location-consent__toggle",
|
|
6283
|
+
"aria-label": "Share precise location",
|
|
6284
|
+
"aria-checked": preference === "on",
|
|
6285
|
+
"aria-busy": isLocating,
|
|
6286
|
+
disabled: !onRespond,
|
|
6287
|
+
onClick: () => {
|
|
6288
|
+
setError(null);
|
|
6289
|
+
setPreference(preference === "on" ? "off" : "on");
|
|
6290
|
+
},
|
|
6291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {})
|
|
6292
|
+
}
|
|
6293
|
+
),
|
|
6294
|
+
request && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6295
|
+
"button",
|
|
6296
|
+
{
|
|
6297
|
+
type: "button",
|
|
6298
|
+
className: "location-consent__decline",
|
|
6299
|
+
disabled: !onRespond,
|
|
6300
|
+
onClick: () => {
|
|
6301
|
+
setError(null);
|
|
6302
|
+
setPreference("off");
|
|
6303
|
+
},
|
|
6304
|
+
children: "No thanks"
|
|
6305
|
+
}
|
|
6306
|
+
)
|
|
6307
|
+
] }),
|
|
6308
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "location-consent__error", children: error })
|
|
6309
|
+
] });
|
|
6310
|
+
}
|
|
6311
|
+
|
|
6312
|
+
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
6313
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6156
6314
|
function CollectionResultCard({
|
|
6157
6315
|
result
|
|
6158
6316
|
}) {
|
|
6159
6317
|
const empty = result.items.length === 0;
|
|
6160
|
-
return /* @__PURE__ */ (0,
|
|
6318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
6161
6319
|
"section",
|
|
6162
6320
|
{
|
|
6163
6321
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
6164
6322
|
"aria-label": result.title,
|
|
6165
6323
|
role: result.status === "completed" ? "status" : "alert",
|
|
6166
6324
|
children: [
|
|
6167
|
-
/* @__PURE__ */ (0,
|
|
6168
|
-
/* @__PURE__ */ (0,
|
|
6169
|
-
/* @__PURE__ */ (0,
|
|
6325
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6326
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6327
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
|
|
6170
6328
|
] }),
|
|
6171
|
-
empty ? /* @__PURE__ */ (0,
|
|
6172
|
-
/* @__PURE__ */ (0,
|
|
6173
|
-
item.description ? /* @__PURE__ */ (0,
|
|
6174
|
-
item.details?.length ? /* @__PURE__ */ (0,
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6176
|
-
/* @__PURE__ */ (0,
|
|
6329
|
+
empty ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { children: [
|
|
6330
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
6331
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: item.description }) : null,
|
|
6332
|
+
item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
|
|
6177
6335
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
6178
|
-
item.href ? /* @__PURE__ */ (0,
|
|
6336
|
+
item.href ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
6179
6337
|
] }, item.title)) })
|
|
6180
6338
|
]
|
|
6181
6339
|
}
|
|
@@ -6183,23 +6341,23 @@ function CollectionResultCard({
|
|
|
6183
6341
|
}
|
|
6184
6342
|
|
|
6185
6343
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
6186
|
-
var
|
|
6344
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6187
6345
|
function EntityResultCard({
|
|
6188
6346
|
result
|
|
6189
6347
|
}) {
|
|
6190
6348
|
const compact = !result.description && !result.details?.length && !result.links?.length;
|
|
6191
6349
|
const collapsible = result.status === "completed" && Boolean(result.details?.length) && !result.links?.length;
|
|
6192
|
-
const heading = /* @__PURE__ */ (0,
|
|
6193
|
-
/* @__PURE__ */ (0,
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6350
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "tool-result-card__heading", children: [
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
|
|
6195
6353
|
] });
|
|
6196
|
-
const content = /* @__PURE__ */ (0,
|
|
6197
|
-
result.description ? /* @__PURE__ */ (0,
|
|
6198
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
6199
|
-
/* @__PURE__ */ (0,
|
|
6200
|
-
/* @__PURE__ */ (0,
|
|
6354
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
6355
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
|
|
6356
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
6357
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: detail.label }),
|
|
6358
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: detail.value })
|
|
6201
6359
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
6202
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6360
|
+
result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6203
6361
|
"a",
|
|
6204
6362
|
{
|
|
6205
6363
|
href: link.href,
|
|
@@ -6211,12 +6369,12 @@ function EntityResultCard({
|
|
|
6211
6369
|
)) }) : null
|
|
6212
6370
|
] });
|
|
6213
6371
|
if (collapsible) {
|
|
6214
|
-
return /* @__PURE__ */ (0,
|
|
6215
|
-
/* @__PURE__ */ (0,
|
|
6372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
|
|
6373
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("summary", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { role: "status", children: heading }) }),
|
|
6216
6374
|
content
|
|
6217
6375
|
] });
|
|
6218
6376
|
}
|
|
6219
|
-
return /* @__PURE__ */ (0,
|
|
6377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6220
6378
|
"section",
|
|
6221
6379
|
{
|
|
6222
6380
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}${compact ? " entity-result-card--compact" : ""}`,
|
|
@@ -6231,24 +6389,24 @@ function EntityResultCard({
|
|
|
6231
6389
|
}
|
|
6232
6390
|
|
|
6233
6391
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
6234
|
-
var
|
|
6392
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
6235
6393
|
function SignatureResultCard({
|
|
6236
6394
|
result
|
|
6237
6395
|
}) {
|
|
6238
6396
|
const primaryLink = result.links?.[0];
|
|
6239
|
-
return /* @__PURE__ */ (0,
|
|
6397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
6240
6398
|
"section",
|
|
6241
6399
|
{
|
|
6242
6400
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
6243
6401
|
"aria-label": result.title,
|
|
6244
6402
|
children: [
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
/* @__PURE__ */ (0,
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6405
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
|
|
6248
6406
|
] }),
|
|
6249
|
-
result.statusLabel ? /* @__PURE__ */ (0,
|
|
6250
|
-
result.description ? /* @__PURE__ */ (0,
|
|
6251
|
-
primaryLink ? /* @__PURE__ */ (0,
|
|
6407
|
+
result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
6408
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
|
|
6409
|
+
primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6252
6410
|
"a",
|
|
6253
6411
|
{
|
|
6254
6412
|
className: "signature-result-card__cta",
|
|
@@ -6264,27 +6422,27 @@ function SignatureResultCard({
|
|
|
6264
6422
|
}
|
|
6265
6423
|
|
|
6266
6424
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
6267
|
-
var
|
|
6425
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
6268
6426
|
function ToolResultCard({
|
|
6269
6427
|
result
|
|
6270
6428
|
}) {
|
|
6271
|
-
return /* @__PURE__ */ (0,
|
|
6429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6272
6430
|
"section",
|
|
6273
6431
|
{
|
|
6274
6432
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
6275
6433
|
"aria-label": result.title,
|
|
6276
6434
|
role: result.status === "completed" ? "status" : "alert",
|
|
6277
6435
|
children: [
|
|
6278
|
-
/* @__PURE__ */ (0,
|
|
6279
|
-
/* @__PURE__ */ (0,
|
|
6280
|
-
/* @__PURE__ */ (0,
|
|
6436
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tool-result-card__heading", children: [
|
|
6437
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
6438
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: result.title })
|
|
6281
6439
|
] }),
|
|
6282
|
-
result.description ? /* @__PURE__ */ (0,
|
|
6283
|
-
result.details?.length ? /* @__PURE__ */ (0,
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6285
|
-
/* @__PURE__ */ (0,
|
|
6440
|
+
result.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: result.description }) : null,
|
|
6441
|
+
result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
6442
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: detail.label }),
|
|
6443
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: detail.value })
|
|
6286
6444
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
6287
|
-
result.links?.length ? /* @__PURE__ */ (0,
|
|
6445
|
+
result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6288
6446
|
"a",
|
|
6289
6447
|
{
|
|
6290
6448
|
href: link.href,
|
|
@@ -6300,14 +6458,14 @@ function ToolResultCard({
|
|
|
6300
6458
|
}
|
|
6301
6459
|
|
|
6302
6460
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
6303
|
-
var
|
|
6461
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
6304
6462
|
function VisitorToolResultView({
|
|
6305
6463
|
disabled = false,
|
|
6306
6464
|
onToolInput,
|
|
6307
6465
|
result
|
|
6308
6466
|
}) {
|
|
6309
6467
|
if (result.kind === "input") {
|
|
6310
|
-
return /* @__PURE__ */ (0,
|
|
6468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6311
6469
|
ToolInputCard,
|
|
6312
6470
|
{
|
|
6313
6471
|
disabled,
|
|
@@ -6317,16 +6475,16 @@ function VisitorToolResultView({
|
|
|
6317
6475
|
);
|
|
6318
6476
|
}
|
|
6319
6477
|
if (result.kind === "entity") {
|
|
6320
|
-
return /* @__PURE__ */ (0,
|
|
6478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EntityResultCard, { result });
|
|
6321
6479
|
}
|
|
6322
6480
|
if (result.kind === "collection") {
|
|
6323
|
-
return /* @__PURE__ */ (0,
|
|
6481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CollectionResultCard, { result });
|
|
6324
6482
|
}
|
|
6325
6483
|
if (result.kind === "signature") {
|
|
6326
|
-
return /* @__PURE__ */ (0,
|
|
6484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SignatureResultCard, { result });
|
|
6327
6485
|
}
|
|
6328
6486
|
if (result.kind === "summary") {
|
|
6329
|
-
return /* @__PURE__ */ (0,
|
|
6487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolResultCard, { result });
|
|
6330
6488
|
}
|
|
6331
6489
|
return null;
|
|
6332
6490
|
}
|
|
@@ -6335,9 +6493,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
6335
6493
|
}
|
|
6336
6494
|
|
|
6337
6495
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
6338
|
-
var
|
|
6496
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6339
6497
|
function MinimizeIcon() {
|
|
6340
|
-
return /* @__PURE__ */ (0,
|
|
6498
|
+
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)(
|
|
6341
6499
|
"path",
|
|
6342
6500
|
{
|
|
6343
6501
|
d: "M3.5 8h9",
|
|
@@ -6348,7 +6506,7 @@ function MinimizeIcon() {
|
|
|
6348
6506
|
) });
|
|
6349
6507
|
}
|
|
6350
6508
|
function CloseIcon2() {
|
|
6351
|
-
return /* @__PURE__ */ (0,
|
|
6509
|
+
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)(
|
|
6352
6510
|
"path",
|
|
6353
6511
|
{
|
|
6354
6512
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -6359,7 +6517,7 @@ function CloseIcon2() {
|
|
|
6359
6517
|
) });
|
|
6360
6518
|
}
|
|
6361
6519
|
function NewChatIcon() {
|
|
6362
|
-
return /* @__PURE__ */ (0,
|
|
6520
|
+
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)(
|
|
6363
6521
|
"path",
|
|
6364
6522
|
{
|
|
6365
6523
|
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",
|
|
@@ -6371,7 +6529,7 @@ function NewChatIcon() {
|
|
|
6371
6529
|
) });
|
|
6372
6530
|
}
|
|
6373
6531
|
function ExpandIcon() {
|
|
6374
|
-
return /* @__PURE__ */ (0,
|
|
6532
|
+
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)(
|
|
6375
6533
|
"path",
|
|
6376
6534
|
{
|
|
6377
6535
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -6383,7 +6541,7 @@ function ExpandIcon() {
|
|
|
6383
6541
|
) });
|
|
6384
6542
|
}
|
|
6385
6543
|
function RestoreIcon() {
|
|
6386
|
-
return /* @__PURE__ */ (0,
|
|
6544
|
+
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)(
|
|
6387
6545
|
"path",
|
|
6388
6546
|
{
|
|
6389
6547
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -6395,7 +6553,7 @@ function RestoreIcon() {
|
|
|
6395
6553
|
) });
|
|
6396
6554
|
}
|
|
6397
6555
|
function ChevronDownIcon() {
|
|
6398
|
-
return /* @__PURE__ */ (0,
|
|
6556
|
+
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)(
|
|
6399
6557
|
"path",
|
|
6400
6558
|
{
|
|
6401
6559
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -6434,28 +6592,29 @@ function AgentRail({
|
|
|
6434
6592
|
onInputResponse,
|
|
6435
6593
|
onToolInput
|
|
6436
6594
|
}) {
|
|
6437
|
-
const railRef = (0,
|
|
6438
|
-
const overlayRef = (0,
|
|
6439
|
-
const transcriptRef = (0,
|
|
6440
|
-
const responseRef = (0,
|
|
6441
|
-
const threadRef = (0,
|
|
6442
|
-
const lastScrolledVisitorIdRef = (0,
|
|
6443
|
-
const pinnedToBottomRef = (0,
|
|
6444
|
-
const smoothScrollToLatestRef = (0,
|
|
6445
|
-
const lockedTranscriptScrollTopRef = (0,
|
|
6446
|
-
const [showJumpToLatest, setShowJumpToLatest] = (0,
|
|
6447
|
-
const [receiptOpen, setReceiptOpen] = (0,
|
|
6595
|
+
const railRef = (0, import_react15.useRef)(null);
|
|
6596
|
+
const overlayRef = (0, import_react15.useRef)(null);
|
|
6597
|
+
const transcriptRef = (0, import_react15.useRef)(null);
|
|
6598
|
+
const responseRef = (0, import_react15.useRef)(null);
|
|
6599
|
+
const threadRef = (0, import_react15.useRef)(null);
|
|
6600
|
+
const lastScrolledVisitorIdRef = (0, import_react15.useRef)(void 0);
|
|
6601
|
+
const pinnedToBottomRef = (0, import_react15.useRef)(true);
|
|
6602
|
+
const smoothScrollToLatestRef = (0, import_react15.useRef)(false);
|
|
6603
|
+
const lockedTranscriptScrollTopRef = (0, import_react15.useRef)(null);
|
|
6604
|
+
const [showJumpToLatest, setShowJumpToLatest] = (0, import_react15.useState)(false);
|
|
6605
|
+
const [receiptOpen, setReceiptOpen] = (0, import_react15.useState)(false);
|
|
6448
6606
|
const resolvedBrandLabel = brandLabel.trim();
|
|
6449
6607
|
const resolvedBrandLogoUrl = brandLogoUrl?.trim();
|
|
6450
6608
|
const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
|
|
6451
|
-
const [failedLogoUrl, setFailedLogoUrl] = (0,
|
|
6609
|
+
const [failedLogoUrl, setFailedLogoUrl] = (0, import_react15.useState)(null);
|
|
6452
6610
|
const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
|
|
6453
6611
|
const resolvedColorScheme = useAgentColorScheme(colorScheme);
|
|
6454
6612
|
const railStyle = agentThemeStyle(theme, resolvedColorScheme);
|
|
6613
|
+
const locationRequest = state.pendingInputs?.find(isLocationConsentRequest);
|
|
6455
6614
|
const pendingInputRequests = (state.pendingInputs ?? []).filter(
|
|
6456
|
-
(request) => shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
|
|
6615
|
+
(request) => !isLocationConsentRequest(request) && shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
|
|
6457
6616
|
);
|
|
6458
|
-
const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
|
|
6617
|
+
const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && (pendingInputRequests.length > 0 || Boolean(locationRequest));
|
|
6459
6618
|
const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
|
|
6460
6619
|
const visitorToolResults = (state.toolResults ?? []).filter(
|
|
6461
6620
|
isRenderableVisitorToolResult
|
|
@@ -6541,7 +6700,7 @@ function AgentRail({
|
|
|
6541
6700
|
...visibleVisitorToolResults
|
|
6542
6701
|
].reverse().find((result) => result.kind !== "input")?.id;
|
|
6543
6702
|
const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
|
|
6544
|
-
(0,
|
|
6703
|
+
(0, import_react15.useEffect)(() => {
|
|
6545
6704
|
if (state.phase !== "complete") {
|
|
6546
6705
|
setReceiptOpen(false);
|
|
6547
6706
|
}
|
|
@@ -6563,7 +6722,7 @@ function AgentRail({
|
|
|
6563
6722
|
onFollowUpSelect?.(label);
|
|
6564
6723
|
}
|
|
6565
6724
|
const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
|
|
6566
|
-
(0,
|
|
6725
|
+
(0, import_react15.useEffect)(() => {
|
|
6567
6726
|
const node = transcriptRef.current;
|
|
6568
6727
|
if (!node) return;
|
|
6569
6728
|
if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
|
|
@@ -6593,7 +6752,7 @@ function AgentRail({
|
|
|
6593
6752
|
state.followUps,
|
|
6594
6753
|
state.journey
|
|
6595
6754
|
]);
|
|
6596
|
-
(0,
|
|
6755
|
+
(0, import_react15.useEffect)(() => {
|
|
6597
6756
|
const node = transcriptRef.current;
|
|
6598
6757
|
if (!node) return;
|
|
6599
6758
|
const handleScroll = () => {
|
|
@@ -6607,7 +6766,7 @@ function AgentRail({
|
|
|
6607
6766
|
handleScroll();
|
|
6608
6767
|
return () => node.removeEventListener("scroll", handleScroll);
|
|
6609
6768
|
}, []);
|
|
6610
|
-
(0,
|
|
6769
|
+
(0, import_react15.useEffect)(() => {
|
|
6611
6770
|
if (!receiptOpen) {
|
|
6612
6771
|
lockedTranscriptScrollTopRef.current = null;
|
|
6613
6772
|
return;
|
|
@@ -6645,7 +6804,7 @@ function AgentRail({
|
|
|
6645
6804
|
window.setTimeout(settle, 900);
|
|
6646
6805
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
6647
6806
|
}
|
|
6648
|
-
return /* @__PURE__ */ (0,
|
|
6807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6649
6808
|
"aside",
|
|
6650
6809
|
{
|
|
6651
6810
|
ref: railRef,
|
|
@@ -6659,34 +6818,34 @@ function AgentRail({
|
|
|
6659
6818
|
autoFocus: mobileFullscreen || expanded,
|
|
6660
6819
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
6661
6820
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
6662
|
-
children: /* @__PURE__ */ (0,
|
|
6821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6663
6822
|
AgentRailOverlayContext.Provider,
|
|
6664
6823
|
{
|
|
6665
6824
|
value: { railRef, overlayRef },
|
|
6666
6825
|
children: [
|
|
6667
|
-
/* @__PURE__ */ (0,
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
6669
|
-
onCollapse ? /* @__PURE__ */ (0,
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__brand-row", children: [
|
|
6828
|
+
onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6670
6829
|
"button",
|
|
6671
6830
|
{
|
|
6672
6831
|
type: "button",
|
|
6673
6832
|
className: "agent-rail__collapse",
|
|
6674
6833
|
"aria-label": "Collapse assist",
|
|
6675
6834
|
onClick: onCollapse,
|
|
6676
|
-
children: /* @__PURE__ */ (0,
|
|
6835
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MinimizeIcon, {})
|
|
6677
6836
|
}
|
|
6678
|
-
) : onClose ? /* @__PURE__ */ (0,
|
|
6837
|
+
) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6679
6838
|
"button",
|
|
6680
6839
|
{
|
|
6681
6840
|
type: "button",
|
|
6682
6841
|
className: "agent-rail__close",
|
|
6683
6842
|
"aria-label": "Close agent",
|
|
6684
6843
|
onClick: onClose,
|
|
6685
|
-
children: /* @__PURE__ */ (0,
|
|
6844
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CloseIcon2, {})
|
|
6686
6845
|
}
|
|
6687
|
-
) : /* @__PURE__ */ (0,
|
|
6688
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0,
|
|
6689
|
-
showBrandLogo ? /* @__PURE__ */ (0,
|
|
6846
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
6847
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "agent-rail__identity", children: [
|
|
6848
|
+
showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6690
6849
|
"img",
|
|
6691
6850
|
{
|
|
6692
6851
|
className: "agent-rail__brand-logo",
|
|
@@ -6697,10 +6856,10 @@ function AgentRail({
|
|
|
6697
6856
|
}
|
|
6698
6857
|
}
|
|
6699
6858
|
) }) : null,
|
|
6700
|
-
resolvedBrandLabel ? /* @__PURE__ */ (0,
|
|
6859
|
+
resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
6701
6860
|
] }) : null,
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
6703
|
-
onReset ? /* @__PURE__ */ (0,
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "agent-rail__actions", children: [
|
|
6862
|
+
onReset ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6704
6863
|
"button",
|
|
6705
6864
|
{
|
|
6706
6865
|
type: "button",
|
|
@@ -6708,24 +6867,24 @@ function AgentRail({
|
|
|
6708
6867
|
"aria-label": "Start a new conversation",
|
|
6709
6868
|
disabled: !hasVisitorMessages2,
|
|
6710
6869
|
onClick: handleReset,
|
|
6711
|
-
children: /* @__PURE__ */ (0,
|
|
6870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(NewChatIcon, {})
|
|
6712
6871
|
}
|
|
6713
6872
|
) : null,
|
|
6714
|
-
onExpandToggle ? /* @__PURE__ */ (0,
|
|
6873
|
+
onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6715
6874
|
"button",
|
|
6716
6875
|
{
|
|
6717
6876
|
type: "button",
|
|
6718
6877
|
className: "agent-rail__expand",
|
|
6719
6878
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
6720
6879
|
onClick: onExpandToggle,
|
|
6721
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
6880
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExpandIcon, {})
|
|
6722
6881
|
}
|
|
6723
6882
|
) : null
|
|
6724
6883
|
] })
|
|
6725
6884
|
] }) }),
|
|
6726
|
-
/* @__PURE__ */ (0,
|
|
6727
|
-
!hasVisitorMessages2 ? /* @__PURE__ */ (0,
|
|
6728
|
-
greeting?.role === "agent" ? /* @__PURE__ */ (0,
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: threadRef, className: "agent-rail__thread", children: [
|
|
6886
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
6887
|
+
greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6729
6888
|
MessageBubble,
|
|
6730
6889
|
{
|
|
6731
6890
|
message: greeting,
|
|
@@ -6734,7 +6893,7 @@ function AgentRail({
|
|
|
6734
6893
|
onBook
|
|
6735
6894
|
}
|
|
6736
6895
|
) : null,
|
|
6737
|
-
showIdleFollowUps ? /* @__PURE__ */ (0,
|
|
6896
|
+
showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6738
6897
|
FollowUpChips,
|
|
6739
6898
|
{
|
|
6740
6899
|
suggestions: state.followUps,
|
|
@@ -6743,7 +6902,7 @@ function AgentRail({
|
|
|
6743
6902
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
6744
6903
|
}
|
|
6745
6904
|
) }) : null,
|
|
6746
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6905
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6747
6906
|
AgentActivityBubble,
|
|
6748
6907
|
{
|
|
6749
6908
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6752,7 +6911,7 @@ function AgentRail({
|
|
|
6752
6911
|
steps: activitySteps
|
|
6753
6912
|
}
|
|
6754
6913
|
) : null,
|
|
6755
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6914
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6756
6915
|
VisitorToolResultView,
|
|
6757
6916
|
{
|
|
6758
6917
|
result,
|
|
@@ -6761,7 +6920,7 @@ function AgentRail({
|
|
|
6761
6920
|
},
|
|
6762
6921
|
result.id
|
|
6763
6922
|
)),
|
|
6764
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6923
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6765
6924
|
HumanInputCard,
|
|
6766
6925
|
{
|
|
6767
6926
|
request,
|
|
@@ -6770,14 +6929,14 @@ function AgentRail({
|
|
|
6770
6929
|
request.requestId
|
|
6771
6930
|
))
|
|
6772
6931
|
] }) : null,
|
|
6773
|
-
transcriptMessages.map((message, index) => /* @__PURE__ */ (0,
|
|
6932
|
+
transcriptMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6774
6933
|
"div",
|
|
6775
6934
|
{
|
|
6776
6935
|
ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
|
|
6777
6936
|
className: "agent-rail__turn-block",
|
|
6778
6937
|
children: [
|
|
6779
|
-
message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ (0,
|
|
6780
|
-
/* @__PURE__ */ (0,
|
|
6938
|
+
message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VisitorToolResultView, { result }, result.id)) : null,
|
|
6939
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6781
6940
|
MessageBubble,
|
|
6782
6941
|
{
|
|
6783
6942
|
message,
|
|
@@ -6787,7 +6946,7 @@ function AgentRail({
|
|
|
6787
6946
|
onBook
|
|
6788
6947
|
}
|
|
6789
6948
|
),
|
|
6790
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0,
|
|
6949
|
+
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6791
6950
|
MessageActions,
|
|
6792
6951
|
{
|
|
6793
6952
|
answeredAt: message.createdAt,
|
|
@@ -6799,8 +6958,8 @@ function AgentRail({
|
|
|
6799
6958
|
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
6800
6959
|
}
|
|
6801
6960
|
) : null,
|
|
6802
|
-
index === lastVisitorIndex ? /* @__PURE__ */ (0,
|
|
6803
|
-
showActivity ? /* @__PURE__ */ (0,
|
|
6961
|
+
index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
6962
|
+
showActivity ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6804
6963
|
AgentActivityBubble,
|
|
6805
6964
|
{
|
|
6806
6965
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6809,7 +6968,7 @@ function AgentRail({
|
|
|
6809
6968
|
steps: activitySteps
|
|
6810
6969
|
}
|
|
6811
6970
|
) : null,
|
|
6812
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0,
|
|
6971
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6813
6972
|
VisitorToolResultView,
|
|
6814
6973
|
{
|
|
6815
6974
|
result,
|
|
@@ -6818,7 +6977,7 @@ function AgentRail({
|
|
|
6818
6977
|
},
|
|
6819
6978
|
result.id
|
|
6820
6979
|
)),
|
|
6821
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0,
|
|
6980
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6822
6981
|
HumanInputCard,
|
|
6823
6982
|
{
|
|
6824
6983
|
request,
|
|
@@ -6831,16 +6990,16 @@ function AgentRail({
|
|
|
6831
6990
|
},
|
|
6832
6991
|
message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
|
|
6833
6992
|
)),
|
|
6834
|
-
waitingForBooking ? /* @__PURE__ */ (0,
|
|
6835
|
-
state.error ? /* @__PURE__ */ (0,
|
|
6836
|
-
/* @__PURE__ */ (0,
|
|
6837
|
-
/* @__PURE__ */ (0,
|
|
6838
|
-
/* @__PURE__ */ (0,
|
|
6993
|
+
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BookingCardLoader, {}) : null,
|
|
6994
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6995
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
6996
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: "Something went wrong" }),
|
|
6997
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: state.error })
|
|
6839
6998
|
] }),
|
|
6840
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
6999
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
6841
7000
|
] }) : null
|
|
6842
7001
|
] }) }),
|
|
6843
|
-
showDisclaimerLabel ? /* @__PURE__ */ (0,
|
|
7002
|
+
showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6844
7003
|
"a",
|
|
6845
7004
|
{
|
|
6846
7005
|
href: disclaimerLink,
|
|
@@ -6849,8 +7008,16 @@ function AgentRail({
|
|
|
6849
7008
|
children: resolvedDisclaimerLabel
|
|
6850
7009
|
}
|
|
6851
7010
|
) : resolvedDisclaimerLabel }) }) : null,
|
|
6852
|
-
/* @__PURE__ */ (0,
|
|
6853
|
-
|
|
7011
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
|
|
7012
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7013
|
+
LocationConsent,
|
|
7014
|
+
{
|
|
7015
|
+
request: locationRequest,
|
|
7016
|
+
onRespond: onInputResponse
|
|
7017
|
+
},
|
|
7018
|
+
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
7019
|
+
),
|
|
7020
|
+
showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6854
7021
|
"button",
|
|
6855
7022
|
{
|
|
6856
7023
|
type: "button",
|
|
@@ -6858,10 +7025,10 @@ function AgentRail({
|
|
|
6858
7025
|
"aria-label": "Jump to the latest message",
|
|
6859
7026
|
title: "Jump to the latest message",
|
|
6860
7027
|
onClick: scrollToLatest,
|
|
6861
|
-
children: /* @__PURE__ */ (0,
|
|
7028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon, {})
|
|
6862
7029
|
}
|
|
6863
7030
|
) : null,
|
|
6864
|
-
/* @__PURE__ */ (0,
|
|
7031
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6865
7032
|
Composer,
|
|
6866
7033
|
{
|
|
6867
7034
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -6873,11 +7040,11 @@ function AgentRail({
|
|
|
6873
7040
|
},
|
|
6874
7041
|
`${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
|
|
6875
7042
|
),
|
|
6876
|
-
poweredByLabel ? /* @__PURE__ */ (0,
|
|
7043
|
+
poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: poweredByLabel }) }) }) : null
|
|
6877
7044
|
] })
|
|
6878
7045
|
] }),
|
|
6879
|
-
/* @__PURE__ */ (0,
|
|
6880
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */ (0,
|
|
7046
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
7047
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6881
7048
|
AnswerReceiptDialog,
|
|
6882
7049
|
{
|
|
6883
7050
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6893,10 +7060,10 @@ function AgentRail({
|
|
|
6893
7060
|
}
|
|
6894
7061
|
|
|
6895
7062
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
6896
|
-
var
|
|
6897
|
-
var
|
|
7063
|
+
var import_react16 = require("react");
|
|
7064
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6898
7065
|
function ChatSparkIcon() {
|
|
6899
|
-
return /* @__PURE__ */ (0,
|
|
7066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6900
7067
|
"svg",
|
|
6901
7068
|
{
|
|
6902
7069
|
className: "assist-edge-tab__chat-spark",
|
|
@@ -6904,7 +7071,7 @@ function ChatSparkIcon() {
|
|
|
6904
7071
|
fill: "none",
|
|
6905
7072
|
"aria-hidden": "true",
|
|
6906
7073
|
children: [
|
|
6907
|
-
/* @__PURE__ */ (0,
|
|
7074
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6908
7075
|
"path",
|
|
6909
7076
|
{
|
|
6910
7077
|
className: "assist-edge-tab__spark assist-edge-tab__spark--a",
|
|
@@ -6912,7 +7079,7 @@ function ChatSparkIcon() {
|
|
|
6912
7079
|
fill: "currentColor"
|
|
6913
7080
|
}
|
|
6914
7081
|
),
|
|
6915
|
-
/* @__PURE__ */ (0,
|
|
7082
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6916
7083
|
"path",
|
|
6917
7084
|
{
|
|
6918
7085
|
className: "assist-edge-tab__spark assist-edge-tab__spark--b",
|
|
@@ -6920,8 +7087,8 @@ function ChatSparkIcon() {
|
|
|
6920
7087
|
fill: "currentColor"
|
|
6921
7088
|
}
|
|
6922
7089
|
),
|
|
6923
|
-
/* @__PURE__ */ (0,
|
|
6924
|
-
/* @__PURE__ */ (0,
|
|
7090
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("g", { className: "assist-edge-tab__bot", children: [
|
|
7091
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6925
7092
|
"path",
|
|
6926
7093
|
{
|
|
6927
7094
|
d: "M11.15 5.2V3.05",
|
|
@@ -6930,8 +7097,8 @@ function ChatSparkIcon() {
|
|
|
6930
7097
|
strokeLinecap: "round"
|
|
6931
7098
|
}
|
|
6932
7099
|
),
|
|
6933
|
-
/* @__PURE__ */ (0,
|
|
6934
|
-
/* @__PURE__ */ (0,
|
|
7100
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
|
|
7101
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6935
7102
|
"rect",
|
|
6936
7103
|
{
|
|
6937
7104
|
x: "3.55",
|
|
@@ -6943,7 +7110,7 @@ function ChatSparkIcon() {
|
|
|
6943
7110
|
strokeWidth: "1.9"
|
|
6944
7111
|
}
|
|
6945
7112
|
),
|
|
6946
|
-
/* @__PURE__ */ (0,
|
|
7113
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6947
7114
|
"circle",
|
|
6948
7115
|
{
|
|
6949
7116
|
className: "assist-edge-tab__eye",
|
|
@@ -6953,7 +7120,7 @@ function ChatSparkIcon() {
|
|
|
6953
7120
|
fill: "currentColor"
|
|
6954
7121
|
}
|
|
6955
7122
|
),
|
|
6956
|
-
/* @__PURE__ */ (0,
|
|
7123
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6957
7124
|
"circle",
|
|
6958
7125
|
{
|
|
6959
7126
|
className: "assist-edge-tab__eye assist-edge-tab__eye--r",
|
|
@@ -6974,10 +7141,10 @@ function TabMarkIcon({
|
|
|
6974
7141
|
}) {
|
|
6975
7142
|
const custom = customIconUrl?.trim();
|
|
6976
7143
|
const logo = logoUrl?.trim();
|
|
6977
|
-
const [customFailed, setCustomFailed] = (0,
|
|
6978
|
-
const [logoFailed, setLogoFailed] = (0,
|
|
7144
|
+
const [customFailed, setCustomFailed] = (0, import_react16.useState)(false);
|
|
7145
|
+
const [logoFailed, setLogoFailed] = (0, import_react16.useState)(false);
|
|
6979
7146
|
if (custom && !customFailed) {
|
|
6980
|
-
return /* @__PURE__ */ (0,
|
|
7147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6981
7148
|
"img",
|
|
6982
7149
|
{
|
|
6983
7150
|
alt: "",
|
|
@@ -6989,7 +7156,7 @@ function TabMarkIcon({
|
|
|
6989
7156
|
);
|
|
6990
7157
|
}
|
|
6991
7158
|
if (logo && !logoFailed) {
|
|
6992
|
-
return /* @__PURE__ */ (0,
|
|
7159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6993
7160
|
"img",
|
|
6994
7161
|
{
|
|
6995
7162
|
alt: "",
|
|
@@ -7000,10 +7167,10 @@ function TabMarkIcon({
|
|
|
7000
7167
|
}
|
|
7001
7168
|
);
|
|
7002
7169
|
}
|
|
7003
|
-
return /* @__PURE__ */ (0,
|
|
7170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChatSparkIcon, {});
|
|
7004
7171
|
}
|
|
7005
7172
|
function ChevronLeftIcon() {
|
|
7006
|
-
return /* @__PURE__ */ (0,
|
|
7173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7007
7174
|
"path",
|
|
7008
7175
|
{
|
|
7009
7176
|
d: "M10 4L6 8l4 4",
|
|
@@ -7015,7 +7182,7 @@ function ChevronLeftIcon() {
|
|
|
7015
7182
|
) });
|
|
7016
7183
|
}
|
|
7017
7184
|
function ChevronDownIcon2() {
|
|
7018
|
-
return /* @__PURE__ */ (0,
|
|
7185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7019
7186
|
"path",
|
|
7020
7187
|
{
|
|
7021
7188
|
d: "M4 6l4 4 4-4",
|
|
@@ -7027,7 +7194,7 @@ function ChevronDownIcon2() {
|
|
|
7027
7194
|
) });
|
|
7028
7195
|
}
|
|
7029
7196
|
function DragDots() {
|
|
7030
|
-
return /* @__PURE__ */ (0,
|
|
7197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("i", {}, index)) });
|
|
7031
7198
|
}
|
|
7032
7199
|
var VARIANT_COPY = {
|
|
7033
7200
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -7082,7 +7249,7 @@ function AssistEdgeTab({
|
|
|
7082
7249
|
...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
7083
7250
|
colorScheme: chromeScheme
|
|
7084
7251
|
};
|
|
7085
|
-
return /* @__PURE__ */ (0,
|
|
7252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7086
7253
|
"button",
|
|
7087
7254
|
{
|
|
7088
7255
|
type: "button",
|
|
@@ -7094,13 +7261,13 @@ function AssistEdgeTab({
|
|
|
7094
7261
|
tabIndex: visible ? 0 : -1,
|
|
7095
7262
|
onClick: onOpen,
|
|
7096
7263
|
children: [
|
|
7097
|
-
pill ? /* @__PURE__ */ (0,
|
|
7098
|
-
/* @__PURE__ */ (0,
|
|
7264
|
+
pill ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7099
7266
|
"span",
|
|
7100
7267
|
{
|
|
7101
7268
|
className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
|
|
7102
7269
|
"aria-hidden": "true",
|
|
7103
|
-
children: /* @__PURE__ */ (0,
|
|
7270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7104
7271
|
TabMarkIcon,
|
|
7105
7272
|
{
|
|
7106
7273
|
customIconUrl,
|
|
@@ -7110,12 +7277,12 @@ function AssistEdgeTab({
|
|
|
7110
7277
|
)
|
|
7111
7278
|
}
|
|
7112
7279
|
),
|
|
7113
|
-
/* @__PURE__ */ (0,
|
|
7114
|
-
/* @__PURE__ */ (0,
|
|
7115
|
-
visibleSubLabel ? /* @__PURE__ */ (0,
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "assist-edge-tab__text", children: [
|
|
7281
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
7282
|
+
visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
|
|
7116
7283
|
] })
|
|
7117
|
-
] }) : variant === "outline" ? /* @__PURE__ */ (0,
|
|
7118
|
-
/* @__PURE__ */ (0,
|
|
7284
|
+
] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7285
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7119
7286
|
TabMarkIcon,
|
|
7120
7287
|
{
|
|
7121
7288
|
customIconUrl,
|
|
@@ -7123,16 +7290,16 @@ function AssistEdgeTab({
|
|
|
7123
7290
|
},
|
|
7124
7291
|
markSourceKey
|
|
7125
7292
|
) }),
|
|
7126
|
-
/* @__PURE__ */ (0,
|
|
7127
|
-
/* @__PURE__ */ (0,
|
|
7293
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
7294
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon2, {})
|
|
7128
7295
|
] }) : null,
|
|
7129
|
-
!pill && variant === "ask" ? /* @__PURE__ */ (0,
|
|
7130
|
-
/* @__PURE__ */ (0,
|
|
7131
|
-
/* @__PURE__ */ (0,
|
|
7132
|
-
/* @__PURE__ */ (0,
|
|
7296
|
+
!pill && variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronLeftIcon, {}),
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DragDots, {})
|
|
7133
7300
|
] }) : null,
|
|
7134
|
-
!pill && variant === "fill" ? /* @__PURE__ */ (0,
|
|
7135
|
-
/* @__PURE__ */ (0,
|
|
7301
|
+
!pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7302
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7136
7303
|
TabMarkIcon,
|
|
7137
7304
|
{
|
|
7138
7305
|
customIconUrl,
|
|
@@ -7140,8 +7307,8 @@ function AssistEdgeTab({
|
|
|
7140
7307
|
},
|
|
7141
7308
|
markSourceKey
|
|
7142
7309
|
) }),
|
|
7143
|
-
/* @__PURE__ */ (0,
|
|
7144
|
-
/* @__PURE__ */ (0,
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
7311
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronLeftIcon, {})
|
|
7145
7312
|
] }) : null
|
|
7146
7313
|
]
|
|
7147
7314
|
}
|
|
@@ -7205,7 +7372,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
|
|
|
7205
7372
|
}
|
|
7206
7373
|
|
|
7207
7374
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
7208
|
-
var
|
|
7375
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7209
7376
|
function AgentWidget({
|
|
7210
7377
|
indexId,
|
|
7211
7378
|
customerId,
|
|
@@ -7224,9 +7391,9 @@ function AgentWidget({
|
|
|
7224
7391
|
}) {
|
|
7225
7392
|
const isMobile = useIsMobile();
|
|
7226
7393
|
const placement = normalizeAgentPlacement(placementInput);
|
|
7227
|
-
const railSlotRef = (0,
|
|
7228
|
-
const [railCollapsed, setRailCollapsed] = (0,
|
|
7229
|
-
const [railExpanded, setRailExpanded] = (0,
|
|
7394
|
+
const railSlotRef = (0, import_react17.useRef)(null);
|
|
7395
|
+
const [railCollapsed, setRailCollapsed] = (0, import_react17.useState)(defaultCollapsed);
|
|
7396
|
+
const [railExpanded, setRailExpanded] = (0, import_react17.useState)(false);
|
|
7230
7397
|
const pageShiftActive = shouldApplyPageShift({
|
|
7231
7398
|
pageShift,
|
|
7232
7399
|
isMobile,
|
|
@@ -7279,7 +7446,7 @@ function AgentWidget({
|
|
|
7279
7446
|
} : {},
|
|
7280
7447
|
...branding?.colors?.border ? { border: branding.colors.border } : {}
|
|
7281
7448
|
};
|
|
7282
|
-
(0,
|
|
7449
|
+
(0, import_react17.useEffect)(() => {
|
|
7283
7450
|
if (!registerPanelController) return;
|
|
7284
7451
|
registerAgentPanelController(customerId, {
|
|
7285
7452
|
open: () => setRailCollapsed(false),
|
|
@@ -7314,7 +7481,7 @@ function AgentWidget({
|
|
|
7314
7481
|
})
|
|
7315
7482
|
);
|
|
7316
7483
|
}
|
|
7317
|
-
(0,
|
|
7484
|
+
(0, import_react17.useEffect)(() => {
|
|
7318
7485
|
if (railCollapsed) return;
|
|
7319
7486
|
const handleKeyDown = (event) => {
|
|
7320
7487
|
if (event.key === "Tab" && (isMobile || railExpanded)) {
|
|
@@ -7348,19 +7515,19 @@ function AgentWidget({
|
|
|
7348
7515
|
window.addEventListener("keydown", handleKeyDown);
|
|
7349
7516
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
7350
7517
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
7351
|
-
return /* @__PURE__ */ (0,
|
|
7352
|
-
/* @__PURE__ */ (0,
|
|
7518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "webless-agent-root", children: [
|
|
7519
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7353
7520
|
"div",
|
|
7354
7521
|
{
|
|
7355
7522
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
7356
|
-
children: /* @__PURE__ */ (0,
|
|
7523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7357
7524
|
"div",
|
|
7358
7525
|
{
|
|
7359
7526
|
ref: railSlotRef,
|
|
7360
7527
|
className: "webless-agent-root__rail-slot",
|
|
7361
7528
|
inert: railCollapsed || void 0,
|
|
7362
7529
|
"aria-hidden": railCollapsed,
|
|
7363
|
-
children: /* @__PURE__ */ (0,
|
|
7530
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7364
7531
|
AgentRail,
|
|
7365
7532
|
{
|
|
7366
7533
|
theme,
|
|
@@ -7397,7 +7564,7 @@ function AgentWidget({
|
|
|
7397
7564
|
)
|
|
7398
7565
|
}
|
|
7399
7566
|
),
|
|
7400
|
-
railCollapsed ? /* @__PURE__ */ (0,
|
|
7567
|
+
railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7401
7568
|
AssistEdgeTab,
|
|
7402
7569
|
{
|
|
7403
7570
|
variant: placement.variant,
|
|
@@ -7424,10 +7591,10 @@ function AgentWidget({
|
|
|
7424
7591
|
}
|
|
7425
7592
|
|
|
7426
7593
|
// src/react/components/AgentTranscript/AgentTranscript.tsx
|
|
7427
|
-
var
|
|
7594
|
+
var import_react18 = require("react");
|
|
7428
7595
|
|
|
7429
7596
|
// src/react/components/AgentTranscript/TranscriptActivity.tsx
|
|
7430
|
-
var
|
|
7597
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7431
7598
|
var statusLabels = {
|
|
7432
7599
|
started: "No result recorded",
|
|
7433
7600
|
completed: "",
|
|
@@ -7437,33 +7604,33 @@ var statusLabels = {
|
|
|
7437
7604
|
function RecordedResult({
|
|
7438
7605
|
result
|
|
7439
7606
|
}) {
|
|
7440
|
-
if (result.kind === "search") return /* @__PURE__ */ (0,
|
|
7607
|
+
if (result.kind === "search") return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchReferences, { results: [result] });
|
|
7441
7608
|
if (result.kind === "booking") {
|
|
7442
7609
|
const card = result.card;
|
|
7443
7610
|
if (card.type === "booking_offer")
|
|
7444
|
-
return /* @__PURE__ */ (0,
|
|
7611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BookingCard, { readOnly: true, offer: card });
|
|
7445
7612
|
if (card.type === "booking_confirmed")
|
|
7446
|
-
return /* @__PURE__ */ (0,
|
|
7613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { children: [
|
|
7447
7614
|
"Booking confirmed",
|
|
7448
7615
|
card.startTime ? ` \xB7 ${card.startTime}` : ""
|
|
7449
7616
|
] });
|
|
7450
|
-
if (card.type === "booking_canceled") return /* @__PURE__ */ (0,
|
|
7451
|
-
return /* @__PURE__ */ (0,
|
|
7617
|
+
if (card.type === "booking_canceled") return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: "Booking canceled" });
|
|
7618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: "Information requested" });
|
|
7452
7619
|
}
|
|
7453
|
-
return /* @__PURE__ */ (0,
|
|
7620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VisitorToolResultView, { disabled: true, result });
|
|
7454
7621
|
}
|
|
7455
7622
|
function TranscriptActivity({
|
|
7456
7623
|
activity
|
|
7457
7624
|
}) {
|
|
7458
7625
|
const result = activity.result?.kind === "hidden" ? void 0 : activity.result;
|
|
7459
|
-
const heading = /* @__PURE__ */ (0,
|
|
7460
|
-
/* @__PURE__ */ (0,
|
|
7461
|
-
activity.status !== "completed" ? /* @__PURE__ */ (0,
|
|
7626
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
7627
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: activity.category === "specialist" ? `Specialist \xB7 ${activity.label}` : activity.label }),
|
|
7628
|
+
activity.status !== "completed" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "agent-transcript__activity-status", children: statusLabels[activity.status] }) : null
|
|
7462
7629
|
] });
|
|
7463
|
-
return /* @__PURE__ */ (0,
|
|
7464
|
-
/* @__PURE__ */ (0,
|
|
7465
|
-
/* @__PURE__ */ (0,
|
|
7466
|
-
] }) : /* @__PURE__ */ (0,
|
|
7630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("li", { className: "agent-transcript__activity", "data-status": activity.status, children: result ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("details", { children: [
|
|
7631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("summary", { className: "agent-transcript__activity-heading", children: heading }),
|
|
7632
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "agent-transcript__activity-result", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RecordedResult, { result }) })
|
|
7633
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "agent-transcript__activity-heading", children: heading }) });
|
|
7467
7634
|
}
|
|
7468
7635
|
|
|
7469
7636
|
// src/react/components/AgentTranscript/group-activities.ts
|
|
@@ -7501,7 +7668,7 @@ function groupTranscriptActivities(activities) {
|
|
|
7501
7668
|
}
|
|
7502
7669
|
|
|
7503
7670
|
// src/react/components/AgentTranscript/AgentTranscript.tsx
|
|
7504
|
-
var
|
|
7671
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7505
7672
|
var timestampFormat = new Intl.DateTimeFormat("en-US", {
|
|
7506
7673
|
month: "short",
|
|
7507
7674
|
day: "numeric",
|
|
@@ -7532,7 +7699,7 @@ function AgentTranscript({
|
|
|
7532
7699
|
...activity
|
|
7533
7700
|
}))
|
|
7534
7701
|
].sort((left, right) => left.createdAt - right.createdAt);
|
|
7535
|
-
return /* @__PURE__ */ (0,
|
|
7702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7536
7703
|
"ol",
|
|
7537
7704
|
{
|
|
7538
7705
|
className: "webless-agent-root agent-transcript not-typeset",
|
|
@@ -7545,15 +7712,15 @@ function AgentTranscript({
|
|
|
7545
7712
|
const previous = entries[index - 1];
|
|
7546
7713
|
const validTimestamp = Number.isFinite(date.getTime());
|
|
7547
7714
|
const showTimestamp = validTimestamp && (previous ? entry.createdAt - previous.createdAt >= 5 * 60 * 1e3 || date.toISOString().slice(0, 10) !== new Date(previous.createdAt).toJSON()?.slice(0, 10) : showInitialTimestamp);
|
|
7548
|
-
return /* @__PURE__ */ (0,
|
|
7549
|
-
showTimestamp ? /* @__PURE__ */ (0,
|
|
7550
|
-
entry.kind === "activity" ? /* @__PURE__ */ (0,
|
|
7715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react18.Fragment, { children: [
|
|
7716
|
+
showTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "agent-transcript__time-marker", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("time", { dateTime: date.toISOString(), children: formatTimestamp(entry.createdAt) }) }) : null,
|
|
7717
|
+
entry.kind === "activity" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranscriptActivity, { activity: entry }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7551
7718
|
"li",
|
|
7552
7719
|
{
|
|
7553
7720
|
className: `agent-transcript__message agent-transcript__message--${entry.role}`,
|
|
7554
7721
|
children: [
|
|
7555
|
-
/* @__PURE__ */ (0,
|
|
7556
|
-
/* @__PURE__ */ (0,
|
|
7722
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "agent-transcript__meta", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: entry.role === "visitor" ? visitorLabel : agentLabel }) }),
|
|
7723
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7557
7724
|
MessageBubble,
|
|
7558
7725
|
{
|
|
7559
7726
|
message: entry.role === "agent" ? { ...entry, streaming: false } : entry,
|