@rebasepro/plugin-insights 0.0.1-canary.eae7889 → 0.1.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.
Files changed (47) hide show
  1. package/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
  2. package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
  3. package/dist/core/src/components/common/useDataTableController.d.ts +3 -3
  4. package/dist/core/src/components/index.d.ts +1 -0
  5. package/dist/core/src/hooks/data/useRelationSelector.d.ts +2 -2
  6. package/dist/core/src/hooks/index.d.ts +1 -0
  7. package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
  8. package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
  9. package/dist/index.es.js +314 -214
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +314 -214
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/plugin-insights/src/components/CollectionInsightsInline.d.ts +3 -2
  14. package/dist/plugin-insights/src/components/InsightWidget.d.ts +4 -1
  15. package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +6 -0
  16. package/dist/plugin-insights/src/engine/useInsightsData.d.ts +2 -2
  17. package/dist/plugin-insights/src/types/engine.d.ts +10 -1
  18. package/dist/types/src/controllers/auth.d.ts +8 -2
  19. package/dist/types/src/controllers/client.d.ts +13 -0
  20. package/dist/types/src/controllers/collection_registry.d.ts +2 -1
  21. package/dist/types/src/controllers/data_driver.d.ts +36 -1
  22. package/dist/types/src/controllers/navigation.d.ts +18 -6
  23. package/dist/types/src/controllers/registry.d.ts +9 -1
  24. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
  25. package/dist/types/src/rebase_context.d.ts +17 -0
  26. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  27. package/dist/types/src/types/collections.d.ts +31 -11
  28. package/dist/types/src/types/component_ref.d.ts +47 -0
  29. package/dist/types/src/types/cron.d.ts +1 -1
  30. package/dist/types/src/types/entity_views.d.ts +6 -7
  31. package/dist/types/src/types/formex.d.ts +40 -0
  32. package/dist/types/src/types/index.d.ts +3 -0
  33. package/dist/types/src/types/plugins.d.ts +6 -3
  34. package/dist/types/src/types/properties.d.ts +72 -88
  35. package/dist/types/src/types/slots.d.ts +20 -10
  36. package/dist/types/src/types/translations.d.ts +6 -0
  37. package/dist/ui/src/components/FileUpload.d.ts +1 -1
  38. package/dist/ui/src/components/SearchBar.d.ts +5 -1
  39. package/dist/ui/src/styles.d.ts +2 -2
  40. package/package.json +3 -3
  41. package/src/components/CollectionInsightsInline.tsx +10 -2
  42. package/src/components/HomeCardInsightSlot.tsx +5 -1
  43. package/src/components/InsightWidget.tsx +5 -1
  44. package/src/components/InsightWidgetSkeleton.tsx +116 -34
  45. package/src/engine/useInsightsData.ts +5 -5
  46. package/src/types/engine.ts +11 -1
  47. package/src/useInsightsPlugin.tsx +1 -1
