@helpai/elements 0.61.5 → 0.62.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 +3 -0
- package/elements-web-component.esm.js +17 -17
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +17 -17
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +17 -17
- package/elements.esm.js.map +3 -3
- package/elements.js +17 -17
- package/elements.js.map +3 -3
- package/index.d.ts +5 -1
- package/index.mjs +24 -9
- package/package.json +1 -1
- package/schema.d.ts +2 -1
- package/schema.json +14 -2
- package/schema.mjs +3 -0
- package/web-component.mjs +24 -9
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-i9cta98X.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -871,6 +871,8 @@ interface BehaviorOptions {
|
|
|
871
871
|
showSources?: boolean;
|
|
872
872
|
/** Turn OFF the 👍/👎 feedback controls on assistant replies. Unset/`false` = shown (default). */
|
|
873
873
|
disableMessageFeedback?: boolean;
|
|
874
|
+
/** Auto-send a suggestion chip's text on tap. Unset/`false` = fill the composer to edit (default). */
|
|
875
|
+
autoSendSuggestions?: boolean;
|
|
874
876
|
}
|
|
875
877
|
/**
|
|
876
878
|
* Section: panel header actions — the enabled set (`history`/`close` buttons +
|
|
@@ -1187,6 +1189,8 @@ interface ResolvedOptions {
|
|
|
1187
1189
|
showSources: boolean;
|
|
1188
1190
|
/** Show 👍/👎 feedback controls on assistant replies. Default `true`. */
|
|
1189
1191
|
enableMessageFeedback: boolean;
|
|
1192
|
+
/** Auto-send a suggestion chip's text on tap (vs. filling the composer to edit). Default `false`. */
|
|
1193
|
+
autoSendSuggestions: boolean;
|
|
1190
1194
|
features: ResolvedFeatures;
|
|
1191
1195
|
/** Resolved event-driven forms — ordered list + trigger index. */
|
|
1192
1196
|
forms: ResolvedForms;
|
package/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var BRAND = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
// src/core/version.ts
|
|
32
|
-
var ELEMENTS_VERSION = true ? "0.
|
|
32
|
+
var ELEMENTS_VERSION = true ? "0.62.0" : "0.0.0-dev";
|
|
33
33
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
34
34
|
|
|
35
35
|
// src/i18n/strings.ts
|
|
@@ -1105,6 +1105,7 @@ function resolveOptions(rawOpts) {
|
|
|
1105
1105
|
showToolCalls: behavior.showToolCalls ?? false,
|
|
1106
1106
|
showSources: behavior.showSources ?? false,
|
|
1107
1107
|
enableMessageFeedback: !(behavior.disableMessageFeedback ?? false),
|
|
1108
|
+
autoSendSuggestions: behavior.autoSendSuggestions ?? false,
|
|
1108
1109
|
features: {
|
|
1109
1110
|
voice: opts.features?.voice ?? DEFAULT_FEATURES.voice,
|
|
1110
1111
|
fileUpload: !(opts.features?.disableFileUpload ?? false),
|
|
@@ -1433,7 +1434,8 @@ var BEHAVIOR_ATTRS = [
|
|
|
1433
1434
|
["show-reasoning", "showReasoning", boolAttr],
|
|
1434
1435
|
["show-tool-calls", "showToolCalls", boolAttr],
|
|
1435
1436
|
["show-sources", "showSources", boolAttr],
|
|
1436
|
-
["disable-message-feedback", "disableMessageFeedback", boolAttr]
|
|
1437
|
+
["disable-message-feedback", "disableMessageFeedback", boolAttr],
|
|
1438
|
+
["auto-send-suggestions", "autoSendSuggestions", boolAttr]
|
|
1437
1439
|
];
|
|
1438
1440
|
var I18N_ATTRS = [["locale", "locale"]];
|
|
1439
1441
|
var ACTION_NAMES = new Set(ACTION_NAME_LITERALS);
|
|
@@ -4526,6 +4528,13 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
|
|
|
4526
4528
|
log11.info("attach (drop)", { count: result.accepted.length, totalBytes: totalBytes(result.accepted) });
|
|
4527
4529
|
bus.emit("attach", { count: result.accepted.length, totalBytes: totalBytes(result.accepted) });
|
|
4528
4530
|
setAtts((prev) => [...prev, ...result.accepted]);
|
|
4531
|
+
},
|
|
4532
|
+
fill: (value) => {
|
|
4533
|
+
setText(value);
|
|
4534
|
+
const el = taRef.current;
|
|
4535
|
+
if (!el) return;
|
|
4536
|
+
el.focus({ preventScroll: true });
|
|
4537
|
+
requestAnimationFrame(() => el.setSelectionRange(el.value.length, el.value.length));
|
|
4529
4538
|
}
|
|
4530
4539
|
};
|
|
4531
4540
|
return () => {
|
|
@@ -6890,10 +6899,13 @@ function Panel(props2) {
|
|
|
6890
6899
|
el.removeEventListener("keydown", onKey);
|
|
6891
6900
|
};
|
|
6892
6901
|
}, [onClose]);
|
|
6893
|
-
const
|
|
6894
|
-
const onDropItems = useCallback2(
|
|
6895
|
-
|
|
6896
|
-
|
|
6902
|
+
const composerApiRef = props2.composerApiRef;
|
|
6903
|
+
const onDropItems = useCallback2(
|
|
6904
|
+
(items) => {
|
|
6905
|
+
composerApiRef.current?.attachFromDrop(items);
|
|
6906
|
+
},
|
|
6907
|
+
[composerApiRef]
|
|
6908
|
+
);
|
|
6897
6909
|
const { visible: dragOver } = useFileDrop({ containerRef, onDrop: onDropItems });
|
|
6898
6910
|
useDragMove(containerRef.current, options.mode === "modal");
|
|
6899
6911
|
return /* @__PURE__ */ jsxs18(
|
|
@@ -6913,7 +6925,7 @@ function Panel(props2) {
|
|
|
6913
6925
|
...props2,
|
|
6914
6926
|
containerEl: containerRef.current,
|
|
6915
6927
|
dragOver,
|
|
6916
|
-
composerAttachApiRef
|
|
6928
|
+
composerAttachApiRef: composerApiRef
|
|
6917
6929
|
}
|
|
6918
6930
|
),
|
|
6919
6931
|
/* @__PURE__ */ jsx23(PoweredByBar, { poweredBy: props2.options.poweredBy })
|
|
@@ -8230,6 +8242,7 @@ function App({ options, hostElement, bus }) {
|
|
|
8230
8242
|
const resumeBubbleRef = useRef9(null);
|
|
8231
8243
|
const regenerateDanglingRef = useRef9(null);
|
|
8232
8244
|
const regenInFlightRef = useRef9(false);
|
|
8245
|
+
const composerApiRef = useRef9(null);
|
|
8233
8246
|
const markActiveConversationReadRef = useRef9(null);
|
|
8234
8247
|
const markReadTimerRef = useRef9();
|
|
8235
8248
|
useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
|
|
@@ -9137,6 +9150,7 @@ function App({ options, hostElement, bus }) {
|
|
|
9137
9150
|
feedback,
|
|
9138
9151
|
bus,
|
|
9139
9152
|
persistence,
|
|
9153
|
+
composerApiRef,
|
|
9140
9154
|
view,
|
|
9141
9155
|
canSend,
|
|
9142
9156
|
isStreaming: streaming,
|
|
@@ -9162,9 +9176,10 @@ function App({ options, hostElement, bus }) {
|
|
|
9162
9176
|
onStop: handleStop,
|
|
9163
9177
|
onSuggestion: (s) => {
|
|
9164
9178
|
const text = s.text ?? s.label;
|
|
9165
|
-
log17.info("suggestion", { text });
|
|
9179
|
+
log17.info("suggestion", { text, autoSend: options.autoSendSuggestions });
|
|
9166
9180
|
bus.emit("suggestion", { text });
|
|
9167
|
-
void handleSend(text, []);
|
|
9181
|
+
if (options.autoSendSuggestions) void handleSend(text, []);
|
|
9182
|
+
else composerApiRef.current?.fill(text);
|
|
9168
9183
|
},
|
|
9169
9184
|
// Active form: replaces the composer as a gate and locks every chat action
|
|
9170
9185
|
// until the visitor submits or (when skippable) skips.
|
package/package.json
CHANGED
package/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-i9cta98X.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -85,6 +85,7 @@ declare const behaviorSchema: z.ZodObject<{
|
|
|
85
85
|
showToolCalls: z.ZodDefault<z.ZodBoolean>;
|
|
86
86
|
showSources: z.ZodDefault<z.ZodBoolean>;
|
|
87
87
|
disableMessageFeedback: z.ZodDefault<z.ZodBoolean>;
|
|
88
|
+
autoSendSuggestions: z.ZodDefault<z.ZodBoolean>;
|
|
88
89
|
}, z.core.$loose>;
|
|
89
90
|
type Behavior = z.infer<typeof behaviorSchema>;
|
|
90
91
|
|
package/schema.json
CHANGED
|
@@ -489,6 +489,11 @@
|
|
|
489
489
|
"default": false,
|
|
490
490
|
"description": "Turn OFF the 👍/👎 feedback controls under each assistant reply. Unset/`false` = shown (default), `true` = hidden. A choice fires the `messageFeedback` event and is POSTed best-effort to `/pai/message-feedback`.",
|
|
491
491
|
"type": "boolean"
|
|
492
|
+
},
|
|
493
|
+
"autoSendSuggestions": {
|
|
494
|
+
"default": false,
|
|
495
|
+
"description": "Auto-send a suggestion chip's text the moment it's tapped. `false` (default) fills the composer with the text so the visitor can edit before sending; `true` sends it immediately.",
|
|
496
|
+
"type": "boolean"
|
|
492
497
|
}
|
|
493
498
|
},
|
|
494
499
|
"required": [
|
|
@@ -497,7 +502,8 @@
|
|
|
497
502
|
"showReasoning",
|
|
498
503
|
"showToolCalls",
|
|
499
504
|
"showSources",
|
|
500
|
-
"disableMessageFeedback"
|
|
505
|
+
"disableMessageFeedback",
|
|
506
|
+
"autoSendSuggestions"
|
|
501
507
|
],
|
|
502
508
|
"additionalProperties": {},
|
|
503
509
|
"description": "Conversation behaviour — lifecycle, streaming, and the transcript surface (scroll, feedback).",
|
|
@@ -2360,6 +2366,11 @@
|
|
|
2360
2366
|
"default": false,
|
|
2361
2367
|
"description": "Turn OFF the 👍/👎 feedback controls under each assistant reply. Unset/`false` = shown (default), `true` = hidden. A choice fires the `messageFeedback` event and is POSTed best-effort to `/pai/message-feedback`.",
|
|
2362
2368
|
"type": "boolean"
|
|
2369
|
+
},
|
|
2370
|
+
"autoSendSuggestions": {
|
|
2371
|
+
"default": false,
|
|
2372
|
+
"description": "Auto-send a suggestion chip's text the moment it's tapped. `false` (default) fills the composer with the text so the visitor can edit before sending; `true` sends it immediately.",
|
|
2373
|
+
"type": "boolean"
|
|
2363
2374
|
}
|
|
2364
2375
|
},
|
|
2365
2376
|
"required": [
|
|
@@ -2368,7 +2379,8 @@
|
|
|
2368
2379
|
"showReasoning",
|
|
2369
2380
|
"showToolCalls",
|
|
2370
2381
|
"showSources",
|
|
2371
|
-
"disableMessageFeedback"
|
|
2382
|
+
"disableMessageFeedback",
|
|
2383
|
+
"autoSendSuggestions"
|
|
2372
2384
|
],
|
|
2373
2385
|
"additionalProperties": {},
|
|
2374
2386
|
"description": "Conversation behaviour — lifecycle, streaming, and the transcript surface (scroll, feedback).",
|
package/schema.mjs
CHANGED
|
@@ -133,6 +133,9 @@ var behaviorSchema = z4.object({
|
|
|
133
133
|
),
|
|
134
134
|
disableMessageFeedback: z4.boolean().default(false).describe(
|
|
135
135
|
"Turn OFF the \u{1F44D}/\u{1F44E} feedback controls under each assistant reply. Unset/`false` = shown (default), `true` = hidden. A choice fires the `messageFeedback` event and is POSTed best-effort to `/pai/message-feedback`."
|
|
136
|
+
),
|
|
137
|
+
autoSendSuggestions: z4.boolean().default(false).describe(
|
|
138
|
+
"Auto-send a suggestion chip's text the moment it's tapped. `false` (default) fills the composer with the text so the visitor can edit before sending; `true` sends it immediately."
|
|
136
139
|
)
|
|
137
140
|
}).loose().describe("Conversation behaviour \u2014 lifecycle, streaming, and the transcript surface (scroll, feedback).").meta({
|
|
138
141
|
examples: [
|
package/web-component.mjs
CHANGED
|
@@ -1086,6 +1086,7 @@ function resolveOptions(rawOpts) {
|
|
|
1086
1086
|
showToolCalls: behavior.showToolCalls ?? false,
|
|
1087
1087
|
showSources: behavior.showSources ?? false,
|
|
1088
1088
|
enableMessageFeedback: !(behavior.disableMessageFeedback ?? false),
|
|
1089
|
+
autoSendSuggestions: behavior.autoSendSuggestions ?? false,
|
|
1089
1090
|
features: {
|
|
1090
1091
|
voice: opts.features?.voice ?? DEFAULT_FEATURES.voice,
|
|
1091
1092
|
fileUpload: !(opts.features?.disableFileUpload ?? false),
|
|
@@ -1414,7 +1415,8 @@ var BEHAVIOR_ATTRS = [
|
|
|
1414
1415
|
["show-reasoning", "showReasoning", boolAttr],
|
|
1415
1416
|
["show-tool-calls", "showToolCalls", boolAttr],
|
|
1416
1417
|
["show-sources", "showSources", boolAttr],
|
|
1417
|
-
["disable-message-feedback", "disableMessageFeedback", boolAttr]
|
|
1418
|
+
["disable-message-feedback", "disableMessageFeedback", boolAttr],
|
|
1419
|
+
["auto-send-suggestions", "autoSendSuggestions", boolAttr]
|
|
1418
1420
|
];
|
|
1419
1421
|
var I18N_ATTRS = [["locale", "locale"]];
|
|
1420
1422
|
var ACTION_NAMES = new Set(ACTION_NAME_LITERALS);
|
|
@@ -1930,7 +1932,7 @@ function createAuth(opts) {
|
|
|
1930
1932
|
}
|
|
1931
1933
|
|
|
1932
1934
|
// src/core/version.ts
|
|
1933
|
-
var ELEMENTS_VERSION = true ? "0.
|
|
1935
|
+
var ELEMENTS_VERSION = true ? "0.62.0" : "0.0.0-dev";
|
|
1934
1936
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
1935
1937
|
|
|
1936
1938
|
// src/stream/types.ts
|
|
@@ -4485,6 +4487,13 @@ function Composer({ options, transport, feedback, bus, isStreaming, onSend, onSt
|
|
|
4485
4487
|
log10.info("attach (drop)", { count: result.accepted.length, totalBytes: totalBytes(result.accepted) });
|
|
4486
4488
|
bus.emit("attach", { count: result.accepted.length, totalBytes: totalBytes(result.accepted) });
|
|
4487
4489
|
setAtts((prev) => [...prev, ...result.accepted]);
|
|
4490
|
+
},
|
|
4491
|
+
fill: (value) => {
|
|
4492
|
+
setText(value);
|
|
4493
|
+
const el = taRef.current;
|
|
4494
|
+
if (!el) return;
|
|
4495
|
+
el.focus({ preventScroll: true });
|
|
4496
|
+
requestAnimationFrame(() => el.setSelectionRange(el.value.length, el.value.length));
|
|
4488
4497
|
}
|
|
4489
4498
|
};
|
|
4490
4499
|
return () => {
|
|
@@ -6849,10 +6858,13 @@ function Panel(props2) {
|
|
|
6849
6858
|
el.removeEventListener("keydown", onKey);
|
|
6850
6859
|
};
|
|
6851
6860
|
}, [onClose]);
|
|
6852
|
-
const
|
|
6853
|
-
const onDropItems = useCallback2(
|
|
6854
|
-
|
|
6855
|
-
|
|
6861
|
+
const composerApiRef = props2.composerApiRef;
|
|
6862
|
+
const onDropItems = useCallback2(
|
|
6863
|
+
(items) => {
|
|
6864
|
+
composerApiRef.current?.attachFromDrop(items);
|
|
6865
|
+
},
|
|
6866
|
+
[composerApiRef]
|
|
6867
|
+
);
|
|
6856
6868
|
const { visible: dragOver } = useFileDrop({ containerRef, onDrop: onDropItems });
|
|
6857
6869
|
useDragMove(containerRef.current, options.mode === "modal");
|
|
6858
6870
|
return /* @__PURE__ */ jsxs18(
|
|
@@ -6872,7 +6884,7 @@ function Panel(props2) {
|
|
|
6872
6884
|
...props2,
|
|
6873
6885
|
containerEl: containerRef.current,
|
|
6874
6886
|
dragOver,
|
|
6875
|
-
composerAttachApiRef
|
|
6887
|
+
composerAttachApiRef: composerApiRef
|
|
6876
6888
|
}
|
|
6877
6889
|
),
|
|
6878
6890
|
/* @__PURE__ */ jsx23(PoweredByBar, { poweredBy: props2.options.poweredBy })
|
|
@@ -8189,6 +8201,7 @@ function App({ options, hostElement, bus }) {
|
|
|
8189
8201
|
const resumeBubbleRef = useRef9(null);
|
|
8190
8202
|
const regenerateDanglingRef = useRef9(null);
|
|
8191
8203
|
const regenInFlightRef = useRef9(false);
|
|
8204
|
+
const composerApiRef = useRef9(null);
|
|
8192
8205
|
const markActiveConversationReadRef = useRef9(null);
|
|
8193
8206
|
const markReadTimerRef = useRef9();
|
|
8194
8207
|
useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
|
|
@@ -9096,6 +9109,7 @@ function App({ options, hostElement, bus }) {
|
|
|
9096
9109
|
feedback,
|
|
9097
9110
|
bus,
|
|
9098
9111
|
persistence,
|
|
9112
|
+
composerApiRef,
|
|
9099
9113
|
view,
|
|
9100
9114
|
canSend,
|
|
9101
9115
|
isStreaming: streaming,
|
|
@@ -9121,9 +9135,10 @@ function App({ options, hostElement, bus }) {
|
|
|
9121
9135
|
onStop: handleStop,
|
|
9122
9136
|
onSuggestion: (s) => {
|
|
9123
9137
|
const text = s.text ?? s.label;
|
|
9124
|
-
log16.info("suggestion", { text });
|
|
9138
|
+
log16.info("suggestion", { text, autoSend: options.autoSendSuggestions });
|
|
9125
9139
|
bus.emit("suggestion", { text });
|
|
9126
|
-
void handleSend(text, []);
|
|
9140
|
+
if (options.autoSendSuggestions) void handleSend(text, []);
|
|
9141
|
+
else composerApiRef.current?.fill(text);
|
|
9127
9142
|
},
|
|
9128
9143
|
// Active form: replaces the composer as a gate and locks every chat action
|
|
9129
9144
|
// until the visitor submits or (when skippable) skips.
|