@ammarkhalidfarooq/dashboard-package 0.6.57 → 0.6.59

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.js CHANGED
@@ -954,6 +954,8 @@ var Dashboard = function Dashboard(_ref) {
954
954
  numberOfDays = _ref$numberOfDays === void 0 ? 1 : _ref$numberOfDays,
955
955
  _ref$activeFilters = _ref.activeFilters,
956
956
  activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters;
957
+ _ref.exportLoading;
958
+ var setExportLoading = _ref.setExportLoading;
957
959
  return /*#__PURE__*/jsxRuntime.jsx(material.ThemeProvider, {
958
960
  theme: theme,
959
961
  children: /*#__PURE__*/jsxRuntime.jsx(React.Suspense, {
@@ -971,7 +973,8 @@ var Dashboard = function Dashboard(_ref) {
971
973
  dateName: dateName,
972
974
  exportTrigger: exportTrigger,
973
975
  apiLoading: apiLoading,
974
- activeFilters: activeFilters
976
+ activeFilters: activeFilters,
977
+ setExportLoading: setExportLoading
975
978
  })
976
979
  })
977
980
  });
@@ -1616,17 +1619,67 @@ var signed = function signed(v) {
1616
1619
  var n = Number(v !== null && v !== void 0 ? v : 0);
1617
1620
  return "".concat(n >= 0 ? "+" : "").concat(n.toFixed(2)).concat(suffix);
1618
1621
  };
1622
+ var TREND_UP = "#0B8F61";
1623
+ var TREND_DOWN = "#ef4444";
1624
+ var resolveTrendColor = function resolveTrendColor(trendText) {
1625
+ var trendPositiveWhenNegative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1626
+ return getTrendColor(trendText, trendPositiveWhenNegative ? {
1627
+ up: TREND_DOWN,
1628
+ down: TREND_UP,
1629
+ neutral: TREND_UP
1630
+ } : {
1631
+ up: TREND_UP,
1632
+ down: TREND_DOWN,
1633
+ neutral: TREND_UP
1634
+ });
1635
+ };
1636
+ var withTrendArrow = function withTrendArrow(text) {
1637
+ var str = String(text !== null && text !== void 0 ? text : "").trim();
1638
+ if (!str || str.includes("▼") || str.includes("▲")) return str;
1639
+ var arrow = getTrendArrow(str);
1640
+ return arrow ? "".concat(arrow, " ").concat(str) : str;
1641
+ };
1642
+ var formatArrowTrend = function formatArrowTrend(value) {
1643
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1644
+ _ref$suffix = _ref.suffix,
1645
+ suffix = _ref$suffix === void 0 ? "%" : _ref$suffix,
1646
+ _ref$decimals = _ref.decimals,
1647
+ decimals = _ref$decimals === void 0 ? 1 : _ref$decimals,
1648
+ _ref$label = _ref.label,
1649
+ label = _ref$label === void 0 ? "" : _ref$label;
1650
+ var n = Number(value !== null && value !== void 0 ? value : 0);
1651
+ var arrow = n >= 0 ? "▲" : "▼";
1652
+ var labelSuffix = label ? " ".concat(label) : "";
1653
+ if (suffix === "pp") return "".concat(arrow, " ").concat(Math.abs(n).toFixed(2), "pp").concat(labelSuffix);
1654
+ if (suffix === "x") return "".concat(arrow, " ").concat(Math.abs(n).toFixed(1), "x").concat(labelSuffix);
1655
+ return "".concat(arrow, " ").concat(Math.abs(n).toFixed(decimals), "%").concat(labelSuffix);
1656
+ };
1657
+ var TrendText = function TrendText(_ref2) {
1658
+ var children = _ref2.children,
1659
+ _ref2$invert = _ref2.invert,
1660
+ invert = _ref2$invert === void 0 ? false : _ref2$invert,
1661
+ _ref2$style = _ref2.style,
1662
+ style = _ref2$style === void 0 ? {} : _ref2$style;
1663
+ var text = withTrendArrow(children);
1664
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
1665
+ style: _objectSpread2({
1666
+ fontWeight: 600,
1667
+ color: resolveTrendColor(text, invert)
1668
+ }, style),
1669
+ children: text
1670
+ });
1671
+ };
1619
1672
 
