pxengine 0.1.103 → 0.1.105

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
@@ -37903,7 +37903,7 @@ var DataTableCard = import_react71.default.memo(
37903
37903
  className: cn("border-b border-gray400/40 transition-colors hover:bg-white/[0.02]", rowIdx === safeRows.length - 1 && "border-b-0"),
37904
37904
  style: { borderBottomColor: theme?.border },
37905
37905
  children: cols.map((col, colIdx) => {
37906
- const raw = row?.[col.key] ?? row?.[col.label];
37906
+ const raw = Array.isArray(row) ? row[colIdx] : row?.[col.key] ?? row?.[col.label];
37907
37907
  const cell = raw ?? "\u2014";
37908
37908
  const isHighlight = highlight != null && (col.key === highlight || col.label === highlight);
37909
37909
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
@@ -38701,27 +38701,39 @@ function normalizeConfidence(c) {
38701
38701
  if (v.startsWith("l")) return "Low";
38702
38702
  return void 0;
38703
38703
  }
38704
+ function coerceItem(it, cardConfidence) {
38705
+ if (typeof it === "string") {
38706
+ const idx = it.indexOf(":");
38707
+ if (idx > 0 && idx < 60) {
38708
+ return {
38709
+ label: it.slice(0, idx).trim(),
38710
+ value: it.slice(idx + 1).trim(),
38711
+ confidence: normalizeConfidence(cardConfidence)
38712
+ };
38713
+ }
38714
+ return { label: it, value: "", confidence: normalizeConfidence(cardConfidence) };
38715
+ }
38716
+ return {
38717
+ label: it?.label ?? it?.finding ?? it?.metric ?? it?.title ?? it?.insight ?? "",
38718
+ value: it?.value ?? it?.data_point ?? it?.detail ?? it?.description ?? "",
38719
+ confidence: normalizeConfidence(it?.confidence ?? cardConfidence)
38720
+ };
38721
+ }
38704
38722
  function resolveItems(props) {
38705
38723
  const cardConfidence = props.confidence;
38706
- if (Array.isArray(props.insights) && props.insights.length > 0) {
38707
- return props.insights.map((it) => ({
38708
- label: it?.label ?? "",
38709
- value: it?.value ?? "",
38710
- confidence: normalizeConfidence(it?.confidence ?? cardConfidence)
38711
- }));
38712
- }
38713
- if (Array.isArray(props.key_findings) && props.key_findings.length > 0) {
38714
- return props.key_findings.map((f) => ({
38715
- label: f?.finding ?? f?.label ?? "",
38716
- value: f?.data_point ?? f?.value ?? "",
38717
- confidence: normalizeConfidence(f?.confidence ?? cardConfidence)
38718
- }));
38719
- }
38720
- return [];
38724
+ const source = [
38725
+ props.insights,
38726
+ props.key_findings,
38727
+ props.key_insights,
38728
+ props.findings,
38729
+ props.items
38730
+ ].find((a) => Array.isArray(a) && a.length > 0);
38731
+ if (!source) return [];
38732
+ return source.map((it) => coerceItem(it, cardConfidence));
38721
38733
  }
38722
38734
  var InsightSummaryCard = (props) => {
38723
38735
  const { title, className } = props;
38724
- const summary = props.summary ?? props.executive_summary;
38736
+ const summary = props.summary ?? props.executive_summary ?? props.thesis ?? props.subtitle;
38725
38737
  const items = resolveItems(props);
38726
38738
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
38727
38739
  "div",