pxengine 0.1.100 → 0.1.101

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.cjs CHANGED
@@ -38649,12 +38649,36 @@ var confidenceClass = {
38649
38649
  Medium: "text-amber-600 dark:text-amber-400",
38650
38650
  Low: "text-rose-600 dark:text-rose-400"
38651
38651
  };
38652
- var InsightSummaryCard = ({
38653
- title,
38654
- summary,
38655
- insights,
38656
- className
38657
- }) => {
38652
+ function normalizeConfidence(c) {
38653
+ if (!c) return void 0;
38654
+ const v = String(c).trim().toLowerCase();
38655
+ if (v.startsWith("h")) return "High";
38656
+ if (v.startsWith("m")) return "Medium";
38657
+ if (v.startsWith("l")) return "Low";
38658
+ return void 0;
38659
+ }
38660
+ function resolveItems(props) {
38661
+ const cardConfidence = props.confidence;
38662
+ if (Array.isArray(props.insights) && props.insights.length > 0) {
38663
+ return props.insights.map((it) => ({
38664
+ label: it?.label ?? "",
38665
+ value: it?.value ?? "",
38666
+ confidence: normalizeConfidence(it?.confidence ?? cardConfidence)
38667
+ }));
38668
+ }
38669
+ if (Array.isArray(props.key_findings) && props.key_findings.length > 0) {
38670
+ return props.key_findings.map((f) => ({
38671
+ label: f?.finding ?? f?.label ?? "",
38672
+ value: f?.data_point ?? f?.value ?? "",
38673
+ confidence: normalizeConfidence(f?.confidence ?? cardConfidence)
38674
+ }));
38675
+ }
38676
+ return [];
38677
+ }
38678
+ var InsightSummaryCard = (props) => {
38679
+ const { title, className } = props;
38680
+ const summary = props.summary ?? props.executive_summary;
38681
+ const items = resolveItems(props);
38658
38682
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
38659
38683
  "div",
38660
38684
  {
@@ -38665,20 +38689,29 @@ var InsightSummaryCard = ({
38665
38689
  children: [
38666
38690
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("h3", { className: "text-base font-semibold text-foreground", children: title }),
38667
38691
  summary ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-2 text-sm text-muted-foreground leading-relaxed", children: summary }) : null,
38668
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-4 space-y-2", children: (Array.isArray(insights) ? insights : []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
38692
+ items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-4 space-y-2", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
38669
38693
  "div",
38670
38694
  {
38671
38695
  className: "rounded-xl border border-border/70 bg-background/50 px-3 py-2",
38672
38696
  children: [
38673
38697
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
38674
38698
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-sm font-medium text-foreground", children: item.label }),
38675
- item.confidence ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: cn("text-xs font-semibold", confidenceClass[item.confidence]), children: item.confidence }) : null
38699
+ item.confidence ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
38700
+ "span",
38701
+ {
38702
+ className: cn(
38703
+ "text-xs font-semibold shrink-0",
38704
+ confidenceClass[item.confidence]
38705
+ ),
38706
+ children: item.confidence
38707
+ }
38708
+ ) : null
38676
38709
  ] }),
38677
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: item.value })
38710
+ item.value ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: item.value }) : null
38678
38711
  ]
38679
38712
  },
38680
38713
  `${item.label}-${index}`
38681
- )) })
38714
+ )) }) : null
38682
38715
  ]
38683
38716
  }
38684
38717
  );