1620
1673
  // ─── SVG line sparkline ───────────────────────────────────────────────────────
1621
- var Sparkline = function Sparkline(_ref) {
1622
- var _ref$data = _ref.data,
1623
- data = _ref$data === void 0 ? [] : _ref$data,
1624
- _ref$color = _ref.color,
1625
- color = _ref$color === void 0 ? "#6366F1" : _ref$color,
1626
- _ref$width = _ref.width,
1627
- width = _ref$width === void 0 ? 120 : _ref$width,
1628
- _ref$height = _ref.height,
1629
- height = _ref$height === void 0 ? 40 : _ref$height;
1674
+ var Sparkline = function Sparkline(_ref3) {
1675
+ var _ref3$data = _ref3.data,
1676
+ data = _ref3$data === void 0 ? [] : _ref3$data,
1677
+ _ref3$color = _ref3.color,
1678
+ color = _ref3$color === void 0 ? "#6366F1" : _ref3$color,
1679
+ _ref3$width = _ref3.width,
1680
+ width = _ref3$width === void 0 ? 120 : _ref3$width,
1681
+ _ref3$height = _ref3.height,
1682
+ height = _ref3$height === void 0 ? 40 : _ref3$height;
1630
1683
  var vals = data.length >= 2 ? data : [0, 0];
1631
1684
  var max = Math.max.apply(Math, _toConsumableArray(vals).concat([0]));
1632
1685
  var min = Math.min.apply(Math, _toConsumableArray(vals).concat([0]));
@@ -1679,15 +1732,15 @@ var Sparkline = function Sparkline(_ref) {
1679
1732
  };
1680
1733
 
1681
1734
  // ─── SVG multi-series line chart ──────────────────────────────────────────────
1682
- var LineChart = function LineChart(_ref2) {
1683
- var _ref2$series = _ref2.series,
1684
- series = _ref2$series === void 0 ? [] : _ref2$series,
1685
- _ref2$categories = _ref2.categories,
1686
- categories = _ref2$categories === void 0 ? [] : _ref2$categories,
1687
- _ref2$width = _ref2.width,
1688
- width = _ref2$width === void 0 ? CW : _ref2$width,
1689
- _ref2$height = _ref2.height,
1690
- height = _ref2$height === void 0 ? 180 : _ref2$height;
1735
+ var LineChart = function LineChart(_ref4) {
1736
+ var _ref4$series = _ref4.series,
1737
+ series = _ref4$series === void 0 ? [] : _ref4$series,
1738
+ _ref4$categories = _ref4.categories,
1739
+ categories = _ref4$categories === void 0 ? [] : _ref4$categories,
1740
+ _ref4$width = _ref4.width,
1741
+ width = _ref4$width === void 0 ? CW : _ref4$width,
1742
+ _ref4$height = _ref4.height,
1743
+ height = _ref4$height === void 0 ? 180 : _ref4$height;
1691
1744
  var allVals = series.flatMap(function (s) {
1692
1745
  return s.data || [];
1693
1746
  });
@@ -1784,13 +1837,13 @@ var LineChart = function LineChart(_ref2) {
1784
1837
  };
1785
1838
 
1786
1839
  // ─── SVG donut ────────────────────────────────────────────────────────────────
1787
- var Donut = function Donut(_ref3) {
1788
- var _ref3$segments = _ref3.segments,
1789
- segments = _ref3$segments === void 0 ? [] : _ref3$segments,
1790
- _ref3$size = _ref3.size,
1791
- size = _ref3$size === void 0 ? 88 : _ref3$size,
1792
- centerVal = _ref3.centerVal,
1793
- centerLabel = _ref3.centerLabel;
1840
+ var Donut = function Donut(_ref5) {
1841
+ var _ref5$segments = _ref5.segments,
1842
+ segments = _ref5$segments === void 0 ? [] : _ref5$segments,
1843
+ _ref5$size = _ref5.size,
1844
+ size = _ref5$size === void 0 ? 88 : _ref5$size,
1845
+ centerVal = _ref5.centerVal,
1846
+ centerLabel = _ref5.centerLabel;
1794
1847
  var total = segments.reduce(function (s, g) {
1795
1848
  return s + (g.value || 0);
1796
1849
  }, 0) || 1;
@@ -1848,11 +1901,11 @@ var Donut = function Donut(_ref3) {
1848
1901
  };
1849
1902
 
1850
1903
  // ─── Shared primitives ────────────────────────────────────────────────────────
1851
- var Divider = function Divider(_ref4) {
1852
- var _ref4$mt = _ref4.mt,
1853
- mt = _ref4$mt === void 0 ? 0 : _ref4$mt,
1854
- _ref4$mb = _ref4.mb,
1855
- mb = _ref4$mb === void 0 ? 0 : _ref4$mb;
1904
+ var Divider = function Divider(_ref6) {
1905
+ var _ref6$mt = _ref6.mt,
1906
+ mt = _ref6$mt === void 0 ? 0 : _ref6$mt,
1907
+ _ref6$mb = _ref6.mb,
1908
+ mb = _ref6$mb === void 0 ? 0 : _ref6$mb;
1856
1909
  return /*#__PURE__*/jsxRuntime.jsx("div", {
1857
1910
  style: {
1858
1911
  borderTop: "1px solid #E5EAF1",
@@ -1861,13 +1914,13 @@ var Divider = function Divider(_ref4) {
1861
1914
  }
1862
1915
  });
1863
1916
  };
1864
- var Panel = function Panel(_ref5) {
1865
- var children = _ref5.children,
1866
- title = _ref5.title,
1867
- subtitle = _ref5.subtitle,
1868
- action = _ref5.action,
1869
- _ref5$style = _ref5.style,
1870
- style = _ref5$style === void 0 ? {} : _ref5$style;
1917
+ var Panel = function Panel(_ref7) {
1918
+ var children = _ref7.children,
1919
+ title = _ref7.title,
1920
+ subtitle = _ref7.subtitle,
1921
+ action = _ref7.action,
1922
+ _ref7$style = _ref7.style,
1923
+ style = _ref7$style === void 0 ? {} : _ref7$style;
1871
1924
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
1872
1925
  style: _objectSpread2({
1873
1926
  border: "1px solid ".concat(THEME.panelBorder),
@@ -1916,11 +1969,11 @@ var Panel = function Panel(_ref5) {
1916
1969
  }), children]
1917
1970
  });
1918
1971
  };
1919
- var MiniTable = function MiniTable(_ref6) {
1920
- var _ref6$head = _ref6.head,
1921
- head = _ref6$head === void 0 ? [] : _ref6$head,
1922
- _ref6$rows = _ref6.rows,
1923
- rows = _ref6$rows === void 0 ? [] : _ref6$rows;
1972
+ var MiniTable = function MiniTable(_ref8) {
1973
+ var _ref8$head = _ref8.head,
1974
+ head = _ref8$head === void 0 ? [] : _ref8$head,
1975
+ _ref8$rows = _ref8.rows,
1976
+ rows = _ref8$rows === void 0 ? [] : _ref8$rows;
1924
1977
  return /*#__PURE__*/jsxRuntime.jsxs("table", {
1925
1978
  style: {
1926
1979
  width: "100%",
@@ -1971,14 +2024,16 @@ var MiniTable = function MiniTable(_ref6) {
1971
2024
  })]
1972
2025
  });
1973
2026
  };
1974
- var KpiCard = function KpiCard(_ref7) {
1975
- var title = _ref7.title,
1976
- value = _ref7.value,
1977
- trend = _ref7.trend,
1978
- detail = _ref7.detail,
1979
- _ref7$variant = _ref7.variant,
1980
- variant = _ref7$variant === void 0 ? "secondary" : _ref7$variant;
1981
- var neg = "".concat(trend).trim().startsWith("-");
2027
+ var KpiCard = function KpiCard(_ref9) {
2028
+ var title = _ref9.title,
2029
+ value = _ref9.value,
2030
+ trend = _ref9.trend,
2031
+ detail = _ref9.detail,
2032
+ _ref9$variant = _ref9.variant,
2033
+ variant = _ref9$variant === void 0 ? "secondary" : _ref9$variant,
2034
+ _ref9$trendPositiveWh = _ref9.trendPositiveWhenNegative,
2035
+ trendPositiveWhenNegative = _ref9$trendPositiveWh === void 0 ? false : _ref9$trendPositiveWh;
2036
+ var displayTrend = withTrendArrow(trend);
1982
2037
  var isPrimary = variant === "primary";
1983
2038
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
1984
2039
  style: {
@@ -2015,9 +2070,9 @@ var KpiCard = function KpiCard(_ref7) {
2015
2070
  style: {
2016
2071
  fontSize: 10.5,
2017
2072
  fontWeight: 600,
2018
- color: neg ? "#DC2626" : "#16A34A"
2073
+ color: resolveTrendColor(displayTrend, trendPositiveWhenNegative)
2019
2074
  },
2020
- children: trend
2075
+ children: displayTrend
2021
2076
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
2022
2077
  style: {
2023
2078
  fontSize: 8.5,
@@ -2028,11 +2083,11 @@ var KpiCard = function KpiCard(_ref7) {
2028
2083
  })]
2029
2084
  });
2030
2085
  };
2031
- var StatPair = function StatPair(_ref8) {
2032
- var label = _ref8.label,
2033
- val = _ref8.val,
2034
- trend = _ref8.trend;
2035
- var neg = "".concat(trend).trim().startsWith("-");
2086
+ var StatPair = function StatPair(_ref0) {
2087
+ var label = _ref0.label,
2088
+ val = _ref0.val,
2089
+ trend = _ref0.trend;
2090
+ var displayTrend = withTrendArrow(trend);
2036
2091
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2037
2092
  style: {
2038
2093
  marginBottom: 6
@@ -2061,19 +2116,19 @@ var StatPair = function StatPair(_ref8) {
2061
2116
  style: {
2062
2117
  fontSize: 9.5,
2063
2118
  fontWeight: 600,
2064
- color: neg ? "#DC2626" : "#16A34A"
2119
+ color: resolveTrendColor(displayTrend)
2065
2120
  },
2066
- children: trend
2121
+ children: displayTrend
2067
2122
  })]
2068
2123
  })]
2069
2124
  });
2070
2125
  };
2071
- var PageHeader = function PageHeader(_ref9) {
2072
- var dateLabel = _ref9.dateLabel,
2073
- generatedLabel = _ref9.generatedLabel,
2074
- activeFilters = _ref9.activeFilters,
2075
- page = _ref9.page,
2076
- windowLabel = _ref9.windowLabel;
2126
+ var PageHeader = function PageHeader(_ref1) {
2127
+ var dateLabel = _ref1.dateLabel,
2128
+ generatedLabel = _ref1.generatedLabel,
2129
+ activeFilters = _ref1.activeFilters,
2130
+ page = _ref1.page,
2131
+ windowLabel = _ref1.windowLabel;
2077
2132
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2078
2133
  style: {
2079
2134
  padding: "22px ".concat(MX, "px 12px"),
@@ -2179,9 +2234,9 @@ var PageHeader = function PageHeader(_ref9) {
2179
2234
  })]
2180
2235
  });
2181
2236
  };