package/dist/index.es.js CHANGED
@@ -86,8 +86,8 @@ function InsightsProvider(t0) {
86
86
  function useInsightsEngine() {
87
87
  return useContext(InsightsContext);
88
88
  }
89
- function useInsightsData(definition, collectionSlug) {
90
- const $ = c(16);
89
+ function useInsightsData(definition, context) {
90
+ const $ = c(18);
91
91
  const engine = useInsightsEngine();
92
92
  const cache = engine?.cache ?? null;
93
93
  const {
@@ -100,9 +100,9 @@ function useInsightsData(definition, collectionSlug) {
100
100
  const [data, setData] = useState(null);
101
101
  const [loading, setLoading] = useState(true);
102
102
  const [error, setError] = useState(null);
103
- const cacheKey = `${definition.id}:${collectionSlug ?? "global"}`;
103
+ const cacheKey = `${definition.id}:${context.path ?? context.collectionSlug ?? "global"}`;
104
104
  let t0;
105
- if ($[0] !== authReady || $[1] !== cache || $[2] !== cacheKey || $[3] !== definition) {
105
+ if ($[0] !== authReady || $[1] !== cache || $[2] !== cacheKey || $[3] !== context || $[4] !== definition) {
106
106
  t0 = () => {
107
107
  if (!authReady || !cache) {
108
108
  return;
@@ -135,7 +135,7 @@ function useInsightsData(definition, collectionSlug) {
135
135
  }
136
136
  setLoading(true);
137
137
  setError(null);
138
- const promise = definition.data();
138
+ const promise = definition.data(context);
139
139
  cache.setInflight(cacheKey, promise);
140
140
  promise.then((result_0) => {
141
141
  cache.set(cacheKey, result_0);
@@ -158,38 +158,40 @@ function useInsightsData(definition, collectionSlug) {
158
158
  $[0] = authReady;
159
159
  $[1] = cache;
160
160
  $[2] = cacheKey;
161
- $[3] = definition;
162
- $[4] = t0;
161
+ $[3] = context;
162
+ $[4] = definition;
163
+ $[5] = t0;
163
164
  } else {
164
- t0 = $[4];
165
+ t0 = $[5];
165
166
  }
166
167
  let t1;
167
- if ($[5] !== authReady || $[6] !== cache || $[7] !== cacheKey || $[8] !== collectionSlug || $[9] !== definition.data || $[10] !== definition.id) {
168
- t1 = [definition.id, definition.data, collectionSlug, cacheKey, cache, authReady];
169
- $[5] = authReady;
170
- $[6] = cache;
171
- $[7] = cacheKey;
172
- $[8] = collectionSlug;
173
- $[9] = definition.data;
174
- $[10] = definition.id;
175
- $[11] = t1;
176
- } else {
177
- t1 = $[11];
168
+ if ($[6] !== authReady || $[7] !== cache || $[8] !== cacheKey || $[9] !== context.collectionSlug || $[10] !== context.path || $[11] !== definition.data || $[12] !== definition.id) {
169
+ t1 = [definition.id, definition.data, context.path, context.collectionSlug, cacheKey, cache, authReady];
170
+ $[6] = authReady;
171
+ $[7] = cache;
172
+ $[8] = cacheKey;
173
+ $[9] = context.collectionSlug;
174
+ $[10] = context.path;
175
+ $[11] = definition.data;
176
+ $[12] = definition.id;
177
+ $[13] = t1;
178
+ } else {
179
+ t1 = $[13];
178
180
  }
179
181
  useEffect(t0, t1);
180
182
  let t2;
181
- if ($[12] !== data || $[13] !== error || $[14] !== loading) {
183
+ if ($[14] !== data || $[15] !== error || $[16] !== loading) {
182
184
  t2 = {
183
185
  data,
184
186
  loading,
185
187
  error
186
188
  };
187
- $[12] = data;
188
- $[13] = error;
189
- $[14] = loading;
190
- $[15] = t2;
189
+ $[14] = data;
190
+ $[15] = error;
191
+ $[16] = loading;
192
+ $[17] = t2;
191
193
  } else {
192
- t2 = $[15];
194
+ t2 = $[17];
193
195
  }
194
196
  return t2;
195
197
  }
@@ -479,7 +481,7 @@ function InsightsScorecardView(t0) {
479
481
  }
480
482
  InsightsScorecardView.displayName = "InsightsScorecardView";
481
483
  function InsightWidgetSkeleton(t0) {
482
- const $ = c(35);
484
+ const $ = c(17);
483
485
  const {
484
486
  config,
485
487
  compact: t1,
@@ -492,282 +494,363 @@ function InsightWidgetSkeleton(t0) {
492
494
  const hasDateRange = Boolean(config.dateRange);
493
495
  if (compact) {
494
496
  const t32 = embedded ? "h-full px-2.5 py-2" : "flex flex-col gap-0.5 rounded-md bg-transparent border min-w-0 px-2.5 py-2";
495
- const t42 = !embedded && defaultBorderMixin;
496
- let t52;
497
- if ($[0] !== t32 || $[1] !== t42) {
498
- t52 = cls("animate-pulse", t32, t42);
497
+ const t4 = !embedded && defaultBorderMixin;
498
+ let t5;
499
+ if ($[0] !== t32 || $[1] !== t4) {
500
+ t5 = cls("animate-pulse", t32, t4);
499
501
  $[0] = t32;
500
- $[1] = t42;
501
- $[2] = t52;
502
+ $[1] = t4;
503
+ $[2] = t5;
502
504
  } else {
503
- t52 = $[2];
505
+ t5 = $[2];
504
506
  }
505
- let t62;
507
+ let t6;
506
508
  if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
507
- t62 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
509
+ t6 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
508
510
  height: 14,
509
511
  width: 48
510
512
  } });
511
- $[3] = t62;
513
+ $[3] = t6;
512
514
  } else {
513
- t62 = $[3];
515
+ t6 = $[3];
514
516
  }
515
- let t72;
517
+ let t7;
516
518
  if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
517
- t72 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
519
+ t7 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
518
520
  height: 20,
519
521
  width: 40
520
522
  } });
521
- $[4] = t72;
523
+ $[4] = t7;
522
524
  } else {
523
- t72 = $[4];
525
+ t7 = $[4];
524
526
  }
525
- let t82;
527
+ let t8;
526
528
  if ($[5] !== hasComparison) {
527
- t82 = hasComparison && /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded-sm", style: {
529
+ t8 = hasComparison && /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded-sm", style: {
528
530
  height: 14,
529
531
  width: 28
530
532
  } });
531
533
  $[5] = hasComparison;
532
- $[6] = t82;
534
+ $[6] = t8;
533
535
  } else {
534
- t82 = $[6];
536
+ t8 = $[6];
535
537
  }
536
- let t92;
537
- if ($[7] !== t82) {
538
- t92 = /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-1.5", children: [
539
- t72,
540
- t82
538
+ let t9;
539
+ if ($[7] !== t8) {
540
+ t9 = /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-1.5", children: [
541
+ t7,
542
+ t8
541
543
  ] });
542
- $[7] = t82;
543
- $[8] = t92;
544
+ $[7] = t8;
545
+ $[8] = t9;
544
546
  } else {
545
- t92 = $[8];
547
+ t9 = $[8];
546
548
  }
547
- let t102;
548
- if ($[9] !== t52 || $[10] !== t92) {
549
- t102 = /* @__PURE__ */ jsxs("div", { className: t52, children: [
550
- t62,
551
- t92
549
+ let t10;
550
+ if ($[9] !== t5 || $[10] !== t9) {
551
+ t10 = /* @__PURE__ */ jsxs("div", { className: t5, children: [
552
+ t6,
553
+ t9
552
554
  ] });
553
- $[9] = t52;
554
- $[10] = t92;
555
- $[11] = t102;
555
+ $[9] = t5;
556
+ $[10] = t9;
557
+ $[11] = t10;
556
558
  } else {
557
- t102 = $[11];
559
+ t10 = $[11];
558
560
  }
559
- return t102;
561
+ return t10;
560
562
  }
561
- const t3 = embedded ? "h-full px-5 py-4" : "rounded-lg bg-transparent border px-5 py-4";
562
- const t4 = !embedded && defaultBorderMixin;
563
- let t5;
564
- if ($[12] !== t3 || $[13] !== t4) {
565
- t5 = cls("animate-pulse", t3, t4);
566
- $[12] = t3;
567
- $[13] = t4;
568
- $[14] = t5;
563
+ let t3;
564
+ if ($[12] !== embedded || $[13] !== hasComparison || $[14] !== hasDateRange || $[15] !== hasIcon) {
565
+ t3 = /* @__PURE__ */ jsx(StandardSkeleton, { hasComparison, hasIcon, hasDateRange, embedded });
566
+ $[12] = embedded;
567
+ $[13] = hasComparison;
568
+ $[14] = hasDateRange;
569
+ $[15] = hasIcon;
570
+ $[16] = t3;
569
571
  } else {
570
- t5 = $[14];
572
+ t3 = $[16];
571
573
  }
572
- let t6;
573
- if ($[15] !== embedded) {
574
- t6 = embedded ? void 0 : {
575
- minHeight: 92
574
+ return t3;
575
+ }
576
+ function StandardSkeleton(t0) {
577
+ const $ = c(36);
578
+ const {
579
+ hasComparison,
580
+ hasIcon,
581
+ hasDateRange,
582
+ embedded
583
+ } = t0;
584
+ const containerRef = useRef(null);
585
+ const [containerWidth, setContainerWidth] = useState(null);
586
+ let t1;
587
+ let t2;
588
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
589
+ t1 = () => {
590
+ if (!containerRef.current) {
591
+ return;
592
+ }
593
+ setContainerWidth(containerRef.current.offsetWidth);
594
+ const observer = new ResizeObserver((entries) => {
595
+ for (const entry of entries) {
596
+ setContainerWidth(entry.contentRect.width);
597
+ }
598
+ });
599
+ observer.observe(containerRef.current);
600
+ return () => observer.disconnect();
601
+ };
602
+ t2 = [];
603
+ $[0] = t1;
604
+ $[1] = t2;
605
+ } else {
606
+ t1 = $[0];
607
+ t2 = $[1];
608
+ }
609
+ React.useLayoutEffect(t1, t2);
610
+ const isSmall = containerWidth !== null && containerWidth < 200;
611
+ const titleHeight = isSmall ? 15 : 16.5;
612
+ const valueHeight = isSmall ? 22.5 : containerWidth !== null && containerWidth < 300 ? 25 : 30;
613
+ const iconSize = isSmall ? 14 : 18;
614
+ let t3;
615
+ let t4;
616
+ if ($[2] !== embedded || $[3] !== isSmall) {
617
+ const baseClass = embedded ? `flex flex-col min-w-0 h-full ${isSmall ? "px-3.5 py-3" : "px-5 py-4"}` : cls("rounded-lg flex flex-col min-w-0 bg-transparent border", defaultBorderMixin, isSmall ? "px-3.5 py-3" : "px-5 py-4");
618
+ t3 = containerRef;
619
+ t4 = cls("animate-pulse", baseClass);
620
+ $[2] = embedded;
621
+ $[3] = isSmall;
622
+ $[4] = t3;
623
+ $[5] = t4;
624
+ } else {
625
+ t3 = $[4];
626
+ t4 = $[5];
627
+ }
628
+ let t5;
629
+ if ($[6] !== embedded || $[7] !== isSmall) {
630
+ t5 = embedded ? void 0 : {
631
+ minHeight: isSmall ? 68 : 92
576
632
  };
577
- $[15] = embedded;
578
- $[16] = t6;
633
+ $[6] = embedded;
634
+ $[7] = isSmall;
635
+ $[8] = t5;
579
636
  } else {
580
- t6 = $[16];
637
+ t5 = $[8];
581
638
  }
639
+ const t6 = `flex items-center justify-between ${isSmall ? "mb-1" : "mb-2"}`;
582
640
  let t7;
583
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
641
+ if ($[9] !== titleHeight) {
584
642
  t7 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
585
- height: 16,
643
+ height: titleHeight,
586
644
  width: "60%"
587
645
  } });
588
- $[17] = t7;
646
+ $[9] = titleHeight;
647
+ $[10] = t7;
589
648
  } else {
590
- t7 = $[17];
649
+ t7 = $[10];
591
650
  }
592
651
  let t8;
593
- if ($[18] !== hasDateRange) {
594
- t8 = hasDateRange && /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5", style: {
652
+ if ($[11] !== hasDateRange || $[12] !== isSmall) {
653
+ t8 = hasDateRange && !isSmall && /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5", style: {
595
654
  height: 14,
596
655
  width: "40%"
597
656
  } });
598
- $[18] = hasDateRange;
599
- $[19] = t8;
657
+ $[11] = hasDateRange;
658
+ $[12] = isSmall;
659
+ $[13] = t8;
600
660
  } else {
601
- t8 = $[19];
661
+ t8 = $[13];
602
662
  }
603
663
  let t9;
604
- if ($[20] !== t8) {
664
+ if ($[14] !== t7 || $[15] !== t8) {
605
665
  t9 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
606
666
  t7,
607
667
  t8
608
668
  ] });
609
- $[20] = t8;
610
- $[21] = t9;
669
+ $[14] = t7;
670
+ $[15] = t8;
671
+ $[16] = t9;
611
672
  } else {
612
- t9 = $[21];
673
+ t9 = $[16];
613
674
  }
614
675
  let t10;
615
- if ($[22] !== hasIcon) {
616
- t10 = hasIcon && /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded ml-2 shrink-0", style: {
617
- height: 18,
618
- width: 18
619
- } });
620
- $[22] = hasIcon;
621
- $[23] = t10;
676
+ if ($[17] !== hasIcon || $[18] !== iconSize) {
677
+ t10 = hasIcon && /* @__PURE__ */ jsx("span", { className: "ml-2 shrink-0", children: /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
678
+ height: iconSize,
679
+ width: iconSize
680
+ } }) });
681
+ $[17] = hasIcon;
682
+ $[18] = iconSize;
683
+ $[19] = t10;
622
684
  } else {
623
- t10 = $[23];
685
+ t10 = $[19];
624
686
  }
