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