2182
- var PageFooter = function PageFooter(_ref0) {
2183
- var generatedLabel = _ref0.generatedLabel,
2184
- page = _ref0.page;
2237
+ var PageFooter = function PageFooter(_ref10) {
2238
+ var generatedLabel = _ref10.generatedLabel,
2239
+ page = _ref10.page;
2185
2240
  return /*#__PURE__*/jsxRuntime.jsx("div", {
2186
2241
  style: {
2187
2242
  padding: "7px ".concat(MX, "px"),
@@ -2201,16 +2256,16 @@ var PageFooter = function PageFooter(_ref0) {
2201
2256
  };
2202
2257
 
2203
2258
  // ─── Main component ───────────────────────────────────────────────────────────
2204
- var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2205
- var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _ob$peakDay;
2206
- var _ref1$apiData = _ref1.apiData,
2207
- apiData = _ref1$apiData === void 0 ? {} : _ref1$apiData,
2208
- _ref1$dateName = _ref1.dateName,
2209
- dateName = _ref1$dateName === void 0 ? "Last Period" : _ref1$dateName,
2210
- _ref1$numberOfDays = _ref1.numberOfDays,
2211
- numberOfDays = _ref1$numberOfDays === void 0 ? 30 : _ref1$numberOfDays,
2212
- _ref1$activeFilters = _ref1.activeFilters,
2213
- activeFilters = _ref1$activeFilters === void 0 ? [] : _ref1$activeFilters;
2259
+ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
2260
+ var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3, _ref14, _refundsRaw$refundRat2, _ob$growthPercentage, _ob$peakDay, _refCard$growthPercen;
2261
+ var _ref11$apiData = _ref11.apiData,
2262
+ apiData = _ref11$apiData === void 0 ? {} : _ref11$apiData,
2263
+ _ref11$dateName = _ref11.dateName,
2264
+ dateName = _ref11$dateName === void 0 ? "Last Period" : _ref11$dateName,
2265
+ _ref11$numberOfDays = _ref11.numberOfDays,
2266
+ numberOfDays = _ref11$numberOfDays === void 0 ? 30 : _ref11$numberOfDays,
2267
+ _ref11$activeFilters = _ref11.activeFilters,
2268
+ activeFilters = _ref11$activeFilters === void 0 ? [] : _ref11$activeFilters;
2214
2269
  var now = new Date();
2215
2270
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
2216
2271
  var windowLabel = "".concat(numberOfDays, "-day window");
@@ -2281,7 +2336,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2281
2336
  totalMix = donorMix.totalMix,
2282
2337
  newPct = donorMix.newPct,
2283
2338
  retPct = donorMix.retPct,
2284
- mixAvgGift = donorMix.avgGift;
2339
+ mixAvgGift = donorMix.avgGift,
2340
+ donorMixPrev = donorMix.donorMixPrev;
2285
2341
  var recData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData) ? apiData.recurringBarChartData : [];
2286
2342
  var recurringTotal = recData.length ? recData.reduce(function (s, i) {
2287
2343
  return s + Number(i.recurring || i.recurringAmount || 0);
@@ -2489,7 +2545,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2489
2545
  title: "Refund Rate",
2490
2546
  value: pct(refundRate, 2),
2491
2547
  trend: ((_metricByTitle$Refund = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund === void 0 ? void 0 : _metricByTitle$Refund.trend) || signed((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) || -0.3, "pp"),
2492
- detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber((_refundsRaw$refundCou = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) !== null && _refundsRaw$refundCou !== void 0 ? _refundsRaw$refundCou : 2), " refunds this period")
2548
+ detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber((_refundsRaw$refundCou = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) !== null && _refundsRaw$refundCou !== void 0 ? _refundsRaw$refundCou : 2), " refunds this period"),
2549
+ trendPositiveWhenNegative: (_metricByTitle$Refund3 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund3 === void 0 ? void 0 : _metricByTitle$Refund3.trendPositiveWhenNegative
2493
2550
  })]
2494
2551
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2495
2552
  style: {
@@ -2536,11 +2593,11 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2536
2593
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
2537
2594
  style: {
2538
2595
  marginLeft: 8,
2539
- fontSize: 10.5,
2540
- fontWeight: 600,
2541
- color: "#16A34A"
2596
+ fontSize: 10.5
2542
2597
  },
2543
- children: mainChart.trend
2598
+ children: /*#__PURE__*/jsxRuntime.jsx(TrendText, {
2599
+ children: mainChart.trend
2600
+ })
2544
2601
  })]
2545
2602
  })]