625
687
  let t11;
626
- if ($[24] !== t10 || $[25] !== t9) {
627
- t11 = /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
688
+ if ($[20] !== t10 || $[21] !== t6 || $[22] !== t9) {
689
+ t11 = /* @__PURE__ */ jsxs("div", { className: t6, children: [
628
690
  t9,
629
691
  t10
630
692
  ] });
631
- $[24] = t10;
632
- $[25] = t9;
633
- $[26] = t11;
693
+ $[20] = t10;
694
+ $[21] = t6;
695
+ $[22] = t9;
696
+ $[23] = t11;
634
697
  } else {
635
- t11 = $[26];
698
+ t11 = $[23];
636
699
  }
637
700
  let t12;
638
- if ($[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
701
+ if ($[24] !== valueHeight) {
639
702
  t12 = /* @__PURE__ */ jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
640
- height: 32,
703
+ height: valueHeight,
641
704
  width: "40%"
642
705
  } });
643
- $[27] = t12;
706
+ $[24] = valueHeight;
707
+ $[25] = t12;
644
708
  } else {
645
- t12 = $[27];
709
+ t12 = $[25];
646
710
  }
647
711
  let t13;
648
- if ($[28] !== hasComparison) {
649
- t13 = hasComparison && /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-1", style: {
712
+ if ($[26] !== hasComparison || $[27] !== isSmall) {
713
+ t13 = hasComparison && /* @__PURE__ */ jsx("div", { className: isSmall ? "mt-0.5" : "mt-1", children: /* @__PURE__ */ jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded", style: {
650
714
  height: 16,
651
715
  width: "25%"
652
- } });
653
- $[28] = hasComparison;
654
- $[29] = t13;
716
+ } }) });
717
+ $[26] = hasComparison;
718
+ $[27] = isSmall;
719
+ $[28] = t13;
655
720
  } else {
656
- t13 = $[29];
721
+ t13 = $[28];
657
722
  }
