@webless/agent 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-GS65OJFL.js → chunk-CD6TKXGT.js} +640 -429
- package/dist/chunk-CD6TKXGT.js.map +1 -0
- package/dist/embed.cjs +688 -477
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +107 -0
- package/dist/embed.css.map +1 -1
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.js +1 -1
- package/dist/{manifest-sR_C4rh_.d.cts → manifest-DgjT8-tW.d.cts} +23 -3
- package/dist/{manifest-sR_C4rh_.d.ts → manifest-DgjT8-tW.d.ts} +23 -3
- package/dist/react.cjs +684 -473
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +107 -0
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GS65OJFL.js.map +0 -1
|
@@ -229,6 +229,72 @@ function hasOnlyKeys(value, allowed) {
|
|
|
229
229
|
return Object.keys(value).every((key) => allowedKeys.has(key));
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
// src/runtime/search-discovery.ts
|
|
233
|
+
function record(value) {
|
|
234
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
235
|
+
}
|
|
236
|
+
function text(value, max = 500) {
|
|
237
|
+
return typeof value === "string" && value.trim().length > 0 && value.trim().length <= max;
|
|
238
|
+
}
|
|
239
|
+
function safeSearchUrl(value) {
|
|
240
|
+
if (typeof value !== "string") return void 0;
|
|
241
|
+
try {
|
|
242
|
+
const url = new URL(value);
|
|
243
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.href : void 0;
|
|
244
|
+
} catch {
|
|
245
|
+
return void 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function parseAgentSearchReferences(value) {
|
|
249
|
+
const data = record(value);
|
|
250
|
+
if (!data || !Array.isArray(data.sources) || data.sources.length > 20)
|
|
251
|
+
return null;
|
|
252
|
+
const sources = [];
|
|
253
|
+
for (const value2 of data.sources) {
|
|
254
|
+
const source = record(value2);
|
|
255
|
+
if (!source || Object.keys(source).some(
|
|
256
|
+
(key) => !["id", "title", "url"].includes(key)
|
|
257
|
+
) || !text(source.id, Infinity) || !text(source.title) || source.url !== void 0 && typeof source.url !== "string")
|
|
258
|
+
return null;
|
|
259
|
+
const url = safeSearchUrl(source.url);
|
|
260
|
+
sources.push({
|
|
261
|
+
id: source.id.trim(),
|
|
262
|
+
title: source.title.trim(),
|
|
263
|
+
...url ? { url } : {}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
let cta;
|
|
267
|
+
if (data.cta !== void 0) {
|
|
268
|
+
const action = record(data.cta);
|
|
269
|
+
if (!action || Object.keys(action).some((key) => !["label", "url"].includes(key)) || !text(action.label) || action.url !== void 0 && typeof action.url !== "string")
|
|
270
|
+
return null;
|
|
271
|
+
const url = safeSearchUrl(action.url);
|
|
272
|
+
cta = { label: action.label.trim(), ...url ? { url } : {} };
|
|
273
|
+
}
|
|
274
|
+
return { sources, ...cta ? { cta } : {} };
|
|
275
|
+
}
|
|
276
|
+
function parseAgentSearchDiscoveryOutput(value) {
|
|
277
|
+
let decoded = value;
|
|
278
|
+
if (typeof value === "string") {
|
|
279
|
+
try {
|
|
280
|
+
decoded = JSON.parse(value);
|
|
281
|
+
} catch {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const data = record(decoded);
|
|
286
|
+
if (!data || Object.keys(data).some(
|
|
287
|
+
(key) => !["answer", "sources", "cta", "suggestions"].includes(key)
|
|
288
|
+
) || !text(data.answer, 5e4) || !Array.isArray(data.suggestions) || data.suggestions.length > 8 || !data.suggestions.every((item) => text(item)))
|
|
289
|
+
return null;
|
|
290
|
+
const references = parseAgentSearchReferences(data);
|
|
291
|
+
return references ? {
|
|
292
|
+
...references,
|
|
293
|
+
answer: data.answer.trim(),
|
|
294
|
+
suggestions: data.suggestions.map((item) => item.trim())
|
|
295
|
+
} : null;
|
|
296
|
+
}
|
|
297
|
+
|
|
232
298
|
// src/runtime/tool-result-envelope.ts
|
|
233
299
|
var ENVELOPE_KEYS = /* @__PURE__ */ new Set([
|
|
234
300
|
"schemaVersion",
|
|
@@ -352,19 +418,19 @@ function parseVisitorFormFields(value) {
|
|
|
352
418
|
const fields = [];
|
|
353
419
|
const seen = /* @__PURE__ */ new Set();
|
|
354
420
|
for (const item of value) {
|
|
355
|
-
const
|
|
356
|
-
const id = asString(
|
|
357
|
-
const kind = asString(
|
|
358
|
-
if (!
|
|
421
|
+
const record2 = asRecord(item);
|
|
422
|
+
const id = asString(record2?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
423
|
+
const kind = asString(record2?.kind);
|
|
424
|
+
if (!record2 || !id || seen.has(id) || !isFieldKind2(kind)) continue;
|
|
359
425
|
seen.add(id);
|
|
360
|
-
const label = asString(
|
|
426
|
+
const label = asString(record2.label) || id;
|
|
361
427
|
fields.push({
|
|
362
428
|
id,
|
|
363
429
|
kind,
|
|
364
430
|
label,
|
|
365
|
-
placeholder: asString(
|
|
366
|
-
required:
|
|
367
|
-
...asString(
|
|
431
|
+
placeholder: asString(record2.placeholder) || label,
|
|
432
|
+
required: record2.required !== false,
|
|
433
|
+
...asString(record2.autocomplete) ? { autocomplete: asString(record2.autocomplete) } : {}
|
|
368
434
|
});
|
|
369
435
|
if (fields.length >= MAX_FORM_FIELDS) break;
|
|
370
436
|
}
|
|
@@ -395,52 +461,52 @@ function formatComposerFormMessage(form, values) {
|
|
|
395
461
|
return value ? `${field.label}: ${value}` : "";
|
|
396
462
|
}).filter(Boolean).join("\n");
|
|
397
463
|
}
|
|
398
|
-
function looksLikeFieldCollection(
|
|
464
|
+
function looksLikeFieldCollection(text2) {
|
|
399
465
|
return /\b(please|need|send|share|enter|provide|add|collect|what|which|use)\b/i.test(
|
|
400
|
-
|
|
401
|
-
) || /:\s*$/m.test(
|
|
466
|
+
text2
|
|
467
|
+
) || /:\s*$/m.test(text2) || /^[-*•]\s+/m.test(text2);
|
|
402
468
|
}
|
|
403
|
-
function looksLikeBookingCopy(
|
|
469
|
+
function looksLikeBookingCopy(text2) {
|
|
404
470
|
return /book(ing)? (card|a demo|this time)|pick a (date|time)|available (times|slots)|calendly/i.test(
|
|
405
|
-
|
|
471
|
+
text2
|
|
406
472
|
);
|
|
407
473
|
}
|
|
408
|
-
function echoedLabeledFieldIds(
|
|
474
|
+
function echoedLabeledFieldIds(text2) {
|
|
409
475
|
const ids = /* @__PURE__ */ new Set();
|
|
410
|
-
if (/\bname\s*:\s+\S+/i.test(
|
|
411
|
-
if (/\be-?mail\s*:\s+\S+/i.test(
|
|
412
|
-
if (/\bphone\s*:\s+\S+/i.test(
|
|
413
|
-
if (/\bcompany\s*:\s+\S+/i.test(
|
|
476
|
+
if (/\bname\s*:\s+\S+/i.test(text2)) ids.add("name");
|
|
477
|
+
if (/\be-?mail\s*:\s+\S+/i.test(text2)) ids.add("email");
|
|
478
|
+
if (/\bphone\s*:\s+\S+/i.test(text2)) ids.add("phone");
|
|
479
|
+
if (/\bcompany\s*:\s+\S+/i.test(text2)) ids.add("company");
|
|
414
480
|
return ids;
|
|
415
481
|
}
|
|
416
|
-
function matchLibraryFields(
|
|
482
|
+
function matchLibraryFields(text2) {
|
|
417
483
|
return FIELD_LIBRARY.flatMap((field) => {
|
|
418
|
-
if (field.exclude?.test(
|
|
419
|
-
const leftover =
|
|
484
|
+
if (field.exclude?.test(text2)) {
|
|
485
|
+
const leftover = text2.replace(field.exclude, " ");
|
|
420
486
|
if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
|
|
421
|
-
} else if (!field.patterns.some((pattern) => pattern.test(
|
|
487
|
+
} else if (!field.patterns.some((pattern) => pattern.test(text2))) {
|
|
422
488
|
return [];
|
|
423
489
|
}
|
|
424
490
|
const { patterns: _patterns, exclude: _exclude, ...next } = field;
|
|
425
491
|
return [next];
|
|
426
492
|
}).slice(0, MAX_FORM_FIELDS);
|
|
427
493
|
}
|
|
428
|
-
function looksLikeCompletedActionRecap(
|
|
429
|
-
const confirmingCreate = /\bshould i create this\b/i.test(
|
|
430
|
-
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(
|
|
494
|
+
function looksLikeCompletedActionRecap(text2) {
|
|
495
|
+
const confirmingCreate = /\bshould i create this\b/i.test(text2);
|
|
496
|
+
const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text2) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text2);
|
|
431
497
|
if (echoingFilledFields) {
|
|
432
|
-
if (looksLikeFieldCollection(
|
|
433
|
-
const echoed = echoedLabeledFieldIds(
|
|
434
|
-
if (matchLibraryFields(
|
|
498
|
+
if (looksLikeFieldCollection(text2)) {
|
|
499
|
+
const echoed = echoedLabeledFieldIds(text2);
|
|
500
|
+
if (matchLibraryFields(text2).some((field) => !echoed.has(field.id))) {
|
|
435
501
|
return false;
|
|
436
502
|
}
|
|
437
503
|
}
|
|
438
504
|
return true;
|
|
439
505
|
}
|
|
440
|
-
return confirmingCreate && !looksLikeFieldCollection(
|
|
506
|
+
return confirmingCreate && !looksLikeFieldCollection(text2);
|
|
441
507
|
}
|
|
442
|
-
function inferComposerForm(
|
|
443
|
-
const cleaned =
|
|
508
|
+
function inferComposerForm(text2) {
|
|
509
|
+
const cleaned = text2.trim();
|
|
444
510
|
if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
|
|
445
511
|
return null;
|
|
446
512
|
}
|
|
@@ -455,8 +521,8 @@ function resolveComposerForm(input) {
|
|
|
455
521
|
if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
|
|
456
522
|
return null;
|
|
457
523
|
}
|
|
458
|
-
const
|
|
459
|
-
if (!
|
|
524
|
+
const text2 = input.agentText.trim();
|
|
525
|
+
if (!text2) return null;
|
|
460
526
|
const card = input.cards?.find((item) => item.type === "visitor_form");
|
|
461
527
|
if (card?.fields && card.fields.length >= MIN_FORM_FIELDS) {
|
|
462
528
|
return {
|
|
@@ -464,7 +530,7 @@ function resolveComposerForm(input) {
|
|
|
464
530
|
fields: card.fields.slice(0, MAX_FORM_FIELDS)
|
|
465
531
|
};
|
|
466
532
|
}
|
|
467
|
-
return inferComposerForm(
|
|
533
|
+
return inferComposerForm(text2);
|
|
468
534
|
}
|
|
469
535
|
|
|
470
536
|
// src/react/lib/tool-card.ts
|
|
@@ -478,9 +544,9 @@ function preferBookingOffer(current, next) {
|
|
|
478
544
|
}
|
|
479
545
|
return next;
|
|
480
546
|
}
|
|
481
|
-
function looksLikeBookingReady(
|
|
547
|
+
function looksLikeBookingReady(text2) {
|
|
482
548
|
return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
|
|
483
|
-
|
|
549
|
+
text2
|
|
484
550
|
);
|
|
485
551
|
}
|
|
486
552
|
function bookingOfferIdentityKey(offer) {
|
|
@@ -504,19 +570,19 @@ function isEventTypeUri(value) {
|
|
|
504
570
|
return /^https:\/\/api\.calendly\.com\/event_types\/[^/]+$/i.test(value);
|
|
505
571
|
}
|
|
506
572
|
function parseToolCard(value) {
|
|
507
|
-
const
|
|
508
|
-
if (!
|
|
509
|
-
if (
|
|
510
|
-
const nested = parseToolCard(
|
|
573
|
+
const record2 = asRecord2(value);
|
|
574
|
+
if (!record2) return null;
|
|
575
|
+
if (record2.booking_offer && asString2(record2.type) !== "booking_offer") {
|
|
576
|
+
const nested = parseToolCard(record2.booking_offer);
|
|
511
577
|
if (nested) return nested;
|
|
512
578
|
}
|
|
513
|
-
if (
|
|
514
|
-
const nested = parseToolCard(
|
|
579
|
+
if (record2.visitor_booking && asString2(record2.type) !== "booking_confirmed") {
|
|
580
|
+
const nested = parseToolCard(record2.visitor_booking);
|
|
515
581
|
if (nested) return nested;
|
|
516
582
|
}
|
|
517
|
-
const type = asString2(
|
|
583
|
+
const type = asString2(record2.type);
|
|
518
584
|
if (type === "booking_offer") {
|
|
519
|
-
const eventTypes = Array.isArray(
|
|
585
|
+
const eventTypes = Array.isArray(record2.eventTypes) ? record2.eventTypes.flatMap((item) => {
|
|
520
586
|
const entry = asRecord2(item);
|
|
521
587
|
const uri = asString2(entry?.uri);
|
|
522
588
|
if (!entry || !uri) return [];
|
|
@@ -533,7 +599,7 @@ function parseToolCard(value) {
|
|
|
533
599
|
}
|
|
534
600
|
];
|
|
535
601
|
}) : [];
|
|
536
|
-
const slots = Array.isArray(
|
|
602
|
+
const slots = Array.isArray(record2.slots) ? record2.slots.flatMap((item) => {
|
|
537
603
|
const entry = asRecord2(item);
|
|
538
604
|
const startTime = asString2(entry?.startTime);
|
|
539
605
|
if (!entry || !startTime) return [];
|
|
@@ -549,11 +615,11 @@ function parseToolCard(value) {
|
|
|
549
615
|
return { type: "booking_offer", eventTypes, slots };
|
|
550
616
|
}
|
|
551
617
|
if (type === "booking_confirmed") {
|
|
552
|
-
const eventUri = asString2(
|
|
618
|
+
const eventUri = asString2(record2.eventUri);
|
|
553
619
|
if (!isEventUri(eventUri)) return null;
|
|
554
|
-
const inviteeUri = asString2(
|
|
555
|
-
const inviteeEmail = asString2(
|
|
556
|
-
const startTime = asString2(
|
|
620
|
+
const inviteeUri = asString2(record2.inviteeUri);
|
|
621
|
+
const inviteeEmail = asString2(record2.inviteeEmail);
|
|
622
|
+
const startTime = asString2(record2.startTime);
|
|
557
623
|
return {
|
|
558
624
|
type: "booking_confirmed",
|
|
559
625
|
eventUri,
|
|
@@ -563,12 +629,12 @@ function parseToolCard(value) {
|
|
|
563
629
|
};
|
|
564
630
|
}
|
|
565
631
|
if (type === "booking_canceled") {
|
|
566
|
-
const eventUri = asString2(
|
|
632
|
+
const eventUri = asString2(record2.eventUri);
|
|
567
633
|
if (!isEventUri(eventUri)) return null;
|
|
568
634
|
return { type: "booking_canceled", eventUri };
|
|
569
635
|
}
|
|
570
636
|
if (type === "visitor_form") {
|
|
571
|
-
const fields = parseVisitorFormFields(
|
|
637
|
+
const fields = parseVisitorFormFields(record2.fields);
|
|
572
638
|
if (fields.length < 2) return null;
|
|
573
639
|
return { type: "visitor_form", fields };
|
|
574
640
|
}
|
|
@@ -586,33 +652,33 @@ function formatBookingOfferFence(offer) {
|
|
|
586
652
|
].join("\n");
|
|
587
653
|
}
|
|
588
654
|
function bookingCardFromActionOutput(output) {
|
|
589
|
-
const
|
|
590
|
-
const data = asRecord2(
|
|
655
|
+
const record2 = asRecord2(output);
|
|
656
|
+
const data = asRecord2(record2?.output) ?? asRecord2(record2?.data) ?? record2;
|
|
591
657
|
return parseToolCard(data);
|
|
592
658
|
}
|
|
593
|
-
function ensureBookingOfferText(
|
|
594
|
-
if (!offer) return
|
|
595
|
-
if (extractToolCards(
|
|
596
|
-
return
|
|
659
|
+
function ensureBookingOfferText(text2, offer) {
|
|
660
|
+
if (!offer) return text2;
|
|
661
|
+
if (extractToolCards(text2).some((card) => card.type === "booking_offer")) {
|
|
662
|
+
return text2;
|
|
597
663
|
}
|
|
598
|
-
const visible = stripToolCards(
|
|
664
|
+
const visible = stripToolCards(text2).trim() || text2.trim();
|
|
599
665
|
return `${visible}
|
|
600
666
|
|
|
601
667
|
${formatBookingOfferFence(offer)}`;
|
|
602
668
|
}
|
|
603
|
-
function hideToolCardFences(
|
|
604
|
-
return
|
|
669
|
+
function hideToolCardFences(text2) {
|
|
670
|
+
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();
|
|
605
671
|
}
|
|
606
672
|
var BOOKING_CARD_FALLBACK = "Pick a date and time that works for you.";
|
|
607
|
-
function looksLikeBookingAvailabilityDump(
|
|
608
|
-
const cleaned =
|
|
673
|
+
function looksLikeBookingAvailabilityDump(text2) {
|
|
674
|
+
const cleaned = text2.trim();
|
|
609
675
|
if (!cleaned) return false;
|
|
610
676
|
const isoCount = (cleaned.match(/\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/g) ?? []).length;
|
|
611
677
|
const utcCount = (cleaned.match(/\bUTC\b/g) ?? []).length;
|
|
612
678
|
return isoCount >= 2 || utcCount >= 2 || /api\.calendly\.com|calendly\.com\//i.test(cleaned) || /webless-tool-card/i.test(cleaned);
|
|
613
679
|
}
|
|
614
|
-
function sanitizeBookingOfferCopy(
|
|
615
|
-
const cleaned = hideToolCardFences(
|
|
680
|
+
function sanitizeBookingOfferCopy(text2) {
|
|
681
|
+
const cleaned = hideToolCardFences(text2);
|
|
616
682
|
if (!cleaned || looksLikeBookingAvailabilityDump(cleaned)) {
|
|
617
683
|
return BOOKING_CARD_FALLBACK;
|
|
618
684
|
}
|
|
@@ -625,9 +691,9 @@ function visitorTimeZone() {
|
|
|
625
691
|
return "UTC";
|
|
626
692
|
}
|
|
627
693
|
}
|
|
628
|
-
function extractToolCards(
|
|
694
|
+
function extractToolCards(text2) {
|
|
629
695
|
const cards = [];
|
|
630
|
-
for (const match of
|
|
696
|
+
for (const match of text2.matchAll(FENCE_PATTERN)) {
|
|
631
697
|
try {
|
|
632
698
|
const card = parseToolCard(JSON.parse(match[1] ?? ""));
|
|
633
699
|
if (card) cards.push(card);
|
|
@@ -636,8 +702,8 @@ function extractToolCards(text) {
|
|
|
636
702
|
}
|
|
637
703
|
return cards;
|
|
638
704
|
}
|
|
639
|
-
function stripToolCards(
|
|
640
|
-
return
|
|
705
|
+
function stripToolCards(text2) {
|
|
706
|
+
return text2.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
641
707
|
}
|
|
642
708
|
function localDateKey(date) {
|
|
643
709
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -757,10 +823,10 @@ function safeText(value) {
|
|
|
757
823
|
return value.trim().slice(0, MAX_TEXT_LENGTH);
|
|
758
824
|
}
|
|
759
825
|
function safeHref(value) {
|
|
760
|
-
const
|
|
761
|
-
if (!
|
|
826
|
+
const text2 = safeText(value);
|
|
827
|
+
if (!text2) return "";
|
|
762
828
|
try {
|
|
763
|
-
const url = new URL(
|
|
829
|
+
const url = new URL(text2);
|
|
764
830
|
return url.protocol === "https:" ? url.toString() : "";
|
|
765
831
|
} catch {
|
|
766
832
|
return "";
|
|
@@ -980,6 +1046,22 @@ function finalizeSummaryPresentation(result, proposed) {
|
|
|
980
1046
|
};
|
|
981
1047
|
}
|
|
982
1048
|
function presentVisitorToolResult(result, registry = []) {
|
|
1049
|
+
if (result.toolName === "search_discovery" && result.status === "completed") {
|
|
1050
|
+
const envelope2 = parseAgentToolResultEnvelope(result.output);
|
|
1051
|
+
const search = parseAgentSearchDiscoveryOutput(
|
|
1052
|
+
envelope2?.output ?? result.output
|
|
1053
|
+
);
|
|
1054
|
+
if (search) {
|
|
1055
|
+
return {
|
|
1056
|
+
id: result.callId,
|
|
1057
|
+
toolName: "search_discovery",
|
|
1058
|
+
status: "completed",
|
|
1059
|
+
kind: "search",
|
|
1060
|
+
sources: search.sources,
|
|
1061
|
+
...search.cta ? { cta: search.cta } : {}
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
983
1065
|
const envelope = parseAgentToolResultEnvelope(result.output) ?? providerErrorEnvelope(result.output) ?? legacyBookingEnvelope(result.output);
|
|
984
1066
|
const proposed = envelope ? resolvePresenterOutput(result, envelope, registry) : null;
|
|
985
1067
|
if (proposed?.kind === "booking") {
|
|
@@ -1044,8 +1126,8 @@ function presentVisitorToolResult(result, registry = []) {
|
|
|
1044
1126
|
return finalizeSummaryPresentation(result, proposed);
|
|
1045
1127
|
}
|
|
1046
1128
|
function providerErrorEnvelope(output) {
|
|
1047
|
-
const
|
|
1048
|
-
const providerError = asRecord3(
|
|
1129
|
+
const record2 = asRecord3(output);
|
|
1130
|
+
const providerError = asRecord3(record2?.providerError);
|
|
1049
1131
|
const message = safeText(providerError?.message);
|
|
1050
1132
|
const action = safeText(providerError?.action);
|
|
1051
1133
|
if (!message || !action) return null;
|
|
@@ -2073,10 +2155,10 @@ var AgentSession = class {
|
|
|
2073
2155
|
}
|
|
2074
2156
|
this.session = session;
|
|
2075
2157
|
const inputResponses = responses.map(
|
|
2076
|
-
({ requestId, optionId, text }) => ({
|
|
2158
|
+
({ requestId, optionId, text: text2 }) => ({
|
|
2077
2159
|
requestId,
|
|
2078
2160
|
...optionId ? { optionId } : {},
|
|
2079
|
-
...
|
|
2161
|
+
...text2 ? { text: text2 } : {}
|
|
2080
2162
|
})
|
|
2081
2163
|
);
|
|
2082
2164
|
const response = await withCapabilityRefresh(
|
|
@@ -2245,82 +2327,87 @@ function conversationKey(storageKeyPrefix, visitorSessionId) {
|
|
|
2245
2327
|
}
|
|
2246
2328
|
function parseMessage(value) {
|
|
2247
2329
|
if (typeof value !== "object" || value === null) return null;
|
|
2248
|
-
const
|
|
2249
|
-
if (typeof
|
|
2330
|
+
const record2 = value;
|
|
2331
|
+
if (typeof record2.id !== "string" || record2.role !== "agent" && record2.role !== "visitor" || typeof record2.text !== "string" || typeof record2.createdAt !== "number" || !Number.isFinite(record2.createdAt)) {
|
|
2250
2332
|
return null;
|
|
2251
2333
|
}
|
|
2252
|
-
if (
|
|
2334
|
+
if (record2.role === "visitor") {
|
|
2253
2335
|
return {
|
|
2254
|
-
id:
|
|
2336
|
+
id: record2.id,
|
|
2255
2337
|
role: "visitor",
|
|
2256
|
-
text:
|
|
2257
|
-
createdAt:
|
|
2258
|
-
...typeof
|
|
2338
|
+
text: record2.text,
|
|
2339
|
+
createdAt: record2.createdAt,
|
|
2340
|
+
...typeof record2.runtimeText === "string" && record2.runtimeText ? { runtimeText: record2.runtimeText } : {}
|
|
2259
2341
|
};
|
|
2260
2342
|
}
|
|
2343
|
+
const searchResults = Array.isArray(record2.searchResults) ? record2.searchResults.flatMap((value2) => {
|
|
2344
|
+
const result = parseToolResult(value2);
|
|
2345
|
+
return result?.kind === "search" ? [result] : [];
|
|
2346
|
+
}) : [];
|
|
2261
2347
|
return {
|
|
2262
|
-
id:
|
|
2348
|
+
id: record2.id,
|
|
2263
2349
|
role: "agent",
|
|
2264
|
-
|
|
2265
|
-
|
|
2350
|
+
...searchResults.length ? { searchResults } : {},
|
|
2351
|
+
text: record2.text,
|
|
2352
|
+
createdAt: record2.createdAt
|
|
2266
2353
|
};
|
|
2267
2354
|
}
|
|
2268
2355
|
function parseToolStep(value) {
|
|
2269
2356
|
if (typeof value !== "object" || value === null) return null;
|
|
2270
|
-
const
|
|
2271
|
-
if (typeof
|
|
2357
|
+
const record2 = value;
|
|
2358
|
+
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") {
|
|
2272
2359
|
return null;
|
|
2273
2360
|
}
|
|
2274
2361
|
return {
|
|
2275
|
-
id:
|
|
2276
|
-
kind:
|
|
2277
|
-
label:
|
|
2278
|
-
state:
|
|
2279
|
-
...typeof
|
|
2362
|
+
id: record2.id,
|
|
2363
|
+
kind: record2.kind,
|
|
2364
|
+
label: record2.label,
|
|
2365
|
+
state: record2.state,
|
|
2366
|
+
...typeof record2.detail === "string" && record2.detail ? { detail: record2.detail } : {}
|
|
2280
2367
|
};
|
|
2281
2368
|
}
|
|
2282
2369
|
function parseInputOption(value) {
|
|
2283
2370
|
if (typeof value !== "object" || value === null) return null;
|
|
2284
|
-
const
|
|
2285
|
-
if (typeof
|
|
2371
|
+
const record2 = value;
|
|
2372
|
+
if (typeof record2.id !== "string" || typeof record2.label !== "string") {
|
|
2286
2373
|
return null;
|
|
2287
2374
|
}
|
|
2288
2375
|
return {
|
|
2289
|
-
id:
|
|
2290
|
-
label:
|
|
2291
|
-
...typeof
|
|
2292
|
-
...
|
|
2376
|
+
id: record2.id,
|
|
2377
|
+
label: record2.label,
|
|
2378
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2379
|
+
...record2.style === "default" || record2.style === "primary" || record2.style === "danger" ? { style: record2.style } : {}
|
|
2293
2380
|
};
|
|
2294
2381
|
}
|
|
2295
2382
|
function parseInputRequest(value) {
|
|
2296
2383
|
if (typeof value !== "object" || value === null) return null;
|
|
2297
|
-
const
|
|
2298
|
-
if (typeof
|
|
2384
|
+
const record2 = value;
|
|
2385
|
+
if (typeof record2.requestId !== "string" || record2.kind !== "question" && record2.kind !== "session-limit" && record2.kind !== "tool-approval" || typeof record2.prompt !== "string") {
|
|
2299
2386
|
return null;
|
|
2300
2387
|
}
|
|
2301
|
-
const action =
|
|
2388
|
+
const action = record2.action;
|
|
2302
2389
|
if (typeof action !== "object" || action === null) return null;
|
|
2303
2390
|
const actionRecord = action;
|
|
2304
2391
|
if (typeof actionRecord.callId !== "string" || actionRecord.kind !== "tool-call" || typeof actionRecord.toolName !== "string") {
|
|
2305
2392
|
return null;
|
|
2306
2393
|
}
|
|
2307
|
-
const options = Array.isArray(
|
|
2308
|
-
if (Array.isArray(
|
|
2394
|
+
const options = Array.isArray(record2.options) ? record2.options.map(parseInputOption) : void 0;
|
|
2395
|
+
if (Array.isArray(record2.options) && options?.some((option) => option === null)) {
|
|
2309
2396
|
return null;
|
|
2310
2397
|
}
|
|
2311
|
-
const ui =
|
|
2312
|
-
if (
|
|
2398
|
+
const ui = record2.ui ? parseAgentToolUiSurface(record2.ui) : void 0;
|
|
2399
|
+
if (record2.ui && !ui) return null;
|
|
2313
2400
|
return {
|
|
2314
|
-
requestId:
|
|
2315
|
-
kind:
|
|
2316
|
-
prompt:
|
|
2401
|
+
requestId: record2.requestId,
|
|
2402
|
+
kind: record2.kind,
|
|
2403
|
+
prompt: record2.prompt,
|
|
2317
2404
|
action: {
|
|
2318
2405
|
callId: actionRecord.callId,
|
|
2319
2406
|
kind: "tool-call",
|
|
2320
2407
|
toolName: actionRecord.toolName
|
|
2321
2408
|
},
|
|
2322
|
-
...
|
|
2323
|
-
...
|
|
2409
|
+
...record2.display === "confirmation" || record2.display === "select" || record2.display === "text" ? { display: record2.display } : {},
|
|
2410
|
+
...record2.allowFreeform === true ? { allowFreeform: true } : {},
|
|
2324
2411
|
...options && options.length > 0 ? {
|
|
2325
2412
|
options: options.filter(
|
|
2326
2413
|
(option) => option !== null
|
|
@@ -2331,40 +2418,50 @@ function parseInputRequest(value) {
|
|
|
2331
2418
|
}
|
|
2332
2419
|
function parseToolResult(value) {
|
|
2333
2420
|
if (typeof value !== "object" || value === null) return null;
|
|
2334
|
-
const
|
|
2335
|
-
if (typeof
|
|
2421
|
+
const record2 = value;
|
|
2422
|
+
if (typeof record2.id !== "string" || typeof record2.toolName !== "string" || record2.status !== "completed" && record2.status !== "failed" && record2.status !== "rejected") {
|
|
2336
2423
|
return null;
|
|
2337
2424
|
}
|
|
2338
|
-
if (
|
|
2425
|
+
if (record2.kind === "search" && record2.toolName === "search_discovery" && record2.status === "completed") {
|
|
2426
|
+
const references = parseAgentSearchReferences(record2);
|
|
2427
|
+
return references ? {
|
|
2428
|
+
id: record2.id,
|
|
2429
|
+
toolName: "search_discovery",
|
|
2430
|
+
status: "completed",
|
|
2431
|
+
kind: "search",
|
|
2432
|
+
...references
|
|
2433
|
+
} : null;
|
|
2434
|
+
}
|
|
2435
|
+
if (record2.kind === "input") {
|
|
2339
2436
|
const surface = parseAgentToolUiSurface(
|
|
2340
|
-
|
|
2437
|
+
record2.surface
|
|
2341
2438
|
);
|
|
2342
2439
|
return surface ? {
|
|
2343
|
-
id:
|
|
2344
|
-
toolName:
|
|
2345
|
-
status:
|
|
2440
|
+
id: record2.id,
|
|
2441
|
+
toolName: record2.toolName,
|
|
2442
|
+
status: record2.status,
|
|
2346
2443
|
kind: "input",
|
|
2347
2444
|
surface
|
|
2348
2445
|
} : null;
|
|
2349
2446
|
}
|
|
2350
|
-
if (
|
|
2447
|
+
if (record2.kind === "entity" && typeof record2.title === "string") {
|
|
2351
2448
|
return {
|
|
2352
|
-
id:
|
|
2353
|
-
toolName:
|
|
2354
|
-
status:
|
|
2449
|
+
id: record2.id,
|
|
2450
|
+
toolName: record2.toolName,
|
|
2451
|
+
status: record2.status,
|
|
2355
2452
|
kind: "entity",
|
|
2356
|
-
title:
|
|
2357
|
-
...typeof
|
|
2453
|
+
title: record2.title,
|
|
2454
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2358
2455
|
};
|
|
2359
2456
|
}
|
|
2360
|
-
if (
|
|
2457
|
+
if (record2.kind === "collection" && typeof record2.title === "string" && Array.isArray(record2.items)) {
|
|
2361
2458
|
return {
|
|
2362
|
-
id:
|
|
2363
|
-
toolName:
|
|
2364
|
-
status:
|
|
2459
|
+
id: record2.id,
|
|
2460
|
+
toolName: record2.toolName,
|
|
2461
|
+
status: record2.status,
|
|
2365
2462
|
kind: "collection",
|
|
2366
|
-
title:
|
|
2367
|
-
items:
|
|
2463
|
+
title: record2.title,
|
|
2464
|
+
items: record2.items.flatMap((item) => {
|
|
2368
2465
|
if (typeof item !== "object" || item === null) return [];
|
|
2369
2466
|
const entry = item;
|
|
2370
2467
|
if (typeof entry.title !== "string") return [];
|
|
@@ -2378,26 +2475,26 @@ function parseToolResult(value) {
|
|
|
2378
2475
|
})
|
|
2379
2476
|
};
|
|
2380
2477
|
}
|
|
2381
|
-
if (
|
|
2478
|
+
if (record2.kind === "signature" && typeof record2.title === "string") {
|
|
2382
2479
|
return {
|
|
2383
|
-
id:
|
|
2384
|
-
toolName:
|
|
2385
|
-
status:
|
|
2480
|
+
id: record2.id,
|
|
2481
|
+
toolName: record2.toolName,
|
|
2482
|
+
status: record2.status,
|
|
2386
2483
|
kind: "signature",
|
|
2387
|
-
title:
|
|
2388
|
-
...typeof
|
|
2389
|
-
...typeof
|
|
2484
|
+
title: record2.title,
|
|
2485
|
+
...typeof record2.description === "string" ? { description: record2.description } : {},
|
|
2486
|
+
...typeof record2.statusLabel === "string" ? { statusLabel: record2.statusLabel } : {}
|
|
2390
2487
|
};
|
|
2391
2488
|
}
|
|
2392
|
-
if (
|
|
2489
|
+
if (record2.kind !== "summary" || typeof record2.title !== "string")
|
|
2393
2490
|
return null;
|
|
2394
2491
|
return {
|
|
2395
|
-
id:
|
|
2396
|
-
toolName:
|
|
2397
|
-
status:
|
|
2492
|
+
id: record2.id,
|
|
2493
|
+
toolName: record2.toolName,
|
|
2494
|
+
status: record2.status,
|
|
2398
2495
|
kind: "summary",
|
|
2399
|
-
title:
|
|
2400
|
-
...typeof
|
|
2496
|
+
title: record2.title,
|
|
2497
|
+
...typeof record2.description === "string" ? { description: record2.description } : {}
|
|
2401
2498
|
};
|
|
2402
2499
|
}
|
|
2403
2500
|
function visitorTurnText(message) {
|
|
@@ -2412,29 +2509,29 @@ function loadPersistedAgentConversation(storageKeyPrefix, visitorSessionId) {
|
|
|
2412
2509
|
try {
|
|
2413
2510
|
const value = JSON.parse(raw);
|
|
2414
2511
|
if (typeof value !== "object" || value === null) return null;
|
|
2415
|
-
const
|
|
2416
|
-
if (
|
|
2512
|
+
const record2 = value;
|
|
2513
|
+
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)) {
|
|
2417
2514
|
return null;
|
|
2418
2515
|
}
|
|
2419
|
-
const messages =
|
|
2516
|
+
const messages = record2.messages.map(parseMessage);
|
|
2420
2517
|
if (messages.some((message) => message === null)) return null;
|
|
2421
|
-
const storedToolSteps = (
|
|
2518
|
+
const storedToolSteps = (record2.version === 2 || record2.version === CONVERSATION_VERSION) && Array.isArray(record2.toolSteps) ? record2.toolSteps : [];
|
|
2422
2519
|
const toolSteps = storedToolSteps.map(parseToolStep);
|
|
2423
2520
|
if (toolSteps.some((step) => step === null)) return null;
|
|
2424
|
-
const storedToolResults =
|
|
2521
|
+
const storedToolResults = record2.version === CONVERSATION_VERSION && Array.isArray(record2.toolResults) ? record2.toolResults : [];
|
|
2425
2522
|
const toolResults = storedToolResults.map(parseToolResult);
|
|
2426
2523
|
if (toolResults.some((result) => result === null)) return null;
|
|
2427
|
-
const storedPendingInputs = Array.isArray(
|
|
2524
|
+
const storedPendingInputs = Array.isArray(record2.pendingInputs) ? record2.pendingInputs : [];
|
|
2428
2525
|
const pendingInputs = storedPendingInputs.map(parseInputRequest);
|
|
2429
2526
|
if (pendingInputs.some((request) => request === null)) return null;
|
|
2430
2527
|
return {
|
|
2431
2528
|
messages: messages.filter(
|
|
2432
2529
|
(message) => message !== null
|
|
2433
2530
|
),
|
|
2434
|
-
pending:
|
|
2435
|
-
streamingText:
|
|
2531
|
+
pending: record2.pending,
|
|
2532
|
+
streamingText: record2.streamingText,
|
|
2436
2533
|
toolSteps: toolSteps.filter((step) => step !== null),
|
|
2437
|
-
...Array.isArray(
|
|
2534
|
+
...Array.isArray(record2.toolResults) ? {
|
|
2438
2535
|
toolResults: toolResults.filter(
|
|
2439
2536
|
(result) => result !== null
|
|
2440
2537
|
)
|
|
@@ -2475,13 +2572,13 @@ function loadPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
|
|
|
2475
2572
|
try {
|
|
2476
2573
|
const value = JSON.parse(raw);
|
|
2477
2574
|
if (typeof value !== "object" || value === null) return null;
|
|
2478
|
-
const
|
|
2479
|
-
if (typeof
|
|
2575
|
+
const record2 = value;
|
|
2576
|
+
if (typeof record2.eventUri !== "string" || !record2.eventUri) return null;
|
|
2480
2577
|
return {
|
|
2481
|
-
eventUri:
|
|
2482
|
-
...typeof
|
|
2483
|
-
...typeof
|
|
2484
|
-
...typeof
|
|
2578
|
+
eventUri: record2.eventUri,
|
|
2579
|
+
...typeof record2.inviteeUri === "string" && record2.inviteeUri ? { inviteeUri: record2.inviteeUri } : {},
|
|
2580
|
+
...typeof record2.inviteeEmail === "string" && record2.inviteeEmail ? { inviteeEmail: record2.inviteeEmail } : {},
|
|
2581
|
+
...typeof record2.startTime === "string" && record2.startTime ? { startTime: record2.startTime } : {}
|
|
2485
2582
|
};
|
|
2486
2583
|
} catch {
|
|
2487
2584
|
return null;
|
|
@@ -2531,15 +2628,15 @@ function appendChatCollectiblePrompts(messages, requests) {
|
|
|
2531
2628
|
}
|
|
2532
2629
|
return next;
|
|
2533
2630
|
}
|
|
2534
|
-
function chatInputResponseForText(requests,
|
|
2535
|
-
const trimmed =
|
|
2631
|
+
function chatInputResponseForText(requests, text2) {
|
|
2632
|
+
const trimmed = text2.trim();
|
|
2536
2633
|
if (!trimmed) return null;
|
|
2537
2634
|
const pending = requests.find(isChatCollectibleInputRequest);
|
|
2538
2635
|
if (!pending) return null;
|
|
2539
2636
|
return { requestId: pending.requestId, text: trimmed };
|
|
2540
2637
|
}
|
|
2541
|
-
function normalizeAssistantDedupeKey(
|
|
2542
|
-
return
|
|
2638
|
+
function normalizeAssistantDedupeKey(text2) {
|
|
2639
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
2543
2640
|
}
|
|
2544
2641
|
function isNearDuplicateAssistantText(left, right) {
|
|
2545
2642
|
const a = normalizeAssistantDedupeKey(left);
|
|
@@ -2553,13 +2650,14 @@ function isNearDuplicateAssistantText(left, right) {
|
|
|
2553
2650
|
shorter.slice(0, Math.floor(shorter.length * 0.85))
|
|
2554
2651
|
);
|
|
2555
2652
|
}
|
|
2556
|
-
function appendAgentTurnMessage(messages, displayText) {
|
|
2653
|
+
function appendAgentTurnMessage(messages, displayText, searchResults = []) {
|
|
2557
2654
|
const trimmed = displayText.trim();
|
|
2558
|
-
if (!trimmed) return [...messages];
|
|
2655
|
+
if (!trimmed && searchResults.length === 0) return [...messages];
|
|
2559
2656
|
const agentMessage = {
|
|
2560
2657
|
id: `agent-${Date.now()}`,
|
|
2561
2658
|
role: "agent",
|
|
2562
2659
|
text: trimmed,
|
|
2660
|
+
...searchResults.length ? { searchResults } : {},
|
|
2563
2661
|
createdAt: Date.now()
|
|
2564
2662
|
};
|
|
2565
2663
|
const last = messages.at(-1);
|
|
@@ -2938,7 +3036,14 @@ function useAgentChat({
|
|
|
2938
3036
|
setState((prev) => ({
|
|
2939
3037
|
...prev,
|
|
2940
3038
|
phase: (prev.pendingInputs ?? []).some(shouldRenderVisitorInputCard) ? "waiting-input" : "complete",
|
|
2941
|
-
messages: appendAgentTurnMessage(
|
|
3039
|
+
messages: appendAgentTurnMessage(
|
|
3040
|
+
prev.messages,
|
|
3041
|
+
displayText,
|
|
3042
|
+
(prev.toolResults ?? []).filter((result) => result.kind === "search")
|
|
3043
|
+
),
|
|
3044
|
+
toolResults: (prev.toolResults ?? []).filter(
|
|
3045
|
+
(result) => result.kind !== "search"
|
|
3046
|
+
),
|
|
2942
3047
|
toolSteps: completeActivePlanning(prev.toolSteps),
|
|
2943
3048
|
streamingText: "",
|
|
2944
3049
|
pendingOffer: bookingConfirmed ? null : capturedOffers.at(-1) ?? prev.pendingOffer,
|
|
@@ -3350,8 +3455,8 @@ import { useEffect as useEffect2, useLayoutEffect, useRef as useRef2, useState a
|
|
|
3350
3455
|
import { createPortal } from "react-dom";
|
|
3351
3456
|
|
|
3352
3457
|
// src/react/lib/speech.ts
|
|
3353
|
-
function toSpeechText(
|
|
3354
|
-
let out = hideToolCardFences(
|
|
3458
|
+
function toSpeechText(text2) {
|
|
3459
|
+
let out = hideToolCardFences(text2);
|
|
3355
3460
|
out = out.replace(/```[\s\S]*?```/g, " ");
|
|
3356
3461
|
out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
3357
3462
|
out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
@@ -3696,12 +3801,12 @@ function StopIcon() {
|
|
|
3696
3801
|
}
|
|
3697
3802
|
) });
|
|
3698
3803
|
}
|
|
3699
|
-
async function writeToClipboard(
|
|
3804
|
+
async function writeToClipboard(text2) {
|
|
3700
3805
|
try {
|
|
3701
|
-
await navigator.clipboard.writeText(
|
|
3806
|
+
await navigator.clipboard.writeText(text2);
|
|
3702
3807
|
} catch {
|
|
3703
3808
|
const textarea = document.createElement("textarea");
|
|
3704
|
-
textarea.value =
|
|
3809
|
+
textarea.value = text2;
|
|
3705
3810
|
textarea.style.position = "fixed";
|
|
3706
3811
|
textarea.style.opacity = "0";
|
|
3707
3812
|
document.body.appendChild(textarea);
|
|
@@ -4572,6 +4677,108 @@ function FollowUpChips({
|
|
|
4572
4677
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4573
4678
|
import { useState as useState6 } from "react";
|
|
4574
4679
|
|
|
4680
|
+
// src/react/components/SearchReferences/SearchReferences.tsx
|
|
4681
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4682
|
+
function SiteIcon() {
|
|
4683
|
+
return /* @__PURE__ */ jsxs6(
|
|
4684
|
+
"svg",
|
|
4685
|
+
{
|
|
4686
|
+
viewBox: "0 0 24 24",
|
|
4687
|
+
width: "18",
|
|
4688
|
+
height: "18",
|
|
4689
|
+
fill: "none",
|
|
4690
|
+
stroke: "currentColor",
|
|
4691
|
+
strokeWidth: "1.5",
|
|
4692
|
+
"aria-hidden": "true",
|
|
4693
|
+
children: [
|
|
4694
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4695
|
+
/* @__PURE__ */ jsx6("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
4696
|
+
/* @__PURE__ */ jsx6("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
|
|
4697
|
+
]
|
|
4698
|
+
}
|
|
4699
|
+
);
|
|
4700
|
+
}
|
|
4701
|
+
function SearchReferences({
|
|
4702
|
+
results
|
|
4703
|
+
}) {
|
|
4704
|
+
const seenSources = /* @__PURE__ */ new Set();
|
|
4705
|
+
const sources = results.flatMap((result) => result.sources).flatMap((source) => {
|
|
4706
|
+
const url = safeSearchUrl(source.url);
|
|
4707
|
+
const key = url ?? source.id;
|
|
4708
|
+
if (seenSources.has(key)) return [];
|
|
4709
|
+
seenSources.add(key);
|
|
4710
|
+
return [{ ...source, url, key }];
|
|
4711
|
+
});
|
|
4712
|
+
const seenActions = /* @__PURE__ */ new Set();
|
|
4713
|
+
const actions = results.flatMap((result) => {
|
|
4714
|
+
const url = safeSearchUrl(result.cta?.url);
|
|
4715
|
+
if (!url || !result.cta || seenActions.has(url)) return [];
|
|
4716
|
+
seenActions.add(url);
|
|
4717
|
+
return [{ label: result.cta.label, url }];
|
|
4718
|
+
});
|
|
4719
|
+
if (!sources.length && !actions.length) return null;
|
|
4720
|
+
return /* @__PURE__ */ jsxs6("div", { className: "search-references", children: [
|
|
4721
|
+
sources.length > 0 ? /* @__PURE__ */ jsxs6("section", { "aria-label": "Sources", children: [
|
|
4722
|
+
/* @__PURE__ */ jsxs6("h3", { className: "search-references__heading", children: [
|
|
4723
|
+
"Sources",
|
|
4724
|
+
/* @__PURE__ */ jsx6("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ jsxs6(
|
|
4725
|
+
"svg",
|
|
4726
|
+
{
|
|
4727
|
+
viewBox: "0 0 24 24",
|
|
4728
|
+
width: "14",
|
|
4729
|
+
height: "14",
|
|
4730
|
+
fill: "none",
|
|
4731
|
+
stroke: "currentColor",
|
|
4732
|
+
strokeWidth: "1.75",
|
|
4733
|
+
"aria-hidden": "true",
|
|
4734
|
+
children: [
|
|
4735
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "9" }),
|
|
4736
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 11v6M12 7v1" })
|
|
4737
|
+
]
|
|
4738
|
+
}
|
|
4739
|
+
) })
|
|
4740
|
+
] }),
|
|
4741
|
+
/* @__PURE__ */ jsx6("ul", { className: "search-references__list", children: sources.map((source) => {
|
|
4742
|
+
const content = /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
4743
|
+
/* @__PURE__ */ jsx6("span", { className: "search-references__icon", children: /* @__PURE__ */ jsx6(SiteIcon, {}) }),
|
|
4744
|
+
/* @__PURE__ */ jsxs6("span", { className: "search-references__copy", children: [
|
|
4745
|
+
/* @__PURE__ */ jsx6(
|
|
4746
|
+
"span",
|
|
4747
|
+
{
|
|
4748
|
+
className: "search-references__title",
|
|
4749
|
+
title: source.title,
|
|
4750
|
+
children: source.title
|
|
4751
|
+
}
|
|
4752
|
+
),
|
|
4753
|
+
source.url ? /* @__PURE__ */ jsx6("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
|
|
4754
|
+
] })
|
|
4755
|
+
] });
|
|
4756
|
+
return /* @__PURE__ */ jsx6("li", { children: source.url ? /* @__PURE__ */ jsx6(
|
|
4757
|
+
"a",
|
|
4758
|
+
{
|
|
4759
|
+
className: "search-references__source",
|
|
4760
|
+
href: source.url,
|
|
4761
|
+
target: "_blank",
|
|
4762
|
+
rel: "noopener noreferrer",
|
|
4763
|
+
children: content
|
|
4764
|
+
}
|
|
4765
|
+
) : /* @__PURE__ */ jsx6("div", { className: "search-references__source", children: content }) }, source.key);
|
|
4766
|
+
}) })
|
|
4767
|
+
] }) : null,
|
|
4768
|
+
actions.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx6(
|
|
4769
|
+
"a",
|
|
4770
|
+
{
|
|
4771
|
+
className: "search-references__cta",
|
|
4772
|
+
href: action.url,
|
|
4773
|
+
target: "_blank",
|
|
4774
|
+
rel: "noopener noreferrer",
|
|
4775
|
+
children: action.label
|
|
4776
|
+
},
|
|
4777
|
+
action.url
|
|
4778
|
+
)) }) : null
|
|
4779
|
+
] });
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4575
4782
|
// src/react/components/BookingCard/BookingCard.tsx
|
|
4576
4783
|
import {
|
|
4577
4784
|
useEffect as useEffect5,
|
|
@@ -4580,7 +4787,7 @@ import {
|
|
|
4580
4787
|
useRef as useRef5,
|
|
4581
4788
|
useState as useState5
|
|
4582
4789
|
} from "react";
|
|
4583
|
-
import { jsx as
|
|
4790
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4584
4791
|
var BOOKING_STEPS = [
|
|
4585
4792
|
{ id: "date", label: "Date" },
|
|
4586
4793
|
{ id: "time", label: "Time" },
|
|
@@ -4611,7 +4818,7 @@ function calendarCells(year, month) {
|
|
|
4611
4818
|
return cells;
|
|
4612
4819
|
}
|
|
4613
4820
|
function BookingCardLoader() {
|
|
4614
|
-
return /* @__PURE__ */
|
|
4821
|
+
return /* @__PURE__ */ jsx7("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
|
|
4615
4822
|
}
|
|
4616
4823
|
function BookingCard({
|
|
4617
4824
|
disabled = false,
|
|
@@ -4710,14 +4917,14 @@ function BookingCard({
|
|
|
4710
4917
|
})
|
|
4711
4918
|
});
|
|
4712
4919
|
}
|
|
4713
|
-
return /* @__PURE__ */
|
|
4920
|
+
return /* @__PURE__ */ jsx7(
|
|
4714
4921
|
"section",
|
|
4715
4922
|
{
|
|
4716
4923
|
className: "booking-card",
|
|
4717
4924
|
"aria-busy": disabled || void 0,
|
|
4718
4925
|
"aria-label": "Book a meeting",
|
|
4719
|
-
children: /* @__PURE__ */
|
|
4720
|
-
/* @__PURE__ */
|
|
4926
|
+
children: /* @__PURE__ */ jsxs7("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
|
|
4927
|
+
/* @__PURE__ */ jsx7("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ jsxs7(
|
|
4721
4928
|
"li",
|
|
4722
4929
|
{
|
|
4723
4930
|
className: [
|
|
@@ -4727,40 +4934,40 @@ function BookingCard({
|
|
|
4727
4934
|
].filter(Boolean).join(" "),
|
|
4728
4935
|
"aria-current": index === stepIndex ? "step" : void 0,
|
|
4729
4936
|
children: [
|
|
4730
|
-
/* @__PURE__ */
|
|
4731
|
-
/* @__PURE__ */
|
|
4937
|
+
/* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: index + 1 }),
|
|
4938
|
+
/* @__PURE__ */ jsx7("span", { children: item.label })
|
|
4732
4939
|
]
|
|
4733
4940
|
},
|
|
4734
4941
|
item.id
|
|
4735
4942
|
)) }),
|
|
4736
|
-
step === "date" ? /* @__PURE__ */
|
|
4737
|
-
/* @__PURE__ */
|
|
4738
|
-
timeZone ? /* @__PURE__ */
|
|
4943
|
+
step === "date" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
4944
|
+
/* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
|
|
4945
|
+
timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
|
|
4739
4946
|
"Times in ",
|
|
4740
4947
|
timeZone
|
|
4741
4948
|
] }) : null,
|
|
4742
|
-
offer.eventTypes.length > 1 ? /* @__PURE__ */
|
|
4949
|
+
offer.eventTypes.length > 1 ? /* @__PURE__ */ jsxs7(
|
|
4743
4950
|
"label",
|
|
4744
4951
|
{
|
|
4745
4952
|
className: "booking-card__field",
|
|
4746
4953
|
htmlFor: `${fieldId}-type`,
|
|
4747
4954
|
children: [
|
|
4748
|
-
/* @__PURE__ */
|
|
4749
|
-
/* @__PURE__ */
|
|
4955
|
+
/* @__PURE__ */ jsx7("span", { children: "Meeting" }),
|
|
4956
|
+
/* @__PURE__ */ jsx7(
|
|
4750
4957
|
"select",
|
|
4751
4958
|
{
|
|
4752
4959
|
id: `${fieldId}-type`,
|
|
4753
4960
|
value: eventTypeUri,
|
|
4754
4961
|
disabled,
|
|
4755
4962
|
onChange: (event) => selectEventType(event.target.value),
|
|
4756
|
-
children: offer.eventTypes.map((item) => /* @__PURE__ */
|
|
4963
|
+
children: offer.eventTypes.map((item) => /* @__PURE__ */ jsx7("option", { value: item.uri, children: item.name }, item.uri))
|
|
4757
4964
|
}
|
|
4758
4965
|
)
|
|
4759
4966
|
]
|
|
4760
4967
|
}
|
|
4761
4968
|
) : null,
|
|
4762
|
-
/* @__PURE__ */
|
|
4763
|
-
/* @__PURE__ */
|
|
4969
|
+
/* @__PURE__ */ jsxs7("div", { className: "booking-card__month", children: [
|
|
4970
|
+
/* @__PURE__ */ jsx7(
|
|
4764
4971
|
"button",
|
|
4765
4972
|
{
|
|
4766
4973
|
type: "button",
|
|
@@ -4771,8 +4978,8 @@ function BookingCard({
|
|
|
4771
4978
|
children: "\u2039"
|
|
4772
4979
|
}
|
|
4773
4980
|
),
|
|
4774
|
-
/* @__PURE__ */
|
|
4775
|
-
/* @__PURE__ */
|
|
4981
|
+
/* @__PURE__ */ jsx7("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
|
|
4982
|
+
/* @__PURE__ */ jsx7(
|
|
4776
4983
|
"button",
|
|
4777
4984
|
{
|
|
4778
4985
|
type: "button",
|
|
@@ -4784,9 +4991,9 @@ function BookingCard({
|
|
|
4784
4991
|
}
|
|
4785
4992
|
)
|
|
4786
4993
|
] }),
|
|
4787
|
-
/* @__PURE__ */
|
|
4788
|
-
offer.slots.length === 0 ? /* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
4994
|
+
/* @__PURE__ */ jsx7("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ jsx7("span", { children: label }, label)) }),
|
|
4995
|
+
offer.slots.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
|
|
4996
|
+
/* @__PURE__ */ jsx7(
|
|
4790
4997
|
"div",
|
|
4791
4998
|
{
|
|
4792
4999
|
className: "booking-card__calendar",
|
|
@@ -4794,7 +5001,7 @@ function BookingCard({
|
|
|
4794
5001
|
"aria-label": "Available dates",
|
|
4795
5002
|
children: cells.map((cell, index) => {
|
|
4796
5003
|
if (!cell) {
|
|
4797
|
-
return /* @__PURE__ */
|
|
5004
|
+
return /* @__PURE__ */ jsx7(
|
|
4798
5005
|
"span",
|
|
4799
5006
|
{
|
|
4800
5007
|
className: "booking-card__day"
|
|
@@ -4804,7 +5011,7 @@ function BookingCard({
|
|
|
4804
5011
|
}
|
|
4805
5012
|
const available = availableByDate.has(cell.key);
|
|
4806
5013
|
const selected = cell.key === selectedDate;
|
|
4807
|
-
return /* @__PURE__ */
|
|
5014
|
+
return /* @__PURE__ */ jsx7(
|
|
4808
5015
|
"button",
|
|
4809
5016
|
{
|
|
4810
5017
|
type: "button",
|
|
@@ -4824,9 +5031,9 @@ function BookingCard({
|
|
|
4824
5031
|
}
|
|
4825
5032
|
)
|
|
4826
5033
|
] }, "date") : null,
|
|
4827
|
-
step === "time" ? /* @__PURE__ */
|
|
4828
|
-
/* @__PURE__ */
|
|
4829
|
-
/* @__PURE__ */
|
|
5034
|
+
step === "time" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
5035
|
+
/* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
|
|
5036
|
+
/* @__PURE__ */ jsx7(
|
|
4830
5037
|
"button",
|
|
4831
5038
|
{
|
|
4832
5039
|
type: "button",
|
|
@@ -4837,15 +5044,15 @@ function BookingCard({
|
|
|
4837
5044
|
children: "\u2039"
|
|
4838
5045
|
}
|
|
4839
5046
|
),
|
|
4840
|
-
/* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
timeZone ? /* @__PURE__ */
|
|
5047
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
5048
|
+
/* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
|
|
5049
|
+
timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
|
|
4843
5050
|
"Times in ",
|
|
4844
5051
|
timeZone
|
|
4845
5052
|
] }) : null
|
|
4846
5053
|
] })
|
|
4847
5054
|
] }),
|
|
4848
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx7("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ jsx7(
|
|
4849
5056
|
"button",
|
|
4850
5057
|
{
|
|
4851
5058
|
type: "button",
|
|
@@ -4857,9 +5064,9 @@ function BookingCard({
|
|
|
4857
5064
|
slot.startTime
|
|
4858
5065
|
)) })
|
|
4859
5066
|
] }, "time") : null,
|
|
4860
|
-
step === "details" ? /* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
5067
|
+
step === "details" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
|
|
5068
|
+
/* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
|
|
5069
|
+
/* @__PURE__ */ jsx7(
|
|
4863
5070
|
"button",
|
|
4864
5071
|
{
|
|
4865
5072
|
type: "button",
|
|
@@ -4870,21 +5077,21 @@ function BookingCard({
|
|
|
4870
5077
|
children: "\u2039"
|
|
4871
5078
|
}
|
|
4872
5079
|
),
|
|
4873
|
-
/* @__PURE__ */
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4876
|
-
selectedType?.location ? /* @__PURE__ */
|
|
5080
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
5081
|
+
/* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: "Enter details" }),
|
|
5082
|
+
/* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
|
|
5083
|
+
selectedType?.location ? /* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: selectedType.location }) : null
|
|
4877
5084
|
] })
|
|
4878
5085
|
] }),
|
|
4879
|
-
/* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */
|
|
5086
|
+
/* @__PURE__ */ jsxs7("div", { className: "booking-card__identity", children: [
|
|
5087
|
+
/* @__PURE__ */ jsxs7(
|
|
4881
5088
|
"label",
|
|
4882
5089
|
{
|
|
4883
5090
|
className: "booking-card__field",
|
|
4884
5091
|
htmlFor: `${fieldId}-name`,
|
|
4885
5092
|
children: [
|
|
4886
|
-
/* @__PURE__ */
|
|
4887
|
-
/* @__PURE__ */
|
|
5093
|
+
/* @__PURE__ */ jsx7("span", { children: "Name" }),
|
|
5094
|
+
/* @__PURE__ */ jsx7(
|
|
4888
5095
|
"input",
|
|
4889
5096
|
{
|
|
4890
5097
|
id: `${fieldId}-name`,
|
|
@@ -4898,14 +5105,14 @@ function BookingCard({
|
|
|
4898
5105
|
]
|
|
4899
5106
|
}
|
|
4900
5107
|
),
|
|
4901
|
-
/* @__PURE__ */
|
|
5108
|
+
/* @__PURE__ */ jsxs7(
|
|
4902
5109
|
"label",
|
|
4903
5110
|
{
|
|
4904
5111
|
className: "booking-card__field",
|
|
4905
5112
|
htmlFor: `${fieldId}-email`,
|
|
4906
5113
|
children: [
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
5114
|
+
/* @__PURE__ */ jsx7("span", { children: "Email" }),
|
|
5115
|
+
/* @__PURE__ */ jsx7(
|
|
4909
5116
|
"input",
|
|
4910
5117
|
{
|
|
4911
5118
|
id: `${fieldId}-email`,
|
|
@@ -4921,7 +5128,7 @@ function BookingCard({
|
|
|
4921
5128
|
}
|
|
4922
5129
|
)
|
|
4923
5130
|
] }),
|
|
4924
|
-
/* @__PURE__ */
|
|
5131
|
+
/* @__PURE__ */ jsx7(
|
|
4925
5132
|
"button",
|
|
4926
5133
|
{
|
|
4927
5134
|
type: "submit",
|
|
@@ -4939,9 +5146,9 @@ function BookingCard({
|
|
|
4939
5146
|
// src/react/components/MessageBubble/MessageBubble.tsx
|
|
4940
5147
|
import { Streamdown } from "streamdown";
|
|
4941
5148
|
import "streamdown/styles.css";
|
|
4942
|
-
import { jsx as
|
|
4943
|
-
function normalizeDedupeText(
|
|
4944
|
-
return
|
|
5149
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5150
|
+
function normalizeDedupeText(text2) {
|
|
5151
|
+
return text2.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4945
5152
|
}
|
|
4946
5153
|
function paragraphsAreNearDuplicates(first, second) {
|
|
4947
5154
|
const left = normalizeDedupeText(first);
|
|
@@ -4957,8 +5164,8 @@ function paragraphsShareOpening(first, second) {
|
|
|
4957
5164
|
if (!opening || opening.length < 20) return false;
|
|
4958
5165
|
return second.trim().startsWith(opening);
|
|
4959
5166
|
}
|
|
4960
|
-
function collapseRepeatedText(
|
|
4961
|
-
const trimmed =
|
|
5167
|
+
function collapseRepeatedText(text2) {
|
|
5168
|
+
const trimmed = text2.trim();
|
|
4962
5169
|
if (trimmed.length < 40) return trimmed;
|
|
4963
5170
|
const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
|
|
4964
5171
|
if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
|
|
@@ -4996,11 +5203,11 @@ function MessageBubble({
|
|
|
4996
5203
|
offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
|
|
4997
5204
|
);
|
|
4998
5205
|
if (message.role === "visitor") {
|
|
4999
|
-
return /* @__PURE__ */
|
|
5206
|
+
return /* @__PURE__ */ jsx8("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ jsx8("p", { className: "message-bubble__text", children: message.text }) });
|
|
5000
5207
|
}
|
|
5001
5208
|
const citations = message.citations ?? [];
|
|
5002
|
-
const agentText = /* @__PURE__ */
|
|
5003
|
-
/* @__PURE__ */
|
|
5209
|
+
const agentText = /* @__PURE__ */ jsxs8("div", { className: "message-bubble__text", children: [
|
|
5210
|
+
/* @__PURE__ */ jsx8(
|
|
5004
5211
|
Streamdown,
|
|
5005
5212
|
{
|
|
5006
5213
|
animated: isStreaming,
|
|
@@ -5014,8 +5221,9 @@ function MessageBubble({
|
|
|
5014
5221
|
children: displayText
|
|
5015
5222
|
}
|
|
5016
5223
|
),
|
|
5017
|
-
|
|
5018
|
-
|
|
5224
|
+
/* @__PURE__ */ jsx8(SearchReferences, { results: message.searchResults ?? [] }),
|
|
5225
|
+
citations.length > 0 ? /* @__PURE__ */ jsx8("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs8("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
|
|
5226
|
+
/* @__PURE__ */ jsx8(
|
|
5019
5227
|
"span",
|
|
5020
5228
|
{
|
|
5021
5229
|
className: "message-bubble__source-icon",
|
|
@@ -5023,12 +5231,12 @@ function MessageBubble({
|
|
|
5023
5231
|
children: "\u25A6"
|
|
5024
5232
|
}
|
|
5025
5233
|
),
|
|
5026
|
-
/* @__PURE__ */
|
|
5234
|
+
/* @__PURE__ */ jsx8("span", { children: citation.label })
|
|
5027
5235
|
] }) }, citation.id)) }) : null
|
|
5028
5236
|
] });
|
|
5029
|
-
return /* @__PURE__ */
|
|
5030
|
-
displayText ? showBrandLogo ? /* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5237
|
+
return /* @__PURE__ */ jsxs8("article", { className: "message-bubble message-bubble--agent", children: [
|
|
5238
|
+
displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ jsxs8("div", { className: "message-bubble__agent-row", children: [
|
|
5239
|
+
/* @__PURE__ */ jsx8("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
|
|
5032
5240
|
"img",
|
|
5033
5241
|
{
|
|
5034
5242
|
src: resolvedLogoUrl,
|
|
@@ -5040,7 +5248,7 @@ function MessageBubble({
|
|
|
5040
5248
|
) }),
|
|
5041
5249
|
agentText
|
|
5042
5250
|
] }) : agentText : null,
|
|
5043
|
-
offers.map((nextOffer, index) => /* @__PURE__ */
|
|
5251
|
+
offers.map((nextOffer, index) => /* @__PURE__ */ jsx8(
|
|
5044
5252
|
BookingCard,
|
|
5045
5253
|
{
|
|
5046
5254
|
disabled: bookingDisabled,
|
|
@@ -5056,7 +5264,7 @@ function MessageBubble({
|
|
|
5056
5264
|
import { useState as useState8 } from "react";
|
|
5057
5265
|
|
|
5058
5266
|
// src/react/components/ConfirmationCard/ConfirmationCard.tsx
|
|
5059
|
-
import { jsx as
|
|
5267
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5060
5268
|
function ConfirmationCard({
|
|
5061
5269
|
disabled = false,
|
|
5062
5270
|
request,
|
|
@@ -5065,17 +5273,17 @@ function ConfirmationCard({
|
|
|
5065
5273
|
const options = request.options ?? [];
|
|
5066
5274
|
const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
|
|
5067
5275
|
const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
|
|
5068
|
-
return /* @__PURE__ */
|
|
5276
|
+
return /* @__PURE__ */ jsxs9(
|
|
5069
5277
|
"section",
|
|
5070
5278
|
{
|
|
5071
5279
|
className: "confirmation-card",
|
|
5072
5280
|
"aria-labelledby": `confirmation-${request.requestId}`,
|
|
5073
5281
|
children: [
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5076
|
-
prompt ? /* @__PURE__ */
|
|
5282
|
+
/* @__PURE__ */ jsxs9("div", { className: "confirmation-card__heading", children: [
|
|
5283
|
+
/* @__PURE__ */ jsx9("strong", { id: `confirmation-${request.requestId}`, children: heading }),
|
|
5284
|
+
prompt ? /* @__PURE__ */ jsx9("p", { children: prompt }) : null
|
|
5077
5285
|
] }),
|
|
5078
|
-
/* @__PURE__ */
|
|
5286
|
+
/* @__PURE__ */ jsx9("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ jsx9(
|
|
5079
5287
|
"button",
|
|
5080
5288
|
{
|
|
5081
5289
|
type: "button",
|
|
@@ -5096,7 +5304,7 @@ function ConfirmationCard({
|
|
|
5096
5304
|
|
|
5097
5305
|
// src/react/components/ToolInputCard/ToolInputCard.tsx
|
|
5098
5306
|
import { useState as useState7 } from "react";
|
|
5099
|
-
import { jsx as
|
|
5307
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5100
5308
|
function isRecord5(value) {
|
|
5101
5309
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5102
5310
|
}
|
|
@@ -5220,7 +5428,7 @@ function FieldDescription({
|
|
|
5220
5428
|
field,
|
|
5221
5429
|
id
|
|
5222
5430
|
}) {
|
|
5223
|
-
return field.description ? /* @__PURE__ */
|
|
5431
|
+
return field.description ? /* @__PURE__ */ jsx10("span", { id, className: "tool-input-card__description", children: field.description }) : null;
|
|
5224
5432
|
}
|
|
5225
5433
|
function ChoiceField({
|
|
5226
5434
|
field,
|
|
@@ -5239,7 +5447,7 @@ function ChoiceField({
|
|
|
5239
5447
|
const selectedIndex = options.findIndex(
|
|
5240
5448
|
(option) => valuesMatch(option.value, value)
|
|
5241
5449
|
);
|
|
5242
|
-
return /* @__PURE__ */
|
|
5450
|
+
return /* @__PURE__ */ jsxs10(
|
|
5243
5451
|
"select",
|
|
5244
5452
|
{
|
|
5245
5453
|
id,
|
|
@@ -5254,13 +5462,13 @@ function ChoiceField({
|
|
|
5254
5462
|
if (option) onChange(option.value);
|
|
5255
5463
|
},
|
|
5256
5464
|
children: [
|
|
5257
|
-
/* @__PURE__ */
|
|
5258
|
-
options.map((option, index) => /* @__PURE__ */
|
|
5465
|
+
/* @__PURE__ */ jsx10("option", { value: "", disabled: field.required, children: "Choose an option" }),
|
|
5466
|
+
options.map((option, index) => /* @__PURE__ */ jsx10("option", { value: index, children: option.label }, optionKey(option)))
|
|
5259
5467
|
]
|
|
5260
5468
|
}
|
|
5261
5469
|
);
|
|
5262
5470
|
}
|
|
5263
|
-
return /* @__PURE__ */
|
|
5471
|
+
return /* @__PURE__ */ jsx10(
|
|
5264
5472
|
"div",
|
|
5265
5473
|
{
|
|
5266
5474
|
className: "tool-input-card__choices",
|
|
@@ -5271,8 +5479,8 @@ function ChoiceField({
|
|
|
5271
5479
|
"aria-required": field.required,
|
|
5272
5480
|
children: options.map((option, index) => {
|
|
5273
5481
|
const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
|
|
5274
|
-
return /* @__PURE__ */
|
|
5275
|
-
/* @__PURE__ */
|
|
5482
|
+
return /* @__PURE__ */ jsxs10("label", { className: "tool-input-card__choice", children: [
|
|
5483
|
+
/* @__PURE__ */ jsx10(
|
|
5276
5484
|
"input",
|
|
5277
5485
|
{
|
|
5278
5486
|
type: multiple ? "checkbox" : "radio",
|
|
@@ -5294,7 +5502,7 @@ function ChoiceField({
|
|
|
5294
5502
|
}
|
|
5295
5503
|
}
|
|
5296
5504
|
),
|
|
5297
|
-
/* @__PURE__ */
|
|
5505
|
+
/* @__PURE__ */ jsx10("span", { children: option.label })
|
|
5298
5506
|
] }, optionKey(option));
|
|
5299
5507
|
})
|
|
5300
5508
|
}
|
|
@@ -5314,9 +5522,9 @@ function ToolField({
|
|
|
5314
5522
|
error ? `${id}-error` : ""
|
|
5315
5523
|
].filter(Boolean).join(" ");
|
|
5316
5524
|
if (field.kind === "checkbox" || field.kind === "confirmation") {
|
|
5317
|
-
return /* @__PURE__ */
|
|
5318
|
-
/* @__PURE__ */
|
|
5319
|
-
/* @__PURE__ */
|
|
5525
|
+
return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
|
|
5526
|
+
/* @__PURE__ */ jsxs10("label", { className: "tool-input-card__check", htmlFor: id, children: [
|
|
5527
|
+
/* @__PURE__ */ jsx10(
|
|
5320
5528
|
"input",
|
|
5321
5529
|
{
|
|
5322
5530
|
id,
|
|
@@ -5329,17 +5537,17 @@ function ToolField({
|
|
|
5329
5537
|
onChange: (event) => onChange(event.target.checked)
|
|
5330
5538
|
}
|
|
5331
5539
|
),
|
|
5332
|
-
/* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5334
|
-
field.description ? /* @__PURE__ */
|
|
5540
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
5541
|
+
/* @__PURE__ */ jsx10("strong", { children: field.label }),
|
|
5542
|
+
field.description ? /* @__PURE__ */ jsx10("span", { id: `${id}-description`, children: field.description }) : null
|
|
5335
5543
|
] })
|
|
5336
5544
|
] }),
|
|
5337
|
-
error ? /* @__PURE__ */
|
|
5545
|
+
error ? /* @__PURE__ */ jsx10("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5338
5546
|
] });
|
|
5339
5547
|
}
|
|
5340
|
-
const label = /* @__PURE__ */
|
|
5548
|
+
const label = /* @__PURE__ */ jsxs10("label", { id: `${id}-label`, htmlFor: id, children: [
|
|
5341
5549
|
field.label,
|
|
5342
|
-
field.required ? /* @__PURE__ */
|
|
5550
|
+
field.required ? /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: " *" }) : null
|
|
5343
5551
|
] });
|
|
5344
5552
|
const common = {
|
|
5345
5553
|
id,
|
|
@@ -5351,7 +5559,7 @@ function ToolField({
|
|
|
5351
5559
|
};
|
|
5352
5560
|
let control;
|
|
5353
5561
|
if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
|
|
5354
|
-
control = /* @__PURE__ */
|
|
5562
|
+
control = /* @__PURE__ */ jsx10(
|
|
5355
5563
|
ChoiceField,
|
|
5356
5564
|
{
|
|
5357
5565
|
field,
|
|
@@ -5365,7 +5573,7 @@ function ToolField({
|
|
|
5365
5573
|
}
|
|
5366
5574
|
);
|
|
5367
5575
|
} else if (field.kind === "textarea" || field.kind === "json") {
|
|
5368
|
-
control = /* @__PURE__ */
|
|
5576
|
+
control = /* @__PURE__ */ jsx10(
|
|
5369
5577
|
"textarea",
|
|
5370
5578
|
{
|
|
5371
5579
|
...common,
|
|
@@ -5379,8 +5587,8 @@ function ToolField({
|
|
|
5379
5587
|
);
|
|
5380
5588
|
} else if (field.kind === "range") {
|
|
5381
5589
|
const numericValue = typeof value === "number" ? value : field.min ?? 0;
|
|
5382
|
-
control = /* @__PURE__ */
|
|
5383
|
-
/* @__PURE__ */
|
|
5590
|
+
control = /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__range", children: [
|
|
5591
|
+
/* @__PURE__ */ jsx10(
|
|
5384
5592
|
"input",
|
|
5385
5593
|
{
|
|
5386
5594
|
...common,
|
|
@@ -5392,11 +5600,11 @@ function ToolField({
|
|
|
5392
5600
|
onChange: (event) => onChange(Number(event.target.value))
|
|
5393
5601
|
}
|
|
5394
5602
|
),
|
|
5395
|
-
/* @__PURE__ */
|
|
5603
|
+
/* @__PURE__ */ jsx10("output", { htmlFor: id, children: numericValue })
|
|
5396
5604
|
] });
|
|
5397
5605
|
} else {
|
|
5398
5606
|
const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
|
|
5399
|
-
control = /* @__PURE__ */
|
|
5607
|
+
control = /* @__PURE__ */ jsx10(
|
|
5400
5608
|
"input",
|
|
5401
5609
|
{
|
|
5402
5610
|
...common,
|
|
@@ -5414,11 +5622,11 @@ function ToolField({
|
|
|
5414
5622
|
}
|
|
5415
5623
|
);
|
|
5416
5624
|
}
|
|
5417
|
-
return /* @__PURE__ */
|
|
5625
|
+
return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
|
|
5418
5626
|
label,
|
|
5419
|
-
/* @__PURE__ */
|
|
5627
|
+
/* @__PURE__ */ jsx10(FieldDescription, { field, id: `${id}-description` }),
|
|
5420
5628
|
control,
|
|
5421
|
-
error ? /* @__PURE__ */
|
|
5629
|
+
error ? /* @__PURE__ */ jsx10("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
|
|
5422
5630
|
] });
|
|
5423
5631
|
}
|
|
5424
5632
|
function ToolInputCard({
|
|
@@ -5455,14 +5663,14 @@ function ToolInputCard({
|
|
|
5455
5663
|
onSubmit?.(surface, result);
|
|
5456
5664
|
}
|
|
5457
5665
|
if (submitted) {
|
|
5458
|
-
return /* @__PURE__ */
|
|
5666
|
+
return /* @__PURE__ */ jsxs10(
|
|
5459
5667
|
"section",
|
|
5460
5668
|
{
|
|
5461
5669
|
className: "tool-input-card tool-input-card--submitted",
|
|
5462
5670
|
role: "status",
|
|
5463
5671
|
children: [
|
|
5464
|
-
/* @__PURE__ */
|
|
5465
|
-
/* @__PURE__ */
|
|
5672
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2713" }),
|
|
5673
|
+
/* @__PURE__ */ jsxs10("strong", { children: [
|
|
5466
5674
|
surface.title,
|
|
5467
5675
|
" submitted"
|
|
5468
5676
|
] })
|
|
@@ -5470,18 +5678,18 @@ function ToolInputCard({
|
|
|
5470
5678
|
}
|
|
5471
5679
|
);
|
|
5472
5680
|
}
|
|
5473
|
-
return /* @__PURE__ */
|
|
5681
|
+
return /* @__PURE__ */ jsxs10(
|
|
5474
5682
|
"section",
|
|
5475
5683
|
{
|
|
5476
5684
|
className: "tool-input-card",
|
|
5477
5685
|
"aria-labelledby": `tool-input-${surface.id}`,
|
|
5478
5686
|
children: [
|
|
5479
|
-
/* @__PURE__ */
|
|
5480
|
-
/* @__PURE__ */
|
|
5481
|
-
surface.description ? /* @__PURE__ */
|
|
5687
|
+
/* @__PURE__ */ jsxs10("div", { className: "tool-input-card__heading", children: [
|
|
5688
|
+
/* @__PURE__ */ jsx10("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
|
|
5689
|
+
surface.description ? /* @__PURE__ */ jsx10("p", { children: surface.description }) : null
|
|
5482
5690
|
] }),
|
|
5483
|
-
/* @__PURE__ */
|
|
5484
|
-
/* @__PURE__ */
|
|
5691
|
+
/* @__PURE__ */ jsxs10("form", { noValidate: true, onSubmit: submit, children: [
|
|
5692
|
+
/* @__PURE__ */ jsx10("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx10(
|
|
5485
5693
|
ToolField,
|
|
5486
5694
|
{
|
|
5487
5695
|
disabled,
|
|
@@ -5494,8 +5702,8 @@ function ToolInputCard({
|
|
|
5494
5702
|
},
|
|
5495
5703
|
field.path
|
|
5496
5704
|
)) }),
|
|
5497
|
-
/* @__PURE__ */
|
|
5498
|
-
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */
|
|
5705
|
+
/* @__PURE__ */ jsxs10("div", { className: "tool-input-card__actions", children: [
|
|
5706
|
+
surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx10(
|
|
5499
5707
|
"button",
|
|
5500
5708
|
{
|
|
5501
5709
|
type: "button",
|
|
@@ -5508,7 +5716,7 @@ function ToolInputCard({
|
|
|
5508
5716
|
children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
|
|
5509
5717
|
}
|
|
5510
5718
|
) : null,
|
|
5511
|
-
/* @__PURE__ */
|
|
5719
|
+
/* @__PURE__ */ jsx10("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
|
|
5512
5720
|
] })
|
|
5513
5721
|
] })
|
|
5514
5722
|
]
|
|
@@ -5517,17 +5725,17 @@ function ToolInputCard({
|
|
|
5517
5725
|
}
|
|
5518
5726
|
|
|
5519
5727
|
// src/react/components/HumanInputCard/HumanInputCard.tsx
|
|
5520
|
-
import { jsx as
|
|
5728
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5521
5729
|
function HumanInputCard({
|
|
5522
5730
|
disabled = false,
|
|
5523
5731
|
request,
|
|
5524
5732
|
onRespond
|
|
5525
5733
|
}) {
|
|
5526
|
-
const [
|
|
5734
|
+
const [text2, setText] = useState8("");
|
|
5527
5735
|
const options = request.options ?? [];
|
|
5528
5736
|
const showText = request.display === "text" || request.allowFreeform && options.length === 0;
|
|
5529
5737
|
if (request.ui) {
|
|
5530
|
-
return /* @__PURE__ */
|
|
5738
|
+
return /* @__PURE__ */ jsx11(
|
|
5531
5739
|
ToolInputCard,
|
|
5532
5740
|
{
|
|
5533
5741
|
disabled,
|
|
@@ -5537,7 +5745,7 @@ function HumanInputCard({
|
|
|
5537
5745
|
);
|
|
5538
5746
|
}
|
|
5539
5747
|
if (options.length > 0) {
|
|
5540
|
-
return /* @__PURE__ */
|
|
5748
|
+
return /* @__PURE__ */ jsx11(
|
|
5541
5749
|
ConfirmationCard,
|
|
5542
5750
|
{
|
|
5543
5751
|
disabled,
|
|
@@ -5548,62 +5756,62 @@ function HumanInputCard({
|
|
|
5548
5756
|
}
|
|
5549
5757
|
function submitText(event) {
|
|
5550
5758
|
event.preventDefault();
|
|
5551
|
-
const value =
|
|
5759
|
+
const value = text2.trim();
|
|
5552
5760
|
if (!value || disabled) return;
|
|
5553
5761
|
onRespond?.({ requestId: request.requestId, text: value });
|
|
5554
5762
|
}
|
|
5555
|
-
return /* @__PURE__ */
|
|
5763
|
+
return /* @__PURE__ */ jsxs11(
|
|
5556
5764
|
"section",
|
|
5557
5765
|
{
|
|
5558
5766
|
className: "human-input-card",
|
|
5559
5767
|
"aria-labelledby": `human-input-${request.requestId}`,
|
|
5560
5768
|
children: [
|
|
5561
|
-
/* @__PURE__ */
|
|
5562
|
-
showText ? /* @__PURE__ */
|
|
5563
|
-
/* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
5769
|
+
/* @__PURE__ */ jsx11("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx11("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
|
|
5770
|
+
showText ? /* @__PURE__ */ jsxs11("form", { onSubmit: submitText, children: [
|
|
5771
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
|
|
5772
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
5773
|
+
/* @__PURE__ */ jsx11(
|
|
5566
5774
|
"input",
|
|
5567
5775
|
{
|
|
5568
5776
|
id: `human-input-text-${request.requestId}`,
|
|
5569
|
-
value:
|
|
5777
|
+
value: text2,
|
|
5570
5778
|
disabled,
|
|
5571
5779
|
onChange: (event) => setText(event.target.value)
|
|
5572
5780
|
}
|
|
5573
5781
|
),
|
|
5574
|
-
/* @__PURE__ */
|
|
5782
|
+
/* @__PURE__ */ jsx11("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
|
|
5575
5783
|
] })
|
|
5576
5784
|
] }) : null,
|
|
5577
|
-
!showText && options.length === 0 ? /* @__PURE__ */
|
|
5785
|
+
!showText && options.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
|
|
5578
5786
|
]
|
|
5579
5787
|
}
|
|
5580
5788
|
);
|
|
5581
5789
|
}
|
|
5582
5790
|
|
|
5583
5791
|
// src/react/components/CollectionResultCard/CollectionResultCard.tsx
|
|
5584
|
-
import { jsx as
|
|
5792
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5585
5793
|
function CollectionResultCard({
|
|
5586
5794
|
result
|
|
5587
5795
|
}) {
|
|
5588
5796
|
const empty = result.items.length === 0;
|
|
5589
|
-
return /* @__PURE__ */
|
|
5797
|
+
return /* @__PURE__ */ jsxs12(
|
|
5590
5798
|
"section",
|
|
5591
5799
|
{
|
|
5592
5800
|
className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5593
5801
|
"aria-label": result.title,
|
|
5594
5802
|
children: [
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5597
|
-
/* @__PURE__ */
|
|
5803
|
+
/* @__PURE__ */ jsxs12("div", { className: "tool-result-card__heading", children: [
|
|
5804
|
+
/* @__PURE__ */ jsx12("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5805
|
+
/* @__PURE__ */ jsx12("strong", { children: result.title })
|
|
5598
5806
|
] }),
|
|
5599
|
-
empty ? /* @__PURE__ */
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
item.description ? /* @__PURE__ */
|
|
5602
|
-
item.details?.length ? /* @__PURE__ */
|
|
5603
|
-
/* @__PURE__ */
|
|
5604
|
-
/* @__PURE__ */
|
|
5807
|
+
empty ? /* @__PURE__ */ jsx12("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx12("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs12("li", { children: [
|
|
5808
|
+
/* @__PURE__ */ jsx12("div", { className: "collection-result-card__item-title", children: item.title }),
|
|
5809
|
+
item.description ? /* @__PURE__ */ jsx12("p", { children: item.description }) : null,
|
|
5810
|
+
item.details?.length ? /* @__PURE__ */ jsx12("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs12("div", { children: [
|
|
5811
|
+
/* @__PURE__ */ jsx12("dt", { children: detail.label }),
|
|
5812
|
+
/* @__PURE__ */ jsx12("dd", { children: detail.value })
|
|
5605
5813
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5606
|
-
item.href ? /* @__PURE__ */
|
|
5814
|
+
item.href ? /* @__PURE__ */ jsx12("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
|
|
5607
5815
|
] }, item.title)) })
|
|
5608
5816
|
]
|
|
5609
5817
|
}
|
|
@@ -5611,26 +5819,26 @@ function CollectionResultCard({
|
|
|
5611
5819
|
}
|
|
5612
5820
|
|
|
5613
5821
|
// src/react/components/EntityResultCard/EntityResultCard.tsx
|
|
5614
|
-
import { jsx as
|
|
5822
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5615
5823
|
function EntityResultCard({
|
|
5616
5824
|
result
|
|
5617
5825
|
}) {
|
|
5618
|
-
return /* @__PURE__ */
|
|
5826
|
+
return /* @__PURE__ */ jsxs13(
|
|
5619
5827
|
"section",
|
|
5620
5828
|
{
|
|
5621
5829
|
className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5622
5830
|
"aria-label": result.title,
|
|
5623
5831
|
children: [
|
|
5624
|
-
/* @__PURE__ */
|
|
5625
|
-
/* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
5832
|
+
/* @__PURE__ */ jsxs13("div", { className: "tool-result-card__heading", children: [
|
|
5833
|
+
/* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5834
|
+
/* @__PURE__ */ jsx13("strong", { children: result.title })
|
|
5627
5835
|
] }),
|
|
5628
|
-
result.description ? /* @__PURE__ */
|
|
5629
|
-
result.details?.length ? /* @__PURE__ */
|
|
5630
|
-
/* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5836
|
+
result.description ? /* @__PURE__ */ jsx13("p", { children: result.description }) : null,
|
|
5837
|
+
result.details?.length ? /* @__PURE__ */ jsx13("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
5838
|
+
/* @__PURE__ */ jsx13("dt", { children: detail.label }),
|
|
5839
|
+
/* @__PURE__ */ jsx13("dd", { children: detail.value })
|
|
5632
5840
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5633
|
-
result.links?.length ? /* @__PURE__ */
|
|
5841
|
+
result.links?.length ? /* @__PURE__ */ jsx13("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx13(
|
|
5634
5842
|
"a",
|
|
5635
5843
|
{
|
|
5636
5844
|
href: link.href,
|
|
@@ -5646,24 +5854,24 @@ function EntityResultCard({
|
|
|
5646
5854
|
}
|
|
5647
5855
|
|
|
5648
5856
|
// src/react/components/SignatureResultCard/SignatureResultCard.tsx
|
|
5649
|
-
import { jsx as
|
|
5857
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5650
5858
|
function SignatureResultCard({
|
|
5651
5859
|
result
|
|
5652
5860
|
}) {
|
|
5653
5861
|
const primaryLink = result.links?.[0];
|
|
5654
|
-
return /* @__PURE__ */
|
|
5862
|
+
return /* @__PURE__ */ jsxs14(
|
|
5655
5863
|
"section",
|
|
5656
5864
|
{
|
|
5657
5865
|
className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
|
|
5658
5866
|
"aria-label": result.title,
|
|
5659
5867
|
children: [
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5868
|
+
/* @__PURE__ */ jsxs14("div", { className: "tool-result-card__heading", children: [
|
|
5869
|
+
/* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5870
|
+
/* @__PURE__ */ jsx14("strong", { children: result.title })
|
|
5663
5871
|
] }),
|
|
5664
|
-
result.statusLabel ? /* @__PURE__ */
|
|
5665
|
-
result.description ? /* @__PURE__ */
|
|
5666
|
-
primaryLink ? /* @__PURE__ */
|
|
5872
|
+
result.statusLabel ? /* @__PURE__ */ jsx14("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
|
|
5873
|
+
result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
|
|
5874
|
+
primaryLink ? /* @__PURE__ */ jsx14(
|
|
5667
5875
|
"a",
|
|
5668
5876
|
{
|
|
5669
5877
|
className: "signature-result-card__cta",
|
|
@@ -5679,26 +5887,26 @@ function SignatureResultCard({
|
|
|
5679
5887
|
}
|
|
5680
5888
|
|
|
5681
5889
|
// src/react/components/ToolResultCard/ToolResultCard.tsx
|
|
5682
|
-
import { jsx as
|
|
5890
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5683
5891
|
function ToolResultCard({
|
|
5684
5892
|
result
|
|
5685
5893
|
}) {
|
|
5686
|
-
return /* @__PURE__ */
|
|
5894
|
+
return /* @__PURE__ */ jsxs15(
|
|
5687
5895
|
"section",
|
|
5688
5896
|
{
|
|
5689
5897
|
className: `tool-result-card tool-result-card--${result.status}`,
|
|
5690
5898
|
"aria-label": result.title,
|
|
5691
5899
|
children: [
|
|
5692
|
-
/* @__PURE__ */
|
|
5693
|
-
/* @__PURE__ */
|
|
5694
|
-
/* @__PURE__ */
|
|
5900
|
+
/* @__PURE__ */ jsxs15("div", { className: "tool-result-card__heading", children: [
|
|
5901
|
+
/* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
|
|
5902
|
+
/* @__PURE__ */ jsx15("strong", { children: result.title })
|
|
5695
5903
|
] }),
|
|
5696
|
-
result.description ? /* @__PURE__ */
|
|
5697
|
-
result.details?.length ? /* @__PURE__ */
|
|
5698
|
-
/* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5904
|
+
result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
|
|
5905
|
+
result.details?.length ? /* @__PURE__ */ jsx15("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs15("div", { children: [
|
|
5906
|
+
/* @__PURE__ */ jsx15("dt", { children: detail.label }),
|
|
5907
|
+
/* @__PURE__ */ jsx15("dd", { children: detail.value })
|
|
5700
5908
|
] }, `${detail.label}:${detail.value}`)) }) : null,
|
|
5701
|
-
result.links?.length ? /* @__PURE__ */
|
|
5909
|
+
result.links?.length ? /* @__PURE__ */ jsx15("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx15(
|
|
5702
5910
|
"a",
|
|
5703
5911
|
{
|
|
5704
5912
|
href: link.href,
|
|
@@ -5714,14 +5922,14 @@ function ToolResultCard({
|
|
|
5714
5922
|
}
|
|
5715
5923
|
|
|
5716
5924
|
// src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
|
|
5717
|
-
import { jsx as
|
|
5925
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5718
5926
|
function VisitorToolResultView({
|
|
5719
5927
|
disabled = false,
|
|
5720
5928
|
onToolInput,
|
|
5721
5929
|
result
|
|
5722
5930
|
}) {
|
|
5723
5931
|
if (result.kind === "input") {
|
|
5724
|
-
return /* @__PURE__ */
|
|
5932
|
+
return /* @__PURE__ */ jsx16(
|
|
5725
5933
|
ToolInputCard,
|
|
5726
5934
|
{
|
|
5727
5935
|
disabled,
|
|
@@ -5731,16 +5939,16 @@ function VisitorToolResultView({
|
|
|
5731
5939
|
);
|
|
5732
5940
|
}
|
|
5733
5941
|
if (result.kind === "entity") {
|
|
5734
|
-
return /* @__PURE__ */
|
|
5942
|
+
return /* @__PURE__ */ jsx16(EntityResultCard, { result });
|
|
5735
5943
|
}
|
|
5736
5944
|
if (result.kind === "collection") {
|
|
5737
|
-
return /* @__PURE__ */
|
|
5945
|
+
return /* @__PURE__ */ jsx16(CollectionResultCard, { result });
|
|
5738
5946
|
}
|
|
5739
5947
|
if (result.kind === "signature") {
|
|
5740
|
-
return /* @__PURE__ */
|
|
5948
|
+
return /* @__PURE__ */ jsx16(SignatureResultCard, { result });
|
|
5741
5949
|
}
|
|
5742
5950
|
if (result.kind === "summary") {
|
|
5743
|
-
return /* @__PURE__ */
|
|
5951
|
+
return /* @__PURE__ */ jsx16(ToolResultCard, { result });
|
|
5744
5952
|
}
|
|
5745
5953
|
return null;
|
|
5746
5954
|
}
|
|
@@ -5749,9 +5957,9 @@ function isRenderableVisitorToolResult(result) {
|
|
|
5749
5957
|
}
|
|
5750
5958
|
|
|
5751
5959
|
// src/react/components/AgentRail/AgentRail.tsx
|
|
5752
|
-
import { Fragment as
|
|
5960
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5753
5961
|
function MinimizeIcon() {
|
|
5754
|
-
return /* @__PURE__ */
|
|
5962
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5755
5963
|
"path",
|
|
5756
5964
|
{
|
|
5757
5965
|
d: "M3.5 8h9",
|
|
@@ -5762,7 +5970,7 @@ function MinimizeIcon() {
|
|
|
5762
5970
|
) });
|
|
5763
5971
|
}
|
|
5764
5972
|
function CloseIcon2() {
|
|
5765
|
-
return /* @__PURE__ */
|
|
5973
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5766
5974
|
"path",
|
|
5767
5975
|
{
|
|
5768
5976
|
d: "M4 4l8 8M12 4l-8 8",
|
|
@@ -5773,7 +5981,7 @@ function CloseIcon2() {
|
|
|
5773
5981
|
) });
|
|
5774
5982
|
}
|
|
5775
5983
|
function NewChatIcon() {
|
|
5776
|
-
return /* @__PURE__ */
|
|
5984
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5777
5985
|
"path",
|
|
5778
5986
|
{
|
|
5779
5987
|
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",
|
|
@@ -5785,7 +5993,7 @@ function NewChatIcon() {
|
|
|
5785
5993
|
) });
|
|
5786
5994
|
}
|
|
5787
5995
|
function ExpandIcon() {
|
|
5788
|
-
return /* @__PURE__ */
|
|
5996
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5789
5997
|
"path",
|
|
5790
5998
|
{
|
|
5791
5999
|
d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
|
|
@@ -5797,7 +6005,7 @@ function ExpandIcon() {
|
|
|
5797
6005
|
) });
|
|
5798
6006
|
}
|
|
5799
6007
|
function RestoreIcon() {
|
|
5800
|
-
return /* @__PURE__ */
|
|
6008
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5801
6009
|
"path",
|
|
5802
6010
|
{
|
|
5803
6011
|
d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
|
|
@@ -5809,7 +6017,7 @@ function RestoreIcon() {
|
|
|
5809
6017
|
) });
|
|
5810
6018
|
}
|
|
5811
6019
|
function ChevronDownIcon() {
|
|
5812
|
-
return /* @__PURE__ */
|
|
6020
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
5813
6021
|
"path",
|
|
5814
6022
|
{
|
|
5815
6023
|
d: "M4 6.5l4 4 4-4",
|
|
@@ -5946,7 +6154,10 @@ function AgentRail({
|
|
|
5946
6154
|
id: "streaming-response",
|
|
5947
6155
|
role: "agent",
|
|
5948
6156
|
streaming: true,
|
|
5949
|
-
text: state.streamingText
|
|
6157
|
+
text: state.streamingText,
|
|
6158
|
+
searchResults: (state.toolResults ?? []).filter(
|
|
6159
|
+
(result) => result.kind === "search"
|
|
6160
|
+
)
|
|
5950
6161
|
} : state.pendingOffer && !lastIsAgent ? {
|
|
5951
6162
|
createdAt: 0,
|
|
5952
6163
|
id: "pending-booking",
|
|
@@ -6068,7 +6279,7 @@ function AgentRail({
|
|
|
6068
6279
|
window.setTimeout(settle, 900);
|
|
6069
6280
|
node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
|
|
6070
6281
|
}
|
|
6071
|
-
return /* @__PURE__ */
|
|
6282
|
+
return /* @__PURE__ */ jsx17(
|
|
6072
6283
|
"aside",
|
|
6073
6284
|
{
|
|
6074
6285
|
ref: railRef,
|
|
@@ -6082,34 +6293,34 @@ function AgentRail({
|
|
|
6082
6293
|
autoFocus: mobileFullscreen || expanded,
|
|
6083
6294
|
role: mobileFullscreen || expanded ? "dialog" : void 0,
|
|
6084
6295
|
tabIndex: mobileFullscreen || expanded ? -1 : void 0,
|
|
6085
|
-
children: /* @__PURE__ */
|
|
6296
|
+
children: /* @__PURE__ */ jsxs16(
|
|
6086
6297
|
AgentRailOverlayContext.Provider,
|
|
6087
6298
|
{
|
|
6088
6299
|
value: { railRef, overlayRef },
|
|
6089
6300
|
children: [
|
|
6090
|
-
/* @__PURE__ */
|
|
6091
|
-
/* @__PURE__ */
|
|
6092
|
-
onCollapse ? /* @__PURE__ */
|
|
6301
|
+
/* @__PURE__ */ jsxs16("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
|
|
6302
|
+
/* @__PURE__ */ jsx17("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs16("div", { className: "agent-rail__brand-row", children: [
|
|
6303
|
+
onCollapse ? /* @__PURE__ */ jsx17(
|
|
6093
6304
|
"button",
|
|
6094
6305
|
{
|
|
6095
6306
|
type: "button",
|
|
6096
6307
|
className: "agent-rail__collapse",
|
|
6097
6308
|
"aria-label": "Collapse assist",
|
|
6098
6309
|
onClick: onCollapse,
|
|
6099
|
-
children: /* @__PURE__ */
|
|
6310
|
+
children: /* @__PURE__ */ jsx17(MinimizeIcon, {})
|
|
6100
6311
|
}
|
|
6101
|
-
) : onClose ? /* @__PURE__ */
|
|
6312
|
+
) : onClose ? /* @__PURE__ */ jsx17(
|
|
6102
6313
|
"button",
|
|
6103
6314
|
{
|
|
6104
6315
|
type: "button",
|
|
6105
6316
|
className: "agent-rail__close",
|
|
6106
6317
|
"aria-label": "Close agent",
|
|
6107
6318
|
onClick: onClose,
|
|
6108
|
-
children: /* @__PURE__ */
|
|
6319
|
+
children: /* @__PURE__ */ jsx17(CloseIcon2, {})
|
|
6109
6320
|
}
|
|
6110
|
-
) : /* @__PURE__ */
|
|
6111
|
-
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */
|
|
6112
|
-
showBrandLogo ? /* @__PURE__ */
|
|
6321
|
+
) : /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
|
|
6322
|
+
resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs16("span", { className: "agent-rail__identity", children: [
|
|
6323
|
+
showBrandLogo ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
|
|
6113
6324
|
"img",
|
|
6114
6325
|
{
|
|
6115
6326
|
className: "agent-rail__brand-logo",
|
|
@@ -6120,10 +6331,10 @@ function AgentRail({
|
|
|
6120
6331
|
}
|
|
6121
6332
|
}
|
|
6122
6333
|
) }) : null,
|
|
6123
|
-
resolvedBrandLabel ? /* @__PURE__ */
|
|
6334
|
+
resolvedBrandLabel ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
|
|
6124
6335
|
] }) : null,
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
onReset ? /* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsxs16("span", { className: "agent-rail__actions", children: [
|
|
6337
|
+
onReset ? /* @__PURE__ */ jsx17(
|
|
6127
6338
|
"button",
|
|
6128
6339
|
{
|
|
6129
6340
|
type: "button",
|
|
@@ -6131,24 +6342,24 @@ function AgentRail({
|
|
|
6131
6342
|
"aria-label": "Start a new conversation",
|
|
6132
6343
|
disabled: !hasVisitorMessages2,
|
|
6133
6344
|
onClick: handleReset,
|
|
6134
|
-
children: /* @__PURE__ */
|
|
6345
|
+
children: /* @__PURE__ */ jsx17(NewChatIcon, {})
|
|
6135
6346
|
}
|
|
6136
6347
|
) : null,
|
|
6137
|
-
onExpandToggle ? /* @__PURE__ */
|
|
6348
|
+
onExpandToggle ? /* @__PURE__ */ jsx17(
|
|
6138
6349
|
"button",
|
|
6139
6350
|
{
|
|
6140
6351
|
type: "button",
|
|
6141
6352
|
className: "agent-rail__expand",
|
|
6142
6353
|
"aria-label": expanded ? "Exit full screen" : "Open full screen",
|
|
6143
6354
|
onClick: onExpandToggle,
|
|
6144
|
-
children: expanded ? /* @__PURE__ */
|
|
6355
|
+
children: expanded ? /* @__PURE__ */ jsx17(RestoreIcon, {}) : /* @__PURE__ */ jsx17(ExpandIcon, {})
|
|
6145
6356
|
}
|
|
6146
6357
|
) : null
|
|
6147
6358
|
] })
|
|
6148
6359
|
] }) }),
|
|
6149
|
-
/* @__PURE__ */
|
|
6150
|
-
!hasVisitorMessages2 ? /* @__PURE__ */
|
|
6151
|
-
greeting?.role === "agent" ? /* @__PURE__ */
|
|
6360
|
+
/* @__PURE__ */ jsx17("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs16("div", { className: "agent-rail__thread", children: [
|
|
6361
|
+
!hasVisitorMessages2 ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
|
|
6362
|
+
greeting?.role === "agent" ? /* @__PURE__ */ jsx17(
|
|
6152
6363
|
MessageBubble,
|
|
6153
6364
|
{
|
|
6154
6365
|
message: greeting,
|
|
@@ -6157,7 +6368,7 @@ function AgentRail({
|
|
|
6157
6368
|
onBook
|
|
6158
6369
|
}
|
|
6159
6370
|
) : null,
|
|
6160
|
-
showIdleFollowUps ? /* @__PURE__ */
|
|
6371
|
+
showIdleFollowUps ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx17(
|
|
6161
6372
|
FollowUpChips,
|
|
6162
6373
|
{
|
|
6163
6374
|
suggestions: state.followUps,
|
|
@@ -6166,7 +6377,7 @@ function AgentRail({
|
|
|
6166
6377
|
onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
|
|
6167
6378
|
}
|
|
6168
6379
|
) }) : null,
|
|
6169
|
-
showActivity ? /* @__PURE__ */
|
|
6380
|
+
showActivity ? /* @__PURE__ */ jsx17(
|
|
6170
6381
|
AgentActivityBubble,
|
|
6171
6382
|
{
|
|
6172
6383
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6175,7 +6386,7 @@ function AgentRail({
|
|
|
6175
6386
|
steps: state.toolSteps
|
|
6176
6387
|
}
|
|
6177
6388
|
) : null,
|
|
6178
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */
|
|
6389
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
|
|
6179
6390
|
VisitorToolResultView,
|
|
6180
6391
|
{
|
|
6181
6392
|
result,
|
|
@@ -6184,7 +6395,7 @@ function AgentRail({
|
|
|
6184
6395
|
},
|
|
6185
6396
|
result.id
|
|
6186
6397
|
)),
|
|
6187
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */
|
|
6398
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
|
|
6188
6399
|
HumanInputCard,
|
|
6189
6400
|
{
|
|
6190
6401
|
request,
|
|
@@ -6193,8 +6404,8 @@ function AgentRail({
|
|
|
6193
6404
|
request.requestId
|
|
6194
6405
|
))
|
|
6195
6406
|
] }) : null,
|
|
6196
|
-
visibleMessages.map((message, index) => /* @__PURE__ */
|
|
6197
|
-
/* @__PURE__ */
|
|
6407
|
+
visibleMessages.map((message, index) => /* @__PURE__ */ jsxs16("div", { className: "agent-rail__turn-block", children: [
|
|
6408
|
+
/* @__PURE__ */ jsx17(
|
|
6198
6409
|
MessageBubble,
|
|
6199
6410
|
{
|
|
6200
6411
|
message,
|
|
@@ -6204,7 +6415,7 @@ function AgentRail({
|
|
|
6204
6415
|
onBook
|
|
6205
6416
|
}
|
|
6206
6417
|
),
|
|
6207
|
-
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */
|
|
6418
|
+
index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx17(
|
|
6208
6419
|
MessageActions,
|
|
6209
6420
|
{
|
|
6210
6421
|
answeredAt: message.createdAt,
|
|
@@ -6216,8 +6427,8 @@ function AgentRail({
|
|
|
6216
6427
|
onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
|
|
6217
6428
|
}
|
|
6218
6429
|
) : null,
|
|
6219
|
-
index === lastVisitorIndex ? /* @__PURE__ */
|
|
6220
|
-
showActivity ? /* @__PURE__ */
|
|
6430
|
+
index === lastVisitorIndex ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
6431
|
+
showActivity ? /* @__PURE__ */ jsx17(
|
|
6221
6432
|
AgentActivityBubble,
|
|
6222
6433
|
{
|
|
6223
6434
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6226,7 +6437,7 @@ function AgentRail({
|
|
|
6226
6437
|
steps: state.toolSteps
|
|
6227
6438
|
}
|
|
6228
6439
|
) : null,
|
|
6229
|
-
visibleVisitorToolResults.map((result) => /* @__PURE__ */
|
|
6440
|
+
visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
|
|
6230
6441
|
VisitorToolResultView,
|
|
6231
6442
|
{
|
|
6232
6443
|
result,
|
|
@@ -6235,7 +6446,7 @@ function AgentRail({
|
|
|
6235
6446
|
},
|
|
6236
6447
|
result.id
|
|
6237
6448
|
)),
|
|
6238
|
-
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */
|
|
6449
|
+
pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
|
|
6239
6450
|
HumanInputCard,
|
|
6240
6451
|
{
|
|
6241
6452
|
request,
|
|
@@ -6245,7 +6456,7 @@ function AgentRail({
|
|
|
6245
6456
|
))
|
|
6246
6457
|
] }) : null
|
|
6247
6458
|
] }, message.id)),
|
|
6248
|
-
streamingMessage ? /* @__PURE__ */
|
|
6459
|
+
streamingMessage ? /* @__PURE__ */ jsx17(
|
|
6249
6460
|
MessageBubble,
|
|
6250
6461
|
{
|
|
6251
6462
|
message: streamingMessage,
|
|
@@ -6255,16 +6466,16 @@ function AgentRail({
|
|
|
6255
6466
|
onBook
|
|
6256
6467
|
}
|
|
6257
6468
|
) : null,
|
|
6258
|
-
waitingForBooking ? /* @__PURE__ */
|
|
6259
|
-
state.error ? /* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6262
|
-
/* @__PURE__ */
|
|
6469
|
+
waitingForBooking ? /* @__PURE__ */ jsx17(BookingCardLoader, {}) : null,
|
|
6470
|
+
state.error ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6471
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
6472
|
+
/* @__PURE__ */ jsx17("strong", { children: "Something went wrong" }),
|
|
6473
|
+
/* @__PURE__ */ jsx17("p", { children: state.error })
|
|
6263
6474
|
] }),
|
|
6264
|
-
onRetry ? /* @__PURE__ */
|
|
6475
|
+
onRetry ? /* @__PURE__ */ jsx17("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
|
|
6265
6476
|
] }) : null
|
|
6266
6477
|
] }) }),
|
|
6267
|
-
showDisclaimerLabel ? /* @__PURE__ */
|
|
6478
|
+
showDisclaimerLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx17("p", { children: disclaimerLink ? /* @__PURE__ */ jsx17(
|
|
6268
6479
|
"a",
|
|
6269
6480
|
{
|
|
6270
6481
|
href: disclaimerLink,
|
|
@@ -6273,8 +6484,8 @@ function AgentRail({
|
|
|
6273
6484
|
children: resolvedDisclaimerLabel
|
|
6274
6485
|
}
|
|
6275
6486
|
) : resolvedDisclaimerLabel }) }) : null,
|
|
6276
|
-
/* @__PURE__ */
|
|
6277
|
-
showJumpToLatest ? /* @__PURE__ */
|
|
6487
|
+
/* @__PURE__ */ jsxs16("div", { className: "agent-rail__composer-wrap", children: [
|
|
6488
|
+
showJumpToLatest ? /* @__PURE__ */ jsx17(
|
|
6278
6489
|
"button",
|
|
6279
6490
|
{
|
|
6280
6491
|
type: "button",
|
|
@@ -6282,10 +6493,10 @@ function AgentRail({
|
|
|
6282
6493
|
"aria-label": "Jump to the latest message",
|
|
6283
6494
|
title: "Jump to the latest message",
|
|
6284
6495
|
onClick: scrollToLatest,
|
|
6285
|
-
children: /* @__PURE__ */
|
|
6496
|
+
children: /* @__PURE__ */ jsx17(ChevronDownIcon, {})
|
|
6286
6497
|
}
|
|
6287
6498
|
) : null,
|
|
6288
|
-
/* @__PURE__ */
|
|
6499
|
+
/* @__PURE__ */ jsx17(
|
|
6289
6500
|
Composer,
|
|
6290
6501
|
{
|
|
6291
6502
|
variant: expanded || mobileFullscreen ? "dock" : "default",
|
|
@@ -6297,11 +6508,11 @@ function AgentRail({
|
|
|
6297
6508
|
},
|
|
6298
6509
|
state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
|
|
6299
6510
|
),
|
|
6300
|
-
poweredByLabel ? /* @__PURE__ */
|
|
6511
|
+
poweredByLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx17("p", { children: /* @__PURE__ */ jsx17("span", { children: poweredByLabel }) }) }) : null
|
|
6301
6512
|
] })
|
|
6302
6513
|
] }),
|
|
6303
|
-
/* @__PURE__ */
|
|
6304
|
-
receiptOpen && receiptSteps ? /* @__PURE__ */
|
|
6514
|
+
/* @__PURE__ */ jsx17("div", { ref: overlayRef, className: "agent-rail__overlay" }),
|
|
6515
|
+
receiptOpen && receiptSteps ? /* @__PURE__ */ jsx17(
|
|
6305
6516
|
AnswerReceiptDialog,
|
|
6306
6517
|
{
|
|
6307
6518
|
brandLabel: resolvedBrandLabel,
|
|
@@ -6317,9 +6528,9 @@ function AgentRail({
|
|
|
6317
6528
|
}
|
|
6318
6529
|
|
|
6319
6530
|
// src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
|
|
6320
|
-
import { Fragment as
|
|
6531
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6321
6532
|
function SparklesIcon() {
|
|
6322
|
-
return /* @__PURE__ */
|
|
6533
|
+
return /* @__PURE__ */ jsxs17(
|
|
6323
6534
|
"svg",
|
|
6324
6535
|
{
|
|
6325
6536
|
className: "assist-edge-tab__sparkles",
|
|
@@ -6327,21 +6538,21 @@ function SparklesIcon() {
|
|
|
6327
6538
|
fill: "none",
|
|
6328
6539
|
"aria-hidden": "true",
|
|
6329
6540
|
children: [
|
|
6330
|
-
/* @__PURE__ */
|
|
6541
|
+
/* @__PURE__ */ jsx18(
|
|
6331
6542
|
"path",
|
|
6332
6543
|
{
|
|
6333
6544
|
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",
|
|
6334
6545
|
fill: "currentColor"
|
|
6335
6546
|
}
|
|
6336
6547
|
),
|
|
6337
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsx18(
|
|
6338
6549
|
"path",
|
|
6339
6550
|
{
|
|
6340
6551
|
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",
|
|
6341
6552
|
fill: "currentColor"
|
|
6342
6553
|
}
|
|
6343
6554
|
),
|
|
6344
|
-
/* @__PURE__ */
|
|
6555
|
+
/* @__PURE__ */ jsx18(
|
|
6345
6556
|
"path",
|
|
6346
6557
|
{
|
|
6347
6558
|
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",
|
|
@@ -6355,7 +6566,7 @@ function SparklesIcon() {
|
|
|
6355
6566
|
function TabMarkIcon({ customIconUrl }) {
|
|
6356
6567
|
const url = customIconUrl?.trim();
|
|
6357
6568
|
if (url) {
|
|
6358
|
-
return /* @__PURE__ */
|
|
6569
|
+
return /* @__PURE__ */ jsx18(
|
|
6359
6570
|
"img",
|
|
6360
6571
|
{
|
|
6361
6572
|
alt: "",
|
|
@@ -6365,10 +6576,10 @@ function TabMarkIcon({ customIconUrl }) {
|
|
|
6365
6576
|
}
|
|
6366
6577
|
);
|
|
6367
6578
|
}
|
|
6368
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ jsx18(SparklesIcon, {});
|
|
6369
6580
|
}
|
|
6370
6581
|
function ChevronLeftIcon() {
|
|
6371
|
-
return /* @__PURE__ */
|
|
6582
|
+
return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
|
|
6372
6583
|
"path",
|
|
6373
6584
|
{
|
|
6374
6585
|
d: "M10 4L6 8l4 4",
|
|
@@ -6380,7 +6591,7 @@ function ChevronLeftIcon() {
|
|
|
6380
6591
|
) });
|
|
6381
6592
|
}
|
|
6382
6593
|
function ChevronDownIcon2() {
|
|
6383
|
-
return /* @__PURE__ */
|
|
6594
|
+
return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
|
|
6384
6595
|
"path",
|
|
6385
6596
|
{
|
|
6386
6597
|
d: "M4 6l4 4 4-4",
|
|
@@ -6392,7 +6603,7 @@ function ChevronDownIcon2() {
|
|
|
6392
6603
|
) });
|
|
6393
6604
|
}
|
|
6394
6605
|
function DragDots() {
|
|
6395
|
-
return /* @__PURE__ */
|
|
6606
|
+
return /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx18("i", {}, index)) });
|
|
6396
6607
|
}
|
|
6397
6608
|
var VARIANT_COPY = {
|
|
6398
6609
|
outline: { label: "Ask anything", aria: "Ask anything" },
|
|
@@ -6438,7 +6649,7 @@ function AssistEdgeTab({
|
|
|
6438
6649
|
...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
6439
6650
|
colorScheme: resolvedColorScheme
|
|
6440
6651
|
};
|
|
6441
|
-
return /* @__PURE__ */
|
|
6652
|
+
return /* @__PURE__ */ jsxs17(
|
|
6442
6653
|
"button",
|
|
6443
6654
|
{
|
|
6444
6655
|
type: "button",
|
|
@@ -6450,15 +6661,15 @@ function AssistEdgeTab({
|
|
|
6450
6661
|
tabIndex: visible ? 0 : -1,
|
|
6451
6662
|
onClick: onOpen,
|
|
6452
6663
|
children: [
|
|
6453
|
-
mobile ? /* @__PURE__ */
|
|
6454
|
-
/* @__PURE__ */
|
|
6664
|
+
mobile ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
6665
|
+
/* @__PURE__ */ jsxs17(
|
|
6455
6666
|
"span",
|
|
6456
6667
|
{
|
|
6457
6668
|
className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
|
|
6458
6669
|
"aria-hidden": "true",
|
|
6459
6670
|
children: [
|
|
6460
|
-
/* @__PURE__ */
|
|
6461
|
-
showLogo ? /* @__PURE__ */
|
|
6671
|
+
/* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
|
|
6672
|
+
showLogo ? /* @__PURE__ */ jsx18(
|
|
6462
6673
|
"img",
|
|
6463
6674
|
{
|
|
6464
6675
|
className: "assist-edge-tab__logo",
|
|
@@ -6472,11 +6683,11 @@ function AssistEdgeTab({
|
|
|
6472
6683
|
]
|
|
6473
6684
|
}
|
|
6474
6685
|
),
|
|
6475
|
-
/* @__PURE__ */
|
|
6476
|
-
] }) : variant === "outline" ? /* @__PURE__ */
|
|
6477
|
-
/* @__PURE__ */
|
|
6478
|
-
/* @__PURE__ */
|
|
6479
|
-
showLogo ? /* @__PURE__ */
|
|
6686
|
+
/* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel })
|
|
6687
|
+
] }) : variant === "outline" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
6688
|
+
/* @__PURE__ */ jsxs17("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6689
|
+
/* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
|
|
6690
|
+
showLogo ? /* @__PURE__ */ jsx18(
|
|
6480
6691
|
"img",
|
|
6481
6692
|
{
|
|
6482
6693
|
className: "assist-edge-tab__logo",
|
|
@@ -6488,18 +6699,18 @@ function AssistEdgeTab({
|
|
|
6488
6699
|
}
|
|
6489
6700
|
) : null
|
|
6490
6701
|
] }),
|
|
6491
|
-
/* @__PURE__ */
|
|
6492
|
-
/* @__PURE__ */
|
|
6702
|
+
/* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6703
|
+
/* @__PURE__ */ jsx18(ChevronDownIcon2, {})
|
|
6493
6704
|
] }) : null,
|
|
6494
|
-
variant === "ask" ? /* @__PURE__ */
|
|
6495
|
-
/* @__PURE__ */
|
|
6496
|
-
/* @__PURE__ */
|
|
6497
|
-
/* @__PURE__ */
|
|
6705
|
+
variant === "ask" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
6706
|
+
/* @__PURE__ */ jsx18(ChevronLeftIcon, {}),
|
|
6707
|
+
/* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6708
|
+
/* @__PURE__ */ jsx18(DragDots, {})
|
|
6498
6709
|
] }) : null,
|
|
6499
|
-
variant === "fill" ? /* @__PURE__ */
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
showLogo ? /* @__PURE__ */
|
|
6710
|
+
variant === "fill" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
6711
|
+
/* @__PURE__ */ jsxs17("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
|
|
6712
|
+
/* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
|
|
6713
|
+
showLogo ? /* @__PURE__ */ jsx18(
|
|
6503
6714
|
"img",
|
|
6504
6715
|
{
|
|
6505
6716
|
className: "assist-edge-tab__logo",
|
|
@@ -6511,8 +6722,8 @@ function AssistEdgeTab({
|
|
|
6511
6722
|
}
|
|
6512
6723
|
) : null
|
|
6513
6724
|
] }),
|
|
6514
|
-
/* @__PURE__ */
|
|
6515
|
-
/* @__PURE__ */
|
|
6725
|
+
/* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
|
|
6726
|
+
/* @__PURE__ */ jsx18(ChevronLeftIcon, {})
|
|
6516
6727
|
] }) : null
|
|
6517
6728
|
]
|
|
6518
6729
|
}
|
|
@@ -6534,8 +6745,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
|
|
|
6534
6745
|
}
|
|
6535
6746
|
return void 0;
|
|
6536
6747
|
}
|
|
6537
|
-
function normalizeAgentFeedbackAnswerText(
|
|
6538
|
-
const normalized =
|
|
6748
|
+
function normalizeAgentFeedbackAnswerText(text2) {
|
|
6749
|
+
const normalized = text2.replace(/\s+/g, " ").trim();
|
|
6539
6750
|
if (!normalized) return void 0;
|
|
6540
6751
|
return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
|
|
6541
6752
|
}
|
|
@@ -6675,7 +6886,7 @@ function useIsMobile(breakpoint = 767) {
|
|
|
6675
6886
|
}
|
|
6676
6887
|
|
|
6677
6888
|
// src/react/components/AgentWidget/AgentWidget.tsx
|
|
6678
|
-
import { jsx as
|
|
6889
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6679
6890
|
function AgentWidget({
|
|
6680
6891
|
indexId,
|
|
6681
6892
|
customerId,
|
|
@@ -6818,19 +7029,19 @@ function AgentWidget({
|
|
|
6818
7029
|
window.addEventListener("keydown", handleKeyDown);
|
|
6819
7030
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
6820
7031
|
}, [isMobile, railCollapsed, railExpanded]);
|
|
6821
|
-
return /* @__PURE__ */
|
|
6822
|
-
/* @__PURE__ */
|
|
7032
|
+
return /* @__PURE__ */ jsxs18("div", { className: "webless-agent-root", children: [
|
|
7033
|
+
/* @__PURE__ */ jsx19(
|
|
6823
7034
|
"div",
|
|
6824
7035
|
{
|
|
6825
7036
|
className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
|
|
6826
|
-
children: /* @__PURE__ */
|
|
7037
|
+
children: /* @__PURE__ */ jsx19(
|
|
6827
7038
|
"div",
|
|
6828
7039
|
{
|
|
6829
7040
|
ref: railSlotRef,
|
|
6830
7041
|
className: "webless-agent-root__rail-slot",
|
|
6831
7042
|
inert: railCollapsed || void 0,
|
|
6832
7043
|
"aria-hidden": railCollapsed,
|
|
6833
|
-
children: /* @__PURE__ */
|
|
7044
|
+
children: /* @__PURE__ */ jsx19(
|
|
6834
7045
|
AgentRail,
|
|
6835
7046
|
{
|
|
6836
7047
|
theme,
|
|
@@ -6867,7 +7078,7 @@ function AgentWidget({
|
|
|
6867
7078
|
)
|
|
6868
7079
|
}
|
|
6869
7080
|
),
|
|
6870
|
-
railCollapsed ? /* @__PURE__ */
|
|
7081
|
+
railCollapsed ? /* @__PURE__ */ jsx19(
|
|
6871
7082
|
AssistEdgeTab,
|
|
6872
7083
|
{
|
|
6873
7084
|
variant: placement.variant,
|
|
@@ -6921,4 +7132,4 @@ export {
|
|
|
6921
7132
|
sendAgentAnswerFeedback,
|
|
6922
7133
|
AgentWidget
|
|
6923
7134
|
};
|
|
6924
|
-
//# sourceMappingURL=chunk-
|
|
7135
|
+
//# sourceMappingURL=chunk-CD6TKXGT.js.map
|