2546
2603
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -2549,10 +2606,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2549
2606
  gap: 14,
2550
2607
  marginBottom: 6
2551
2608
  },
2552
- children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref10) {
2553
- var _ref11 = _slicedToArray(_ref10, 2),
2554
- name = _ref11[0],
2555
- color = _ref11[1];
2609
+ children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref12) {
2610
+ var _ref13 = _slicedToArray(_ref12, 2),
2611
+ name = _ref13[0],
2612
+ color = _ref13[1];
2556
2613
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2557
2614
  style: {
2558
2615
  display: "flex",
@@ -2706,13 +2763,17 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2706
2763
  color: "#9CA3AF"
2707
2764
  },
2708
2765
  children: "Avg gift"
2709
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2766
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2710
2767
  style: {
2711
2768
  fontSize: 9,
2712
- color: "#16A34A",
2713
2769
  marginTop: 1
2714
2770
  },
2715
- children: [signed((growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) || 8.4), " vs last month"]
2771
+ children: /*#__PURE__*/jsxRuntime.jsx(TrendText, {
2772
+ style: {
2773
+ fontSize: 9
2774
+ },
2775
+ children: "".concat(Number((_ref14 = donorMixPrev !== null && donorMixPrev !== void 0 ? donorMixPrev : growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _ref14 !== void 0 ? _ref14 : 0).toFixed(2), "% vs pp")
2776
+ })
2716
2777
  })]
