@ammarkhalidfarooq/dashboard-package 0.6.94 → 0.6.96

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
@@ -1482,7 +1482,7 @@ var parseDonationTypeChartData = function parseDonationTypeChartData(donationTyp
1482
1482
 
1483
1483
  /** Normalizes refundAndChargeBacks from API for PDF + report cards. */
1484
1484
  var parseRefundsChargebacks = function parseRefundsChargebacks(refundsData) {
1485
- var _raw$refundRate, _raw$chargebackRate, _raw$totalRefundedAmo, _raw$totalRefunds, _raw$totalChargebacks, _raw$wonChargebacks, _raw$lostChargebacks, _raw$growthPercentage, _raw$totalRevenue;
1485
+ var _raw$refundRate, _raw$chargebackRate, _raw$totalRefundedAmo, _raw$totalRefunds, _raw$totalChargebacks, _raw$wonChargebacks, _raw$lostChargebacks, _raw$growthPercentage, _ref, _raw$disputedAmount, _raw$totalRevenue;
1486
1486
  var raw = refundsData && _typeof(refundsData) === "object" ? refundsData : {};
1487
1487
  return {
1488
1488
  refundRate: Number((_raw$refundRate = raw.refundRate) !== null && _raw$refundRate !== void 0 ? _raw$refundRate : 0),
@@ -1493,6 +1493,7 @@ var parseRefundsChargebacks = function parseRefundsChargebacks(refundsData) {
1493
1493
  wonChargebacks: Number((_raw$wonChargebacks = raw.wonChargebacks) !== null && _raw$wonChargebacks !== void 0 ? _raw$wonChargebacks : 0),
1494
1494
  lostChargebacks: Number((_raw$lostChargebacks = raw.lostChargebacks) !== null && _raw$lostChargebacks !== void 0 ? _raw$lostChargebacks : 0),
1495
1495
  growthPercentage: Number((_raw$growthPercentage = raw.growthPercentage) !== null && _raw$growthPercentage !== void 0 ? _raw$growthPercentage : 0),
1496
+ disputedAmount: Number((_ref = (_raw$disputedAmount = raw.disputedAmount) !== null && _raw$disputedAmount !== void 0 ? _raw$disputedAmount : raw.totalDisputed) !== null && _ref !== void 0 ? _ref : 0),
1496
1497
  chartData: Array.isArray(raw.chartData) ? raw.chartData : [],
1497
1498
  totalRevenue: Number((_raw$totalRevenue = raw.totalRevenue) !== null && _raw$totalRevenue !== void 0 ? _raw$totalRevenue : 0)
1498
1499
  };
@@ -1500,11 +1501,11 @@ var parseRefundsChargebacks = function parseRefundsChargebacks(refundsData) {
1500
1501
 
1501
1502
  /** Median / top-decile for avg donation KPI (not shown in Overall section UI). */
1502
1503
  var parseAvgDonationDetail = function parseAvgDonationDetail() {
1503
- var _apiData$overviewStat, _ref, _ref2, _ref3, _ref4, _ref5, _overview$medianDonat, _ref6, _ref7, _ref8, _ref9, _ref0, _overview$topDecileDo;
1504
+ var _apiData$overviewStat, _ref2, _ref3, _ref4, _ref5, _ref6, _overview$medianDonat, _ref7, _ref8, _ref9, _ref0, _ref1, _overview$topDecileDo;
1504
1505
  var apiData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1505
1506
  var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
1506
- var median = Number((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_overview$medianDonat = overview === null || overview === void 0 ? void 0 : overview.medianDonation) !== null && _overview$medianDonat !== void 0 ? _overview$medianDonat : overview === null || overview === void 0 ? void 0 : overview.medianGift) !== null && _ref5 !== void 0 ? _ref5 : overview === null || overview === void 0 ? void 0 : overview.median) !== null && _ref4 !== void 0 ? _ref4 : apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) !== null && _ref3 !== void 0 ? _ref3 : apiData === null || apiData === void 0 ? void 0 : apiData.medianDonation) !== null && _ref2 !== void 0 ? _ref2 : apiData === null || apiData === void 0 ? void 0 : apiData.median) !== null && _ref !== void 0 ? _ref : 0);
1507
- var topDecile = Number((_ref6 = (_ref7 = (_ref8 = (_ref9 = (_ref0 = (_overview$topDecileDo = overview === null || overview === void 0 ? void 0 : overview.topDecileDonation) !== null && _overview$topDecileDo !== void 0 ? _overview$topDecileDo : overview === null || overview === void 0 ? void 0 : overview.topDecileGift) !== null && _ref0 !== void 0 ? _ref0 : overview === null || overview === void 0 ? void 0 : overview.topDecile) !== null && _ref9 !== void 0 ? _ref9 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) !== null && _ref8 !== void 0 ? _ref8 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileDonation) !== null && _ref7 !== void 0 ? _ref7 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecile) !== null && _ref6 !== void 0 ? _ref6 : 0);
1507
+ var median = Number((_ref2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_overview$medianDonat = overview === null || overview === void 0 ? void 0 : overview.medianDonation) !== null && _overview$medianDonat !== void 0 ? _overview$medianDonat : overview === null || overview === void 0 ? void 0 : overview.medianGift) !== null && _ref6 !== void 0 ? _ref6 : overview === null || overview === void 0 ? void 0 : overview.median) !== null && _ref5 !== void 0 ? _ref5 : apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) !== null && _ref4 !== void 0 ? _ref4 : apiData === null || apiData === void 0 ? void 0 : apiData.medianDonation) !== null && _ref3 !== void 0 ? _ref3 : apiData === null || apiData === void 0 ? void 0 : apiData.median) !== null && _ref2 !== void 0 ? _ref2 : 0);
1508
+ var topDecile = Number((_ref7 = (_ref8 = (_ref9 = (_ref0 = (_ref1 = (_overview$topDecileDo = overview === null || overview === void 0 ? void 0 : overview.topDecileDonation) !== null && _overview$topDecileDo !== void 0 ? _overview$topDecileDo : overview === null || overview === void 0 ? void 0 : overview.topDecileGift) !== null && _ref1 !== void 0 ? _ref1 : overview === null || overview === void 0 ? void 0 : overview.topDecile) !== null && _ref0 !== void 0 ? _ref0 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) !== null && _ref9 !== void 0 ? _ref9 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileDonation) !== null && _ref8 !== void 0 ? _ref8 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecile) !== null && _ref7 !== void 0 ? _ref7 : 0);
1508
1509
  return {
1509
1510
  median: median,
1510
1511
  topDecile: topDecile
@@ -1516,11 +1517,11 @@ var parseAvgDonationDetail = function parseAvgDonationDetail() {
1516
1517
  var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
1517
1518
  var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
1518
1519
  return rawCountries.map(function (item) {
1519
- var _item$percentage, _ref1, _ref10, _item$value;
1520
+ var _item$percentage, _ref10, _ref11, _item$value;
1520
1521
  return {
1521
1522
  country: item.countryName || item.country || item.name || "Unknown",
1522
1523
  percentage: typeof item.percentage === "number" ? item.percentage : Number((_item$percentage = item.percentage) !== null && _item$percentage !== void 0 ? _item$percentage : 0),
1523
- value: item.donations !== undefined ? item.donations : (_ref1 = (_ref10 = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.totalDonors) !== null && _ref10 !== void 0 ? _ref10 : item.donors) !== null && _ref1 !== void 0 ? _ref1 : 0
1524
+ value: item.donations !== undefined ? item.donations : (_ref10 = (_ref11 = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.totalDonors) !== null && _ref11 !== void 0 ? _ref11 : item.donors) !== null && _ref10 !== void 0 ? _ref10 : 0
1524
1525
  };
1525
1526
  });
1526
1527
  };
@@ -1672,7 +1673,8 @@ var buildReportData = function buildReportData() {
1672
1673
  type: "progress",
1673
1674
  progress: Math.round((campaign.collectedAmount || 0) / (campaign.usdTargetAmount || 1) * 100),
1674
1675
  val3: formatNumber(campaign.uniqueDonationsCount || 0),
1675
- val4: "$".concat(formatNumber(campaign.avgGift || 0))
1676
+ val4: "$".concat(formatNumber(campaign.avgGift || campaign.averageDonation || 0)),
1677
+ status: campaign.status || ""
1676
1678
  };
1677
1679
  });
1678
1680
  return {
@@ -1709,12 +1711,9 @@ var MIN_H = 1123;
1709
1711
  var MX = 32; // horizontal margin
1710
1712
  var THEME = {
1711
1713
  pageBg: "#F9FAFB",
1712
- panelBg: "#FFFFFF",
1713
1714
  panelBorder: "#E5E7EB",
1714
1715
  brand: "#6366F1",
1715
1716
  kpiBorderPrimary: "#C7D2FE",
1716
- tableHeadBg: "#EEF2FF",
1717
- tableAltBg: "#F8FAFF",
1718
1717
  muted: "#9CA3AF",
1719
1718
  text: "#111827",
1720
1719
  trendUpBg: "#D1FAE5",
@@ -1745,56 +1744,6 @@ var pct = function pct(v) {
1745
1744
  var dp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1746
1745
  return "".concat(Number(v !== null && v !== void 0 ? v : 0).toFixed(dp), "%");
1747
1746
  };
1748
- var TREND_UP = "#0B8F61";
1749
- var TREND_DOWN = "#ef4444";
1750
- var resolveTrendColor = function resolveTrendColor(trendText) {
1751
- var trendPositiveWhenNegative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1752
- return getTrendColor(trendText, trendPositiveWhenNegative ? {
1753
- up: TREND_DOWN,
1754
- down: TREND_UP,
1755
- neutral: TREND_UP
1756
- } : {
1757
- up: TREND_UP,
1758
- down: TREND_DOWN,
1759
- neutral: TREND_UP
1760
- });
1761
- };
1762
- var withTrendArrow = function withTrendArrow(text) {
1763
- var str = String(text !== null && text !== void 0 ? text : "").trim();
1764
- if (!str || str.includes("▼") || str.includes("▲")) return str;
1765
- var arrow = getTrendArrow(str);
1766
- return arrow ? "".concat(arrow, " ").concat(str) : str;
1767
- };
1768
- var formatArrowTrend = function formatArrowTrend(value) {
1769
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1770
- _ref$suffix = _ref.suffix,
1771
- suffix = _ref$suffix === void 0 ? "%" : _ref$suffix,
1772
- _ref$decimals = _ref.decimals,
1773
- decimals = _ref$decimals === void 0 ? 1 : _ref$decimals,
1774
- _ref$label = _ref.label,
1775
- label = _ref$label === void 0 ? "" : _ref$label;
1776
- var n = Number(value !== null && value !== void 0 ? value : 0);
1777
- var arrow = n >= 0 ? "▲" : "▼";
1778
- var labelSuffix = label ? " ".concat(label) : "";
1779
- if (suffix === "pp") return "".concat(arrow, " ").concat(Math.abs(n).toFixed(2), "pp").concat(labelSuffix);
1780
- if (suffix === "x") return "".concat(arrow, " ").concat(Math.abs(n).toFixed(1), "x").concat(labelSuffix);
1781
- return "".concat(arrow, " ").concat(Math.abs(n).toFixed(decimals), "%").concat(labelSuffix);
1782
- };
1783
- var TrendText = function TrendText(_ref2) {
1784
- var children = _ref2.children,
1785
- _ref2$invert = _ref2.invert,
1786
- invert = _ref2$invert === void 0 ? false : _ref2$invert,
1787
- _ref2$style = _ref2.style,
1788
- style = _ref2$style === void 0 ? {} : _ref2$style;
1789
- var text = withTrendArrow(children);
1790
- return /*#__PURE__*/jsx("span", {
1791
- style: _objectSpread2({
1792
- fontWeight: 600,
1793
- color: resolveTrendColor(text, invert)
1794
- }, style),
1795
- children: text
1796
- });
1797
- };
1798
1747
 
1799
1748
  // ─── SVG path helpers ─────────────────────────────────────────────────────────
1800
1749
  var buildSmoothPath = function buildSmoothPath(points) {
@@ -1956,119 +1905,6 @@ var Divider = function Divider(_ref5) {
1956
1905
  }
1957
1906
  });
1958
1907
  };
1959
- var Panel = function Panel(_ref6) {
1960
- var children = _ref6.children,
1961
- title = _ref6.title,
1962
- subtitle = _ref6.subtitle,
1963
- action = _ref6.action,
1964
- _ref6$style = _ref6.style,
1965
- style = _ref6$style === void 0 ? {} : _ref6$style;
1966
- return /*#__PURE__*/jsxs("div", {
1967
- style: _objectSpread2({
1968
- border: "1px solid ".concat(THEME.panelBorder),
1969
- borderRadius: 8,
1970
- background: THEME.panelBg,
1971
- padding: 12,
1972
- display: "flex",
1973
- flexDirection: "column",
1974
- boxSizing: "border-box",
1975
- boxShadow: "0 1px 0 rgba(15,23,42,0.03)"
1976
- }, style),
1977
- children: [(title || subtitle || action) && /*#__PURE__*/jsxs("div", {
1978
- style: {
1979
- display: "flex",
1980
- justifyContent: "space-between",
1981
- alignItems: "flex-start",
1982
- marginBottom: 8,
1983
- flexShrink: 0
1984
- },
1985
- children: [/*#__PURE__*/jsxs("div", {
1986
- children: [title && /*#__PURE__*/jsx("div", {
1987
- style: {
1988
- fontSize: 12,
1989
- fontWeight: 700,
1990
- color: THEME.text,
1991
- lineHeight: 1.15
1992
- },
1993
- children: title
1994
- }), subtitle && /*#__PURE__*/jsx("div", {
1995
- style: {
1996
- fontSize: 9.5,
1997
- color: THEME.muted,
1998
- lineHeight: 1.15
1999
- },
2000
- children: subtitle
2001
- })]
2002
- }), action && /*#__PURE__*/jsx("div", {
2003
- style: {
2004
- fontSize: 9.5,
2005
- color: "#6366F1",
2006
- fontWeight: 500,
2007
- flexShrink: 0
2008
- },
2009
- children: action
2010
- })]
2011
- }), children]
2012
- });
2013
- };
2014
- var MiniTable = function MiniTable(_ref7) {
2015
- var _ref7$head = _ref7.head,
2016
- head = _ref7$head === void 0 ? [] : _ref7$head,
2017
- _ref7$rows = _ref7.rows,
2018
- rows = _ref7$rows === void 0 ? [] : _ref7$rows,
2019
- _ref7$colAlign = _ref7.colAlign,
2020
- colAlign = _ref7$colAlign === void 0 ? [] : _ref7$colAlign;
2021
- return /*#__PURE__*/jsxs("table", {
2022
- style: {
2023
- width: "100%",
2024
- borderCollapse: "collapse",
2025
- fontSize: 9.5,
2026
- tableLayout: "fixed",
2027
- background: "#fff"
2028
- },
2029
- children: [/*#__PURE__*/jsx("thead", {
2030
- children: /*#__PURE__*/jsx("tr", {
2031
- style: {
2032
- background: THEME.tableHeadBg
2033
- },
2034
- children: head.map(function (h, i) {
2035
- return /*#__PURE__*/jsx("th", {
2036
- style: {
2037
- padding: "4px 6px",
2038
- textAlign: colAlign[i] || (i === 0 ? "left" : "right"),
2039
- fontWeight: 700,
2040
- fontSize: 8.5,
2041
- letterSpacing: "0.3px",
2042
- color: "#64748B",
2043
- borderBottom: "1px solid #DDE3EA"
2044
- },
2045
- children: h
2046
- }, i);
2047
- })
2048
- })
2049
- }), /*#__PURE__*/jsx("tbody", {
2050
- children: rows.map(function (row, ri) {
2051
- return /*#__PURE__*/jsx("tr", {
2052
- style: {
2053
- background: ri % 2 === 1 ? THEME.tableAltBg : "#fff"
2054
- },
2055
- children: row.map(function (cell, ci) {
2056
- return /*#__PURE__*/jsx("td", {
2057
- style: {
2058
- padding: "4px 6px",
2059
- textAlign: colAlign[ci] || (ci === 0 ? "left" : "right"),
2060
- color: "#334155",
2061
- borderBottom: ri < rows.length - 1 ? "1px solid #EEF2F7" : "none",
2062
- verticalAlign: "middle"
2063
- },
2064
- children: cell
2065
- }, ci);
2066
- })
2067
- }, ri);
2068
- })
2069
- })]
2070
- });
2071
- };
2072
1908
  var ProgressBar = function ProgressBar(_ref8) {
2073
1909
  var value = _ref8.value,
2074
1910
  _ref8$color = _ref8.color,
@@ -2117,71 +1953,6 @@ var ProgressBar = function ProgressBar(_ref8) {
2117
1953
  })]
