@streamoid/chat-components 0.2.5 → 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.
Files changed (2) hide show
  1. package/dist/index.js +19 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -648,7 +648,25 @@ function DynamicForm(props) {
648
648
  form_title: title,
649
649
  values
650
650
  };
651
- 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}`;
652
670
  try {
653
671
  await onSubmit(resumePayload, messageText);
654
672
  setSubmittedData({ user_action: userAction, values });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/chat-components",
3
- "version": "0.2.5",
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",