2717
2778
  })]
2718
2779
  })
@@ -2867,10 +2928,17 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2867
2928
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
2868
2929
  style: {
2869
2930
  fontSize: 9,
2870
- color: "#DC2626",
2871
2931
  fontWeight: 600
2872
2932
  },
2873
- children: signed((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) || -0.3, "pp")
2933
+ children: /*#__PURE__*/jsxRuntime.jsx(TrendText, {
2934
+ invert: true,
2935
+ style: {
2936
+ fontSize: 9
2937
+ },
2938
+ children: formatArrowTrend((_refundsRaw$refundRat2 = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) !== null && _refundsRaw$refundRat2 !== void 0 ? _refundsRaw$refundRat2 : 0, {
2939
+ suffix: "pp"
2940
+ })
2941
+ })
2874
2942
  })]
2875
2943
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2876
2944
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -2933,14 +3001,20 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2933
3001
  color: "#111827"
2934
3002
  },
2935
3003
  children: d$((ob === null || ob === void 0 ? void 0 : ob.totalRevenue) || 0)
2936
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
3004
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2937
3005
  style: {
2938
3006
  fontSize: 10,
2939
- color: "#16A34A",
2940
3007
  fontWeight: 600,
2941
3008
  marginBottom: 5
2942
3009
  },
