@helpai/elements 0.51.6 → 0.51.7

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.mjs CHANGED
@@ -29,7 +29,7 @@ var BRAND = {
29
29
  };
30
30
 
31
31
  // src/core/version.ts
32
- var ELEMENTS_VERSION = true ? "0.51.6" : "0.0.0-dev";
32
+ var ELEMENTS_VERSION = true ? "0.51.7" : "0.0.0-dev";
33
33
  var ELEMENTS_VERSION_PARAM = "_ev";
34
34
 
35
35
  // src/i18n/strings.ts
@@ -6018,12 +6018,17 @@ function MessageList({
6018
6018
  return () => obs.disconnect();
6019
6019
  }, [messages.value]);
6020
6020
  const activeFormId = form?.form.id;
6021
+ const inlineForm = !!form && (formMarkers ?? []).some((m) => m.formId === form.form.id);
6021
6022
  useLayoutEffect2(() => {
6022
6023
  const el = ref.current;
6023
6024
  if (!el || !activeFormId || detachedRef.current) return;
6024
6025
  if (!messages.value.some((m) => m.role === "user")) return;
6025
- pinBottom(el);
6026
- }, [activeFormId]);
6026
+ if (inlineForm) {
6027
+ el.querySelector(`[data-testid="${TID.formGate}"]`)?.scrollIntoView({ block: "nearest" });
6028
+ } else {
6029
+ pinBottom(el);
6030
+ }
6031
+ }, [activeFormId, inlineForm]);
6027
6032
  useEffect7(() => {
6028
6033
  const el = ref.current;
6029
6034
  if (!el) return;
@@ -6096,15 +6101,29 @@ function MessageList({
6096
6101
  const pendingMarkers = [...formMarkers ?? []].toSorted(
6097
6102
  (a, b) => (a.createdAt ?? Infinity) - (b.createdAt ?? Infinity)
6098
6103
  );
6099
- const markerRow = (marker) => /* @__PURE__ */ jsx19(
6100
- FormDoneMarker,
6101
- {
6102
- marker,
6103
- strings,
6104
- onFill: !form && onFillForm ? () => onFillForm(marker.formId) : void 0
6105
- },
6106
- marker.key
6107
- );
6104
+ const markerRow = (marker) => {
6105
+ if (form && marker.formId === form.form.id) {
6106
+ return /* @__PURE__ */ jsx19(
6107
+ FormGate,
6108
+ {
6109
+ form: form.form,
6110
+ strings,
6111
+ onSubmit: form.onSubmit,
6112
+ onSkip: form.onSkip
6113
+ },
6114
+ `gate:${marker.formId}`
6115
+ );
6116
+ }
6117
+ return /* @__PURE__ */ jsx19(
6118
+ FormDoneMarker,
6119
+ {
6120
+ marker,
6121
+ strings,
6122
+ onFill: !form && onFillForm ? () => onFillForm(marker.formId) : void 0
6123
+ },
6124
+ marker.key
6125
+ );
6126
+ };
6108
6127
  const flushMarkersBefore = (createdAt) => {
6109
6128
  for (let next = pendingMarkers[0]; next?.createdAt !== void 0; next = pendingMarkers[0]) {
6110
6129
  if (createdAt !== void 0 && next.createdAt > createdAt) break;
@@ -6157,7 +6176,7 @@ function MessageList({
6157
6176
  children: [
6158
6177
  loading && messages.value.length === 0 ? /* @__PURE__ */ jsx19("div", { class: `${p18}-list-loading`, role: "status", children: strings.conversationLoading }) : null,
6159
6178
  rows,
6160
- form ? /* @__PURE__ */ jsx19(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6179
+ form && !inlineForm ? /* @__PURE__ */ jsx19(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6161
6180
  ]
6162
6181
  }
6163
6182
  ),
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.51.6"
83
+ "version": "0.51.7"
84
84
  }
package/web-component.mjs CHANGED
@@ -1794,7 +1794,7 @@ function createAuth(opts) {
1794
1794
  }
1795
1795
 
1796
1796
  // src/core/version.ts
1797
- var ELEMENTS_VERSION = true ? "0.51.6" : "0.0.0-dev";
1797
+ var ELEMENTS_VERSION = true ? "0.51.7" : "0.0.0-dev";
1798
1798
  var ELEMENTS_VERSION_PARAM = "_ev";
1799
1799
 
1800
1800
  // src/stream/types.ts
@@ -5977,12 +5977,17 @@ function MessageList({
5977
5977
  return () => obs.disconnect();
5978
5978
  }, [messages.value]);
5979
5979
  const activeFormId = form?.form.id;
5980
+ const inlineForm = !!form && (formMarkers ?? []).some((m) => m.formId === form.form.id);
5980
5981
  useLayoutEffect2(() => {
5981
5982
  const el = ref.current;
5982
5983
  if (!el || !activeFormId || detachedRef.current) return;
5983
5984
  if (!messages.value.some((m) => m.role === "user")) return;
5984
- pinBottom(el);
5985
- }, [activeFormId]);
5985
+ if (inlineForm) {
5986
+ el.querySelector(`[data-testid="${TID.formGate}"]`)?.scrollIntoView({ block: "nearest" });
5987
+ } else {
5988
+ pinBottom(el);
5989
+ }
5990
+ }, [activeFormId, inlineForm]);
5986
5991
  useEffect7(() => {
5987
5992
  const el = ref.current;
5988
5993
  if (!el) return;
@@ -6055,15 +6060,29 @@ function MessageList({
6055
6060
  const pendingMarkers = [...formMarkers ?? []].toSorted(
6056
6061
  (a, b) => (a.createdAt ?? Infinity) - (b.createdAt ?? Infinity)
6057
6062
  );
6058
- const markerRow = (marker) => /* @__PURE__ */ jsx19(
6059
- FormDoneMarker,
6060
- {
6061
- marker,
6062
- strings,
6063
- onFill: !form && onFillForm ? () => onFillForm(marker.formId) : void 0
6064
- },
6065
- marker.key
6066
- );
6063
+ const markerRow = (marker) => {
6064
+ if (form && marker.formId === form.form.id) {
6065
+ return /* @__PURE__ */ jsx19(
6066
+ FormGate,
6067
+ {
6068
+ form: form.form,
6069
+ strings,
6070
+ onSubmit: form.onSubmit,
6071
+ onSkip: form.onSkip
6072
+ },
6073
+ `gate:${marker.formId}`
6074
+ );
6075
+ }
6076
+ return /* @__PURE__ */ jsx19(
6077
+ FormDoneMarker,
6078
+ {
6079
+ marker,
6080
+ strings,
6081
+ onFill: !form && onFillForm ? () => onFillForm(marker.formId) : void 0
6082
+ },
6083
+ marker.key
6084
+ );
6085
+ };
6067
6086
  const flushMarkersBefore = (createdAt) => {
6068
6087
  for (let next = pendingMarkers[0]; next?.createdAt !== void 0; next = pendingMarkers[0]) {
6069
6088
  if (createdAt !== void 0 && next.createdAt > createdAt) break;
@@ -6116,7 +6135,7 @@ function MessageList({
6116
6135
  children: [
6117
6136
  loading && messages.value.length === 0 ? /* @__PURE__ */ jsx19("div", { class: `${p18}-list-loading`, role: "status", children: strings.conversationLoading }) : null,
6118
6137
  rows,
6119
- form ? /* @__PURE__ */ jsx19(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6138
+ form && !inlineForm ? /* @__PURE__ */ jsx19(FormGate, { form: form.form, strings, onSubmit: form.onSubmit, onSkip: form.onSkip }) : null
6120
6139
  ]
6121
6140
  }
6122
6141
  ),