658
723
  let t14;
659
- if ($[30] !== t11 || $[31] !== t13 || $[32] !== t5 || $[33] !== t6) {
660
- t14 = /* @__PURE__ */ jsxs("div", { className: t5, style: t6, children: [
724
+ if ($[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t3 || $[33] !== t4 || $[34] !== t5) {
725
+ t14 = /* @__PURE__ */ jsxs("div", { ref: t3, className: t4, style: t5, children: [
661
726
  t11,
662
727
  t12,
663
728
  t13
664
729
  ] });
665
- $[30] = t11;
730
+ $[29] = t11;
731
+ $[30] = t12;
666
732
  $[31] = t13;
667
- $[32] = t5;
668
- $[33] = t6;
669
- $[34] = t14;
733
+ $[32] = t3;
734
+ $[33] = t4;
735
+ $[34] = t5;
736
+ $[35] = t14;
670
737
  } else {
671
- t14 = $[34];
738
+ t14 = $[35];
672
739
  }
673
740
  return t14;
674
741
  }
675
742
  InsightWidgetSkeleton.displayName = "InsightWidgetSkeleton";
676
743
  function InsightWidget(t0) {
677
- const $ = c(21);
744
+ const $ = c(25);
678
745
  const {
679
746
  definition,
680
747
  collectionSlug,
748
+ path,
749
+ parentCollectionSlugs,
681
750
  compact: t1,
682
751
  embedded: t2
683
752
  } = t0;
684
753
  const compact = t1 === void 0 ? false : t1;
685
754
  const embedded = t2 === void 0 ? false : t2;
755
+ let t3;
756
+ if ($[0] !== collectionSlug || $[1] !== parentCollectionSlugs || $[2] !== path) {
757
+ t3 = {
758
+ path,
759
+ collectionSlug,
760
+ parentCollectionSlugs
761
+ };
762
+ $[0] = collectionSlug;
763
+ $[1] = parentCollectionSlugs;
764
+ $[2] = path;
765
+ $[3] = t3;
766
+ } else {
767
+ t3 = $[3];
768
+ }
686
769
  const {
687
770
  data,
688
771
  loading,
689
772
  error
690
- } = useInsightsData(definition, collectionSlug);
773
+ } = useInsightsData(definition, t3);
691
774
  if (loading) {
692
- let t32;
693
- if ($[0] !== compact || $[1] !== definition.scorecard || $[2] !== embedded) {
694
- t32 = /* @__PURE__ */ jsx(InsightWidgetSkeleton, { config: definition.scorecard, compact, embedded });
695
- $[0] = compact;
696
- $[1] = definition.scorecard;
697
- $[2] = embedded;
698
- $[3] = t32;
775
+ let t42;
776
+ if ($[4] !== compact || $[5] !== definition.scorecard || $[6] !== embedded) {
777
+ t42 = /* @__PURE__ */ jsx(InsightWidgetSkeleton, { config: definition.scorecard, compact, embedded });
778
+ $[4] = compact;
779
+ $[5] = definition.scorecard;
780
+ $[6] = embedded;
781
+ $[7] = t42;
699
782
  } else {
700
- t32 = $[3];
783
+ t42 = $[7];
701
784
  }
702
- return t32;
785
+ return t42;
703
786
  }
704
787
  if (error) {
705
- const t32 = `text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
706
- let t42;
707
- if ($[4] !== definition.title) {
708
- t42 = /* @__PURE__ */ jsx("div", { className: "font-semibold mb-1", children: definition.title });
709
- $[4] = definition.title;
710
- $[5] = t42;
711
- } else {
712
- t42 = $[5];
713
- }
714
- let t5;
715
- if ($[6] !== error.message) {
716
- t5 = /* @__PURE__ */ jsx("div", { children: error.message });
717
- $[6] = error.message;
718
- $[7] = t5;
788
+ const t42 = `text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
789
+ let t52;
790
+ if ($[8] !== definition.title) {
791
+ t52 = /* @__PURE__ */ jsx("div", { className: "font-semibold mb-1", children: definition.title });
792
+ $[8] = definition.title;
793
+ $[9] = t52;
719
794
  } else {
720
- t5 = $[7];
795
+ t52 = $[9];
721
796
  }
722
797
  let t6;
723
- if ($[8] !== t32 || $[9] !== t42 || $[10] !== t5) {
724
- t6 = /* @__PURE__ */ jsxs("div", { className: t32, children: [
725
- t42,
726
- t5
727
- ] });
728
- $[8] = t32;
729
- $[9] = t42;
730
- $[10] = t5;
798
+ if ($[10] !== error.message) {
799
+ t6 = /* @__PURE__ */ jsx("div", { children: error.message });
800
+ $[10] = error.message;
731
801
  $[11] = t6;
732
802
  } else {
733
803
  t6 = $[11];
734
804
  }
735
- return t6;
805
+ let t7;
806
+ if ($[12] !== t42 || $[13] !== t52 || $[14] !== t6) {
807
+ t7 = /* @__PURE__ */ jsxs("div", { className: t42, children: [
808
+ t52,
809
+ t6
810
+ ] });
811
+ $[12] = t42;
812
+ $[13] = t52;
813
+ $[14] = t6;
814
+ $[15] = t7;
815
+ } else {
816
+ t7 = $[15];
817
+ }
818
+ return t7;
736
819
  }
737
820
  if (!data || data.rows.length === 0) {
738
- const t32 = `text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
739
- let t42;
740
- if ($[12] !== definition.title || $[13] !== t32) {
741
- t42 = /* @__PURE__ */ jsxs("div", { className: t32, children: [
821
+ const t42 = `text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
822
+ let t52;
823
+ if ($[16] !== definition.title || $[17] !== t42) {
824
+ t52 = /* @__PURE__ */ jsxs("div", { className: t42, children: [
742
825
  definition.title,
743
826
  " — No data"
744
827
  ] });
745
- $[12] = definition.title;
746
- $[13] = t32;
747
- $[14] = t42;
828
+ $[16] = definition.title;
829
+ $[17] = t42;
830
+ $[18] = t52;
748
831
  } else {
749
- t42 = $[14];
832
+ t52 = $[18];
750
833
  }
751
- return t42;
834
+ return t52;
752
835
  }
753
- const t3 = data.rows[0];
754
- let t4;
755
- if ($[15] !== compact || $[16] !== definition.scorecard || $[17] !== definition.title || $[18] !== embedded || $[19] !== t3) {
756
- t4 = /* @__PURE__ */ jsx(InsightsScorecardView, { config: definition.scorecard, data: t3, title: definition.title, compact, embedded });
757
- $[15] = compact;
758
- $[16] = definition.scorecard;
759
- $[17] = definition.title;
760
- $[18] = embedded;
761
- $[19] = t3;
762
- $[20] = t4;
763
- } else {
764
- t4 = $[20];
765
- }
766
- return t4;
836
+ const t4 = data.rows[0];
837
+ let t5;
838
+ if ($[19] !== compact || $[20] !== definition.scorecard || $[21] !== definition.title || $[22] !== embedded || $[23] !== t4) {
839
+ t5 = /* @__PURE__ */ jsx(InsightsScorecardView, { config: definition.scorecard, data: t4, title: definition.title, compact, embedded });
840
+ $[19] = compact;
841
+ $[20] = definition.scorecard;
842
+ $[21] = definition.title;
843
+ $[22] = embedded;
844
+ $[23] = t4;
845
+ $[24] = t5;
846
+ } else {
847
+ t5 = $[24];
848
+ }
849
+ return t5;
767
850
  }
768
851
  InsightWidget.displayName = "InsightWidget";
769
852
  function HomeCardInsightSlot(t0) {
770
- const $ = c(8);
853
+ const $ = c(10);
771
854
  const {
772
855
  slug,
773
856
  insights
@@ -775,39 +858,43 @@ function HomeCardInsightSlot(t0) {
775
858
  if (!insights || insights.length === 0) {
776
859
  return null;
777
860
  }
861
+ const estimatedRows = Math.ceil(insights.length / 2);
862
+ const minHeight = estimatedRows * 42 + (estimatedRows - 1) * 6;
778
863
  let t1;
779
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
864
+ if ($[0] !== minHeight) {
780
865
  t1 = {
781
- minHeight: 46
866
+ minHeight
782
867
  };
783
- $[0] = t1;
868
+ $[0] = minHeight;
869
+ $[1] = t1;
784
870
  } else {
785
- t1 = $[0];
871
+ t1 = $[1];
786
872
  }
787
873
  let t2;
788
- if ($[1] !== insights || $[2] !== slug) {
874
+ if ($[2] !== insights || $[3] !== slug) {
789
875
  let t32;
790
- if ($[4] !== slug) {
876
+ if ($[5] !== slug) {
791
877
  t32 = (def) => /* @__PURE__ */ jsx(InsightWidget, { definition: def, collectionSlug: slug, compact: true }, def.id);
792
- $[4] = slug;
793
- $[5] = t32;
878
+ $[5] = slug;
879
+ $[6] = t32;
794
880
  } else {
795
- t32 = $[5];
881
+ t32 = $[6];
796
882
  }
797
883
  t2 = insights.map(t32);
798
- $[1] = insights;
799
- $[2] = slug;
800
- $[3] = t2;
884
+ $[2] = insights;
885
+ $[3] = slug;
886
+ $[4] = t2;
801
887
  } else {
802
- t2 = $[3];
888
+ t2 = $[4];
803
889
  }
804
890
  let t3;
805
- if ($[6] !== t2) {
891
+ if ($[7] !== t1 || $[8] !== t2) {
806
892
  t3 = /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1.5 mt-2", style: t1, children: t2 });
807
- $[6] = t2;
808
- $[7] = t3;
893
+ $[7] = t1;
894
+ $[8] = t2;
895
+ $[9] = t3;
809
896
  } else {
810
- t3 = $[7];
897
+ t3 = $[9];
811
898
  }
812
899
  return t3;
813
900
  }
@@ -831,7 +918,7 @@ function HomeInsightsSlot(t0) {
831
918
  }
832
919
  let t2;
833
920
  if ($[1] !== insights) {
834
- t2 = insights.map(_temp$1);
921
+ t2 = insights.map(_temp);
835
922
  $[1] = insights;
836
923
  $[2] = t2;
837
924
  } else {
@@ -847,39 +934,52 @@ function HomeInsightsSlot(t0) {
847
934
  }
848
935
  return t3;
849
936
  }
850
- function _temp$1(def) {
937
+ function _temp(def) {
851
938
  return /* @__PURE__ */ jsx(InsightWidget, { definition: def }, def.id);
852
939
  }
853
940
  HomeInsightsSlot.displayName = "HomeInsightsSlot";
854
941
  function CollectionInsightsInline(t0) {
855
- const $ = c(4);
942
+ const $ = c(11);
856
943
  const {
857
- insights
944
+ insights,
945
+ path,
946
+ parentCollectionSlugs,
947
+ parentEntityIds
858
948
  } = t0;
859
949
  if (!insights || insights.length === 0) {
860
950
  return null;
861
951
  }
862
952
  let t1;
863
- if ($[0] !== insights) {
864
- t1 = insights.map(_temp);
953
+ if ($[0] !== insights || $[1] !== parentCollectionSlugs || $[2] !== parentEntityIds || $[3] !== path) {
954
+ let t22;
955
+ if ($[5] !== parentCollectionSlugs || $[6] !== parentEntityIds || $[7] !== path) {
956
+ t22 = (def) => /* @__PURE__ */ jsx(InsightWidget, { definition: def, path, parentCollectionSlugs, parentEntityIds }, def.id);
957
+ $[5] = parentCollectionSlugs;
958
+ $[6] = parentEntityIds;
959
+ $[7] = path;
960
+ $[8] = t22;
961
+ } else {
962
+ t22 = $[8];
963
+ }
964
+ t1 = insights.map(t22);
865
965
  $[0] = insights;
866
- $[1] = t1;
966
+ $[1] = parentCollectionSlugs;
967
+ $[2] = parentEntityIds;
968
+ $[3] = path;
969
+ $[4] = t1;
867
970
  } else {
868
- t1 = $[1];
971
+ t1 = $[4];
869
972
  }
870
973
  let t2;
871
- if ($[2] !== t1) {
974
+ if ($[9] !== t1) {
872
975
  t2 = /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-4", children: t1 });
873
- $[2] = t1;
874
- $[3] = t2;
976
+ $[9] = t1;
977
+ $[10] = t2;
875
978
  } else {
876
- t2 = $[3];
979
+ t2 = $[10];
877
980
  }
878
981
  return t2;
879
982
  }
880
- function _temp(def) {
881
- return /* @__PURE__ */ jsx(InsightWidget, { definition: def }, def.id);
882
- }
883
983
  CollectionInsightsInline.displayName = "CollectionInsightsInline";
884
984
  function useInsightsPlugin(config) {
885
985
  const {