@streamoid/chat-components 0.2.4 → 0.2.6

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/dist/index.d.ts CHANGED
@@ -57,10 +57,7 @@ declare const dynamicFormManifest: {
57
57
  readonly service: "common";
58
58
  readonly description: "Server-driven dynamic form supporting text, textarea, number, select, multiselect, checkbox, radio, approval, todo_list, and file upload fields";
59
59
  readonly containerStyle: {
60
- readonly overflow: "auto";
61
60
  readonly display: "flex";
62
- readonly marginTop: "8px";
63
- readonly paddingBottom: "16px";
64
61
  readonly position: "relative";
65
62
  readonly width: "100%";
66
63
  };
package/dist/index.js CHANGED
@@ -472,6 +472,11 @@ function DynamicForm(props) {
472
472
  mo.disconnect();
473
473
  };
474
474
  }, [checkScroll, isSubmitted, isLoading]);
475
+ useEffect(() => {
476
+ if (error && scrollRef.current) {
477
+ scrollRef.current.scrollTo({ top: scrollRef.current.scrollHeight, behavior: "smooth" });
478
+ }
479
+ }, [error]);
475
480
  const handleFieldChange = (fieldId, value) => {
476
481
  setFormValues((prev) => ({ ...prev, [fieldId]: value }));
477
482
  setError(null);
@@ -643,7 +648,25 @@ function DynamicForm(props) {
643
648
  form_title: title,
644
649
  values
645
650
  };
646
- const messageText = `User clicked "${userAction}" on form "${title}"`;
651
+ const valueSummaryParts = [];
652
+ for (const [fieldId, val] of Object.entries(values)) {
653
+ const field = fields.find((f) => f.id === fieldId);
654
+ const fieldLabel = field?.label || fieldId;
655
+ let displayVal;
656
+ if (field?.options && typeof val === "string") {
657
+ const opt = field.options.find((o) => o.id === val);
658
+ displayVal = opt?.label || val;
659
+ } else if (field?.options && Array.isArray(val)) {
660
+ displayVal = val.map((v) => field.options.find((o) => o.id === v)?.label || v).join(", ");
661
+ } else {
662
+ displayVal = String(val ?? "");
663
+ }
664
+ valueSummaryParts.push(`${fieldLabel}: ${displayVal}`);
665
+ }
666
+ const valueSummary = valueSummaryParts.length > 0 ? `
667
+ Submitted values:
668
+ ${valueSummaryParts.join("\n")}` : "";
669
+ const messageText = `User clicked "${userAction}" on form "${title}"${valueSummary}`;
647
670
  try {
648
671
  await onSubmit(resumePayload, messageText);
649
672
  setSubmittedData({ user_action: userAction, values });
@@ -1092,10 +1115,7 @@ var dynamicFormManifest = {
1092
1115
  service: "common",
1093
1116
  description: "Server-driven dynamic form supporting text, textarea, number, select, multiselect, checkbox, radio, approval, todo_list, and file upload fields",
1094
1117
  containerStyle: {
1095
- overflow: "auto",
1096
1118
  display: "flex",
1097
- marginTop: "8px",
1098
- paddingBottom: "16px",
1099
1119
  position: "relative",
1100
1120
  width: "100%"
1101
1121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/chat-components",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Shared chat UI components for the Streamoid chat host — DynamicForm and other cross-service components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",