@helpai/elements 0.61.5 → 0.62.1

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/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-D9QqhMzi.js';
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.61.5" : "0.0.0-dev";
32
+ var ELEMENTS_VERSION = true ? "0.62.1" : "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 composerAttachApiRef = useRef6(null);
6894
- const onDropItems = useCallback2((items) => {
6895
- composerAttachApiRef.current?.attachFromDrop(items);
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 })
@@ -7894,10 +7906,13 @@ function MessengerHome({
7894
7906
  el.removeEventListener("keydown", onKey);
7895
7907
  };
7896
7908
  }, [panelProps.onClose]);
7897
- const composerAttachApiRef = useRef8(null);
7898
- const onDropItems = useCallback4((items) => {
7899
- composerAttachApiRef.current?.attachFromDrop(items);
7900
- }, []);
7909
+ const composerApiRef = panelProps.composerApiRef;
7910
+ const onDropItems = useCallback4(
7911
+ (items) => {
7912
+ composerApiRef.current?.attachFromDrop(items);
7913
+ },
7914
+ [composerApiRef]
7915
+ );
7901
7916
  const { visible: dragOver } = useFileDrop({ containerRef, onDrop: onDropItems });
7902
7917
  useDragMove(containerRef.current, options.mode === "modal");
7903
7918
  const navState = useComputed8(() => nav.sig.value).value;
@@ -7948,7 +7963,7 @@ function MessengerHome({
7948
7963
  ...panelProps,
7949
7964
  containerEl: containerRef.current,
7950
7965
  dragOver,
7951
- composerAttachApiRef
7966
+ composerAttachApiRef: composerApiRef
7952
7967
  }
7953
7968
  );
7954
7969
  }
@@ -8230,6 +8245,7 @@ function App({ options, hostElement, bus }) {
8230
8245
  const resumeBubbleRef = useRef9(null);
8231
8246
  const regenerateDanglingRef = useRef9(null);
8232
8247
  const regenInFlightRef = useRef9(false);
8248
+ const composerApiRef = useRef9(null);
8233
8249
  const markActiveConversationReadRef = useRef9(null);
8234
8250
  const markReadTimerRef = useRef9();
8235
8251
  useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
@@ -9137,6 +9153,7 @@ function App({ options, hostElement, bus }) {
9137
9153
  feedback,
9138
9154
  bus,
9139
9155
  persistence,
9156
+ composerApiRef,
9140
9157
  view,
9141
9158
  canSend,
9142
9159
  isStreaming: streaming,
@@ -9162,9 +9179,10 @@ function App({ options, hostElement, bus }) {
9162
9179
  onStop: handleStop,
9163
9180
  onSuggestion: (s) => {
9164
9181
  const text = s.text ?? s.label;
9165
- log17.info("suggestion", { text });
9182
+ log17.info("suggestion", { text, autoSend: options.autoSendSuggestions });
9166
9183
  bus.emit("suggestion", { text });
9167
- void handleSend(text, []);
9184
+ if (options.autoSendSuggestions) void handleSend(text, []);
9185
+ else composerApiRef.current?.fill(text);
9168
9186
  },
9169
9187
  // Active form: replaces the composer as a gate and locks every chat action
9170
9188
  // until the visitor submits or (when skippable) skips.
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.61.5"
83
+ "version": "0.62.1"
84
84
  }
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-D9QqhMzi.js';
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.61.5" : "0.0.0-dev";
1935
+ var ELEMENTS_VERSION = true ? "0.62.1" : "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 composerAttachApiRef = useRef6(null);
6853
- const onDropItems = useCallback2((items) => {
6854
- composerAttachApiRef.current?.attachFromDrop(items);
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 })
@@ -7853,10 +7865,13 @@ function MessengerHome({
7853
7865
  el.removeEventListener("keydown", onKey);
7854
7866
  };
7855
7867
  }, [panelProps.onClose]);
7856
- const composerAttachApiRef = useRef8(null);
7857
- const onDropItems = useCallback4((items) => {
7858
- composerAttachApiRef.current?.attachFromDrop(items);
7859
- }, []);
7868
+ const composerApiRef = panelProps.composerApiRef;
7869
+ const onDropItems = useCallback4(
7870
+ (items) => {
7871
+ composerApiRef.current?.attachFromDrop(items);
7872
+ },
7873
+ [composerApiRef]
7874
+ );
7860
7875
  const { visible: dragOver } = useFileDrop({ containerRef, onDrop: onDropItems });
7861
7876
  useDragMove(containerRef.current, options.mode === "modal");
7862
7877
  const navState = useComputed8(() => nav.sig.value).value;
@@ -7907,7 +7922,7 @@ function MessengerHome({
7907
7922
  ...panelProps,
7908
7923
  containerEl: containerRef.current,
7909
7924
  dragOver,
7910
- composerAttachApiRef
7925
+ composerAttachApiRef: composerApiRef
7911
7926
  }
7912
7927
  );
7913
7928
  }
@@ -8189,6 +8204,7 @@ function App({ options, hostElement, bus }) {
8189
8204
  const resumeBubbleRef = useRef9(null);
8190
8205
  const regenerateDanglingRef = useRef9(null);
8191
8206
  const regenInFlightRef = useRef9(false);
8207
+ const composerApiRef = useRef9(null);
8192
8208
  const markActiveConversationReadRef = useRef9(null);
8193
8209
  const markReadTimerRef = useRef9();
8194
8210
  useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
@@ -9096,6 +9112,7 @@ function App({ options, hostElement, bus }) {
9096
9112
  feedback,
9097
9113
  bus,
9098
9114
  persistence,
9115
+ composerApiRef,
9099
9116
  view,
9100
9117
  canSend,
9101
9118
  isStreaming: streaming,
@@ -9121,9 +9138,10 @@ function App({ options, hostElement, bus }) {
9121
9138
  onStop: handleStop,
9122
9139
  onSuggestion: (s) => {
9123
9140
  const text = s.text ?? s.label;
9124
- log16.info("suggestion", { text });
9141
+ log16.info("suggestion", { text, autoSend: options.autoSendSuggestions });
9125
9142
  bus.emit("suggestion", { text });
9126
- void handleSend(text, []);
9143
+ if (options.autoSendSuggestions) void handleSend(text, []);
9144
+ else composerApiRef.current?.fill(text);
9127
9145
  },
9128
9146
  // Active form: replaces the composer as a gate and locks every chat action
9129
9147
  // until the visitor submits or (when skippable) skips.