@firstlovecenter/ai-chat 0.6.0 → 0.7.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/dist/ui/index.js CHANGED
@@ -468,17 +468,22 @@ function sanitiseBlock(input) {
468
468
  }
469
469
  return { kind: "callout", tone: input.tone, text: input.text };
470
470
  }
471
+ function isBlankString(v) {
472
+ return typeof v !== "string" || !v.trim();
473
+ }
471
474
  function isBlockEmpty(b) {
472
475
  if (b.kind === "paragraph_brief") {
473
- if (b.prose && b.prose.trim()) return false;
474
- return b.key_facts.length === 0 || b.key_facts.every((f) => !f.trim());
476
+ if (typeof b.prose === "string" && b.prose.trim()) return false;
477
+ const facts = Array.isArray(b.key_facts) ? b.key_facts : [];
478
+ return facts.length === 0 || facts.every(isBlankString);
475
479
  }
476
480
  if (b.kind === "list") {
477
- return b.items.length === 0 || b.items.every((i) => !i.trim());
481
+ const items = Array.isArray(b.items) ? b.items : [];
482
+ return items.length === 0 || items.every(isBlankString);
478
483
  }
479
- if (b.kind === "callout") return !b.text.trim();
480
- if (b.kind === "chart") return b.data.length === 0;
481
- if (b.kind === "table") return b.rows.length === 0;
484
+ if (b.kind === "callout") return isBlankString(b.text);
485
+ if (b.kind === "chart") return !Array.isArray(b.data) || b.data.length === 0;
486
+ if (b.kind === "table") return !Array.isArray(b.rows) || b.rows.length === 0;
482
487
  return false;
483
488
  }
484
489
  function AnswerBlocks({ blocks }) {