2943
- children: [signed((ob === null || ob === void 0 ? void 0 : ob.growthPercentage) || 8.7), " vs last month"]
3010
+ children: /*#__PURE__*/jsxRuntime.jsx(TrendText, {
3011
+ style: {
3012
+ fontSize: 10
3013
+ },
3014
+ children: formatArrowTrend((_ob$growthPercentage = ob === null || ob === void 0 ? void 0 : ob.growthPercentage) !== null && _ob$growthPercentage !== void 0 ? _ob$growthPercentage : 0, {
3015
+ label: "vs pp"
3016
+ })
3017
+ })
2944
3018
  }), /*#__PURE__*/jsxRuntime.jsx(Sparkline, {
2945
3019
  data: obData.length ? obData : [0, 1],
2946
3020
  color: C.indigo,
@@ -2954,10 +3028,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2954
3028
  display: "flex",
2955
3029
  gap: 12
2956
3030
  },
2957
- children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (_ref12) {
2958
- var _ref13 = _slicedToArray(_ref12, 2),
2959
- l = _ref13[0],
2960
- v = _ref13[1];
3031
+ children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (_ref15) {
3032
+ var _ref16 = _slicedToArray(_ref15, 2),
3033
+ l = _ref16[0],
3034
+ v = _ref16[1];
2961
3035
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2962
3036
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2963
3037
  style: {
@@ -3004,11 +3078,11 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
3004
3078
  children: [/*#__PURE__*/jsxRuntime.jsx(StatPair, {
3005
3079
  label: "Acceptance",
3006
3080
  val: pct((up === null || up === void 0 ? void 0 : up.acceptanceRate) || 0, 1),
3007
- trend: signed(up === null || up === void 0 ? void 0 : up.acceptanceGrowth)
3081
+ trend: formatArrowTrend(up === null || up === void 0 ? void 0 : up.acceptanceGrowth)
3008
3082
  }), /*#__PURE__*/jsxRuntime.jsx(StatPair, {
3009
3083
  label: "Raised",
3010
3084
  val: d$((up === null || up === void 0 ? void 0 : up.raised) || 0),
3011
- trend: signed(up === null || up === void 0 ? void 0 : up.raisedGrowth)
3085
+ trend: formatArrowTrend(up === null || up === void 0 ? void 0 : up.raisedGrowth)
3012
3086
  })]
3013
3087
  })]
3014
3088
  })
