pxengine 0.1.104 → 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
@@ -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",