@ammarkhalidfarooq/dashboard-package 0.6.95 → 0.6.97

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