@helpai/elements 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configurator.mjs +2 -2
- package/elements-web-component.esm.js +29 -29
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +28 -28
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +28 -28
- package/elements.esm.js.map +4 -4
- package/elements.js +27 -27
- package/elements.js.map +4 -4
- package/index.d.ts +5 -5
- package/index.mjs +195 -282
- package/package.json +1 -1
- package/schema.d.ts +27 -27
- package/schema.json +4 -4
- package/schema.mjs +2 -2
- package/web-component.mjs +195 -282
package/web-component.mjs
CHANGED
|
@@ -112,7 +112,7 @@ var STRINGS_EN = {
|
|
|
112
112
|
newsLoading: "Loading news\u2026",
|
|
113
113
|
newsBack: "Back to news",
|
|
114
114
|
newsPublishedAt: "Published {date}",
|
|
115
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
115
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ────
|
|
116
116
|
formSubmit: "Submit",
|
|
117
117
|
formSkip: "Maybe later",
|
|
118
118
|
formSubmitted: "Completed",
|
|
@@ -132,26 +132,15 @@ var STRINGS_EN = {
|
|
|
132
132
|
formChooseAtMost: "Choose at most {max}",
|
|
133
133
|
formOther: "Other",
|
|
134
134
|
formOtherPlaceholder: "Type your answer\u2026",
|
|
135
|
-
inputRequired: "
|
|
136
|
-
inputBadge: "
|
|
135
|
+
inputRequired: "Questions for you",
|
|
136
|
+
inputBadge: "Questions",
|
|
137
137
|
inputAnswered: "Answered",
|
|
138
138
|
inputSkipped: "Skipped",
|
|
139
|
-
|
|
140
|
-
inputYourAnswer: "Your answer",
|
|
141
|
-
inputSubmit: "Submit answer",
|
|
139
|
+
inputSubmit: "Submit answers",
|
|
142
140
|
inputSubmitHint: "Enter to send \xB7 Shift+Enter = new line",
|
|
143
|
-
inputAnswerPlaceholder: "Type your answer\u2026",
|
|
144
141
|
inputSkip: "Skip",
|
|
145
142
|
confirmYes: "Yes",
|
|
146
143
|
confirmNo: "No",
|
|
147
|
-
inputConfirmHint: "Choose yes or no.",
|
|
148
|
-
inputOptionalNote: "Optional note",
|
|
149
|
-
inputOptionalNotePlaceholder: "Optional comment\u2026",
|
|
150
|
-
inputSubmitted: "Answer submitted",
|
|
151
|
-
respFreeText: "Free Text",
|
|
152
|
-
respSingleChoice: "Single Choice",
|
|
153
|
-
respMultiChoice: "Multiple Choice",
|
|
154
|
-
respConfirmation: "Confirmation",
|
|
155
144
|
approvalRequired: "Approval required",
|
|
156
145
|
approve: "Approve",
|
|
157
146
|
reject: "Reject",
|
|
@@ -256,7 +245,7 @@ var STRINGS_FR = {
|
|
|
256
245
|
newsLoading: "Chargement des actualit\xE9s\u2026",
|
|
257
246
|
newsBack: "Retour aux actualit\xE9s",
|
|
258
247
|
newsPublishedAt: "Publi\xE9 le {date}",
|
|
259
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
248
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ────
|
|
260
249
|
formSubmit: "Envoyer",
|
|
261
250
|
formSkip: "Plus tard",
|
|
262
251
|
formSubmitted: "Termin\xE9",
|
|
@@ -276,26 +265,15 @@ var STRINGS_FR = {
|
|
|
276
265
|
formChooseAtMost: "Choisissez au plus {max}",
|
|
277
266
|
formOther: "Autre",
|
|
278
267
|
formOtherPlaceholder: "Saisissez votre r\xE9ponse\u2026",
|
|
279
|
-
inputRequired: "
|
|
280
|
-
inputBadge: "
|
|
268
|
+
inputRequired: "Questions pour vous",
|
|
269
|
+
inputBadge: "Questions",
|
|
281
270
|
inputAnswered: "R\xE9pondu",
|
|
282
271
|
inputSkipped: "Ignor\xE9",
|
|
283
|
-
|
|
284
|
-
inputYourAnswer: "Votre r\xE9ponse",
|
|
285
|
-
inputSubmit: "Envoyer la r\xE9ponse",
|
|
272
|
+
inputSubmit: "Envoyer les r\xE9ponses",
|
|
286
273
|
inputSubmitHint: "Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",
|
|
287
|
-
inputAnswerPlaceholder: "Saisissez votre r\xE9ponse\u2026",
|
|
288
274
|
inputSkip: "Ignorer",
|
|
289
275
|
confirmYes: "Oui",
|
|
290
276
|
confirmNo: "Non",
|
|
291
|
-
inputConfirmHint: "Choisissez oui ou non.",
|
|
292
|
-
inputOptionalNote: "Note facultative",
|
|
293
|
-
inputOptionalNotePlaceholder: "Commentaire facultatif\u2026",
|
|
294
|
-
inputSubmitted: "R\xE9ponse envoy\xE9e",
|
|
295
|
-
respFreeText: "Texte libre",
|
|
296
|
-
respSingleChoice: "Choix unique",
|
|
297
|
-
respMultiChoice: "Choix multiple",
|
|
298
|
-
respConfirmation: "Confirmation",
|
|
299
277
|
approvalRequired: "Approbation requise",
|
|
300
278
|
approve: "Approuver",
|
|
301
279
|
reject: "Refuser",
|
|
@@ -400,7 +378,7 @@ var STRINGS_AR = {
|
|
|
400
378
|
newsLoading: "\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",
|
|
401
379
|
newsBack: "\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",
|
|
402
380
|
newsPublishedAt: "\u0646\u064F\u0634\u0631 \u0641\u064A {date}",
|
|
403
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
381
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ────
|
|
404
382
|
formSubmit: "\u0625\u0631\u0633\u0627\u0644",
|
|
405
383
|
formSkip: "\u0644\u0627\u062D\u0642\u064B\u0627",
|
|
406
384
|
formSubmitted: "\u062A\u0645",
|
|
@@ -420,26 +398,15 @@ var STRINGS_AR = {
|
|
|
420
398
|
formChooseAtMost: "\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",
|
|
421
399
|
formOther: "\u0623\u062E\u0631\u0649",
|
|
422
400
|
formOtherPlaceholder: "\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",
|
|
423
|
-
inputRequired: "\
|
|
424
|
-
inputBadge: "\
|
|
401
|
+
inputRequired: "\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",
|
|
402
|
+
inputBadge: "\u0623\u0633\u0626\u0644\u0629",
|
|
425
403
|
inputAnswered: "\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",
|
|
426
404
|
inputSkipped: "\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",
|
|
427
|
-
|
|
428
|
-
inputYourAnswer: "\u0625\u062C\u0627\u0628\u062A\u0643",
|
|
429
|
-
inputSubmit: "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",
|
|
405
|
+
inputSubmit: "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",
|
|
430
406
|
inputSubmitHint: "Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",
|
|
431
|
-
inputAnswerPlaceholder: "\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",
|
|
432
407
|
inputSkip: "\u062A\u062E\u0637\u064D\u0651",
|
|
433
408
|
confirmYes: "\u0646\u0639\u0645",
|
|
434
409
|
confirmNo: "\u0644\u0627",
|
|
435
|
-
inputConfirmHint: "\u0627\u062E\u062A\u0631 \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627.",
|
|
436
|
-
inputOptionalNote: "\u0645\u0644\u0627\u062D\u0638\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u0629",
|
|
437
|
-
inputOptionalNotePlaceholder: "\u062A\u0639\u0644\u064A\u0642 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u2026",
|
|
438
|
-
inputSubmitted: "\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",
|
|
439
|
-
respFreeText: "\u0646\u0635 \u062D\u0631",
|
|
440
|
-
respSingleChoice: "\u0627\u062E\u062A\u064A\u0627\u0631 \u0648\u0627\u062D\u062F",
|
|
441
|
-
respMultiChoice: "\u0627\u062E\u062A\u064A\u0627\u0631 \u0645\u062A\u0639\u062F\u062F",
|
|
442
|
-
respConfirmation: "\u062A\u0623\u0643\u064A\u062F",
|
|
443
410
|
approvalRequired: "\u0645\u0637\u0644\u0648\u0628 \u0645\u0648\u0627\u0641\u0642\u0629",
|
|
444
411
|
approve: "\u0645\u0648\u0627\u0641\u0642\u0629",
|
|
445
412
|
reject: "\u0631\u0641\u0636",
|
|
@@ -544,7 +511,7 @@ var STRINGS_ES = {
|
|
|
544
511
|
newsLoading: "Cargando novedades\u2026",
|
|
545
512
|
newsBack: "Volver a novedades",
|
|
546
513
|
newsPublishedAt: "Publicado el {date}",
|
|
547
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
514
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ────
|
|
548
515
|
formSubmit: "Enviar",
|
|
549
516
|
formSkip: "Quiz\xE1 m\xE1s tarde",
|
|
550
517
|
formSubmitted: "Completado",
|
|
@@ -564,26 +531,15 @@ var STRINGS_ES = {
|
|
|
564
531
|
formChooseAtMost: "Elige como m\xE1ximo {max}",
|
|
565
532
|
formOther: "Otro",
|
|
566
533
|
formOtherPlaceholder: "Escribe tu respuesta\u2026",
|
|
567
|
-
inputRequired: "
|
|
568
|
-
inputBadge: "
|
|
534
|
+
inputRequired: "Preguntas para ti",
|
|
535
|
+
inputBadge: "Preguntas",
|
|
569
536
|
inputAnswered: "Respondido",
|
|
570
537
|
inputSkipped: "Omitido",
|
|
571
|
-
|
|
572
|
-
inputYourAnswer: "Tu respuesta",
|
|
573
|
-
inputSubmit: "Enviar respuesta",
|
|
538
|
+
inputSubmit: "Enviar respuestas",
|
|
574
539
|
inputSubmitHint: "Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",
|
|
575
|
-
inputAnswerPlaceholder: "Escribe tu respuesta\u2026",
|
|
576
540
|
inputSkip: "Omitir",
|
|
577
541
|
confirmYes: "S\xED",
|
|
578
542
|
confirmNo: "No",
|
|
579
|
-
inputConfirmHint: "Elige s\xED o no.",
|
|
580
|
-
inputOptionalNote: "Nota opcional",
|
|
581
|
-
inputOptionalNotePlaceholder: "Comentario opcional\u2026",
|
|
582
|
-
inputSubmitted: "Respuesta enviada",
|
|
583
|
-
respFreeText: "Texto libre",
|
|
584
|
-
respSingleChoice: "Opci\xF3n \xFAnica",
|
|
585
|
-
respMultiChoice: "Opci\xF3n m\xFAltiple",
|
|
586
|
-
respConfirmation: "Confirmaci\xF3n",
|
|
587
543
|
approvalRequired: "Aprobaci\xF3n requerida",
|
|
588
544
|
approve: "Aprobar",
|
|
589
545
|
reject: "Rechazar",
|
|
@@ -688,7 +644,7 @@ var STRINGS_HE = {
|
|
|
688
644
|
newsLoading: "\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",
|
|
689
645
|
newsBack: "\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",
|
|
690
646
|
newsPublishedAt: "\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",
|
|
691
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
647
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ────
|
|
692
648
|
formSubmit: "\u05E9\u05DC\u05D9\u05D7\u05D4",
|
|
693
649
|
formSkip: "\u05D0\u05D7\u05E8 \u05DB\u05DA",
|
|
694
650
|
formSubmitted: "\u05E0\u05E9\u05DC\u05D7",
|
|
@@ -708,26 +664,15 @@ var STRINGS_HE = {
|
|
|
708
664
|
formChooseAtMost: "\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",
|
|
709
665
|
formOther: "\u05D0\u05D7\u05E8",
|
|
710
666
|
formOtherPlaceholder: "\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",
|
|
711
|
-
inputRequired: "\
|
|
712
|
-
inputBadge: "\
|
|
667
|
+
inputRequired: "\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",
|
|
668
|
+
inputBadge: "\u05E9\u05D0\u05DC\u05D5\u05EA",
|
|
713
669
|
inputAnswered: "\u05E0\u05E2\u05E0\u05D4",
|
|
714
670
|
inputSkipped: "\u05D3\u05D5\u05DC\u05D2",
|
|
715
|
-
|
|
716
|
-
inputYourAnswer: "\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",
|
|
717
|
-
inputSubmit: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D4",
|
|
671
|
+
inputSubmit: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",
|
|
718
672
|
inputSubmitHint: "Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",
|
|
719
|
-
inputAnswerPlaceholder: "\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",
|
|
720
673
|
inputSkip: "\u05D3\u05D9\u05DC\u05D5\u05D2",
|
|
721
674
|
confirmYes: "\u05DB\u05DF",
|
|
722
675
|
confirmNo: "\u05DC\u05D0",
|
|
723
|
-
inputConfirmHint: "\u05D1\u05D7\u05E8 \u05DB\u05DF \u05D0\u05D5 \u05DC\u05D0.",
|
|
724
|
-
inputOptionalNote: "\u05D4\u05E2\u05E8\u05D4 \u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9\u05EA",
|
|
725
|
-
inputOptionalNotePlaceholder: "\u05D4\u05E2\u05E8\u05D4 \u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9\u05EA\u2026",
|
|
726
|
-
inputSubmitted: "\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4",
|
|
727
|
-
respFreeText: "\u05D8\u05E7\u05E1\u05D8 \u05D7\u05D5\u05E4\u05E9\u05D9",
|
|
728
|
-
respSingleChoice: "\u05D1\u05D7\u05D9\u05E8\u05D4 \u05D9\u05D7\u05D9\u05D3\u05D4",
|
|
729
|
-
respMultiChoice: "\u05D1\u05D7\u05D9\u05E8\u05D4 \u05DE\u05E8\u05D5\u05D1\u05D4",
|
|
730
|
-
respConfirmation: "\u05D0\u05D9\u05E9\u05D5\u05E8",
|
|
731
676
|
approvalRequired: "\u05E0\u05D3\u05E8\u05E9 \u05D0\u05D9\u05E9\u05D5\u05E8",
|
|
732
677
|
approve: "\u05D0\u05D9\u05E9\u05D5\u05E8",
|
|
733
678
|
reject: "\u05D3\u05D7\u05D9\u05D9\u05D4",
|
|
@@ -1850,7 +1795,7 @@ function applyHostAttributes(host, resolved) {
|
|
|
1850
1795
|
import { h, render as renderPreact } from "preact";
|
|
1851
1796
|
|
|
1852
1797
|
// src/ui/app.tsx
|
|
1853
|
-
import { useCallback as useCallback6, useEffect as useEffect16, useLayoutEffect as useLayoutEffect3, useMemo as useMemo3, useRef as useRef9, useState as
|
|
1798
|
+
import { useCallback as useCallback6, useEffect as useEffect16, useLayoutEffect as useLayoutEffect3, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
|
|
1854
1799
|
import { batch, useComputed as useComputed8, useSignal } from "@preact/signals";
|
|
1855
1800
|
|
|
1856
1801
|
// src/core/handshake-shape.ts
|
|
@@ -1935,7 +1880,7 @@ function createAuth(opts) {
|
|
|
1935
1880
|
}
|
|
1936
1881
|
|
|
1937
1882
|
// src/core/version.ts
|
|
1938
|
-
var ELEMENTS_VERSION = true ? "0.
|
|
1883
|
+
var ELEMENTS_VERSION = true ? "0.54.0" : "0.0.0-dev";
|
|
1939
1884
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
1940
1885
|
|
|
1941
1886
|
// src/stream/types.ts
|
|
@@ -3778,7 +3723,7 @@ var TID = {
|
|
|
3778
3723
|
helpArticle: `${p2}-help-article`,
|
|
3779
3724
|
/** News list item — suffix `-{id}`. */
|
|
3780
3725
|
newsItem: `${p2}-news-item`,
|
|
3781
|
-
// ── Forms + human-in-the-loop (forms / ask-
|
|
3726
|
+
// ── Forms + human-in-the-loop (forms / ask-questions / approval) ─────
|
|
3782
3727
|
/** Form gate root — a timeline row that locks the chat while open. */
|
|
3783
3728
|
formGate: `${p2}-form-gate`,
|
|
3784
3729
|
/** "Form submitted / skipped" marker row (wire-reconstructed on resume). */
|
|
@@ -3795,11 +3740,11 @@ var TID = {
|
|
|
3795
3740
|
formSkip: `${p2}-form-skip`,
|
|
3796
3741
|
/** A single form field control — suffix `-{name}` at the JSX site. */
|
|
3797
3742
|
formField: `${p2}-form-field`,
|
|
3798
|
-
/** Ask-
|
|
3799
|
-
|
|
3800
|
-
/** Ask-
|
|
3743
|
+
/** Ask-questions tool root (inline form in a message bubble). */
|
|
3744
|
+
toolAskQuestions: `${p2}-tool-ask-questions`,
|
|
3745
|
+
/** Ask-questions submit button. */
|
|
3801
3746
|
toolInputSubmit: `${p2}-tool-input-submit`,
|
|
3802
|
-
/** Ask-
|
|
3747
|
+
/** Ask-questions skip/cancel button. */
|
|
3803
3748
|
toolInputSkip: `${p2}-tool-input-skip`,
|
|
3804
3749
|
/** Tool-approval root (approve/reject prompt). */
|
|
3805
3750
|
toolApproval: `${p2}-tool-approval`,
|
|
@@ -4006,7 +3951,7 @@ var KEEP_VISIBLE = 56;
|
|
|
4006
3951
|
function useDragMove(panelEl, enabled) {
|
|
4007
3952
|
useEffect3(() => {
|
|
4008
3953
|
if (!enabled || !panelEl) return;
|
|
4009
|
-
const
|
|
3954
|
+
const num = (v) => Number.parseFloat(v) || 0;
|
|
4010
3955
|
const clamp = (v, max) => Math.min(max, Math.max(-max, v));
|
|
4011
3956
|
let drag = null;
|
|
4012
3957
|
const onDown = (e) => {
|
|
@@ -4017,8 +3962,8 @@ function useDragMove(panelEl, enabled) {
|
|
|
4017
3962
|
id: e.pointerId,
|
|
4018
3963
|
x: e.clientX,
|
|
4019
3964
|
y: e.clientY,
|
|
4020
|
-
dx:
|
|
4021
|
-
dy:
|
|
3965
|
+
dx: num(panelEl.style.getPropertyValue(`--${p4}-modal-dx`)),
|
|
3966
|
+
dy: num(panelEl.style.getPropertyValue(`--${p4}-modal-dy`)),
|
|
4022
3967
|
// Centred origin: |offset| ≤ (viewport + panel)/2 − keepVisible keeps a
|
|
4023
3968
|
// strip of the dialog reachable so it can never be lost off-screen.
|
|
4024
3969
|
maxX: (window.innerWidth + rect.width) / 2 - KEEP_VISIBLE,
|
|
@@ -4951,7 +4896,7 @@ function HeaderActions({ panelProps, variant }) {
|
|
|
4951
4896
|
}
|
|
4952
4897
|
|
|
4953
4898
|
// src/ui/message-list.tsx
|
|
4954
|
-
import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as
|
|
4899
|
+
import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "preact/hooks";
|
|
4955
4900
|
import { useComputed as useComputed6 } from "@preact/signals";
|
|
4956
4901
|
|
|
4957
4902
|
// src/ui/form/dynamic-form.tsx
|
|
@@ -5351,10 +5296,10 @@ function FormDoneMarker({
|
|
|
5351
5296
|
import { useComputed as useComputed5 } from "@preact/signals";
|
|
5352
5297
|
|
|
5353
5298
|
// src/stream/constants.ts
|
|
5354
|
-
function
|
|
5299
|
+
function isAskUserQuestionsTool(toolName2) {
|
|
5355
5300
|
if (!toolName2) return false;
|
|
5356
5301
|
const name = toolName2.startsWith("tool:") ? toolName2.slice(5) : toolName2;
|
|
5357
|
-
return name === "ask-user-
|
|
5302
|
+
return name === "ask-user-questions" || name === "ask_user_questions";
|
|
5358
5303
|
}
|
|
5359
5304
|
|
|
5360
5305
|
// src/ui/markdown.tsx
|
|
@@ -5621,107 +5566,103 @@ function ToolApproval({ part, strings, active, superseded = false, onDecision, o
|
|
|
5621
5566
|
] });
|
|
5622
5567
|
}
|
|
5623
5568
|
|
|
5624
|
-
// src/ui/tool-ask-
|
|
5569
|
+
// src/ui/tool-ask-questions.tsx
|
|
5625
5570
|
import { useComputed as useComputed3 } from "@preact/signals";
|
|
5626
|
-
import { useState as useState6 } from "preact/hooks";
|
|
5627
5571
|
|
|
5628
5572
|
// src/ui/form/field.ts
|
|
5629
|
-
|
|
5573
|
+
var QUESTION_TYPES = /* @__PURE__ */ new Set([
|
|
5574
|
+
"text",
|
|
5575
|
+
"email",
|
|
5576
|
+
"phone",
|
|
5577
|
+
"number",
|
|
5578
|
+
"date",
|
|
5579
|
+
"single-select",
|
|
5580
|
+
"multi-select",
|
|
5581
|
+
"boolean"
|
|
5582
|
+
]);
|
|
5583
|
+
function parseAskUserQuestions(input) {
|
|
5630
5584
|
const raw = input && typeof input === "object" ? input : {};
|
|
5631
|
-
const
|
|
5585
|
+
const rawQuestions = Array.isArray(raw.questions) ? raw.questions : [];
|
|
5586
|
+
const questions = rawQuestions.map(parseQuestion).filter((q) => q !== null);
|
|
5587
|
+
return { intro: str(raw.intro), questions };
|
|
5588
|
+
}
|
|
5589
|
+
function parseQuestion(value, index) {
|
|
5590
|
+
if (!value || typeof value !== "object") return null;
|
|
5591
|
+
const raw = value;
|
|
5592
|
+
const type = QUESTION_TYPES.has(raw.type) ? raw.type : "text";
|
|
5632
5593
|
return {
|
|
5633
|
-
|
|
5594
|
+
key: str(raw.key) ?? `q${index + 1}`,
|
|
5634
5595
|
question: str(raw.question) ?? "Please provide the missing information.",
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
allowOther: typeof raw.allowOther === "boolean" ? raw.allowOther : void 0,
|
|
5640
|
-
required: typeof raw.required === "boolean" ? raw.required : true,
|
|
5641
|
-
defaultValues: Array.isArray(raw.defaultValues) ? raw.defaultValues.filter((v) => typeof v === "string") : void 0,
|
|
5642
|
-
minSelections: num(raw.minSelections),
|
|
5643
|
-
maxSelections: num(raw.maxSelections),
|
|
5644
|
-
validationHint: str(raw.validationHint)
|
|
5596
|
+
type,
|
|
5597
|
+
options: Array.isArray(raw.options) ? raw.options.filter((o) => typeof o === "string" && o.trim().length > 0) : void 0,
|
|
5598
|
+
required: typeof raw.required === "boolean" ? raw.required : void 0,
|
|
5599
|
+
helpText: str(raw.helpText)
|
|
5645
5600
|
};
|
|
5646
5601
|
}
|
|
5647
|
-
function
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5602
|
+
function fieldTypeFor(type) {
|
|
5603
|
+
switch (type) {
|
|
5604
|
+
case "text":
|
|
5605
|
+
return "textarea";
|
|
5606
|
+
case "phone":
|
|
5607
|
+
return "tel";
|
|
5608
|
+
case "single-select":
|
|
5609
|
+
case "boolean":
|
|
5610
|
+
return "radio";
|
|
5611
|
+
case "multi-select":
|
|
5612
|
+
return "multiselect";
|
|
5613
|
+
default:
|
|
5614
|
+
return type;
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
function askQuestionsToFields(req, yesLabel, noLabel) {
|
|
5618
|
+
return req.questions.map((q) => {
|
|
5619
|
+
const type = fieldTypeFor(q.type);
|
|
5620
|
+
const options = q.type === "boolean" ? [
|
|
5621
|
+
{ value: "yes", label: yesLabel },
|
|
5622
|
+
{ value: "no", label: noLabel }
|
|
5623
|
+
] : (q.options ?? []).map((o) => ({ value: o, label: o }));
|
|
5624
|
+
return {
|
|
5625
|
+
name: q.key,
|
|
5626
|
+
label: q.question,
|
|
5658
5627
|
type,
|
|
5659
|
-
|
|
5660
|
-
required: req.required ?? true,
|
|
5661
|
-
defaultValue,
|
|
5628
|
+
required: q.required ?? false,
|
|
5662
5629
|
options: options.length > 0 ? options : void 0,
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
}
|
|
5667
|
-
];
|
|
5668
|
-
}
|
|
5669
|
-
function normalizeChoice(c) {
|
|
5670
|
-
if (typeof c === "string") return c ? { value: c, label: c } : null;
|
|
5671
|
-
if (c && typeof c.value === "string" && c.value)
|
|
5672
|
-
return { value: c.value, label: c.label ?? c.value, description: c.description };
|
|
5673
|
-
return null;
|
|
5630
|
+
validationHint: q.helpText
|
|
5631
|
+
};
|
|
5632
|
+
});
|
|
5674
5633
|
}
|
|
5675
5634
|
function str(v) {
|
|
5676
5635
|
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
5677
5636
|
}
|
|
5678
|
-
function num(v) {
|
|
5679
|
-
return typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
5680
|
-
}
|
|
5681
5637
|
|
|
5682
|
-
// src/ui/tool-ask-
|
|
5638
|
+
// src/ui/tool-ask-questions.tsx
|
|
5683
5639
|
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs13 } from "preact/jsx-runtime";
|
|
5684
5640
|
var p15 = BRAND.cssPrefix;
|
|
5685
|
-
function
|
|
5686
|
-
switch (req.responseType) {
|
|
5687
|
-
case "single-choice":
|
|
5688
|
-
return s.respSingleChoice;
|
|
5689
|
-
case "multi-choice":
|
|
5690
|
-
return s.respMultiChoice;
|
|
5691
|
-
case "confirmation":
|
|
5692
|
-
return s.respConfirmation;
|
|
5693
|
-
default:
|
|
5694
|
-
return s.respFreeText;
|
|
5695
|
-
}
|
|
5696
|
-
}
|
|
5697
|
-
function ToolAskInput({ part, strings, active, superseded = false, onSubmit, onDecision, onEdit }) {
|
|
5641
|
+
function ToolAskQuestions({ part, strings, active, superseded = false, onDecision, onEdit }) {
|
|
5698
5642
|
const state = useComputed3(() => part.stateSig.value);
|
|
5699
5643
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5700
|
-
const request = useComputed3(() =>
|
|
5644
|
+
const request = useComputed3(() => parseAskUserQuestions(part.inputSig.value));
|
|
5701
5645
|
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5702
|
-
const viaApproval = approval.value !== void 0;
|
|
5703
|
-
const resolve = (answer, accepted) => {
|
|
5704
|
-
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
5705
|
-
else if (request.value.responseType === "confirmation") onSubmit(part.toolCallId, { confirmed: accepted });
|
|
5706
|
-
else onSubmit(part.toolCallId, accepted ? { answer } : {});
|
|
5707
|
-
};
|
|
5708
5646
|
const req = request.value;
|
|
5709
5647
|
if (decided) {
|
|
5710
5648
|
const editable = responded && active && !terminal;
|
|
5711
5649
|
return /* @__PURE__ */ jsx16(DecidedCard, { part, strings, req, editable, onEdit: () => onEdit(part.toolCallId) });
|
|
5712
5650
|
}
|
|
5713
5651
|
const stale = superseded;
|
|
5714
|
-
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui${stale ? ` ${p15}-toolui-stale` : ""}`, "data-testid": TID.
|
|
5652
|
+
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui${stale ? ` ${p15}-toolui-stale` : ""}`, "data-testid": TID.toolAskQuestions, children: [
|
|
5715
5653
|
/* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-head`, children: stale ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5716
5654
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
5717
5655
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-muted`, children: strings.statusSuperseded })
|
|
5718
|
-
] }) : /* @__PURE__ */
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5656
|
+
] }) : /* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputRequired }) }),
|
|
5657
|
+
req.intro ? /* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-desc`, children: req.intro }) : null,
|
|
5658
|
+
stale ? null : /* @__PURE__ */ jsx16(
|
|
5659
|
+
AskBody,
|
|
5660
|
+
{
|
|
5661
|
+
req,
|
|
5662
|
+
strings,
|
|
5663
|
+
resolve: (reason, accepted) => onDecision(part.toolCallId, accepted, reason)
|
|
5664
|
+
}
|
|
5665
|
+
)
|
|
5725
5666
|
] });
|
|
5726
5667
|
}
|
|
5727
5668
|
function AskBody({
|
|
@@ -5729,72 +5670,32 @@ function AskBody({
|
|
|
5729
5670
|
strings,
|
|
5730
5671
|
resolve
|
|
5731
5672
|
}) {
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
}
|
|
5735
|
-
const fields = askInputToFields(req).map((f) => {
|
|
5736
|
-
f.label = strings.inputYourAnswer;
|
|
5737
|
-
f.placeholder = f.placeholder ?? strings.inputAnswerPlaceholder;
|
|
5738
|
-
return f;
|
|
5739
|
-
});
|
|
5673
|
+
const fields = askQuestionsToFields(req, strings.confirmYes, strings.confirmNo);
|
|
5674
|
+
const loneTextarea = req.questions.length === 1 && req.questions[0]?.type === "text";
|
|
5740
5675
|
return /* @__PURE__ */ jsx16(
|
|
5741
5676
|
DynamicForm,
|
|
5742
5677
|
{
|
|
5743
5678
|
fields,
|
|
5744
5679
|
strings,
|
|
5745
5680
|
submitLabel: strings.inputSubmit,
|
|
5746
|
-
footerHint:
|
|
5747
|
-
onSubmit: (values) => resolve(
|
|
5681
|
+
footerHint: loneTextarea ? strings.inputSubmitHint : void 0,
|
|
5682
|
+
onSubmit: (values) => resolve(buildAnswersReason(req.questions, values), true),
|
|
5748
5683
|
skipLabel: strings.inputSkip,
|
|
5749
5684
|
onSkip: () => resolve(void 0, false),
|
|
5750
|
-
submitOnEnter:
|
|
5685
|
+
submitOnEnter: loneTextarea,
|
|
5751
5686
|
submitTestId: TID.toolInputSubmit,
|
|
5752
5687
|
skipTestId: TID.toolInputSkip
|
|
5753
5688
|
}
|
|
5754
5689
|
);
|
|
5755
5690
|
}
|
|
5756
|
-
function
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
const no = () => resolve(void 0, false);
|
|
5765
|
-
const onKeyDown = (e) => {
|
|
5766
|
-
if (e.key !== "Enter" || e.shiftKey || e.isComposing) return;
|
|
5767
|
-
e.preventDefault();
|
|
5768
|
-
yes();
|
|
5769
|
-
};
|
|
5770
|
-
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5771
|
-
supportsNote ? /* @__PURE__ */ jsxs13("label", { class: `${p15}-field`, children: [
|
|
5772
|
-
/* @__PURE__ */ jsx16("span", { class: `${p15}-field-label`, children: strings.inputOptionalNote }),
|
|
5773
|
-
/* @__PURE__ */ jsx16(
|
|
5774
|
-
"textarea",
|
|
5775
|
-
{
|
|
5776
|
-
class: `${p15}-field-input`,
|
|
5777
|
-
rows: 2,
|
|
5778
|
-
value: note,
|
|
5779
|
-
placeholder: req.placeholder ?? strings.inputOptionalNotePlaceholder,
|
|
5780
|
-
onInput: (e) => setNote(e.target.value),
|
|
5781
|
-
onKeyDown,
|
|
5782
|
-
"data-testid": `${TID.formField}-note`
|
|
5783
|
-
}
|
|
5784
|
-
)
|
|
5785
|
-
] }) : null,
|
|
5786
|
-
/* @__PURE__ */ jsxs13("div", { class: `${p15}-form-actions`, children: [
|
|
5787
|
-
/* @__PURE__ */ jsx16("span", { class: `${p15}-form-hint`, children: strings.inputConfirmHint }),
|
|
5788
|
-
/* @__PURE__ */ jsx16("button", { type: "button", class: `${p15}-form-skip`, onClick: no, "data-testid": TID.toolInputSkip, children: strings.confirmNo }),
|
|
5789
|
-
/* @__PURE__ */ jsx16("button", { type: "button", class: `${p15}-form-submit`, onClick: yes, "data-testid": TID.toolInputSubmit, children: strings.confirmYes })
|
|
5790
|
-
] })
|
|
5791
|
-
] });
|
|
5792
|
-
}
|
|
5793
|
-
function Section({ label, text }) {
|
|
5794
|
-
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-section`, children: [
|
|
5795
|
-
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-label`, children: label }),
|
|
5796
|
-
/* @__PURE__ */ jsx16("p", { class: `${p15}-toolui-text`, children: text })
|
|
5797
|
-
] });
|
|
5691
|
+
function buildAnswersReason(questions, values) {
|
|
5692
|
+
const answers = questions.flatMap((q) => {
|
|
5693
|
+
const flat = values[q.key];
|
|
5694
|
+
if (flat == null || flat.trim() === "") return [];
|
|
5695
|
+
const value = q.type === "multi-select" ? flat.split(",").map((s) => s.trim()).filter(Boolean) : flat;
|
|
5696
|
+
return [{ key: q.key, value }];
|
|
5697
|
+
});
|
|
5698
|
+
return JSON.stringify({ answers });
|
|
5798
5699
|
}
|
|
5799
5700
|
function DecidedCard({
|
|
5800
5701
|
part,
|
|
@@ -5803,31 +5704,44 @@ function DecidedCard({
|
|
|
5803
5704
|
editable,
|
|
5804
5705
|
onEdit
|
|
5805
5706
|
}) {
|
|
5806
|
-
const output = useComputed3(() => part.outputSig.value);
|
|
5807
5707
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5808
5708
|
const skipped = approval.value?.approved === false;
|
|
5809
|
-
const
|
|
5709
|
+
const answers = approval.value?.approved ? parseAnswers(approval.value.reason) : {};
|
|
5810
5710
|
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui`, "data-testid": TID.toolDecision, children: [
|
|
5811
5711
|
/* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-head`, children: [
|
|
5812
5712
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
5813
5713
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge`, children: skipped ? strings.inputSkipped : strings.inputAnswered })
|
|
5814
5714
|
] }),
|
|
5815
|
-
req.
|
|
5816
|
-
|
|
5817
|
-
|
|
5715
|
+
req.intro ? /* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-desc`, children: req.intro }) : null,
|
|
5716
|
+
req.questions.map((q) => {
|
|
5717
|
+
const text = skipped ? "" : answers[q.key] ?? "";
|
|
5718
|
+
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-section`, children: [
|
|
5719
|
+
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-label`, children: q.question }),
|
|
5720
|
+
text ? /* @__PURE__ */ jsx16("p", { class: `${p15}-toolui-text`, children: text }) : null
|
|
5721
|
+
] }, q.key);
|
|
5722
|
+
}),
|
|
5818
5723
|
editable ? /* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-actions`, children: /* @__PURE__ */ jsx16("button", { type: "button", class: `${p15}-form-skip`, onClick: onEdit, "data-testid": TID.toolEdit, children: strings.edit }) }) : null
|
|
5819
5724
|
] });
|
|
5820
5725
|
}
|
|
5821
|
-
function
|
|
5822
|
-
if (
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5726
|
+
function parseAnswers(reason) {
|
|
5727
|
+
if (!reason) return {};
|
|
5728
|
+
const parsed = (() => {
|
|
5729
|
+
try {
|
|
5730
|
+
return JSON.parse(reason);
|
|
5731
|
+
} catch {
|
|
5732
|
+
return void 0;
|
|
5733
|
+
}
|
|
5734
|
+
})();
|
|
5735
|
+
const list = parsed?.answers;
|
|
5736
|
+
if (!Array.isArray(list)) return {};
|
|
5737
|
+
const out = {};
|
|
5738
|
+
for (const entry of list) {
|
|
5739
|
+
if (!entry || typeof entry !== "object") continue;
|
|
5740
|
+
const { key, value } = entry;
|
|
5741
|
+
if (typeof key !== "string") continue;
|
|
5742
|
+
out[key] = Array.isArray(value) ? value.filter((v) => typeof v === "string").join(", ") : String(value ?? "");
|
|
5829
5743
|
}
|
|
5830
|
-
return
|
|
5744
|
+
return out;
|
|
5831
5745
|
}
|
|
5832
5746
|
|
|
5833
5747
|
// src/ui/tool-call.tsx
|
|
@@ -5977,15 +5891,14 @@ function ToolPartView({
|
|
|
5977
5891
|
}) {
|
|
5978
5892
|
const hasApproval = useComputed5(() => part.approvalSig.value !== void 0);
|
|
5979
5893
|
if (tool?.humanInLoop) {
|
|
5980
|
-
if (
|
|
5894
|
+
if (isAskUserQuestionsTool(part.toolName)) {
|
|
5981
5895
|
return /* @__PURE__ */ jsx18(
|
|
5982
|
-
|
|
5896
|
+
ToolAskQuestions,
|
|
5983
5897
|
{
|
|
5984
5898
|
part,
|
|
5985
5899
|
strings,
|
|
5986
5900
|
active: interactive,
|
|
5987
5901
|
superseded,
|
|
5988
|
-
onSubmit: tool.onResult,
|
|
5989
5902
|
onDecision: tool.onDecision,
|
|
5990
5903
|
onEdit: tool.onEdit
|
|
5991
5904
|
}
|
|
@@ -6067,7 +5980,7 @@ function MessageList({
|
|
|
6067
5980
|
}) {
|
|
6068
5981
|
const ref = useRef5(null);
|
|
6069
5982
|
const messages = useComputed6(() => messagesSig.value);
|
|
6070
|
-
const [showJump, setShowJump] =
|
|
5983
|
+
const [showJump, setShowJump] = useState6(false);
|
|
6071
5984
|
const hasHydratedRef = useRef5(false);
|
|
6072
5985
|
const detachedRef = useRef5(false);
|
|
6073
5986
|
const interactingRef = useRef5(false);
|
|
@@ -6354,7 +6267,7 @@ function dayLabel(createdAt, strings) {
|
|
|
6354
6267
|
}
|
|
6355
6268
|
|
|
6356
6269
|
// src/ui/conversation-list.tsx
|
|
6357
|
-
import { useEffect as useEffect8, useState as
|
|
6270
|
+
import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
|
|
6358
6271
|
|
|
6359
6272
|
// src/ui/history-groups.ts
|
|
6360
6273
|
var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
|
|
@@ -6413,8 +6326,8 @@ function ConversationList({
|
|
|
6413
6326
|
}) {
|
|
6414
6327
|
const p36 = BRAND.cssPrefix;
|
|
6415
6328
|
const seed = transport.peekConversations({ visitorId });
|
|
6416
|
-
const [state, setState] =
|
|
6417
|
-
const [conversations, setChats] =
|
|
6329
|
+
const [state, setState] = useState7(seed ? "loaded" : "loading");
|
|
6330
|
+
const [conversations, setChats] = useState7(seed?.conversations ?? []);
|
|
6418
6331
|
useEffect8(() => {
|
|
6419
6332
|
let cancelled = false;
|
|
6420
6333
|
transport.listConversations({ visitorId }).then((res) => {
|
|
@@ -7020,7 +6933,7 @@ var chatLayout = {
|
|
|
7020
6933
|
};
|
|
7021
6934
|
|
|
7022
6935
|
// src/ui/modules/help.tsx
|
|
7023
|
-
import { useEffect as useEffect10, useMemo as useMemo2, useState as
|
|
6936
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
|
|
7024
6937
|
|
|
7025
6938
|
// src/ui/back-header.tsx
|
|
7026
6939
|
import { jsx as jsx25, jsxs as jsxs21 } from "preact/jsx-runtime";
|
|
@@ -7137,11 +7050,11 @@ function ArticleRow({ article, nav }) {
|
|
|
7137
7050
|
}
|
|
7138
7051
|
function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
7139
7052
|
const tags = config.contentTags;
|
|
7140
|
-
const [state, setState] =
|
|
7141
|
-
const [errorMsg, setErrorMsg] =
|
|
7142
|
-
const [items, setItems] =
|
|
7143
|
-
const [query, setQuery] =
|
|
7144
|
-
const [reloadKey, setReloadKey] =
|
|
7053
|
+
const [state, setState] = useState8("loading");
|
|
7054
|
+
const [errorMsg, setErrorMsg] = useState8(strings.errorGeneric);
|
|
7055
|
+
const [items, setItems] = useState8([]);
|
|
7056
|
+
const [query, setQuery] = useState8("");
|
|
7057
|
+
const [reloadKey, setReloadKey] = useState8(0);
|
|
7145
7058
|
useEffect10(() => {
|
|
7146
7059
|
let cancelled = false;
|
|
7147
7060
|
setState("loading");
|
|
@@ -7195,7 +7108,7 @@ var helpLayout = {
|
|
|
7195
7108
|
};
|
|
7196
7109
|
|
|
7197
7110
|
// src/ui/modules/home.tsx
|
|
7198
|
-
import { useEffect as useEffect11, useState as
|
|
7111
|
+
import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
|
|
7199
7112
|
|
|
7200
7113
|
// src/ui/home-card.tsx
|
|
7201
7114
|
import { jsx as jsx30 } from "preact/jsx-runtime";
|
|
@@ -7223,8 +7136,8 @@ function resolveGreeting(props2) {
|
|
|
7223
7136
|
var openContent = (nav, item) => item.url ? nav.push({ kind: "iframe", url: item.url, title: item.title }) : nav.push({ kind: "content", id: item.id, title: item.title });
|
|
7224
7137
|
function HomeRoot(props2) {
|
|
7225
7138
|
const { transport, strings, config, nav, bus, panelProps } = props2;
|
|
7226
|
-
const [recent, setRecent] =
|
|
7227
|
-
const [content, setContent] =
|
|
7139
|
+
const [recent, setRecent] = useState9(null);
|
|
7140
|
+
const [content, setContent] = useState9([]);
|
|
7228
7141
|
const tagsKey = config.contentTags?.join(",");
|
|
7229
7142
|
useEffect11(() => {
|
|
7230
7143
|
if (!config.showRecentConversations) return;
|
|
@@ -7314,16 +7227,16 @@ var homeLayout = {
|
|
|
7314
7227
|
};
|
|
7315
7228
|
|
|
7316
7229
|
// src/ui/modules/news.tsx
|
|
7317
|
-
import { useEffect as useEffect12, useState as
|
|
7230
|
+
import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
|
|
7318
7231
|
import { jsx as jsx32, jsxs as jsxs27 } from "preact/jsx-runtime";
|
|
7319
7232
|
var p29 = BRAND.cssPrefix;
|
|
7320
7233
|
var log14 = logger.scope("news");
|
|
7321
7234
|
function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
7322
7235
|
const tags = config.contentTags;
|
|
7323
|
-
const [state, setState] =
|
|
7324
|
-
const [errorMsg, setErrorMsg] =
|
|
7325
|
-
const [items, setItems] =
|
|
7326
|
-
const [reloadKey, setReloadKey] =
|
|
7236
|
+
const [state, setState] = useState10("loading");
|
|
7237
|
+
const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
|
|
7238
|
+
const [items, setItems] = useState10([]);
|
|
7239
|
+
const [reloadKey, setReloadKey] = useState10(0);
|
|
7327
7240
|
useEffect12(() => {
|
|
7328
7241
|
let cancelled = false;
|
|
7329
7242
|
setState("loading");
|
|
@@ -7446,15 +7359,15 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
7446
7359
|
}
|
|
7447
7360
|
|
|
7448
7361
|
// src/ui/content-view.tsx
|
|
7449
|
-
import { useCallback as useCallback3, useEffect as useEffect13, useState as
|
|
7362
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
|
|
7450
7363
|
import { jsx as jsx35, jsxs as jsxs30 } from "preact/jsx-runtime";
|
|
7451
7364
|
var p32 = BRAND.cssPrefix;
|
|
7452
7365
|
var log15 = logger.scope("content");
|
|
7453
7366
|
var READ_DWELL_MS = 5e3;
|
|
7454
7367
|
function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
7455
|
-
const [item, setItem] =
|
|
7456
|
-
const [failed, setFailed] =
|
|
7457
|
-
const [reloadKey, setReloadKey] =
|
|
7368
|
+
const [item, setItem] = useState11(null);
|
|
7369
|
+
const [failed, setFailed] = useState11(false);
|
|
7370
|
+
const [reloadKey, setReloadKey] = useState11(0);
|
|
7458
7371
|
const retry = useCallback3(() => {
|
|
7459
7372
|
setFailed(false);
|
|
7460
7373
|
setItem(null);
|
|
@@ -7698,11 +7611,11 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
7698
7611
|
}
|
|
7699
7612
|
|
|
7700
7613
|
// src/ui/use-launcher-callout.ts
|
|
7701
|
-
import { useCallback as useCallback5, useEffect as useEffect15, useState as
|
|
7614
|
+
import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
|
|
7702
7615
|
function useLauncherCallout({ callout, persistence }) {
|
|
7703
7616
|
const textKey = callout?.text ?? "";
|
|
7704
7617
|
const persistent = callout?.persistent ?? true;
|
|
7705
|
-
const [dismissed, setDismissed] =
|
|
7618
|
+
const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
7706
7619
|
useEffect15(() => {
|
|
7707
7620
|
setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
7708
7621
|
}, [textKey, persistent, persistence]);
|
|
@@ -7731,21 +7644,21 @@ function isAbortError(error) {
|
|
|
7731
7644
|
return error instanceof DOMException ? error.name === "AbortError" : error?.name === "AbortError";
|
|
7732
7645
|
}
|
|
7733
7646
|
function App({ options, hostElement, bus }) {
|
|
7734
|
-
const [persistence] =
|
|
7647
|
+
const [persistence] = useState13(
|
|
7735
7648
|
() => createPersistence(options.widgetId, options.storage, options.aiAgentDeploymentId)
|
|
7736
7649
|
);
|
|
7737
|
-
const [visitorId, setVisitorId] =
|
|
7650
|
+
const [visitorId, setVisitorId] = useState13(() => persistence.getVisitorId());
|
|
7738
7651
|
const initialSettings = persistence.loadUserPrefs();
|
|
7739
|
-
const [activeLocale, setActiveLocale] =
|
|
7740
|
-
const [activeThemeMode, setActiveThemeMode] =
|
|
7652
|
+
const [activeLocale, setActiveLocale] = useState13(() => initialSettings.locale ?? options.locale);
|
|
7653
|
+
const [activeThemeMode, setActiveThemeMode] = useState13(
|
|
7741
7654
|
() => initialSettings.themeMode ?? options.themeMode
|
|
7742
7655
|
);
|
|
7743
|
-
const [activeTextSize, setActiveTextSize] =
|
|
7656
|
+
const [activeTextSize, setActiveTextSize] = useState13(() => initialSettings.textSize ?? options.textSize);
|
|
7744
7657
|
const conversationIdSig = useSignal(persistence.loadConversationId());
|
|
7745
7658
|
const messagesSig = useSignal([]);
|
|
7746
7659
|
const unreadCountSig = useSignal(0);
|
|
7747
|
-
const [loadingMessages, setLoadingMessages] =
|
|
7748
|
-
const [formMarkers, setFormMarkers] =
|
|
7660
|
+
const [loadingMessages, setLoadingMessages] = useState13(false);
|
|
7661
|
+
const [formMarkers, setFormMarkers] = useState13([]);
|
|
7749
7662
|
function landingTab() {
|
|
7750
7663
|
const list = options.modules.list;
|
|
7751
7664
|
const ids = new Set(list.map((m) => m.id));
|
|
@@ -7764,15 +7677,15 @@ function App({ options, hostElement, bus }) {
|
|
|
7764
7677
|
const homeNav = homeNavRef.current;
|
|
7765
7678
|
const chatTabIdRef = useRef9(void 0);
|
|
7766
7679
|
chatTabIdRef.current = chatTabId();
|
|
7767
|
-
const [conversationReady, setConversationReady] =
|
|
7768
|
-
const [remoteForms, setRemoteForms] =
|
|
7769
|
-
const [formsReady, setFormsReady] =
|
|
7680
|
+
const [conversationReady, setConversationReady] = useState13(false);
|
|
7681
|
+
const [remoteForms, setRemoteForms] = useState13(null);
|
|
7682
|
+
const [formsReady, setFormsReady] = useState13(false);
|
|
7770
7683
|
const isInlineLike = options.mode === "standalone" || options.mode === "inline";
|
|
7771
7684
|
const initialPanelRef = useRef9(
|
|
7772
7685
|
resolveInitialPanelState(options, currentViewportWidth(), persistence.loadPanelOpen(), persistence.loadPanelSize())
|
|
7773
7686
|
);
|
|
7774
|
-
const [isOpen, setIsOpen] =
|
|
7775
|
-
const [activated, setActivated] =
|
|
7687
|
+
const [isOpen, setIsOpen] = useState13(initialPanelRef.current.panelOpen);
|
|
7688
|
+
const [activated, setActivated] = useState13(initialPanelRef.current.panelOpen);
|
|
7776
7689
|
const activatedRef = useRef9(activated);
|
|
7777
7690
|
activatedRef.current = activated;
|
|
7778
7691
|
const pendingThreadRef = useRef9(false);
|
|
@@ -7781,7 +7694,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7781
7694
|
if (isOpen) setActivated(true);
|
|
7782
7695
|
}, [isOpen]);
|
|
7783
7696
|
const initialPanelApplied = useRef9(false);
|
|
7784
|
-
const [launcherLeaving, setLauncherLeaving] =
|
|
7697
|
+
const [launcherLeaving, setLauncherLeaving] = useState13(false);
|
|
7785
7698
|
const { dismissed: calloutDismissed, dismissCallout: dismissCalloutRaw } = useLauncherCallout({
|
|
7786
7699
|
callout: options.launcher.callout,
|
|
7787
7700
|
persistence
|
|
@@ -7792,21 +7705,21 @@ function App({ options, hostElement, bus }) {
|
|
|
7792
7705
|
bus.emit("calloutDismiss", void 0);
|
|
7793
7706
|
dismissCalloutRaw();
|
|
7794
7707
|
}, [bus, dismissCalloutRaw]);
|
|
7795
|
-
const [panelSize, setPanelSize] =
|
|
7708
|
+
const [panelSize, setPanelSize] = useState13(initialPanelRef.current.panelSize);
|
|
7796
7709
|
const initialSizeApplied = useRef9(false);
|
|
7797
|
-
const [view, setView] =
|
|
7798
|
-
const [canSend, setCanSend] =
|
|
7799
|
-
const [streaming, setStreaming] =
|
|
7800
|
-
const [agent, setAgent] =
|
|
7801
|
-
const [suggestions, setSuggestions] =
|
|
7802
|
-
const [activeCancel, setActiveCancel] =
|
|
7803
|
-
const [activeDetach, setActiveDetach] =
|
|
7710
|
+
const [view, setView] = useState13("chat");
|
|
7711
|
+
const [canSend, setCanSend] = useState13(true);
|
|
7712
|
+
const [streaming, setStreaming] = useState13(false);
|
|
7713
|
+
const [agent, setAgent] = useState13(null);
|
|
7714
|
+
const [suggestions, setSuggestions] = useState13([]);
|
|
7715
|
+
const [activeCancel, setActiveCancel] = useState13(null);
|
|
7716
|
+
const [activeDetach, setActiveDetach] = useState13(null);
|
|
7804
7717
|
const stringsRef = useRef9(options.strings);
|
|
7805
|
-
const [parsedSite, setParsedSite] =
|
|
7806
|
-
const [parsedBlocks, setParsedBlocks] =
|
|
7807
|
-
const [sidebarCollapsed, setSidebarCollapsed] =
|
|
7808
|
-
const [formContext, setFormContext] =
|
|
7809
|
-
const [transport] =
|
|
7718
|
+
const [parsedSite, setParsedSite] = useState13(void 0);
|
|
7719
|
+
const [parsedBlocks, setParsedBlocks] = useState13(void 0);
|
|
7720
|
+
const [sidebarCollapsed, setSidebarCollapsed] = useState13(() => persistence.loadSidebarCollapsed() ?? false);
|
|
7721
|
+
const [formContext, setFormContext] = useState13({});
|
|
7722
|
+
const [transport] = useState13(
|
|
7810
7723
|
() => new AgentTransport({
|
|
7811
7724
|
agentApiBaseUrl: options.agentApiBaseUrl,
|
|
7812
7725
|
dataApiBaseUrl: options.dataApiBaseUrl,
|
|
@@ -7818,8 +7731,8 @@ function App({ options, hostElement, bus }) {
|
|
|
7818
7731
|
endpoints: options.endpoints
|
|
7819
7732
|
})
|
|
7820
7733
|
);
|
|
7821
|
-
const [reducer] =
|
|
7822
|
-
const [feedback] =
|
|
7734
|
+
const [reducer] = useState13(() => new StreamReducer(messagesSig));
|
|
7735
|
+
const [feedback] = useState13(() => new FeedbackBus(options.sound, options.haptics));
|
|
7823
7736
|
const patchAndSync = useCallback6(
|
|
7824
7737
|
(patch) => {
|
|
7825
7738
|
persistence.patchUserPrefs(patch);
|