2118
1954
  });
2119
1955
  };
2120
- var DonorGeographyPanel = function DonorGeographyPanel(_ref9) {
2121
- var _ref9$geoList = _ref9.geoList,
2122
- geoList = _ref9$geoList === void 0 ? [] : _ref9$geoList,
2123
- _ref9$totalDonors = _ref9.totalDonors,
2124
- totalDonors = _ref9$totalDonors === void 0 ? 0 : _ref9$totalDonors,
2125
- _ref9$barColor = _ref9.barColor,
2126
- barColor = _ref9$barColor === void 0 ? "#6366F1" : _ref9$barColor;
2127
- return /*#__PURE__*/jsx(Panel, {
2128
- title: "Donor geography",
2129
- subtitle: "Top countries - ".concat(formatNumber(totalDonors), " total"),
2130
- children: (geoList.length ? geoList.slice(0, 6) : []).map(function (g, i) {
2131
- var _g$percentage;
2132
- return /*#__PURE__*/jsxs("div", {
2133
- style: {
2134
- padding: i < 5 ? "0 0 5px" : 0,
2135
- marginBottom: i < 5 ? 5 : 0,
2136
- borderBottom: i < 5 ? "1px solid #F3F4F6" : "none"
2137
- },
2138
- children: [/*#__PURE__*/jsxs("div", {
2139
- style: {
2140
- display: "flex",
2141
- justifyContent: "space-between",
2142
- alignItems: "center",
2143
- gap: 6,
2144
- marginBottom: 3
2145
- },
2146
- children: [/*#__PURE__*/jsx("span", {
2147
- style: {
2148
- fontSize: 9,
2149
- color: "#374151",
2150
- overflow: "hidden",
2151
- textOverflow: "ellipsis",
2152
- whiteSpace: "nowrap",
2153
- minWidth: 0
2154
- },
2155
- children: g.country
2156
- }), /*#__PURE__*/jsxs("span", {
2157
- style: {
2158
- fontSize: 9,
2159
- fontWeight: 700,
2160
- color: "#111827",
2161
- flexShrink: 0
2162
- },
2163
- children: [formatNumber(g.value), " - ", formatNumber(g.percentage), "%"]
2164
- })]
2165
- }), /*#__PURE__*/jsx("div", {
2166
- style: {
2167
- height: 5,
2168
- background: "#F3F4F6",
2169
- borderRadius: 3,
2170
- overflow: "hidden"
2171
- },
2172
- children: /*#__PURE__*/jsx("div", {
2173
- style: {
2174
- width: "".concat(Math.min(100, Math.max(0, Number((_g$percentage = g.percentage) !== null && _g$percentage !== void 0 ? _g$percentage : 0))), "%"),
2175
- height: "100%",
2176
- background: barColor,
2177
- borderRadius: 3
2178
- }
2179
- })
2180
- })]
2181
- }, i);
2182
- })
2183
- });
2184
- };
2185
1956
  var formatDonationTypeCategory = function formatDonationTypeCategory(label, slotWidth) {
2186
1957
  var str = String(label !== null && label !== void 0 ? label : "").trim();
2187
1958
  if (!str) return "";
@@ -2197,401 +1968,46 @@ var formatDonationTypeCategory = function formatDonationTypeCategory(label, slot
2197
1968
  if (noYear.length <= maxChars) return noYear;
2198
1969
  return "".concat(noYear.slice(0, Math.max(1, maxChars - 1)), "\u2026");
2199
1970
  };
2200
- var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
2201
- var _ref0$categories = _ref0.categories,
2202
- categories = _ref0$categories === void 0 ? [] : _ref0$categories,
2203
- _ref0$recurring = _ref0.recurring,
2204
- recurring = _ref0$recurring === void 0 ? [] : _ref0$recurring,
2205
- _ref0$oneTime = _ref0.oneTime,
2206
- oneTime = _ref0$oneTime === void 0 ? [] : _ref0$oneTime,
2207
- _ref0$recurringColor = _ref0.recurringColor,
2208
- recurringColor = _ref0$recurringColor === void 0 ? "#6366F1" : _ref0$recurringColor,
2209
- _ref0$oneTimeColor = _ref0.oneTimeColor,
2210
- oneTimeColor = _ref0$oneTimeColor === void 0 ? "#10B981" : _ref0$oneTimeColor;
2211
- var width = 158;
2212
- var height = 96;
2213
- var padL = 30;
2214
- var padR = 2;
2215
- var padT = 14;
2216
- var padB = 20;
2217
- var chartW = width - padL - padR;
2218
- var chartH = height - padT - padB;
2219
- var allVals = [].concat(_toConsumableArray(recurring), _toConsumableArray(oneTime));
2220
- var maxVal = Math.max.apply(Math, _toConsumableArray(allVals).concat([0])) || 1;
2221
- var n = categories.length;
2222
- var yTicks = [0, maxVal / 2, maxVal];
2223
- var groupW = n > 0 ? chartW / n : chartW;
2224
- var labelFontSize = n > 3 ? 5 : 5.5;
2225
- if (!n) {
2226
- return /*#__PURE__*/jsxs("svg", {
2227
- width: "100%",
2228
- height: height,
2229
- viewBox: "0 0 ".concat(width, " ").concat(height),
2230
- style: {
2231
- display: "block"
2232
- },
2233
- children: [/*#__PURE__*/jsx("line", {
2234
- x1: padL,
2235
- y1: padT + chartH,
2236
- x2: width - padR,
2237
- y2: padT + chartH,
2238
- stroke: "#f1f1f1"
2239
- }), /*#__PURE__*/jsx("text", {
2240
- x: padL - 4,
2241
- y: padT + chartH + 3,
2242
- textAnchor: "end",
2243
- fontSize: 7,
2244
- fill: "rgba(0,0,0,0.4)",
2245
- children: "$0"
2246
- })]
2247
- });
2248
- }
2249
- var barW = Math.min(groupW * 0.3, 12);
2250
- var baseY = padT + chartH;
2251
- return /*#__PURE__*/jsxs("svg", {
2252
- width: "100%",
2253
- height: height,
2254
- viewBox: "0 0 ".concat(width, " ").concat(height),
1971
+ var TrendPill$1 = function TrendPill(_ref12) {
1972
+ var children = _ref12.children,
1973
+ _ref12$positive = _ref12.positive,
1974
+ positive = _ref12$positive === void 0 ? true : _ref12$positive;
1975
+ return /*#__PURE__*/jsx("span", {
2255
1976
  style: {
2256
- display: "block"
1977
+ display: "inline-flex",
1978
+ alignItems: "center",
1979
+ background: positive ? THEME.trendUpBg : "#FEE2E2",
1980
+ color: positive ? THEME.trendUpText : "#DC2626",
1981
+ padding: "3px 10px",
1982
+ borderRadius: 100,
1983
+ fontSize: 9,
1984
+ fontWeight: 600,
1985
+ whiteSpace: "nowrap",
1986
+ lineHeight: 1.35
2257
1987
  },
2258
- children: [/*#__PURE__*/jsx("defs", {
2259
- children: categories.map(function (_, i) {
2260
- return /*#__PURE__*/jsx("clipPath", {
2261
- id: "donation-type-cat-clip-".concat(i),
2262
- children: /*#__PURE__*/jsx("rect", {
2263
- x: padL + i * groupW,
2264
- y: baseY + 2,
2265
- width: groupW,
2266
- height: padB - 2
2267
- })
2268
- }, "clip-".concat(i));
2269
- })
2270
- }), yTicks.map(function (tick, i) {
2271
- var y = padT + chartH - tick / maxVal * chartH;
2272
- return /*#__PURE__*/jsxs("g", {
2273
- children: [/*#__PURE__*/jsx("line", {
2274
- x1: padL,
2275
- y1: y,
2276
- x2: width - padR,
2277
- y2: y,
2278
- stroke: "#f1f1f1",
2279
- strokeDasharray: "4"
2280
- }), /*#__PURE__*/jsx("text", {
2281
- x: padL - 4,
2282
- y: y + 3,
2283
- textAnchor: "end",
2284
- fontSize: 7,
2285
- fill: "rgba(0,0,0,0.4)",
2286
- children: d$Compact(tick)
2287
- })]
2288
- }, "y-".concat(i));
2289
- }), categories.map(function (cat, i) {
2290
- var groupX = padL + i * groupW + groupW / 2;
2291
- var rVal = recurring[i] || 0;
2292
- var oVal = oneTime[i] || 0;
2293
- var rH = rVal / maxVal * chartH;
2294
- var oH = oVal / maxVal * chartH;
2295
- var rX = groupX - barW - 1;
2296
- var oX = groupX + 1;
2297
- return /*#__PURE__*/jsxs("g", {
2298
- children: [rVal > 0 && /*#__PURE__*/jsxs(Fragment, {
2299
- children: [/*#__PURE__*/jsx("rect", {
2300
- x: rX,
2301
- y: baseY - rH,
2302
- width: barW,
2303
- height: Math.max(rH, 1),
2304
- fill: recurringColor,
2305
- rx: 2
2306
- }), /*#__PURE__*/jsx("text", {
2307
- x: rX + barW / 2,
2308
- y: baseY - rH - 3,
2309
- textAnchor: "middle",
2310
- fontSize: 6.5,
2311
- fontWeight: 600,
2312
- fill: "#111827",
2313
- children: d$Compact(rVal)
2314
- })]
2315
- }), oVal > 0 && /*#__PURE__*/jsxs(Fragment, {
2316
- children: [/*#__PURE__*/jsx("rect", {
2317
- x: oX,
2318
- y: baseY - oH,
2319
- width: barW,
2320
- height: Math.max(oH, 1),
2321
- fill: oneTimeColor,
2322
- rx: 2
2323
- }), /*#__PURE__*/jsx("text", {
2324
- x: oX + barW / 2,
2325
- y: baseY - oH - 3,
2326
- textAnchor: "middle",
2327
- fontSize: 6.5,
2328
- fontWeight: 600,
2329
- fill: "#111827",
2330
- children: d$Compact(oVal)
2331
- })]
2332
- }), /*#__PURE__*/jsx("text", {
2333
- x: groupX,
2334
- y: height - 5,
2335
- textAnchor: "middle",
2336
- fontSize: labelFontSize,
2337
- fill: "rgba(0,0,0,0.4)",
2338
- clipPath: "url(#donation-type-cat-clip-".concat(i, ")"),
2339
- children: formatDonationTypeCategory(cat, groupW)
2340
- })]
2341
- }, "bar-".concat(i));
2342
- })]
1988
+ children: children
2343
1989
  });
2344
1990
  };
2345
- var DonationTypePanel = function DonationTypePanel(_ref1) {
2346
- var donationTypeData = _ref1.donationTypeData,
2347
- _ref1$recurringColor = _ref1.recurringColor,
2348
- recurringColor = _ref1$recurringColor === void 0 ? "#6366F1" : _ref1$recurringColor,
2349
- _ref1$oneTimeColor = _ref1.oneTimeColor,
2350
- oneTimeColor = _ref1$oneTimeColor === void 0 ? "#10B981" : _ref1$oneTimeColor;
2351
- var _parseDonationTypeCha = parseDonationTypeChartData(donationTypeData),
2352
- categories = _parseDonationTypeCha.categories,
2353
- recurring = _parseDonationTypeCha.recurring,
2354
- oneTime = _parseDonationTypeCha.oneTime,
2355
- recurringTotal = _parseDonationTypeCha.recurringTotal,
2356
- oneTimeTotal = _parseDonationTypeCha.oneTimeTotal;
2357
- return /*#__PURE__*/jsxs(Panel, {
2358
- title: "Recurring vs one-time",
2359
- subtitle: "Donation type - weekly",
2360
- children: [/*#__PURE__*/jsx("div", {
2361
- style: {
2362
- display: "flex",
2363
- flexWrap: "wrap",
2364
- gap: "6px 10px",
2365
- marginBottom: 4
2366
- },
2367
- children: [{
2368
- label: "Recurring",
2369
- total: recurringTotal,
2370
- color: recurringColor
2371
- }, {
2372
- label: "One-time",
2373
- total: oneTimeTotal,
2374
- color: oneTimeColor
2375
- }].map(function (item) {
2376
- return /*#__PURE__*/jsxs("div", {
2377
- style: {
2378
- display: "flex",
2379
- alignItems: "center",
2380
- gap: 4
2381
- },
2382
- children: [/*#__PURE__*/jsx("div", {
2383
- style: {
2384
- width: 6,
2385
- height: 6,
2386
- borderRadius: "50%",
2387
- background: item.color,
2388
- flexShrink: 0
2389
- }
2390
- }), /*#__PURE__*/jsx("span", {
2391
- style: {
2392
- fontSize: 9.5,
2393
- color: "#374151"
2394
- },
2395
- children: item.label
2396
- }), /*#__PURE__*/jsx("span", {
2397
- style: {
2398
- fontSize: 9.5,
2399
- fontWeight: 700,
2400
- color: "#111827"
2401
- },
2402
- children: d$(item.total)
2403
- })]
2404
- }, item.label);
2405
- })
2406
- }), /*#__PURE__*/jsx(DonationTypeBarSvg, {
2407
- categories: categories,
2408
- recurring: recurring,
2409
- oneTime: oneTime,
2410
- recurringColor: recurringColor,
2411
- oneTimeColor: oneTimeColor
2412
- })]
2413
- });
1991
+ var isTrendPositive = function isTrendPositive(trendText) {
1992
+ var invert = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1993
+ var n = Number(String(trendText !== null && trendText !== void 0 ? trendText : "").replace(/[^0-9.\-+]/g, ""));
1994
+ if (Number.isNaN(n)) return true;
1995
+ return invert ? n <= 0 : n >= 0;
2414
1996
  };
2415
- var AcceptanceRaisedPanel = function AcceptanceRaisedPanel(_ref10) {
2416
- var title = _ref10.title,
2417
- subtitle = _ref10.subtitle,
2418
- _ref10$acceptanceRate = _ref10.acceptanceRate,
2419
- acceptanceRate = _ref10$acceptanceRate === void 0 ? 0 : _ref10$acceptanceRate,
2420
- _ref10$acceptanceGrow = _ref10.acceptanceGrowth,
2421
- acceptanceGrowth = _ref10$acceptanceGrow === void 0 ? 0 : _ref10$acceptanceGrow,
2422
- _ref10$raised = _ref10.raised,
2423
- raised = _ref10$raised === void 0 ? 0 : _ref10$raised,
2424
- _ref10$raisedGrowth = _ref10.raisedGrowth,
2425
- raisedGrowth = _ref10$raisedGrowth === void 0 ? 0 : _ref10$raisedGrowth,
2426
- _ref10$primaryColor = _ref10.primaryColor,
2427
- primaryColor = _ref10$primaryColor === void 0 ? "#6366F1" : _ref10$primaryColor,
2428
- _ref10$secondaryColor = _ref10.secondaryColor,
2429
- secondaryColor = _ref10$secondaryColor === void 0 ? "#88bfd290" : _ref10$secondaryColor;
2430
- return /*#__PURE__*/jsx(Panel, {
2431
- title: title,
2432
- subtitle: subtitle,
1997
+ var PageOneHeader = function PageOneHeader(_ref13) {
1998
+ var dateLabel = _ref13.dateLabel,
1999
+ generatedLabel = _ref13.generatedLabel,
2000
+ windowLabel = _ref13.windowLabel;
2001
+ return /*#__PURE__*/jsx("div", {
2002
+ style: {
2003
+ padding: "36px ".concat(MX, "px 0"),
2004
+ flexShrink: 0
2005
+ },
2433
2006
  children: /*#__PURE__*/jsxs("div", {
2434
2007
  style: {
2435
2008
  display: "flex",
2436
- flexDirection: "column",
2437
- alignItems: "center"
2438
- },
2439
- children: [/*#__PURE__*/jsx(Donut, {
2440
- segments: [{
2441
- value: acceptanceRate,
2442
- color: primaryColor
2443
- }, {
2444
- value: Math.max(0, 100 - acceptanceRate),
2445
- color: "#E5E7EB"
2446
- }],
2447
- size: 88,
2448
- centerVal: "".concat(formatNumber(acceptanceRate), "%"),
2449
- centerLabel: "accepted"
2450
- }), /*#__PURE__*/jsxs("div", {
2451
- style: {
2452
- width: "100%",
2453
- marginTop: 6
2454
- },
2455
- children: [/*#__PURE__*/jsxs("div", {
2456
- style: {
2457
- display: "flex",
2458
- justifyContent: "space-between",
2459
- alignItems: "center",
2460
- marginBottom: 5
2461
- },
2462
- children: [/*#__PURE__*/jsxs("div", {
2463
- style: {
2464
- display: "flex",
2465
- alignItems: "center",
2466
- gap: 5
2467
- },
2468
- children: [/*#__PURE__*/jsx("div", {
2469
- style: {
2470
- width: 8,
2471
- height: 8,
2472
- borderRadius: 2,
2473
- background: primaryColor,
2474
- flexShrink: 0
2475
- }
2476
- }), /*#__PURE__*/jsx("span", {
2477
- style: {
2478
- fontSize: 9.5,
2479
- color: "#6B7280"
2480
- },
2481
- children: "Acceptance"
2482
- })]
2483
- }), /*#__PURE__*/jsxs("div", {
2484
- style: {
2485
- display: "flex",
2486
- alignItems: "baseline",
2487
- gap: 4
2488
- },
2489
- children: [/*#__PURE__*/jsxs("span", {
2490
- style: {
2491
- fontSize: 9.5,
2492
- fontWeight: 700,
2493
- color: "#111827"
2494
- },
2495
- children: [formatNumber(acceptanceRate), "%"]
2496
- }), /*#__PURE__*/jsx(TrendText, {
2497
- style: {
2498
- fontSize: 9
2499
- },
2500
- children: formatArrowTrend(acceptanceGrowth)
2501
- })]
2502
- })]
2503
- }), /*#__PURE__*/jsxs("div", {
2504
- style: {
2505
- display: "flex",
2506
- justifyContent: "space-between",
2507
- alignItems: "center"
2508
- },
2509
- children: [/*#__PURE__*/jsxs("div", {
2510
- style: {
2511
- display: "flex",
2512
- alignItems: "center",
2513
- gap: 5
2514
- },
2515
- children: [/*#__PURE__*/jsx("div", {
2516
- style: {
2517
- width: 8,
2518
- height: 8,
2519
- borderRadius: 2,
2520
- background: secondaryColor,
2521
- flexShrink: 0
2522
- }
2523
- }), /*#__PURE__*/jsx("span", {
2524
- style: {
2525
- fontSize: 9.5,
2526
- color: "#6B7280"
2527
- },
2528
- children: "Raised"
2529
- })]
2530
- }), /*#__PURE__*/jsxs("div", {
2531
- style: {
2532
- display: "flex",
2533
- alignItems: "baseline",
2534
- gap: 4
2535
- },
2536
- children: [/*#__PURE__*/jsx("span", {
2537
- style: {
2538
- fontSize: 9.5,
2539
- fontWeight: 700,
2540
- color: "#111827"
2541
- },
2542
- children: d$(raised)
2543
- }), /*#__PURE__*/jsx(TrendText, {
2544
- style: {
2545
- fontSize: 9
2546
- },
2547
- children: formatArrowTrend(raisedGrowth)
2548
- })]
2549
- })]
2550
- })]
2551
- })]
2552
- })
2553
- });
2554
- };
2555
- var TrendPill$1 = function TrendPill(_ref12) {
2556
- var children = _ref12.children,
2557
- _ref12$positive = _ref12.positive,
2558
- positive = _ref12$positive === void 0 ? true : _ref12$positive;
2559
- return /*#__PURE__*/jsx("span", {
2560
- style: {
2561
- display: "inline-flex",
2562
- alignItems: "center",
2563
- background: positive ? THEME.trendUpBg : "#FEE2E2",
2564
- color: positive ? THEME.trendUpText : "#DC2626",
2565
- padding: "3px 10px",
2566
- borderRadius: 100,
2567
- fontSize: 9,
2568
- fontWeight: 600,
2569
- whiteSpace: "nowrap",
2570
- lineHeight: 1.35
2571
- },
2572
- children: children
2573
- });
2574
- };
2575
- var isTrendPositive = function isTrendPositive(trendText) {
2576
- var invert = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2577
- var n = Number(String(trendText !== null && trendText !== void 0 ? trendText : "").replace(/[^0-9.\-+]/g, ""));
2578
- if (Number.isNaN(n)) return true;
2579
- return invert ? n <= 0 : n >= 0;
2580
- };
2581
- var PageOneHeader = function PageOneHeader(_ref13) {
2582
- var dateLabel = _ref13.dateLabel,
2583
- generatedLabel = _ref13.generatedLabel,
2584
- windowLabel = _ref13.windowLabel;
2585
- return /*#__PURE__*/jsx("div", {
2586
- style: {
2587
- padding: "36px ".concat(MX, "px 0"),
2588
- flexShrink: 0
2589
- },
2590
- children: /*#__PURE__*/jsxs("div", {
2591
- style: {
2592
- display: "flex",
2593
- justifyContent: "space-between",
2594
- alignItems: "flex-start"
2009
+ justifyContent: "space-between",
2010
+ alignItems: "flex-start"
2595
2011
  },
2596
2012
  children: [/*#__PURE__*/jsxs("div", {
2597
2013
  children: [/*#__PURE__*/jsx("div", {
@@ -2842,159 +2258,1036 @@ var PageOneFooter = function PageOneFooter(_ref17) {
2842
2258
  })
2843
2259
  });
2844
2260
  };
2845
- var PageHeader = function PageHeader(_ref18) {
2846
- var dateLabel = _ref18.dateLabel,
2847
- generatedLabel = _ref18.generatedLabel,
2848
- activeFilters = _ref18.activeFilters,
2849
- page = _ref18.page,
2850
- windowLabel = _ref18.windowLabel;
2851
- return /*#__PURE__*/jsxs("div", {
2261
+ var PageTwoFooter = function PageTwoFooter(_ref18) {
2262
+ var generatedBy = _ref18.generatedBy,
2263
+ generatedLabel = _ref18.generatedLabel;
2264
+ return /*#__PURE__*/jsx("div", {
2852
2265
  style: {
2853
- padding: "22px ".concat(MX, "px 12px"),
2854
- borderBottom: "1px solid #DEE5EF",
2855
- background: "#FFFFFF",
2266
+ padding: "14px ".concat(MX, "px 28px"),
2267
+ borderTop: "1px solid ".concat(THEME.panelBorder),
2268
+ marginTop: "auto",
2856
2269
  flexShrink: 0
2857
2270
  },
2858
- children: [/*#__PURE__*/jsx("div", {
2271
+ children: /*#__PURE__*/jsxs("div", {
2859
2272
  style: {
2860
2273
  display: "flex",
2861
2274
  justifyContent: "space-between",
2862
- alignItems: "center"
2275
+ alignItems: "center",
2276
+ fontSize: 8,
2277
+ color: THEME.muted,
2278
+ lineHeight: 1.4
2279
+ },
2280
+ children: [/*#__PURE__*/jsxs("span", {
2281
+ children: ["Confidential", BULLET, "Generated by ", generatedBy, BULLET, generatedLabel]
2282
+ }), /*#__PURE__*/jsxs("span", {
2283
+ children: ["Page 2 of 2", BULLET, "madinah.com"]
2284
+ })]
2285
+ })
2286
+ });
2287
+ };
2288
+ var P2Card = function P2Card(_ref19) {
2289
+ var children = _ref19.children,
2290
+ title = _ref19.title,
2291
+ subtitle = _ref19.subtitle,
2292
+ action = _ref19.action,
2293
+ _ref19$style = _ref19.style,
2294
+ style = _ref19$style === void 0 ? {} : _ref19$style;
2295
+ return /*#__PURE__*/jsxs("div", {
2296
+ style: _objectSpread2({
2297
+ border: "1px solid ".concat(THEME.panelBorder),
2298
+ borderRadius: 12,
2299
+ background: "#FFFFFF",
2300
+ padding: "13px 14px 12px",
2301
+ display: "flex",
2302
+ flexDirection: "column",
2303
+ boxSizing: "border-box",
2304
+ minWidth: 0
2305
+ }, style),
2306
+ children: [(title || subtitle || action) && /*#__PURE__*/jsxs("div", {
2307
+ style: {
2308
+ display: "flex",
2309
+ justifyContent: "space-between",
2310
+ alignItems: "flex-start",
2311
+ marginBottom: 10,
2312
+ flexShrink: 0,
2313
+ gap: 8
2863
2314
  },
2864
- children: /*#__PURE__*/jsxs("div", {
2315
+ children: [/*#__PURE__*/jsxs("div", {
2865
2316
  style: {
2866
- display: "flex",
2867
- alignItems: "baseline",
2868
- gap: 10
2317
+ minWidth: 0
2869
2318
  },
2870
- children: [/*#__PURE__*/jsx("span", {
2319
+ children: [title && /*#__PURE__*/jsx("div", {
2871
2320
  style: {
2872
- fontSize: 20,
2873
- fontWeight: 800,
2321
+ fontSize: 12,
2322
+ fontWeight: 700,
2874
2323
  color: THEME.text,
2875
- letterSpacing: "-0.5px"
2324
+ lineHeight: 1.15
2876
2325
  },
2877
- children: "Madinah"
2878
- }), /*#__PURE__*/jsx("span", {
2326
+ children: title
2327
+ }), subtitle && /*#__PURE__*/jsx("div", {
2879
2328
  style: {
2880
- fontSize: 8.5,
2881
- fontWeight: 700,
2882
- letterSpacing: "1.5px",
2883
- color: "#94A3B8",
2884
- textTransform: "uppercase"
2329
+ fontSize: 9,
2330
+ color: THEME.muted,
2331
+ marginTop: 2,
2332
+ lineHeight: 1.2
2885
2333
  },
2886
- children: "PERFORMANCE REPORT"
2334
+ children: subtitle
2887
2335
  })]
2888
- })
2889
- }), /*#__PURE__*/jsx("div", {
2890
- style: {
2891
- marginTop: 8,
2892
- fontSize: 13.5,
2893
- fontWeight: 700,
2894
- color: THEME.text
2895
- },
2896
- children: "Dashboard overview \u2014 Overall"
2897
- }), /*#__PURE__*/jsxs("div", {
2336
+ }), action]
2337
+ }), children]
2338
+ });
2339
+ };
2340
+ var campaignBarColor = function campaignBarColor() {
2341
+ var status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2342
+ var s = String(status).toLowerCase();
2343
+ if (s.includes("slow")) return "#F59E0B";
2344
+ if (s.includes("closing")) return "#14B8A6";
2345
+ return THEME.brand;
2346
+ };
2347
+ var StatusPill = function StatusPill(_ref20) {
2348
+ var _ref20$status = _ref20.status,
2349
+ status = _ref20$status === void 0 ? "" : _ref20$status;
2350
+ if (!String(status).trim()) {
2351
+ return /*#__PURE__*/jsx("span", {
2898
2352
  style: {
2899
- display: "flex",
2900
- justifyContent: "space-between",
2901
- marginTop: 2
2353
+ fontSize: 8,
2354
+ color: THEME.muted
2902
2355
  },
2903
- children: [/*#__PURE__*/jsxs("div", {
2904
- children: [/*#__PURE__*/jsx("div", {
2905
- style: {
2906
- fontSize: 10.5,
2907
- color: "#334155"
2908
- },
2909
- children: dateLabel
2910
- }), /*#__PURE__*/jsxs("div", {
2356
+ children: "\u2014"
2357
+ });
2358
+ }
2359
+ var s = String(status).toLowerCase();
2360
+ var styles = s.includes("slow") ? {
2361
+ bg: "#FEF3C7",
2362
+ color: "#D97706",
2363
+ label: String(status).includes("$") ? status : "$ ".concat(status)
2364
+ } : s.includes("closing") ? {
2365
+ bg: "#DBEAFE",
2366
+ color: "#2563EB",
2367
+ label: status || "Closing"
2368
+ } : {
2369
+ bg: "#D1FAE5",
2370
+ color: "#059669",
2371
+ label: status || "Active"
2372
+ };
2373
+ return /*#__PURE__*/jsx("span", {
2374
+ style: {
2375
+ display: "inline-flex",
2376
+ alignItems: "center",
2377
+ background: styles.bg,
2378
+ color: styles.color,
2379
+ padding: "2px 8px",
2380
+ borderRadius: 100,
2381
+ fontSize: 8,
2382
+ fontWeight: 600,
2383
+ whiteSpace: "nowrap",
2384
+ lineHeight: 1.3
2385
+ },
2386
+ children: styles.label
2387
+ });
2388
+ };
2389
+ var P2CampaignTable = function P2CampaignTable(_ref21) {
2390
+ var _ref21$rows = _ref21.rows,
2391
+ rows = _ref21$rows === void 0 ? [] : _ref21$rows;
2392
+ return /*#__PURE__*/jsxs("table", {
2393
+ style: {
2394
+ width: "100%",
2395
+ borderCollapse: "collapse",
2396
+ fontSize: 9,
2397
+ tableLayout: "fixed"
2398
+ },
2399
+ children: [/*#__PURE__*/jsx("thead", {
2400
+ children: /*#__PURE__*/jsx("tr", {
2401
+ children: ["Campaign", "Raised", "Progress", "Donors", "Status"].map(function (h, i) {
2402
+ return /*#__PURE__*/jsx("th", {
2403
+ style: {
2404
+ padding: "5px 4px",
2405
+ textAlign: i === 0 || i === 2 ? "left" : "right",
2406
+ fontWeight: 700,
2407
+ fontSize: 7.5,
2408
+ letterSpacing: "0.5px",
2409
+ color: THEME.muted,
2410
+ textTransform: "uppercase",
2411
+ borderBottom: "1px solid ".concat(THEME.panelBorder)
2412
+ },
2413
+ children: h
2414
+ }, h);
2415
+ })
2416
+ })
2417
+ }), /*#__PURE__*/jsx("tbody", {
2418
+ children: rows.length === 0 ? /*#__PURE__*/jsx("tr", {
2419
+ children: /*#__PURE__*/jsx("td", {
2420
+ colSpan: 5,
2911
2421
  style: {
2912
- fontSize: 9.5,
2422
+ padding: "10px 4px",
2423
+ fontSize: 9,
2913
2424
  color: THEME.muted,
2914
- marginTop: 1
2425
+ textAlign: "center"
2915
2426
  },
2916
- children: [windowLabel, " - Generated ", generatedLabel]
2917
- })]
2427
+ children: "No active campaigns"
2428
+ })
2429
+ }) : rows.map(function (row, ri) {
2430
+ return /*#__PURE__*/jsxs("tr", {
2431
+ children: [/*#__PURE__*/jsx("td", {
2432
+ style: {
2433
+ padding: "6px 4px",
2434
+ color: "#374151",
2435
+ fontSize: 8.5,
2436
+ borderBottom: ri < rows.length - 1 ? "1px solid #F3F4F6" : "none",
2437
+ overflow: "hidden",
2438
+ textOverflow: "ellipsis",
2439
+ whiteSpace: "nowrap"
2440
+ },
2441
+ children: row.name
2442
+ }), /*#__PURE__*/jsx("td", {
2443
+ style: {
2444
+ padding: "6px 4px",
2445
+ textAlign: "right",
2446
+ fontWeight: 700,
2447
+ color: THEME.text,
2448
+ fontSize: 8.5,
2449
+ borderBottom: ri < rows.length - 1 ? "1px solid #F3F4F6" : "none"
2450
+ },
2451
+ children: row.raised
2452
+ }), /*#__PURE__*/jsx("td", {
2453
+ style: {
2454
+ padding: "6px 4px",
2455
+ borderBottom: ri < rows.length - 1 ? "1px solid #F3F4F6" : "none"
2456
+ },
2457
+ children: /*#__PURE__*/jsx(ProgressBar, {
2458
+ value: row.progress,
2459
+ color: campaignBarColor(row.status),
2460
+ height: 5
2461
+ })
2462
+ }), /*#__PURE__*/jsx("td", {
2463
+ style: {
2464
+ padding: "6px 4px",
2465
+ textAlign: "right",
2466
+ fontWeight: 700,
2467
+ color: THEME.text,
2468
+ fontSize: 8.5,
2469
+ borderBottom: ri < rows.length - 1 ? "1px solid #F3F4F6" : "none"
2470
+ },
2471
+ children: row.donors
2472
+ }), /*#__PURE__*/jsx("td", {
2473
+ style: {
2474
+ padding: "6px 4px",
2475
+ textAlign: "right",
2476
+ borderBottom: ri < rows.length - 1 ? "1px solid #F3F4F6" : "none"
2477
+ },
2478
+ children: /*#__PURE__*/jsx(StatusPill, {
2479
+ status: row.status
2480
+ })
2481
+ })]
2482
+ }, ri);
2483
+ })
2484
+ })]
2485
+ });
2486
+ };
2487
+ var P2DonorMixCard = function P2DonorMixCard(_ref22) {
2488
+ var newDonors = _ref22.newDonors,
2489
+ returningDonors = _ref22.returningDonors,
2490
+ totalMix = _ref22.totalMix,
2491
+ newPct = _ref22.newPct,
2492
+ retPct = _ref22.retPct,
2493
+ avgGift = _ref22.avgGift,
2494
+ avgGiftTrend = _ref22.avgGiftTrend;
2495
+ return /*#__PURE__*/jsx(P2Card, {
2496
+ title: "Donor mix",
2497
+ subtitle: "Acquisition vs retention",
2498
+ children: /*#__PURE__*/jsxs("div", {
2499
+ style: {
2500
+ display: "flex",
2501
+ flexDirection: "column",
2502
+ alignItems: "center"
2503
+ },
2504
+ children: [/*#__PURE__*/jsx(Donut, {
2505
+ segments: [{
2506
+ value: newDonors,
2507
+ color: "#10B981"
2508
+ }, {
2509
+ value: returningDonors,
2510
+ color: THEME.brand
2511
+ }],
2512
+ size: 84,
2513
+ centerVal: formatNumber(totalMix),
2514
+ centerLabel: "donors"
2918
2515
  }), /*#__PURE__*/jsxs("div", {
2919
2516
  style: {
2920
- fontSize: 9,
2921
- color: THEME.muted,
2922
- textAlign: "right",
2923
- alignSelf: "flex-end"
2517
+ width: "100%",
2518
+ marginTop: 8
2924
2519
  },
2925
- children: ["Page ", page, " of 2"]
2520
+ children: [[{
2521
+ label: "New donors",
2522
+ color: "#10B981",
2523
+ count: newDonors,
2524
+ pct: newPct
2525
+ }, {
2526
+ label: "Returning",
2527
+ color: THEME.brand,
2528
+ count: returningDonors,
2529
+ pct: retPct
2530
+ }].map(function (item, i) {
2531
+ return /*#__PURE__*/jsxs("div", {
2532
+ style: {
2533
+ display: "flex",
2534
+ justifyContent: "space-between",
2535
+ alignItems: "center",
2536
+ marginBottom: i === 0 ? 6 : 10
2537
+ },
2538
+ children: [/*#__PURE__*/jsxs("div", {
2539
+ style: {
2540
+ display: "flex",
2541
+ alignItems: "center",
2542
+ gap: 5
2543
+ },
2544
+ children: [/*#__PURE__*/jsx("div", {
2545
+ style: {
2546
+ width: 7,
2547
+ height: 7,
2548
+ borderRadius: "50%",
2549
+ background: item.color,
2550
+ flexShrink: 0
2551
+ }
2552
+ }), /*#__PURE__*/jsx("span", {
2553
+ style: {
2554
+ fontSize: 9,
2555
+ color: "#6B7280"
2556
+ },
2557
+ children: item.label
2558
+ })]
2559
+ }), /*#__PURE__*/jsxs("span", {
2560
+ style: {
2561
+ fontSize: 9,
2562
+ fontWeight: 700,
2563
+ color: THEME.text
2564
+ },
2565
+ children: [formatNumber(item.count), BULLET, item.pct, "%"]
2566
+ })]
2567
+ }, item.label);
2568
+ }), /*#__PURE__*/jsx(Divider, {
2569
+ mb: 8
2570
+ }), /*#__PURE__*/jsx("div", {
2571
+ style: {
2572
+ fontSize: 9,
2573
+ color: THEME.muted,
2574
+ marginBottom: 3
2575
+ },
2576
+ children: "Avg gift"
2577
+ }), /*#__PURE__*/jsx("div", {
2578
+ style: {
2579
+ fontSize: 16,
2580
+ fontWeight: 700,
2581
+ color: THEME.text,
2582
+ marginBottom: 6
2583
+ },
2584
+ children: d$(avgGift)
2585
+ }), /*#__PURE__*/jsx(TrendPill$1, {
2586
+ positive: isTrendPositive(avgGiftTrend),
2587
+ children: avgGiftTrend
2588
+ })]
2926
2589
  })]
2927
- }), !!"".concat(activeFilters || "").trim() && /*#__PURE__*/jsxs("div", {
2590
+ })
2591
+ });
2592
+ };
2593
+ var StackedDonationTypeBarSvg = function StackedDonationTypeBarSvg(_ref23) {
2594
+ var _ref23$categories = _ref23.categories,
2595
+ categories = _ref23$categories === void 0 ? [] : _ref23$categories,
2596
+ _ref23$recurring = _ref23.recurring,
2597
+ recurring = _ref23$recurring === void 0 ? [] : _ref23$recurring,
2598
+ _ref23$oneTime = _ref23.oneTime,
2599
+ oneTime = _ref23$oneTime === void 0 ? [] : _ref23$oneTime,
2600
+ _ref23$recurringColor = _ref23.recurringColor,
2601
+ recurringColor = _ref23$recurringColor === void 0 ? "#10B981" : _ref23$recurringColor,
2602
+ _ref23$oneTimeColor = _ref23.oneTimeColor,
2603
+ oneTimeColor = _ref23$oneTimeColor === void 0 ? "#6366F1" : _ref23$oneTimeColor;
2604
+ var width = 158;
2605
+ var height = 88;
2606
+ var padL = 22;
2607
+ var padR = 4;
2608
+ var padT = 8;
2609
+ var padB = 18;
2610
+ var chartW = width - padL - padR;
2611
+ var chartH = height - padT - padB;
2612
+ var totals = categories.map(function (_, i) {
2613
+ return (recurring[i] || 0) + (oneTime[i] || 0);
2614
+ });
2615
+ var maxVal = Math.max.apply(Math, _toConsumableArray(totals).concat([0])) || 1;
2616
+ var n = categories.length;
2617
+ var groupW = n > 0 ? chartW / n : chartW;
2618
+ var barW = Math.min(groupW * 0.42, 18);
2619
+ var baseY = padT + chartH;
2620
+ if (!n) {
2621
+ return /*#__PURE__*/jsx("svg", {
2622
+ width: "100%",
2623
+ height: height,
2624
+ viewBox: "0 0 ".concat(width, " ").concat(height),
2625
+ style: {
2626
+ display: "block"
2627
+ },
2628
+ children: /*#__PURE__*/jsx("line", {
2629
+ x1: padL,
2630
+ y1: baseY,
2631
+ x2: width - padR,
2632
+ y2: baseY,
2633
+ stroke: "#F3F4F6"
2634
+ })
2635
+ });
2636
+ }
2637
+ return /*#__PURE__*/jsx("svg", {
2638
+ width: "100%",
2639
+ height: height,
2640
+ viewBox: "0 0 ".concat(width, " ").concat(height),
2641
+ style: {
2642
+ display: "block"
2643
+ },
2644
+ children: categories.map(function (cat, i) {
2645
+ var groupX = padL + i * groupW + groupW / 2;
2646
+ var rVal = recurring[i] || 0;
2647
+ var oVal = oneTime[i] || 0;
2648
+ var total = rVal + oVal || 1;
2649
+ var oH = oVal / maxVal * chartH;
2650
+ var rH = rVal / maxVal * chartH;
2651
+ var x = groupX - barW / 2;
2652
+ return /*#__PURE__*/jsxs("g", {
2653
+ children: [oVal > 0 && /*#__PURE__*/jsx("rect", {
2654
+ x: x,
2655
+ y: baseY - oH,
2656
+ width: barW,
2657
+ height: Math.max(oH, total > 0 ? 1 : 0),
2658
+ fill: oneTimeColor,
2659
+ rx: 2
2660
+ }), rVal > 0 && /*#__PURE__*/jsx("rect", {
2661
+ x: x,
2662
+ y: baseY - oH - rH,
2663
+ width: barW,
2664
+ height: Math.max(rH, total > 0 ? 1 : 0),
2665
+ fill: recurringColor,
2666
+ rx: 2
2667
+ }), /*#__PURE__*/jsx("text", {
2668
+ x: groupX,
2669
+ y: height - 4,
2670
+ textAnchor: "middle",
2671
+ fontSize: 6.5,
2672
+ fill: THEME.muted,
2673
+ children: formatDonationTypeCategory(cat, groupW)
2674
+ })]
2675
+ }, "stack-".concat(i));
2676
+ })
2677
+ });
2678
+ };
2679
+ var P2DonationTypeCard = function P2DonationTypeCard(_ref24) {
2680
+ var donationTypeData = _ref24.donationTypeData;
2681
+ var _parseDonationTypeCha2 = parseDonationTypeChartData(donationTypeData),
2682
+ categories = _parseDonationTypeCha2.categories,
2683
+ recurring = _parseDonationTypeCha2.recurring,
2684
+ oneTime = _parseDonationTypeCha2.oneTime,
2685
+ recurringTotal = _parseDonationTypeCha2.recurringTotal,
2686
+ oneTimeTotal = _parseDonationTypeCha2.oneTimeTotal;
2687
+ return /*#__PURE__*/jsxs(P2Card, {
2688
+ title: "Recurring vs one-time",
2689
+ subtitle: "Donation type".concat(BULLET, "weekly"),
2690
+ children: [/*#__PURE__*/jsx("div", {
2691
+ style: {
2692
+ display: "flex",
2693
+ flexDirection: "column",
2694
+ gap: 4,
2695
+ marginBottom: 6
2696
+ },
2697
+ children: [{
2698
+ label: "Recurring",
2699
+ total: recurringTotal,
2700
+ color: "#10B981"
2701
+ }, {
2702
+ label: "One-time",
2703
+ total: oneTimeTotal,
2704
+ color: THEME.brand
2705
+ }].map(function (item) {
2706
+ return /*#__PURE__*/jsxs("div", {
2707
+ style: {
2708
+ display: "flex",
2709
+ alignItems: "center",
2710
+ gap: 5
2711
+ },
2712
+ children: [/*#__PURE__*/jsx("div", {
2713
+ style: {
2714
+ width: 6,
2715
+ height: 6,
2716
+ borderRadius: "50%",
2717
+ background: item.color,
2718
+ flexShrink: 0
2719
+ }
2720
+ }), /*#__PURE__*/jsx("span", {
2721
+ style: {
2722
+ fontSize: 9,
2723
+ color: "#6B7280"
2724
+ },
2725
+ children: item.label
2726
+ }), /*#__PURE__*/jsx("span", {
2727
+ style: {
2728
+ fontSize: 9,
2729
+ fontWeight: 700,
2730
+ color: THEME.text
2731
+ },
2732
+ children: d$(item.total)
2733
+ })]
2734
+ }, item.label);
2735
+ })
2736
+ }), /*#__PURE__*/jsx(StackedDonationTypeBarSvg, {
2737
+ categories: categories,
2738
+ recurring: recurring,
2739
+ oneTime: oneTime
2740
+ })]
2741
+ });
2742
+ };
2743
+ var P2DonorGeographyCard = function P2DonorGeographyCard(_ref25) {
2744
+ var _ref25$geoList = _ref25.geoList,
2745
+ geoList = _ref25$geoList === void 0 ? [] : _ref25$geoList,
2746
+ _ref25$totalDonors = _ref25.totalDonors,
2747
+ totalDonors = _ref25$totalDonors === void 0 ? 0 : _ref25$totalDonors;
2748
+ return /*#__PURE__*/jsxs(P2Card, {
2749
+ title: "Donor geography",
2750
+ subtitle: "Top countries".concat(BULLET).concat(formatNumber(totalDonors), " total"),
2751
+ children: [(geoList.length ? geoList.slice(0, 6) : []).map(function (g, i) {
2752
+ var _g$percentage2;
2753
+ return /*#__PURE__*/jsxs("div", {
2754
+ style: {
2755
+ marginBottom: i < 5 ? 7 : 0
2756
+ },
2757
+ children: [/*#__PURE__*/jsxs("div", {
2758
+ style: {
2759
+ display: "flex",
2760
+ justifyContent: "space-between",
2761
+ alignItems: "center",
2762
+ gap: 6,
2763
+ marginBottom: 3
2764
+ },
2765
+ children: [/*#__PURE__*/jsx("span", {
2766
+ style: {
2767
+ fontSize: 8.5,
2768
+ color: "#374151",
2769
+ overflow: "hidden",
2770
+ textOverflow: "ellipsis",
2771
+ whiteSpace: "nowrap",
2772
+ minWidth: 0
2773
+ },
2774
+ children: g.country
2775
+ }), /*#__PURE__*/jsxs("span", {
2776
+ style: {
2777
+ fontSize: 8.5,
2778
+ fontWeight: 700,
2779
+ color: THEME.text,
2780
+ flexShrink: 0
2781
+ },
2782
+ children: [formatNumber(g.value), BULLET, formatNumber(g.percentage), "%"]
2783
+ })]
2784
+ }), /*#__PURE__*/jsx("div", {
2785
+ style: {
2786
+ height: 4,
2787
+ background: "#F3F4F6",
2788
+ borderRadius: 3,
2789
+ overflow: "hidden"
2790
+ },
2791
+ children: /*#__PURE__*/jsx("div", {
2792
+ style: {
2793
+ width: "".concat(Math.min(100, Math.max(0, Number((_g$percentage2 = g.percentage) !== null && _g$percentage2 !== void 0 ? _g$percentage2 : 0))), "%"),
2794
+ height: "100%",
2795
+ background: THEME.brand,
2796
+ borderRadius: 3
2797
+ }
2798
+ })
2799
+ })]
2800
+ }, i);
2801
+ }), !geoList.length && /*#__PURE__*/jsx("div", {
2802
+ style: {
2803
+ fontSize: 9,
2804
+ color: THEME.muted,
2805
+ textAlign: "center",
2806
+ padding: "8px 0"
2807
+ },
2808
+ children: "No geography data"
2809
+ })]
2810
+ });
2811
+ };
2812
+ var SparklineWithLabels = function SparklineWithLabels(_ref26) {
2813
+ var _ref26$data = _ref26.data,
2814
+ data = _ref26$data === void 0 ? [] : _ref26$data,
2815
+ _ref26$color = _ref26.color,
2816
+ color = _ref26$color === void 0 ? "#6366F1" : _ref26$color,
2817
+ _ref26$startLabel = _ref26.startLabel,
2818
+ startLabel = _ref26$startLabel === void 0 ? "" : _ref26$startLabel,
2819
+ _ref26$endLabel = _ref26.endLabel,
2820
+ endLabel = _ref26$endLabel === void 0 ? "" : _ref26$endLabel,
2821
+ _ref26$width = _ref26.width,
2822
+ width = _ref26$width === void 0 ? 150 : _ref26$width,
2823
+ _ref26$height = _ref26.height,
2824
+ height = _ref26$height === void 0 ? 42 : _ref26$height;
2825
+ return /*#__PURE__*/jsxs("div", {
2826
+ children: [/*#__PURE__*/jsx(Sparkline, {
2827
+ data: data,
2828
+ color: color,
2829
+ width: width,
2830
+ height: height
2831
+ }), (startLabel || endLabel) && /*#__PURE__*/jsxs("div", {
2832
+ style: {
2833
+ display: "flex",
2834
+ justifyContent: "space-between",
2835
+ marginTop: 2,
2836
+ fontSize: 7,
2837
+ color: THEME.muted
2838
+ },
2839
+ children: [/*#__PURE__*/jsx("span", {
2840
+ children: startLabel
2841
+ }), /*#__PURE__*/jsx("span", {
2842
+ children: endLabel
2843
+ })]
2844
+ })]
2845
+ });
2846
+ };
2847
+ var getTrafficSourceColor = function getTrafficSourceColor() {
2848
+ var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2849
+ var s = String(source).toLowerCase();
2850
+ if (s.includes("paid")) return THEME.brand;
2851
+ if (s.includes("organic")) return "#10B981";
2852
+ if (s.includes("email")) return "#3B82F6";
2853
+ if (s.includes("direct")) return "#9CA3AF";
2854
+ return "#CBD5E1";
2855
+ };
2856
+ var P2TrafficSourceCard = function P2TrafficSourceCard(_ref27) {
2857
+ var _ref27$items = _ref27.items,
2858
+ items = _ref27$items === void 0 ? [] : _ref27$items,
2859
+ _ref27$total = _ref27.total,
2860
+ total = _ref27$total === void 0 ? 0 : _ref27$total,
2861
+ daysLabel = _ref27.daysLabel;
2862
+ return /*#__PURE__*/jsxs(P2Card, {
2863
+ title: "Traffic source",
2864
+ subtitle: "Revenue by channel".concat(BULLET).concat(daysLabel),
2865
+ children: [items.length === 0 ? /*#__PURE__*/jsx("div", {
2866
+ style: {
2867
+ fontSize: 9,
2868
+ color: THEME.muted,
2869
+ textAlign: "center",
2870
+ padding: "8px 0"
2871
+ },
2872
+ children: "No traffic data"
2873
+ }) : items.map(function (item, i) {
2874
+ var source = item.source || item.name || "-";
2875
+ var revenue = Number(item.revenue || item.raised || 0);
2876
+ var share = Number(item.share || item.percentage || 0);
2877
+ var color = getTrafficSourceColor(source);
2878
+ return /*#__PURE__*/jsxs("div", {
2879
+ style: {
2880
+ marginBottom: i < items.length - 1 ? 8 : 0
2881
+ },
2882
+ children: [/*#__PURE__*/jsxs("div", {
2883
+ style: {
2884
+ display: "flex",
2885
+ alignItems: "center",
2886
+ gap: 5,
2887
+ marginBottom: 3
2888
+ },
2889
+ children: [/*#__PURE__*/jsx("div", {
2890
+ style: {
2891
+ width: 6,
2892
+ height: 6,
2893
+ borderRadius: "50%",
2894
+ background: color,
2895
+ flexShrink: 0
2896
+ }
2897
+ }), /*#__PURE__*/jsx("span", {
2898
+ style: {
2899
+ fontSize: 8.5,
2900
+ color: "#374151",
2901
+ flex: 1,
2902
+ overflow: "hidden",
2903
+ textOverflow: "ellipsis",
2904
+ whiteSpace: "nowrap"
2905
+ },
2906
+ children: source
2907
+ }), /*#__PURE__*/jsx("span", {
2908
+ style: {
2909
+ fontSize: 8.5,
2910
+ fontWeight: 700,
2911
+ color: THEME.text,
2912
+ flexShrink: 0
2913
+ },
2914
+ children: d$Compact(revenue)
2915
+ })]
2916
+ }), /*#__PURE__*/jsxs("div", {
2917
+ style: {
2918
+ display: "flex",
2919
+ alignItems: "center",
2920
+ gap: 6
2921
+ },
2922
+ children: [/*#__PURE__*/jsx("div", {
2923
+ style: {
2924
+ flex: 1,
2925
+ height: 4,
2926
+ background: "#F3F4F6",
2927
+ borderRadius: 3,
2928
+ overflow: "hidden"
2929
+ },
2930
+ children: /*#__PURE__*/jsx("div", {
2931
+ style: {
2932
+ width: "".concat(Math.min(100, share), "%"),
2933
+ height: "100%",
2934
+ background: color,
2935
+ borderRadius: 3
2936
+ }
2937
+ })
2938
+ }), /*#__PURE__*/jsxs("span", {
2939
+ style: {
2940
+ fontSize: 8,
2941
+ color: THEME.muted,
2942
+ minWidth: 24,
2943
+ textAlign: "right"
2944
+ },
2945
+ children: [formatNumber(share), "%"]
2946
+ })]
2947
+ })]
2948
+ }, i);
2949
+ }), /*#__PURE__*/jsx(Divider, {
2950
+ mt: 8,
2951
+ mb: 0
2952
+ }), /*#__PURE__*/jsxs("div", {
2953
+ style: {
2954
+ display: "flex",
2955
+ justifyContent: "space-between",
2956
+ alignItems: "center",
2957
+ marginTop: 8
2958
+ },
2959
+ children: [/*#__PURE__*/jsx("span", {
2960
+ style: {
2961
+ fontSize: 9,
2962
+ color: THEME.muted
2963
+ },
2964
+ children: "Total"
2965
+ }), /*#__PURE__*/jsx("span", {
2966
+ style: {
2967
+ fontSize: 10,
2968
+ fontWeight: 700,
2969
+ color: THEME.text
2970
+ },
2971
+ children: d$Compact(total)
2972
+ })]
2973
+ })]
2974
+ });
2975
+ };
2976
+ var P2RefundsCard = function P2RefundsCard(_ref28) {
2977
+ var refundRate = _ref28.refundRate,
2978
+ chargebackRate = _ref28.chargebackRate,
2979
+ refundGrowth = _ref28.refundGrowth,
2980
+ totalRefundedAmount = _ref28.totalRefundedAmount,
2981
+ disputedAmount = _ref28.disputedAmount,
2982
+ lostCases = _ref28.lostCases,
2983
+ _ref28$chartData = _ref28.chartData,
2984
+ chartData = _ref28$chartData === void 0 ? [] : _ref28$chartData,
2985
+ windowLabel = _ref28.windowLabel;
2986
+ var refundChart = chartData.map(function (d) {
2987
+ var _ref29, _ref30, _d$value;
2988
+ return Number((_ref29 = (_ref30 = (_d$value = d === null || d === void 0 ? void 0 : d.value) !== null && _d$value !== void 0 ? _d$value : d === null || d === void 0 ? void 0 : d.amount) !== null && _ref30 !== void 0 ? _ref30 : d) !== null && _ref29 !== void 0 ? _ref29 : 0);
2989
+ });
2990
+ return /*#__PURE__*/jsxs(P2Card, {
2991
+ title: "Refunds & chargebacks",
2992
+ subtitle: "Trust health".concat(BULLET).concat(windowLabel),
2993
+ children: [/*#__PURE__*/jsxs("div", {
2994
+ style: {
2995
+ display: "flex",
2996
+ gap: 16,
2997
+ marginBottom: 8
2998
+ },
2999
+ children: [/*#__PURE__*/jsxs("div", {
3000
+ children: [/*#__PURE__*/jsx("div", {
3001
+ style: {
3002
+ fontSize: 7.5,
3003
+ fontWeight: 700,
3004
+ letterSpacing: "0.5px",
3005
+ color: THEME.muted,
3006
+ textTransform: "uppercase",
3007
+ marginBottom: 3
3008
+ },
3009
+ children: "Refunds"
3010
+ }), /*#__PURE__*/jsx("div", {
3011
+ style: {
3012
+ fontSize: 16,
3013
+ fontWeight: 700,
3014
+ color: THEME.text,
3015
+ lineHeight: 1.1
3016
+ },
3017
+ children: pct(refundRate, 1)
3018
+ }), /*#__PURE__*/jsx("div", {
3019
+ style: {
3020
+ marginTop: 3
3021
+ },
3022
+ children: refundGrowth === 0 ? /*#__PURE__*/jsx("span", {
3023
+ style: {
3024
+ fontSize: 8.5,
3025
+ color: THEME.muted
3026
+ },
3027
+ children: "stable"
3028
+ }) : /*#__PURE__*/jsx(TrendPill$1, {
3029
+ positive: refundGrowth <= 0,
3030
+ children: formatTrend(refundGrowth, "pp")
3031
+ })
3032
+ })]
3033
+ }), /*#__PURE__*/jsxs("div", {
3034
+ children: [/*#__PURE__*/jsx("div", {
3035
+ style: {
3036
+ fontSize: 7.5,
3037
+ fontWeight: 700,
3038
+ letterSpacing: "0.5px",
3039
+ color: THEME.muted,
3040
+ textTransform: "uppercase",
3041
+ marginBottom: 3
3042
+ },
3043
+ children: "Chargebacks"
3044
+ }), /*#__PURE__*/jsx("div", {
3045
+ style: {
3046
+ fontSize: 16,
3047
+ fontWeight: 700,
3048
+ color: THEME.text,
3049
+ lineHeight: 1.1
3050
+ },
3051
+ children: pct(chargebackRate, 1)
3052
+ }), /*#__PURE__*/jsx("div", {
3053
+ style: {
3054
+ fontSize: 8.5,
3055
+ color: THEME.muted,
3056
+ marginTop: 3
3057
+ },
3058
+ children: "stable"
3059
+ })]
3060
+ })]
3061
+ }), /*#__PURE__*/jsxs("div", {
3062
+ style: {
3063
+ fontSize: 8,
3064
+ color: THEME.muted,
3065
+ lineHeight: 1.45,
3066
+ marginBottom: 8
3067
+ },
3068
+ children: [d$(totalRefundedAmount), " refunded", BULLET, d$(disputedAmount), " disputed", BULLET, formatNumber(lostCases), " ", lostCases === 1 ? "case" : "cases"]
3069
+ }), /*#__PURE__*/jsx(Sparkline, {
3070
+ data: refundChart.length ? refundChart : [0, 0],
3071
+ color: "#F97316",
3072
+ width: 150,
3073
+ height: 36
3074
+ }), /*#__PURE__*/jsx("div", {
3075
+ style: {
3076
+ display: "flex",
3077
+ gap: 10,
3078
+ marginTop: 6
3079
+ },
3080
+ children: [{
3081
+ label: "Refunds",
3082
+ color: "#F97316"
3083
+ }, {
3084
+ label: "Chargebacks",
3085
+ color: "#EF4444"
3086
+ }].map(function (leg) {
3087
+ return /*#__PURE__*/jsxs("div", {
3088
+ style: {
3089
+ display: "flex",
3090
+ alignItems: "center",
3091
+ gap: 4
3092
+ },
3093
+ children: [/*#__PURE__*/jsx("div", {
3094
+ style: {
3095
+ width: 6,
3096
+ height: 6,
3097
+ borderRadius: "50%",
3098
+ background: leg.color
3099
+ }
3100
+ }), /*#__PURE__*/jsx("span", {
3101
+ style: {
3102
+ fontSize: 8,
3103
+ color: "#6B7280"
3104
+ },
3105
+ children: leg.label
3106
+ })]
3107
+ }, leg.label);
3108
+ })
3109
+ })]
3110
+ });
3111
+ };
3112
+ var P2RevenueTrendCard = function P2RevenueTrendCard(_ref31) {
3113
+ var title = _ref31.title,
3114
+ subtitle = _ref31.subtitle,
3115
+ value = _ref31.value,
3116
+ trend = _ref31.trend,
3117
+ chartData = _ref31.chartData,
3118
+ chartColor = _ref31.chartColor,
3119
+ startLabel = _ref31.startLabel,
3120
+ endLabel = _ref31.endLabel,
3121
+ _ref31$footerStats = _ref31.footerStats,
3122
+ footerStats = _ref31$footerStats === void 0 ? [] : _ref31$footerStats;
3123
+ return /*#__PURE__*/jsxs(P2Card, {
3124
+ title: title,
3125
+ subtitle: subtitle,
3126
+ children: [/*#__PURE__*/jsx("div", {
3127
+ style: {
3128
+ fontSize: 17,
3129
+ fontWeight: 700,
3130
+ color: THEME.text,
3131
+ lineHeight: 1.1
3132
+ },
3133
+ children: d$Compact(value)
3134
+ }), /*#__PURE__*/jsx("div", {
2928
3135
  style: {
2929
- marginTop: 7,
2930
- display: "inline-block",
2931
- background: "#EEF2FF",
2932
- border: "1px solid #D7DEFF",
2933
- borderRadius: 4,
2934
- padding: "4px 9px",
2935
- fontSize: 9,
2936
- lineHeight: 1.35,
2937
- color: "#374151",
2938
- maxWidth: "100%"
3136
+ marginTop: 4,
3137
+ marginBottom: 6
2939
3138
  },
2940
- children: [/*#__PURE__*/jsx("span", {
2941
- style: {
2942
- fontWeight: 700,
2943
- letterSpacing: "0.3px"
2944
- },
2945
- children: "Active Filters:"
2946
- }), " ", /*#__PURE__*/jsx("span", {
2947
- style: {
2948
- fontWeight: 500,
2949
- color: "#334155"
2950
- },
2951
- children: activeFilters
2952
- })]
3139
+ children: /*#__PURE__*/jsx(TrendPill$1, {
3140
+ positive: isTrendPositive(trend),
3141
+ children: trend
3142
+ })
3143
+ }), /*#__PURE__*/jsx(SparklineWithLabels, {
3144
+ data: chartData,
3145
+ color: chartColor,
3146
+ startLabel: startLabel,
3147
+ endLabel: endLabel,
3148
+ width: 150,
3149
+ height: 40
3150
+ }), /*#__PURE__*/jsx(Divider, {
3151
+ mt: 8,
3152
+ mb: 0
3153
+ }), /*#__PURE__*/jsx("div", {
3154
+ style: {
3155
+ display: "flex",
3156
+ gap: 10,
3157
+ marginTop: 8,
3158
+ flexWrap: "wrap"
3159
+ },
3160
+ children: footerStats.map(function (_ref32) {
3161
+ var _ref33 = _slicedToArray(_ref32, 2),
3162
+ label = _ref33[0],
3163
+ val = _ref33[1];
3164
+ return /*#__PURE__*/jsxs("div", {
3165
+ children: [/*#__PURE__*/jsx("div", {
3166
+ style: {
3167
+ fontSize: 7.5,
3168
+ color: THEME.muted,
3169
+ marginBottom: 3
3170
+ },
3171
+ children: label
3172
+ }), /*#__PURE__*/jsx("div", {
3173
+ style: {
3174
+ fontSize: 10,
3175
+ fontWeight: 700,
3176
+ color: THEME.text
3177
+ },
3178
+ children: val
3179
+ })]
3180
+ }, label);
3181
+ })
2953
3182
  })]
2954
3183
  });
2955
3184
  };
2956
- var PageFooter = function PageFooter(_ref19) {
2957
- var generatedBy = _ref19.generatedBy,
2958
- generatedLabel = _ref19.generatedLabel,
2959
- page = _ref19.page;
2960
- return /*#__PURE__*/jsx("div", {
2961
- style: {
2962
- padding: "9px ".concat(MX, "px 54px"),
2963
- borderTop: "1px solid #DEE5EF",
2964
- background: "#FFFFFF",
2965
- marginTop: "auto",
2966
- flexShrink: 0
2967
- },
3185
+ var P2AcceptanceCard = function P2AcceptanceCard(_ref34) {
3186
+ var title = _ref34.title,
3187
+ acceptanceRate = _ref34.acceptanceRate,
3188
+ acceptanceGrowth = _ref34.acceptanceGrowth,
3189
+ raised = _ref34.raised,
3190
+ raisedGrowth = _ref34.raisedGrowth;
3191
+ return /*#__PURE__*/jsx(P2Card, {
3192
+ title: title,
3193
+ subtitle: "Acceptance & raised",
2968
3194
  children: /*#__PURE__*/jsxs("div", {
2969
3195
  style: {
2970
3196
  display: "flex",
2971
- justifyContent: "space-between",
2972
- alignItems: "center",
2973
- fontSize: 8,
2974
- color: THEME.muted
3197
+ flexDirection: "column",
3198
+ alignItems: "center"
2975
3199
  },
2976
- children: [/*#__PURE__*/jsxs("span", {
2977
- children: ["Confidential - Generated by ", generatedBy, " - ", generatedLabel]
2978
- }), /*#__PURE__*/jsxs("span", {
2979
- children: ["Page ", page, " of 2 - madinah.com"]
3200
+ children: [/*#__PURE__*/jsx(Donut, {
3201
+ segments: [{
3202
+ value: acceptanceRate,
3203
+ color: THEME.brand
3204
+ }, {
3205
+ value: Math.max(0, 100 - acceptanceRate),
3206
+ color: "#E5E7EB"
3207
+ }],
3208
+ size: 76,
3209
+ centerVal: "".concat(formatNumber(acceptanceRate), "%"),
3210
+ centerLabel: "accepted"
3211
+ }), /*#__PURE__*/jsx("div", {
3212
+ style: {
3213
+ width: "100%",
3214
+ marginTop: 8
3215
+ },
3216
+ children: [{
3217
+ label: "Acceptance",
3218
+ value: "".concat(formatNumber(acceptanceRate), "%"),
3219
+ trend: formatTrend(acceptanceGrowth)
3220
+ }, {
3221
+ label: "Raised",
3222
+ value: d$Compact(raised),
3223
+ trend: formatTrend(raisedGrowth)
3224
+ }].map(function (row, i) {
3225
+ return /*#__PURE__*/jsxs("div", {
3226
+ style: {
3227
+ display: "flex",
3228
+ justifyContent: "space-between",
3229
+ alignItems: "center",
3230
+ marginBottom: i === 0 ? 6 : 0
3231
+ },
3232
+ children: [/*#__PURE__*/jsxs("div", {
3233
+ style: {
3234
+ display: "flex",
3235
+ alignItems: "center",
3236
+ gap: 5
3237
+ },
3238
+ children: [/*#__PURE__*/jsx("div", {
3239
+ style: {
3240
+ width: 7,
3241
+ height: 7,
3242
+ borderRadius: 2,
3243
+ background: THEME.brand,
3244
+ flexShrink: 0
3245
+ }
3246
+ }), /*#__PURE__*/jsx("span", {
3247
+ style: {
3248
+ fontSize: 9,
3249
+ color: "#6B7280"
3250
+ },
3251
+ children: row.label
3252
+ })]
3253
+ }), /*#__PURE__*/jsxs("div", {
3254
+ style: {
3255
+ display: "flex",
3256
+ alignItems: "center",
3257
+ gap: 5
3258
+ },
3259
+ children: [/*#__PURE__*/jsx("span", {
3260
+ style: {
3261
+ fontSize: 9,
3262
+ fontWeight: 700,
3263
+ color: THEME.text
3264
+ },
3265
+ children: row.value
3266
+ }), /*#__PURE__*/jsx(TrendPill$1, {
3267
+ positive: isTrendPositive(row.trend),
3268
+ children: row.trend
3269
+ })]
3270
+ })]
3271
+ }, row.label);
3272
+ })
2980
3273
  })]
2981
3274
  })
2982
3275
  });
2983
3276
  };
2984
3277
 
2985
3278
  // ─── Main component ───────────────────────────────────────────────────────────
2986
- var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
2987
- var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _apiData$trafficSourc, _apiData$trafficSourc2, _apiData$trafficSourc3, _growth$totalRevenue, _metricByTitle$AvgDo, _avgDonationDetail$me, _avgDonationDetail$to, _metricByTitle$NetRa, _growth$netRevenue, _metricByTitle$Total, _metricByTitle$Total2, _growth$totalDonation, _metricByTitle$Total3, _metricByTitle$AvgDo2, _growth$overallAVGDon, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _growth$conversionRat, _metricByTitle$Conver2, _metricByTitle$Refund, _refunds$growthPercen, _metricByTitle$Refund2, _mainChart$stacked, _ob$growthPercentage, _ob$peakDay, _up$acceptanceGrowth, _up$raisedGrowth, _dn$acceptanceGrowth, _dn$raisedGrowth, _refCard$growthPercen;
2988
- var _ref20$name = _ref20.name,
2989
- name = _ref20$name === void 0 ? "" : _ref20$name,
2990
- _ref20$apiData = _ref20.apiData,
2991
- apiData = _ref20$apiData === void 0 ? {} : _ref20$apiData,
2992
- _ref20$dateName = _ref20.dateName,
2993
- dateName = _ref20$dateName === void 0 ? "Last Period" : _ref20$dateName,
2994
- _ref20$numberOfDays = _ref20.numberOfDays,
2995
- numberOfDays = _ref20$numberOfDays === void 0 ? 30 : _ref20$numberOfDays,
2996
- _ref20$activeFilters = _ref20.activeFilters,
2997
- activeFilters = _ref20$activeFilters === void 0 ? [] : _ref20$activeFilters;
3279
+ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref35, ref) {
3280
+ var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _apiData$trafficSourc, _apiData$trafficSourc2, _growth$totalRevenue, _metricByTitle$AvgDo, _apiData$trafficSourc3, _metricByTitle$NetRa, _growth$netRevenue, _metricByTitle$Total, _metricByTitle$Total2, _growth$totalDonation, _metricByTitle$Total3, _metricByTitle$AvgDo2, _growth$overallAVGDon, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _growth$conversionRat, _metricByTitle$Conver2, _metricByTitle$Refund, _refunds$growthPercen, _metricByTitle$Refund2, _mainChart$stacked, _ob$totalRevenue, _ob$growthPercentage, _ob$averagePerDay, _ob$peakDay$amount, _ob$peakDay, _ob$totalOrders, _up$acceptanceRate, _up$acceptanceGrowth, _up$raised, _up$raisedGrowth, _dn$acceptanceRate, _dn$acceptanceGrowth, _dn$raised, _dn$raisedGrowth, _refCard$totalRevenue, _refCard$growthPercen, _refCard$totalReferre, _refCard$averageGift, _refCard$conversionRa;
3281
+ var _ref35$name = _ref35.name,
3282
+ name = _ref35$name === void 0 ? "" : _ref35$name,
3283
+ _ref35$apiData = _ref35.apiData,
3284
+ apiData = _ref35$apiData === void 0 ? {} : _ref35$apiData,
3285
+ _ref35$dateName = _ref35.dateName,
3286
+ dateName = _ref35$dateName === void 0 ? "Last Period" : _ref35$dateName,
3287
+ _ref35$numberOfDays = _ref35.numberOfDays,
3288
+ numberOfDays = _ref35$numberOfDays === void 0 ? 30 : _ref35$numberOfDays,
3289
+ _ref35$activeFilters = _ref35.activeFilters,
3290
+ activeFilters = _ref35$activeFilters === void 0 ? [] : _ref35$activeFilters;
2998
3291
  var now = new Date();
2999
3292
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
3000
3293
  var windowLabel = "".concat(numberOfDays, "-day window");
@@ -3011,42 +3304,6 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
3011
3304
  hour12: false
3012
3305
  }, gmtOptions)) + " GMT";
3013
3306
  var dateLabel = dateName;
3014
- var _normalizeFiltersText = function normalizeFiltersText(filtersInput) {
3015
- if (typeof filtersInput === "string") {
3016
- var str = filtersInput.trim();
3017
- if (!str) return "";
3018
- if (str.startsWith("[") || str.startsWith("{")) {
3019
- try {
3020
- return _normalizeFiltersText(JSON.parse(str));
3021
- } catch (_) {
3022
- // Keep raw text if not valid JSON.
3023
- }
3024
- }
3025
- return str;
3026
- }
3027
- if (Array.isArray(filtersInput)) {
3028
- var fromObjects = filtersInput.filter(function (item) {
3029
- return item && _typeof(item) === "object" && item.value !== undefined && item.value !== null && "".concat(item.value).trim();
3030
- }).map(function (item) {
3031
- return "".concat(item.label || item.id || "Filter", ": ").concat(item.value);
3032
- }).join(" | ").trim();
3033
- if (fromObjects) return fromObjects;
3034
- var fromStrings = filtersInput.map(function (item) {
3035
- return typeof item === "string" ? item.trim() : "";
3036
- }).filter(Boolean).join(" | ").trim();
3037
- if (fromStrings) return fromStrings;
3038
- }
3039
- if (filtersInput && _typeof(filtersInput) === "object") {
3040
- if (Array.isArray(filtersInput.activeFilters) || typeof filtersInput.activeFilters === "string") {
3041
- return _normalizeFiltersText(filtersInput.activeFilters);
3042
- }
3043
- if (filtersInput.value !== undefined && filtersInput.value !== null && "".concat(filtersInput.value).trim()) {
3044
- return "".concat(filtersInput.label || filtersInput.id || "Filter", ": ").concat(filtersInput.value).trim();
3045
- }
3046
- }
3047
- return "";
3048
- };
3049
- var formattedActiveFilters = _normalizeFiltersText(activeFilters);
3050
3307
  var parseFilterPills = function parseFilterPills(filtersInput) {
3051
3308
  if (Array.isArray(filtersInput)) {
3052
3309
  var fromObjects = filtersInput.filter(function (item) {
@@ -3093,9 +3350,9 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
3093
3350
  chargebackRate = refunds.chargebackRate,
3094
3351
  growthPercentage = refunds.growthPercentage,
3095
3352
  totalRefundedAmount = refunds.totalRefundedAmount,
3096
- totalRefunds = refunds.totalRefunds,
3097
- totalChargebacks = refunds.totalChargebacks,
3098
- lostChargebacks = refunds.lostChargebacks;
3353
+ totalRefunds = refunds.totalRefunds;
3354
+ refunds.totalChargebacks;
3355
+ var lostChargebacks = refunds.lostChargebacks;
3099
3356
  var newDonors = donorMix.newDonors,
3100
3357
  returningDonors = donorMix.returningDonors,
3101
3358
  totalMix = donorMix.totalMix,
@@ -3104,8 +3361,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
3104
3361
  mixAvgGift = donorMix.avgGift,
3105
3362
  donorMixPrev = donorMix.donorMixPrev;
3106
3363
  var geoList = report.donorGeographyList;
3107
- var trafficItems = Array.isArray(apiData === null || apiData === void 0 || (_apiData$trafficSourc = apiData.trafficSourceData) === null || _apiData$trafficSourc === void 0 ? void 0 : _apiData$trafficSourc.data) ? apiData.trafficSourceData.data : [];
3108
- var trafficTotal = Number((_apiData$trafficSourc2 = apiData === null || apiData === void 0 || (_apiData$trafficSourc3 = apiData.trafficSourceData) === null || _apiData$trafficSourc3 === void 0 ? void 0 : _apiData$trafficSourc3.totalRevenue) !== null && _apiData$trafficSourc2 !== void 0 ? _apiData$trafficSourc2 : 0);
3364
+ var trafficTotal = Number((_apiData$trafficSourc = apiData === null || apiData === void 0 || (_apiData$trafficSourc2 = apiData.trafficSourceData) === null || _apiData$trafficSourc2 === void 0 ? void 0 : _apiData$trafficSourc2.totalRevenue) !== null && _apiData$trafficSourc !== void 0 ? _apiData$trafficSourc : 0);
3109
3365
  var revSeries = mainChart.series || [{
3110
3366
  name: "Paid Ads",
3111
3367
  data: []
@@ -3154,13 +3410,31 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
3154
3410
  var formatRoasTrend = function formatRoasTrend(trend) {
3155
3411
  return String(trend !== null && trend !== void 0 ? trend : "").replace(/x$/, "×");
3156
3412
  };
3157
- var avgDonationDetailText = formatMetricDetail(((_metricByTitle$AvgDo = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo === void 0 ? void 0 : _metricByTitle$AvgDo.detail) || avgDonationDetail.detail || "Median $".concat(formatNumber((_avgDonationDetail$me = avgDonationDetail.median) !== null && _avgDonationDetail$me !== void 0 ? _avgDonationDetail$me : 0), " \xB7 top decile $").concat(formatNumber((_avgDonationDetail$to = avgDonationDetail.topDecile) !== null && _avgDonationDetail$to !== void 0 ? _avgDonationDetail$to : 0)));
3158
- var headerProps = {
3159
- dateLabel: dateLabel,
3160
- generatedLabel: generatedLabel,
3161
- activeFilters: formattedActiveFilters,
3162
- windowLabel: windowLabel
3413
+ var avgDonationDetailText = formatMetricDetail(((_metricByTitle$AvgDo = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo === void 0 ? void 0 : _metricByTitle$AvgDo.detail) || avgDonationDetail.detail);
3414
+ var campaignRows = activeCampaigns.map(function (c) {
3415
+ return {
3416
+ name: c.name,
3417
+ raised: c.val1,
3418
+ progress: c.progress,
3419
+ donors: c.val3,
3420
+ status: c.status
3421
+ };
3422
+ });
3423
+ var donorMixTrend = "".concat(formatTrend(donorMixPrev !== null && donorMixPrev !== void 0 ? donorMixPrev : 0), " vs last month");
3424
+ var trafficList = Array.isArray(apiData === null || apiData === void 0 || (_apiData$trafficSourc3 = apiData.trafficSourceData) === null || _apiData$trafficSourc3 === void 0 ? void 0 : _apiData$trafficSourc3.data) ? apiData.trafficSourceData.data : Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.trafficSourceData) ? apiData.trafficSourceData : [];
3425
+ var chartLabelAt = function chartLabelAt(chart, index) {
3426
+ var item = chart === null || chart === void 0 ? void 0 : chart[index];
3427
+ if (!item) return "";
3428
+ return item.date || item.label || item.category || "";
3163
3429
  };
3430
+ var obChart = (ob === null || ob === void 0 ? void 0 : ob.chart) || [];
3431
+ var refChart = (refCard === null || refCard === void 0 ? void 0 : refCard.chartData) || [];
3432
+ var chartStartLabel = chartLabelAt(obChart, 0) || revCats[0] || "";
3433
+ var chartEndLabel = chartLabelAt(obChart, obChart.length - 1) || revCats[revCats.length - 1] || "";
3434
+ var refStartLabel = chartLabelAt(refChart, 0) || revCats[0] || "";
3435
+ var refEndLabel = chartLabelAt(refChart, refChart.length - 1) || revCats[revCats.length - 1] || "";
3436
+ var disputedAmount = refunds.disputedAmount;
3437
+ var refundChartData = refunds.chartData || [];
3164
3438
  return /*#__PURE__*/jsxs("div", {
3165
3439
  ref: ref,
3166
3440
  style: {
@@ -3367,419 +3641,118 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref20, ref) {
3367
3641
  background: THEME.pageBg,
3368
3642
  display: "flex",
3369
3643
  flexDirection: "column",
3370
- fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
3644
+ fontFamily: "'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif",
3371
3645
  boxSizing: "border-box"
3372
3646
  },
3373
- children: [/*#__PURE__*/jsx(PageHeader, _objectSpread2(_objectSpread2({}, headerProps), {}, {
3374
- page: 2
3375
- })), /*#__PURE__*/jsxs("div", {
3647
+ children: [/*#__PURE__*/jsx(PageOneHeader, {
3648
+ dateLabel: dateLabel,
3649
+ generatedLabel: generatedLabel,
3650
+ windowLabel: windowLabel
3651
+ }), /*#__PURE__*/jsxs("div", {
3376
3652
  style: {
3377
3653
  flex: 1,
3378
- padding: "10px ".concat(MX, "px 8px"),
3654
+ padding: "14px ".concat(MX, "px 0"),
3379
3655
  display: "flex",
3380
3656
  flexDirection: "column",
3381
- gap: 8
3657
+ gap: 10
3382
3658
  },
3383
3659
  children: [/*#__PURE__*/jsxs("div", {
3384
3660
  style: {
3385
3661
  display: "grid",
3386
- gridTemplateColumns: "2.2fr 1fr",
3387
- gap: 8
3662
+ gridTemplateColumns: "2.15fr 1fr",
3663
+ gap: 10
3388
3664
  },
3389
- children: [/*#__PURE__*/jsx(Panel, {
3665
+ children: [/*#__PURE__*/jsx(P2Card, {
3390
3666
  title: "Active campaigns",
3391
3667
  subtitle: "Live fundraisers ranked by velocity",
3392
- children: /*#__PURE__*/jsx(MiniTable, {
3393
- head: ["Campaign", "Raised", "Progress", "Donors", "Avg Gift"],
3394
- colAlign: ["left", "right", "left", "right", "right"],
3395
- rows: activeCampaigns.map(function (c, i) {
3396
- return [c.name, c.val1, /*#__PURE__*/jsx(ProgressBar, {
3397
- value: c.progress
3398
- }, "campaign-progress-".concat(i)), c.val3, c.val4];
3399
- })
3400
- })
3401
- }), /*#__PURE__*/jsx(Panel, {
3402
- title: "Donor mix",
3403
- subtitle: "Acquisition vs retention",
3404
- children: /*#__PURE__*/jsxs("div", {
3668
+ action: /*#__PURE__*/jsx("span", {
3405
3669
  style: {
3406
- display: "flex",
3407
- flexDirection: "column",
3408
- alignItems: "center"
3670
+ fontSize: 9,
3671
+ color: THEME.brand,
3672
+ fontWeight: 500
3409
3673
  },
3410
- children: [/*#__PURE__*/jsx(Donut, {
3411
- segments: [{
3412
- value: newDonors,
3413
- color: C.indigo
3414
- }, {
3415
- value: returningDonors,
3416
- color: C.emerald
3417
- }],
3418
- size: 88,
3419
- centerVal: "".concat(formatNumber(totalMix)),
3420
- centerLabel: "donors"
3421
- }), /*#__PURE__*/jsxs("div", {
3422
- style: {
3423
- width: "100%",
3424
- marginTop: 6
3425
- },
3426
- children: [/*#__PURE__*/jsxs("div", {
3427
- style: {
3428
- display: "flex",
3429
- justifyContent: "space-between",
3430
- alignItems: "center",
3431
- marginBottom: 5
3432
- },
3433
- children: [/*#__PURE__*/jsxs("div", {
3434
- style: {
3435
- display: "flex",
3436
- alignItems: "center",
3437
- gap: 5
3438
- },
3439
- children: [/*#__PURE__*/jsx("div", {
3440
- style: {
3441
- width: 8,
3442
- height: 8,
3443
- borderRadius: 2,
3444
- background: C.indigo,
3445
- flexShrink: 0
3446
- }
3447
- }), /*#__PURE__*/jsx("span", {
3448
- style: {
3449
- fontSize: 9.5,
3450
- color: "#6B7280"
3451
- },
3452
- children: "New donors"
3453
- })]
3454
- }), /*#__PURE__*/jsxs("span", {
3455
- style: {
3456
- fontSize: 9.5,
3457
- fontWeight: 700,
3458
- color: "#111827"
3459
- },
3460
- children: [formatNumber(newDonors), " - ", newPct, "%"]
3461
- })]
3462
- }), /*#__PURE__*/jsxs("div", {
3463
- style: {
3464
- display: "flex",
3465
- justifyContent: "space-between",
3466
- alignItems: "center",
3467
- marginBottom: 8
3468
- },
3469
- children: [/*#__PURE__*/jsxs("div", {
3470
- style: {
3471
- display: "flex",
3472
- alignItems: "center",
3473
- gap: 5
3474
- },
3475
- children: [/*#__PURE__*/jsx("div", {
3476
- style: {
3477
- width: 8,
3478
- height: 8,
3479
- borderRadius: 2,
3480
- background: C.emerald,
3481
- flexShrink: 0
3482
- }
3483
- }), /*#__PURE__*/jsx("span", {
3484
- style: {
3485
- fontSize: 9.5,
3486
- color: "#6B7280"
3487
- },
3488
- children: "Returning"
3489
- })]
3490
- }), /*#__PURE__*/jsxs("span", {
3491
- style: {
3492
- fontSize: 9.5,
3493
- fontWeight: 700,
3494
- color: "#111827"
3495
- },
3496
- children: [formatNumber(returningDonors), " - ", retPct, "%"]
3497
- })]
3498
- }), /*#__PURE__*/jsx(Divider, {
3499
- mb: 6
3500
- }), /*#__PURE__*/jsx("div", {
3501
- style: {
3502
- fontSize: 9.5,
3503
- color: "#9CA3AF",
3504
- marginBottom: 2
3505
- },
3506
- children: "Avg gift"
3507
- }), /*#__PURE__*/jsx("div", {
3508
- style: {
3509
- fontSize: 14,
3510
- fontWeight: 800,
3511
- color: "#111827",
3512
- marginBottom: 2
3513
- },
3514
- children: d$(mixAvgGift)
3515
- }), /*#__PURE__*/jsx("div", {
3516
- style: {
3517
- fontSize: 9
3518
- },
3519
- children: /*#__PURE__*/jsx(TrendText, {
3520
- style: {
3521
- fontSize: 9
3522
- },
3523
- children: formatArrowTrend(donorMixPrev, {
3524
- label: "vs last month"
3525
- })
3526
- })
3527
- })]
3528
- })]
3674
+ children: "View all"
3675
+ }),
3676
+ children: /*#__PURE__*/jsx(P2CampaignTable, {
3677
+ rows: campaignRows
3529
3678
  })
3679
+ }), /*#__PURE__*/jsx(P2DonorMixCard, {
3680
+ newDonors: newDonors,
3681
+ returningDonors: returningDonors,
3682
+ totalMix: totalMix,
3683
+ newPct: newPct,
3684
+ retPct: retPct,
3685
+ avgGift: mixAvgGift,
3686
+ avgGiftTrend: donorMixTrend
3530
3687
  })]
3531
3688
  }), /*#__PURE__*/jsxs("div", {
3532
3689
  style: {
3533
3690
  display: "grid",
3534
3691
  gridTemplateColumns: "repeat(4, 1fr)",
3535
- gap: 8
3692
+ gap: 10
3536
3693
  },
3537
- children: [/*#__PURE__*/jsx(DonationTypePanel, {
3538
- donationTypeData: report.donationTypeData,
3539
- recurringColor: C.indigo,
3540
- oneTimeColor: C.emerald
3541
- }), /*#__PURE__*/jsx(DonorGeographyPanel, {
3694
+ children: [/*#__PURE__*/jsx(P2DonationTypeCard, {
3695
+ donationTypeData: report.donationTypeData
3696
+ }), /*#__PURE__*/jsx(P2DonorGeographyCard, {
3542
3697
  geoList: geoList,
3543
- totalDonors: totalDonors,
3544
- barColor: C.indigo
3545
- }), /*#__PURE__*/jsxs(Panel, {
3546
- title: "Refunds & chargebacks",
3547
- subtitle: "Trust health - ".concat(numberOfDays, "-day window"),
3548
- children: [/*#__PURE__*/jsxs("div", {
3549
- style: {
3550
- display: "flex",
3551
- gap: 12,
3552
- marginBottom: 7
3553
- },
3554
- children: [/*#__PURE__*/jsxs("div", {
3555
- children: [/*#__PURE__*/jsx("div", {
3556
- style: {
3557
- fontSize: 8,
3558
- fontWeight: 700,
3559
- letterSpacing: "0.5px",
3560
- color: "#6B7280",
3561
- marginBottom: 2
3562
- },
3563
- children: "Refunds"
3564
- }), /*#__PURE__*/jsx("div", {
3565
- style: {
3566
- fontSize: 15,
3567
- fontWeight: 800,
3568
- color: "#111827"
3569
- },
3570
- children: pct(refundRate, 1)
3571
- }), /*#__PURE__*/jsx("div", {
3572
- style: {
3573
- fontSize: 9,
3574
- fontWeight: 600
3575
- },
3576
- children: /*#__PURE__*/jsx(TrendText, {
3577
- invert: true,
3578
- style: {
3579
- fontSize: 9
3580
- },
3581
- children: growthPercentage === 0 ? "stable" : formatArrowTrend(growthPercentage)
3582
- })
3583
- })]
3584
- }), /*#__PURE__*/jsxs("div", {
3585
- children: [/*#__PURE__*/jsx("div", {
3586
- style: {
3587
- fontSize: 8,
3588
- fontWeight: 700,
3589
- letterSpacing: "0.5px",
3590
- color: "#6B7280",
3591
- marginBottom: 2
3592
- },
3593
- children: "Chargebacks"
3594
- }), /*#__PURE__*/jsx("div", {
3595
- style: {
3596
- fontSize: 15,
3597
- fontWeight: 800,
3598
- color: "#111827"
3599
- },
3600
- children: pct(chargebackRate, 1)
3601
- }), /*#__PURE__*/jsx("div", {
3602
- style: {
3603
- fontSize: 9,
3604
- color: "#9CA3AF"
3605
- },
3606
- children: growthPercentage === 0 ? "stable" : /*#__PURE__*/jsx(TrendText, {
3607
- invert: true,
3608
- style: {
3609
- fontSize: 9
3610
- },
3611
- children: formatArrowTrend(growthPercentage)
3612
- })
3613
- })]
3614
- })]
3615
- }), /*#__PURE__*/jsx(Divider, {
3616
- mb: 5
3617
- }), /*#__PURE__*/jsxs("div", {
3618
- style: {
3619
- fontSize: 8,
3620
- color: "#6B7280",
3621
- lineHeight: 1.45
3622
- },
3623
- children: [d$(totalRefundedAmount), " refunded - ", formatNumber(totalChargebacks), " chargebacks - ", formatNumber(lostChargebacks), " cases lost"]
3624
- })]
3625
- }), /*#__PURE__*/jsx(Panel, {
3626
- title: "Traffic source",
3627
- subtitle: "Revenue by channel - ".concat(daysLabel),
3628
- children: /*#__PURE__*/jsx(MiniTable, {
3629
- head: ["Source", "Revenue", "Share"],
3630
- rows: [].concat(_toConsumableArray(trafficItems.map(function (t) {
3631
- return [t.source || t.name || "-", d$(t.revenue || t.raised || 0), "".concat(formatNumber(t.share || t.percentage || 0), "%")];
3632
- })), [["Total", d$(trafficTotal), ""]])
3633
- })
3698
+ totalDonors: totalDonors
3699
+ }), /*#__PURE__*/jsx(P2RefundsCard, {
3700
+ refundRate: refundRate,
3701
+ chargebackRate: chargebackRate,
3702
+ refundGrowth: growthPercentage !== null && growthPercentage !== void 0 ? growthPercentage : 0,
3703
+ totalRefundedAmount: totalRefundedAmount,
3704
+ disputedAmount: disputedAmount !== null && disputedAmount !== void 0 ? disputedAmount : 0,
3705
+ lostCases: lostChargebacks !== null && lostChargebacks !== void 0 ? lostChargebacks : 0,
3706
+ chartData: refundChartData,
3707
+ windowLabel: windowLabel
3708
+ }), /*#__PURE__*/jsx(P2TrafficSourceCard, {
3709
+ items: trafficList,
3710
+ total: trafficTotal,
3711
+ daysLabel: daysLabel
3634
3712
  })]
3635
3713
  }), /*#__PURE__*/jsxs("div", {
3636
3714
  style: {
3637
3715
  display: "grid",
3638
3716
  gridTemplateColumns: "repeat(4, 1fr)",
3639
- gap: 8
3717
+ gap: 10
3640
3718
  },
3641
- children: [/*#__PURE__*/jsxs(Panel, {
3719
+ children: [/*#__PURE__*/jsx(P2RevenueTrendCard, {
3642
3720
  title: "Order Bump",
3643
- subtitle: "Revenue trend - last ".concat(daysLabel),
3644
- children: [/*#__PURE__*/jsx("div", {
3645
- style: {
3646
- fontSize: 17,
3647
- fontWeight: 800,
3648
- color: "#111827"
3649
- },
3650
- children: d$((ob === null || ob === void 0 ? void 0 : ob.totalRevenue) || 0)
3651
- }), /*#__PURE__*/jsx("div", {
3652
- style: {
3653
- fontSize: 10,
3654
- fontWeight: 600,
3655
- marginBottom: 5
3656
- },
3657
- children: /*#__PURE__*/jsx(TrendText, {
3658
- style: {
3659
- fontSize: 10
3660
- },
3661
- children: formatArrowTrend((_ob$growthPercentage = ob === null || ob === void 0 ? void 0 : ob.growthPercentage) !== null && _ob$growthPercentage !== void 0 ? _ob$growthPercentage : 0, {
3662
- label: "vs pp"
3663
- })
3664
- })
3665
- }), /*#__PURE__*/jsx(Sparkline, {
3666
- data: obData.length ? obData : [0, 0],
3667
- color: C.indigo,
3668
- width: 110,
3669
- height: 34
3670
- }), /*#__PURE__*/jsx(Divider, {
3671
- mt: 8,
3672
- mb: 7
3673
- }), /*#__PURE__*/jsx("div", {
3674
- style: {
3675
- display: "flex",
3676
- gap: 12
3677
- },
3678
- 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 (_ref21) {
3679
- var _ref22 = _slicedToArray(_ref21, 2),
3680
- l = _ref22[0],
3681
- v = _ref22[1];
3682
- return /*#__PURE__*/jsxs("div", {
3683
- children: [/*#__PURE__*/jsx("div", {
3684
- style: {
3685
- fontSize: 8,
3686
- color: "#9CA3AF",
3687
- marginBottom: 4
3688
- },
3689
- children: l
3690
- }), /*#__PURE__*/jsx("div", {
3691
- style: {
3692
- fontSize: 11.5,
3693
- fontWeight: 700,
3694
- color: "#111827"
3695
- },
3696
- children: v
3697
- })]
3698
- }, l);
3699
- })
3700
- })]
3701
- }), /*#__PURE__*/jsx(AcceptanceRaisedPanel, {
3721
+ subtitle: "Revenue trend".concat(BULLET, "last ").concat(daysLabel),
3722
+ value: (_ob$totalRevenue = ob === null || ob === void 0 ? void 0 : ob.totalRevenue) !== null && _ob$totalRevenue !== void 0 ? _ob$totalRevenue : 0,
3723
+ trend: "".concat(formatTrend((_ob$growthPercentage = ob === null || ob === void 0 ? void 0 : ob.growthPercentage) !== null && _ob$growthPercentage !== void 0 ? _ob$growthPercentage : 0), " vs last month"),
3724
+ chartData: obData.length ? obData : [0, 0],
3725
+ chartColor: THEME.brand,
3726
+ startLabel: chartStartLabel,
3727
+ endLabel: chartEndLabel,
3728
+ footerStats: [["Avg/day", d$Compact((_ob$averagePerDay = ob === null || ob === void 0 ? void 0 : ob.averagePerDay) !== null && _ob$averagePerDay !== void 0 ? _ob$averagePerDay : 0)], ["Peak day", d$Compact((_ob$peakDay$amount = ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) !== null && _ob$peakDay$amount !== void 0 ? _ob$peakDay$amount : 0)], ["Orders", formatNumber((_ob$totalOrders = ob === null || ob === void 0 ? void 0 : ob.totalOrders) !== null && _ob$totalOrders !== void 0 ? _ob$totalOrders : 0)]]
3729
+ }), /*#__PURE__*/jsx(P2AcceptanceCard, {
3702
3730
  title: "Upsell",
3703
- subtitle: "Acceptance & raised",
3704
- acceptanceRate: (up === null || up === void 0 ? void 0 : up.acceptanceRate) || 0,
3731
+ acceptanceRate: (_up$acceptanceRate = up === null || up === void 0 ? void 0 : up.acceptanceRate) !== null && _up$acceptanceRate !== void 0 ? _up$acceptanceRate : 0,
3705
3732
  acceptanceGrowth: (_up$acceptanceGrowth = up === null || up === void 0 ? void 0 : up.acceptanceGrowth) !== null && _up$acceptanceGrowth !== void 0 ? _up$acceptanceGrowth : 0,
3706
- raised: (up === null || up === void 0 ? void 0 : up.raised) || 0,
3707
- raisedGrowth: (_up$raisedGrowth = up === null || up === void 0 ? void 0 : up.raisedGrowth) !== null && _up$raisedGrowth !== void 0 ? _up$raisedGrowth : 0,
3708
- primaryColor: C.indigo
3709
- }), /*#__PURE__*/jsx(AcceptanceRaisedPanel, {
3733
+ raised: (_up$raised = up === null || up === void 0 ? void 0 : up.raised) !== null && _up$raised !== void 0 ? _up$raised : 0,
3734
+ raisedGrowth: (_up$raisedGrowth = up === null || up === void 0 ? void 0 : up.raisedGrowth) !== null && _up$raisedGrowth !== void 0 ? _up$raisedGrowth : 0
3735
+ }), /*#__PURE__*/jsx(P2AcceptanceCard, {
3710
3736
  title: "Downsell",
3711
- subtitle: "Acceptance & raised",
3712
- acceptanceRate: (dn === null || dn === void 0 ? void 0 : dn.acceptanceRate) || 0,
3737
+ acceptanceRate: (_dn$acceptanceRate = dn === null || dn === void 0 ? void 0 : dn.acceptanceRate) !== null && _dn$acceptanceRate !== void 0 ? _dn$acceptanceRate : 0,
3713
3738
  acceptanceGrowth: (_dn$acceptanceGrowth = dn === null || dn === void 0 ? void 0 : dn.acceptanceGrowth) !== null && _dn$acceptanceGrowth !== void 0 ? _dn$acceptanceGrowth : 0,
3714
- raised: (dn === null || dn === void 0 ? void 0 : dn.raised) || 0,
3715
- raisedGrowth: (_dn$raisedGrowth = dn === null || dn === void 0 ? void 0 : dn.raisedGrowth) !== null && _dn$raisedGrowth !== void 0 ? _dn$raisedGrowth : 0,
3716
- primaryColor: C.cyan
3717
- }), /*#__PURE__*/jsxs(Panel, {
3739
+ raised: (_dn$raised = dn === null || dn === void 0 ? void 0 : dn.raised) !== null && _dn$raised !== void 0 ? _dn$raised : 0,
3740
+ raisedGrowth: (_dn$raisedGrowth = dn === null || dn === void 0 ? void 0 : dn.raisedGrowth) !== null && _dn$raisedGrowth !== void 0 ? _dn$raisedGrowth : 0
3741
+ }), /*#__PURE__*/jsx(P2RevenueTrendCard, {
3718
3742
  title: "Referrals",
3719
- subtitle: "Revenue trend - last ".concat(daysLabel),
3720
- children: [/*#__PURE__*/jsx("div", {
3721
- style: {
3722
- fontSize: 17,
3723
- fontWeight: 800,
3724
- color: "#111827"
3725
- },
3726
- children: d$((refCard === null || refCard === void 0 ? void 0 : refCard.totalRevenue) || 0)
3727
- }), /*#__PURE__*/jsx("div", {
3728
- style: {
3729
- fontSize: 10,
3730
- fontWeight: 600,
3731
- marginBottom: 5
3732
- },
3733
- children: /*#__PURE__*/jsx(TrendText, {
3734
- style: {
3735
- fontSize: 10
3736
- },
3737
- children: formatArrowTrend((_refCard$growthPercen = refCard === null || refCard === void 0 ? void 0 : refCard.growthPercentage) !== null && _refCard$growthPercen !== void 0 ? _refCard$growthPercen : 0, {
3738
- label: "vs pp"
3739
- })
3740
- })
3741
- }), /*#__PURE__*/jsx(Sparkline, {
3742
- data: refData.length ? refData : [0, 0],
3743
- color: C.emerald,
3744
- width: 110,
3745
- height: 34
3746
- }), /*#__PURE__*/jsx(Divider, {
3747
- mt: 8,
3748
- mb: 7
3749
- }), /*#__PURE__*/jsx("div", {
3750
- style: {
3751
- display: "flex",
3752
- gap: 12
3753
- },
3754
- 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 (_ref23) {
3755
- var _ref24 = _slicedToArray(_ref23, 2),
3756
- l = _ref24[0],
3757
- v = _ref24[1];
3758
- return /*#__PURE__*/jsxs("div", {
3759
- children: [/*#__PURE__*/jsx("div", {
3760
- style: {
3761
- fontSize: 8,
3762
- color: "#9CA3AF",
3763
- marginBottom: 4
3764
- },
3765
- children: l
3766
- }), /*#__PURE__*/jsx("div", {
3767
- style: {
3768
- fontSize: 11.5,
3769
- fontWeight: 700,
3770
- color: "#111827"
3771
- },
3772
- children: v
3773
- })]
3774
- }, l);
3775
- })
3776
- })]
3743
+ subtitle: "Revenue trend".concat(BULLET, "last ").concat(daysLabel),
3744
+ value: (_refCard$totalRevenue = refCard === null || refCard === void 0 ? void 0 : refCard.totalRevenue) !== null && _refCard$totalRevenue !== void 0 ? _refCard$totalRevenue : 0,
3745
+ trend: "".concat(formatTrend((_refCard$growthPercen = refCard === null || refCard === void 0 ? void 0 : refCard.growthPercentage) !== null && _refCard$growthPercen !== void 0 ? _refCard$growthPercen : 0), " vs last month"),
3746
+ chartData: refData.length ? refData : [0, 0],
3747
+ chartColor: "#10B981",
3748
+ startLabel: refStartLabel,
3749
+ endLabel: refEndLabel,
3750
+ footerStats: [["Referrers", formatNumber((_refCard$totalReferre = refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) !== null && _refCard$totalReferre !== void 0 ? _refCard$totalReferre : 0)], ["Avg gift", d$Compact((_refCard$averageGift = refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) !== null && _refCard$averageGift !== void 0 ? _refCard$averageGift : 0)], ["Conv. rate", pct((_refCard$conversionRa = refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) !== null && _refCard$conversionRa !== void 0 ? _refCard$conversionRa : 0, 1)]]
3777
3751
  })]
3778
3752
  })]
3779
- }), /*#__PURE__*/jsx(PageFooter, {
3753
+ }), /*#__PURE__*/jsx(PageTwoFooter, {
3780
3754
  generatedBy: name,
3781
- generatedLabel: generatedLabel,
3782
- page: 2
3755
+ generatedLabel: generatedLabel
3783
3756
  })]
3784
3757
  })]
3785
3758
  });