@@ -3039,11 +3113,11 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
3039
3113
  children: [/*#__PURE__*/jsxRuntime.jsx(StatPair, {
3040
3114
  label: "Acceptance",
3041
3115
  val: pct((dn === null || dn === void 0 ? void 0 : dn.acceptanceRate) || 0, 1),
3042
- trend: signed(dn === null || dn === void 0 ? void 0 : dn.acceptanceGrowth)
3116
+ trend: formatArrowTrend(dn === null || dn === void 0 ? void 0 : dn.acceptanceGrowth)
3043
3117
  }), /*#__PURE__*/jsxRuntime.jsx(StatPair, {
3044
3118
  label: "Raised",
3045
3119
  val: d$((dn === null || dn === void 0 ? void 0 : dn.raised) || 0),
3046
- trend: signed(dn === null || dn === void 0 ? void 0 : dn.raisedGrowth)
3120
+ trend: formatArrowTrend(dn === null || dn === void 0 ? void 0 : dn.raisedGrowth)
3047
3121
  })]
3048
3122
  })]
3049
3123
  })
@@ -3057,14 +3131,20 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
3057
3131
  color: "#111827"
3058
3132
  },
3059
3133
  children: d$((refCard === null || refCard === void 0 ? void 0 : refCard.totalRevenue) || 0)
3060
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
3134
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
3061
3135
  style: {
3062
3136
  fontSize: 10,
3063
- color: "#16A34A",
3064
3137
  fontWeight: 600,
3065
3138
  marginBottom: 5
3066
3139
  },
3067
- children: [signed((refCard === null || refCard === void 0 ? void 0 : refCard.growthPercentage) || 9.1), " vs last month"]
3140
+ children: /*#__PURE__*/jsxRuntime.jsx(TrendText, {
3141
+ style: {
3142
+ fontSize: 10
3143
+ },
3144
+ children: formatArrowTrend((_refCard$growthPercen = refCard === null || refCard === void 0 ? void 0 : refCard.growthPercentage) !== null && _refCard$growthPercen !== void 0 ? _refCard$growthPercen : 0, {
3145
+ label: "vs pp"
3146
+ })
3147
+ })
3068
3148
  }), /*#__PURE__*/jsxRuntime.jsx(Sparkline, {
3069
3149
  data: refData.length ? refData : [0, 1],
3070
3150
  color: C.emerald,
@@ -3078,10 +3158,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
3078
3158
  display: "flex",
3079
3159
  gap: 12
3080
3160
  },
3081
- children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (_ref14) {
3082
- var _ref15 = _slicedToArray(_ref14, 2),
3083
- l = _ref15[0],
3084
- v = _ref15[1];
3161
+ children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (_ref17) {
3162
+ var _ref18 = _slicedToArray(_ref17, 2),
3163
+ l = _ref18[0],
3164
+ v = _ref18[1];
3085
3165
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
3086
3166
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
3087
3167
  style: {
@@ -3224,7 +3304,8 @@ var NewOverview = function NewOverview(_ref) {
3224
3304
  _ref$apiLoading = _ref.apiLoading,
3225
3305
  apiLoading = _ref$apiLoading === void 0 ? false : _ref$apiLoading,
3226
3306
  _ref$activeFilters = _ref.activeFilters,
3227
- activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters;
3307
+ activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters,
3308
+ setExportLoading = _ref.setExportLoading;
3228
3309
  var initialMetric = "Revenue";
3229
3310
  var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
3230
3311
  var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
@@ -3303,6 +3384,7 @@ var NewOverview = function NewOverview(_ref) {
3303
3384
  case 6:
3304
3385
  _context.p = 6;
3305
3386
  setShowExportLayout(false);
3387
+ setExportLoading === null || setExportLoading === void 0 || setExportLoading(false);
3306
3388
  return _context.f(6);
3307
3389
  case 7:
3308
3390
  return _context.a(2);
@@ -3314,7 +3396,7 @@ var NewOverview = function NewOverview(_ref) {
3314
3396
  };
3315
3397
  }();
3316
3398
  doPdfExport();
3317
- }, [showExportLayout, exportFiltersSnapshot]);
3399
+ }, [showExportLayout, exportFiltersSnapshot, setExportLoading]);
3318
3400
  var currentData = metric === "Revenue" ? revenueData : donationsData;
3319
3401
  var oneTimeData = (apiData === null || apiData === void 0 ? void 0 : apiData.oneTimeDonations) || [];
3320
3402
  var oneTimeValues = oneTimeData.length > 0 ? oneTimeData.map(function (item) {