@ammarkhalidfarooq/dashboard-package 0.5.36 → 0.5.38
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 +435 -450
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +435 -450
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -595,7 +595,7 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
595
595
|
},
|
|
596
596
|
children: /*#__PURE__*/jsxRuntime.jsxs(material.CardContent, {
|
|
597
597
|
sx: {
|
|
598
|
-
p: 3,
|
|
598
|
+
p: item.exportMode ? 2 : 3,
|
|
599
599
|
flexGrow: 1,
|
|
600
600
|
display: "flex",
|
|
601
601
|
flexDirection: "column"
|
|
@@ -605,7 +605,7 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
605
605
|
display: "flex",
|
|
606
606
|
justifyContent: "space-between",
|
|
607
607
|
alignItems: "flex-start",
|
|
608
|
-
mb: isPremium ? 3 : 2
|
|
608
|
+
mb: item.exportMode ? 2 : isPremium ? 3 : 2
|
|
609
609
|
},
|
|
610
610
|
children: [isPremium ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
611
611
|
sx: {
|
|
@@ -697,7 +697,7 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
697
697
|
},
|
|
698
698
|
children: item.hideControls ? item.series && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
699
699
|
sx: {
|
|
700
|
-
display: {
|
|
700
|
+
display: item.exportMode ? "flex" : {
|
|
701
701
|
xs: "none",
|
|
702
702
|
sm: "flex"
|
|
703
703
|
},
|
|
@@ -902,8 +902,6 @@ function formatNumber(num) {
|
|
|
902
902
|
}
|
|
903
903
|
|
|
904
904
|
var PURPLE = "#6363E6";
|
|
905
|
-
var GREEN = "#10B981";
|
|
906
|
-
var BLUE = "#06B6D4";
|
|
907
905
|
var REPORT_COLORS = {
|
|
908
906
|
purple: PURPLE};
|
|
909
907
|
var formatTrend = function formatTrend(value) {
|
|
@@ -1029,7 +1027,7 @@ var buildReportData = function buildReportData() {
|
|
|
1029
1027
|
trend: "".concat(formatTrend((_growth$totalRevenue2 = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue2 !== void 0 ? _growth$totalRevenue2 : 18), " vs ").concat(dateName || "last month"),
|
|
1030
1028
|
hideControls: true,
|
|
1031
1029
|
stacked: true,
|
|
1032
|
-
colors: [
|
|
1030
|
+
colors: ["#6366F1", "#10B981", "#06B6D4"],
|
|
1033
1031
|
stroke: {
|
|
1034
1032
|
curve: "smooth",
|
|
1035
1033
|
width: 3
|
|
@@ -1081,37 +1079,6 @@ var buildReportData = function buildReportData() {
|
|
|
1081
1079
|
categories: _categories
|
|
1082
1080
|
});
|
|
1083
1081
|
}
|
|
1084
|
-
var campaignStatus = function campaignStatus(campaign) {
|
|
1085
|
-
if (campaign.status) return campaign.status;
|
|
1086
|
-
var progress = Math.round((campaign.collectedAmount || 0) / (campaign.usdTargetAmount || 1) * 100);
|
|
1087
|
-
if (progress >= 95) return "Closing";
|
|
1088
|
-
if (progress < 50) return "Slow";
|
|
1089
|
-
return "Active";
|
|
1090
|
-
};
|
|
1091
|
-
var statusStyle = function statusStyle(status) {
|
|
1092
|
-
switch (status) {
|
|
1093
|
-
case "Slow":
|
|
1094
|
-
return {
|
|
1095
|
-
statusBg: "#FEF3C7",
|
|
1096
|
-
statusColor: "#B45309"
|
|
1097
|
-
};
|
|
1098
|
-
case "Closing":
|
|
1099
|
-
return {
|
|
1100
|
-
statusBg: "#DBEAFE",
|
|
1101
|
-
statusColor: "#1D4ED8"
|
|
1102
|
-
};
|
|
1103
|
-
default:
|
|
1104
|
-
return {
|
|
1105
|
-
statusBg: "#D1FAE5",
|
|
1106
|
-
statusColor: "#047857"
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
var progressColor = function progressColor(progress) {
|
|
1111
|
-
if (progress >= 95) return GREEN;
|
|
1112
|
-
if (progress < 50) return "#F59E0B";
|
|
1113
|
-
return PURPLE;
|
|
1114
|
-
};
|
|
1115
1082
|
var sampleCampaigns = [{
|
|
1116
1083
|
title: "Orphan sponsorship — Yemen",
|
|
1117
1084
|
collectedAmount: 78400,
|
|
@@ -1145,20 +1112,17 @@ var buildReportData = function buildReportData() {
|
|
|
1145
1112
|
}];
|
|
1146
1113
|
var campaignSource = ((apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || []).length ? apiData.activeCampaigns : sampleCampaigns;
|
|
1147
1114
|
var activeCampaigns = campaignSource.map(function (campaign) {
|
|
1148
|
-
|
|
1149
|
-
var status = campaignStatus(campaign);
|
|
1150
|
-
return _objectSpread2({
|
|
1115
|
+
return {
|
|
1151
1116
|
id: campaign.campaignName ? campaign.campaignName.split(" ").filter(Boolean).map(function (w) {
|
|
1152
1117
|
return w[0];
|
|
1153
1118
|
}).join("").toUpperCase().slice(0, 2) : "??",
|
|
1154
1119
|
name: campaign.title || "Untitled Campaign",
|
|
1155
1120
|
val1: "$".concat(formatNumber(campaign.collectedAmount || 0)),
|
|
1156
1121
|
type: "progress",
|
|
1157
|
-
progress:
|
|
1158
|
-
progressColor: progressColor(progress),
|
|
1122
|
+
progress: Math.round((campaign.collectedAmount || 0) / (campaign.usdTargetAmount || 1) * 100),
|
|
1159
1123
|
val3: formatNumber(campaign.uniqueDonationsCount || 0),
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1124
|
+
val4: "$".concat(formatNumber(campaign.avgGift || 0))
|
|
1125
|
+
};
|
|
1162
1126
|
});
|
|
1163
1127
|
return {
|
|
1164
1128
|
hero: hero,
|
|
@@ -1467,14 +1431,16 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1467
1431
|
rows = _ref$rows === void 0 ? [] : _ref$rows,
|
|
1468
1432
|
_ref$gridTemplateColu = _ref.gridTemplateColumns,
|
|
1469
1433
|
gridTemplateColumns = _ref$gridTemplateColu === void 0 ? "3fr 1fr 1.5fr 0.8fr 1fr " : _ref$gridTemplateColu,
|
|
1470
|
-
height = _ref.height
|
|
1434
|
+
height = _ref.height,
|
|
1435
|
+
_ref$compact = _ref.compact,
|
|
1436
|
+
compact = _ref$compact === void 0 ? false : _ref$compact;
|
|
1471
1437
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1472
1438
|
sx: {
|
|
1473
1439
|
bgcolor: "#fff",
|
|
1474
|
-
borderRadius: 4,
|
|
1440
|
+
borderRadius: compact ? 3 : 4,
|
|
1475
1441
|
border: "1px solid #f0f0f0",
|
|
1476
|
-
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
1477
|
-
p: 3,
|
|
1442
|
+
boxShadow: compact ? "0 2px 12px rgba(0,0,0,0.05)" : "0 4px 24px rgba(0,0,0,0.06)",
|
|
1443
|
+
p: compact ? 1.5 : 3,
|
|
1478
1444
|
height: height
|
|
1479
1445
|
// height: "100%",
|
|
1480
1446
|
},
|
|
@@ -1483,20 +1449,20 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1483
1449
|
display: "flex",
|
|
1484
1450
|
justifyContent: "space-between",
|
|
1485
1451
|
alignItems: "flex-start",
|
|
1486
|
-
mb: 3
|
|
1452
|
+
mb: compact ? 1.25 : 3
|
|
1487
1453
|
},
|
|
1488
1454
|
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1489
1455
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1490
1456
|
sx: {
|
|
1491
1457
|
fontWeight: 700,
|
|
1492
|
-
fontSize: "18px",
|
|
1458
|
+
fontSize: compact ? "14px" : "18px",
|
|
1493
1459
|
color: "#000",
|
|
1494
1460
|
textAlign: "left"
|
|
1495
1461
|
},
|
|
1496
1462
|
children: title
|
|
1497
1463
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1498
1464
|
sx: {
|
|
1499
|
-
fontSize: "13px",
|
|
1465
|
+
fontSize: compact ? "10px" : "13px",
|
|
1500
1466
|
color: "rgba(0, 0, 0, 0.4)",
|
|
1501
1467
|
mt: 0.2
|
|
1502
1468
|
},
|
|
@@ -1504,7 +1470,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1504
1470
|
})]
|
|
1505
1471
|
}), actionLabel && /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1506
1472
|
sx: {
|
|
1507
|
-
fontSize: "13px",
|
|
1473
|
+
fontSize: compact ? "10px" : "13px",
|
|
1508
1474
|
fontWeight: 600,
|
|
1509
1475
|
color: "rgb(99, 99, 230)",
|
|
1510
1476
|
cursor: "pointer"
|
|
@@ -1513,24 +1479,24 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1513
1479
|
})]
|
|
1514
1480
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1515
1481
|
sx: {
|
|
1516
|
-
overflowX: "auto"
|
|
1482
|
+
overflowX: compact ? "hidden" : "auto"
|
|
1517
1483
|
},
|
|
1518
1484
|
children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1519
1485
|
sx: {
|
|
1520
|
-
minWidth: "600px"
|
|
1486
|
+
minWidth: compact ? 0 : "600px"
|
|
1521
1487
|
},
|
|
1522
1488
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1523
1489
|
sx: {
|
|
1524
1490
|
display: "grid",
|
|
1525
1491
|
gridTemplateColumns: gridTemplateColumns,
|
|
1526
|
-
gap: 2,
|
|
1527
|
-
pb: 2.5,
|
|
1492
|
+
gap: compact ? 1 : 2,
|
|
1493
|
+
pb: compact ? 1 : 2.5,
|
|
1528
1494
|
borderBottom: "1px solid #f0f0f0"
|
|
1529
1495
|
},
|
|
1530
1496
|
children: columns.map(function (header) {
|
|
1531
1497
|
return /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1532
1498
|
sx: {
|
|
1533
|
-
fontSize: "12px",
|
|
1499
|
+
fontSize: compact ? "9px" : "12px",
|
|
1534
1500
|
color: "rgba(0, 0, 0, 0.4)",
|
|
1535
1501
|
fontWeight: 500,
|
|
1536
1502
|
textAlign: "left"
|
|
@@ -1548,8 +1514,8 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1548
1514
|
sx: {
|
|
1549
1515
|
display: "grid",
|
|
1550
1516
|
gridTemplateColumns: gridTemplateColumns,
|
|
1551
|
-
gap: 2,
|
|
1552
|
-
py: 1.2,
|
|
1517
|
+
gap: compact ? 1 : 2,
|
|
1518
|
+
py: compact ? 0.5 : 1.2,
|
|
1553
1519
|
alignItems: "center",
|
|
1554
1520
|
borderBottom: idx === rows.length - 1 ? "none" : "1px solid #f5f5f5"
|
|
1555
1521
|
},
|
|
@@ -1561,9 +1527,9 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1561
1527
|
},
|
|
1562
1528
|
children: [row.id && /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
|
|
1563
1529
|
sx: {
|
|
1564
|
-
width: 28,
|
|
1565
|
-
height: 28,
|
|
1566
|
-
fontSize: "10px",
|
|
1530
|
+
width: compact ? 22 : 28,
|
|
1531
|
+
height: compact ? 22 : 28,
|
|
1532
|
+
fontSize: compact ? "8px" : "10px",
|
|
1567
1533
|
fontWeight: 700,
|
|
1568
1534
|
bgcolor: row.avatarBg || "#F3F4F6",
|
|
1569
1535
|
color: "rgb(99, 99, 230)"
|
|
@@ -1582,7 +1548,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1582
1548
|
})
|
|
1583
1549
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1584
1550
|
sx: {
|
|
1585
|
-
fontSize: "12px",
|
|
1551
|
+
fontSize: compact ? "10px" : "12px",
|
|
1586
1552
|
fontWeight: 700,
|
|
1587
1553
|
color: "#000"
|
|
1588
1554
|
},
|
|
@@ -1590,7 +1556,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1590
1556
|
})]
|
|
1591
1557
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1592
1558
|
sx: {
|
|
1593
|
-
fontSize: "13px",
|
|
1559
|
+
fontSize: compact ? "10px" : "13px",
|
|
1594
1560
|
fontWeight: 600,
|
|
1595
1561
|
color: "#000",
|
|
1596
1562
|
textAlign: "left"
|
|
@@ -1610,7 +1576,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1610
1576
|
variant: "determinate",
|
|
1611
1577
|
value: Math.min(100, Math.max(0, (_row$progress = row.progress) !== null && _row$progress !== void 0 ? _row$progress : 0)),
|
|
1612
1578
|
sx: {
|
|
1613
|
-
height: 8,
|
|
1579
|
+
height: compact ? 6 : 8,
|
|
1614
1580
|
borderRadius: 4,
|
|
1615
1581
|
bgcolor: "#F3F4F6",
|
|
1616
1582
|
"& .MuiLinearProgress-bar": {
|
|
@@ -1621,7 +1587,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1621
1587
|
})
|
|
1622
1588
|
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
1623
1589
|
sx: {
|
|
1624
|
-
fontSize: "11px",
|
|
1590
|
+
fontSize: compact ? "9px" : "11px",
|
|
1625
1591
|
color: "rgba(0, 0, 0, 0.4)",
|
|
1626
1592
|
minWidth: "30px"
|
|
1627
1593
|
},
|
|
@@ -1637,7 +1603,7 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1637
1603
|
children: row.val2
|
|
1638
1604
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1639
1605
|
sx: {
|
|
1640
|
-
fontSize: "13px",
|
|
1606
|
+
fontSize: compact ? "10px" : "13px",
|
|
1641
1607
|
fontWeight: row.highlightVal3 ? 700 : 500,
|
|
1642
1608
|
color: row.highlightVal3 ? row.val3Color || "#22C55E" : "#000",
|
|
1643
1609
|
textAlign: "left"
|
|
@@ -1692,12 +1658,12 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
1692
1658
|
}) : /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1693
1659
|
sx: {
|
|
1694
1660
|
display: "inline-block",
|
|
1695
|
-
px: 1.5,
|
|
1696
|
-
py: 0.5,
|
|
1661
|
+
px: compact ? 1 : 1.5,
|
|
1662
|
+
py: compact ? 0.25 : 0.5,
|
|
1697
1663
|
borderRadius: "100px",
|
|
1698
1664
|
bgcolor: row.statusBg,
|
|
1699
1665
|
color: row.statusColor,
|
|
1700
|
-
fontSize: "11px",
|
|
1666
|
+
fontSize: compact ? "9px" : "11px",
|
|
1701
1667
|
fontWeight: 700,
|
|
1702
1668
|
textAlign: "center"
|
|
1703
1669
|
},
|
|
@@ -1743,6 +1709,8 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1743
1709
|
bottomSummaryValue = _ref$bottomSummaryVal === void 0 ? "$130.58" : _ref$bottomSummaryVal,
|
|
1744
1710
|
_ref$bottomSummaryTre = _ref.bottomSummaryTrend,
|
|
1745
1711
|
bottomSummaryTrend = _ref$bottomSummaryTre === void 0 ? "8.4% vs last month" : _ref$bottomSummaryTre,
|
|
1712
|
+
_ref$compact = _ref.compact,
|
|
1713
|
+
compact = _ref$compact === void 0 ? false : _ref$compact,
|
|
1746
1714
|
_ref$sx = _ref.sx,
|
|
1747
1715
|
sx = _ref$sx === void 0 ? {} : _ref$sx;
|
|
1748
1716
|
var chartOptions = {
|
|
@@ -1811,7 +1779,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1811
1779
|
borderRadius: 4,
|
|
1812
1780
|
border: "1px solid #f0f0f0",
|
|
1813
1781
|
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
1814
|
-
p: 3,
|
|
1782
|
+
p: compact ? 1.5 : 3,
|
|
1815
1783
|
// height: "100%",
|
|
1816
1784
|
// width: "100%",
|
|
1817
1785
|
display: "flex",
|
|
@@ -1822,16 +1790,15 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1822
1790
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1823
1791
|
sx: {
|
|
1824
1792
|
fontWeight: 700,
|
|
1825
|
-
fontSize: "18px",
|
|
1793
|
+
fontSize: compact ? "14px" : "18px",
|
|
1826
1794
|
color: "#000",
|
|
1827
1795
|
textAlign: "left"
|
|
1828
1796
|
},
|
|
1829
1797
|
children: title
|
|
1830
1798
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1831
1799
|
sx: {
|
|
1832
|
-
fontSize: "13px",
|
|
1800
|
+
fontSize: compact ? "10px" : "13px",
|
|
1833
1801
|
color: "rgba(0, 0, 0, 0.4)",
|
|
1834
|
-
// mt: 0.2,
|
|
1835
1802
|
textAlign: "left"
|
|
1836
1803
|
},
|
|
1837
1804
|
children: subtitle
|
|
@@ -1839,7 +1806,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1839
1806
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1840
1807
|
sx: {
|
|
1841
1808
|
position: "relative",
|
|
1842
|
-
height: "180px",
|
|
1809
|
+
height: compact ? "110px" : "180px",
|
|
1843
1810
|
// mb: 1,
|
|
1844
1811
|
display: "flex",
|
|
1845
1812
|
justifyContent: "center"
|
|
@@ -1848,7 +1815,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1848
1815
|
options: chartOptions,
|
|
1849
1816
|
series: series,
|
|
1850
1817
|
type: "donut",
|
|
1851
|
-
width: "210"
|
|
1818
|
+
width: compact ? "140" : "210"
|
|
1852
1819
|
})
|
|
1853
1820
|
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1854
1821
|
sx: {},
|
|
@@ -1857,7 +1824,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1857
1824
|
sx: {
|
|
1858
1825
|
display: "flex",
|
|
1859
1826
|
justifyContent: "space-between",
|
|
1860
|
-
mb: idx === items.length - 1 ? showBottomSummary ? 1 : 0 : 1
|
|
1827
|
+
mb: idx === items.length - 1 ? showBottomSummary ? compact ? 0.5 : 1 : 0 : compact ? 0.5 : 1
|
|
1861
1828
|
},
|
|
1862
1829
|
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1863
1830
|
sx: {
|
|
@@ -1874,7 +1841,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1874
1841
|
}
|
|
1875
1842
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1876
1843
|
sx: {
|
|
1877
|
-
fontSize: "13px",
|
|
1844
|
+
fontSize: compact ? "10px" : "13px",
|
|
1878
1845
|
fontWeight: 500,
|
|
1879
1846
|
color: "rgba(0, 0, 0, 0.4)"
|
|
1880
1847
|
},
|
|
@@ -1882,7 +1849,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1882
1849
|
})]
|
|
1883
1850
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1884
1851
|
sx: {
|
|
1885
|
-
fontSize: "13px",
|
|
1852
|
+
fontSize: compact ? "10px" : "13px",
|
|
1886
1853
|
fontWeight: 700,
|
|
1887
1854
|
color: "#111"
|
|
1888
1855
|
},
|
|
@@ -1894,7 +1861,7 @@ var DonorMixCard = function DonorMixCard(_ref) {
|
|
|
1894
1861
|
// display: "flex",
|
|
1895
1862
|
// justifyContent: "space-between",
|
|
1896
1863
|
// alignItems: "center",
|
|
1897
|
-
pt: 2,
|
|
1864
|
+
pt: compact ? 1 : 2,
|
|
1898
1865
|
borderTop: "1px solid #f0f0f0",
|
|
1899
1866
|
textAlign: "left"
|
|
1900
1867
|
},
|
|
@@ -2144,7 +2111,9 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
|
|
|
2144
2111
|
footerMetrics = _ref$footerMetrics === void 0 ? [] : _ref$footerMetrics,
|
|
2145
2112
|
sx = _ref.sx,
|
|
2146
2113
|
_ref$bottomSection = _ref.bottomSection,
|
|
2147
|
-
bottomSection = _ref$bottomSection === void 0 ? false : _ref$bottomSection
|
|
2114
|
+
bottomSection = _ref$bottomSection === void 0 ? false : _ref$bottomSection,
|
|
2115
|
+
_ref$compact = _ref.compact,
|
|
2116
|
+
compact = _ref$compact === void 0 ? false : _ref$compact;
|
|
2148
2117
|
// Extract values for chart series
|
|
2149
2118
|
var series = [{
|
|
2150
2119
|
name: title,
|
|
@@ -2218,8 +2187,8 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
|
|
|
2218
2187
|
};
|
|
2219
2188
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
2220
2189
|
sx: _objectSpread2({
|
|
2221
|
-
p: 3,
|
|
2222
|
-
borderRadius: 4,
|
|
2190
|
+
p: compact ? 1.25 : 3,
|
|
2191
|
+
borderRadius: compact ? 3 : 4,
|
|
2223
2192
|
border: "1px solid #f0f0f0",
|
|
2224
2193
|
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
2225
2194
|
bgcolor: "#fff",
|
|
@@ -2233,7 +2202,7 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
|
|
|
2233
2202
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
2234
2203
|
sx: {
|
|
2235
2204
|
fontWeight: 700,
|
|
2236
|
-
fontSize: "16px",
|
|
2205
|
+
fontSize: compact ? "13px" : "16px",
|
|
2237
2206
|
color: "#000",
|
|
2238
2207
|
textAlign: "left"
|
|
2239
2208
|
},
|
|
@@ -2349,7 +2318,9 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
2349
2318
|
raisedTrend = _ref.raisedTrend,
|
|
2350
2319
|
_ref$chartColors = _ref.chartColors,
|
|
2351
2320
|
chartColors = _ref$chartColors === void 0 ? ["rgb(99, 99, 230)", "#88bfd290"] : _ref$chartColors,
|
|
2352
|
-
sx = _ref.sx
|
|
2321
|
+
sx = _ref.sx,
|
|
2322
|
+
_ref$compact = _ref.compact,
|
|
2323
|
+
compact = _ref$compact === void 0 ? false : _ref$compact;
|
|
2353
2324
|
var chartOptions = {
|
|
2354
2325
|
chart: {
|
|
2355
2326
|
type: "radialBar",
|
|
@@ -2405,8 +2376,8 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
2405
2376
|
var series = [acceptanceRate];
|
|
2406
2377
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
2407
2378
|
sx: _objectSpread2({
|
|
2408
|
-
p: 3,
|
|
2409
|
-
borderRadius: 4,
|
|
2379
|
+
p: compact ? 1.25 : 3,
|
|
2380
|
+
borderRadius: compact ? 3 : 4,
|
|
2410
2381
|
border: "1px solid #f0f0f0",
|
|
2411
2382
|
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
2412
2383
|
bgcolor: "#fff",
|
|
@@ -2419,7 +2390,7 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
2419
2390
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
2420
2391
|
sx: {
|
|
2421
2392
|
fontWeight: 700,
|
|
2422
|
-
fontSize: "16px",
|
|
2393
|
+
fontSize: compact ? "13px" : "16px",
|
|
2423
2394
|
color: "#000",
|
|
2424
2395
|
textAlign: "left"
|
|
2425
2396
|
},
|
|
@@ -2435,9 +2406,9 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
2435
2406
|
})]
|
|
2436
2407
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
2437
2408
|
sx: {
|
|
2438
|
-
height: 160,
|
|
2409
|
+
height: compact ? 90 : 160,
|
|
2439
2410
|
position: "relative",
|
|
2440
|
-
mt: 1,
|
|
2411
|
+
mt: compact ? 0.5 : 1,
|
|
2441
2412
|
display: "flex",
|
|
2442
2413
|
justifyContent: "center"
|
|
2443
2414
|
},
|
|
@@ -4135,15 +4106,269 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4135
4106
|
});
|
|
4136
4107
|
};
|
|
4137
4108
|
|
|
4138
|
-
var
|
|
4139
|
-
|
|
4109
|
+
var CARD_SX = {
|
|
4110
|
+
maxHeight: 280
|
|
4140
4111
|
};
|
|
4112
|
+
var GRID_GAP = "6px";
|
|
4113
|
+
var fourColGridSx = function fourColGridSx(exportMode) {
|
|
4114
|
+
return {
|
|
4115
|
+
display: "grid",
|
|
4116
|
+
gridTemplateColumns: exportMode ? "repeat(4, 1fr)" : {
|
|
4117
|
+
xs: "1fr",
|
|
4118
|
+
sm: "repeat(2, 1fr)",
|
|
4119
|
+
md: "repeat(4, 1fr)"
|
|
4120
|
+
},
|
|
4121
|
+
gap: GRID_GAP,
|
|
4122
|
+
mt: GRID_GAP,
|
|
4123
|
+
alignItems: "stretch"
|
|
4124
|
+
};
|
|
4125
|
+
};
|
|
4126
|
+
var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
|
|
4127
|
+
var _orderBumpData$chart, _orderBumpData$peakDa, _orderBumpData$peakDa2, _referralData$chartDa;
|
|
4128
|
+
var _ref$exportMode = _ref.exportMode,
|
|
4129
|
+
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode,
|
|
4130
|
+
_ref$section = _ref.section,
|
|
4131
|
+
section = _ref$section === void 0 ? "all" : _ref$section,
|
|
4132
|
+
_ref$activeCampaignsR = _ref.activeCampaignsRows,
|
|
4133
|
+
activeCampaignsRows = _ref$activeCampaignsR === void 0 ? [] : _ref$activeCampaignsR,
|
|
4134
|
+
_ref$donorMix = _ref.donorMix,
|
|
4135
|
+
donorMix = _ref$donorMix === void 0 ? {} : _ref$donorMix,
|
|
4136
|
+
_ref$donationTypeData = _ref.donationTypeData,
|
|
4137
|
+
donationTypeData = _ref$donationTypeData === void 0 ? [] : _ref$donationTypeData,
|
|
4138
|
+
_ref$donorGeographyDa = _ref.donorGeographyData,
|
|
4139
|
+
donorGeographyData = _ref$donorGeographyDa === void 0 ? [] : _ref$donorGeographyDa,
|
|
4140
|
+
_ref$trafficSourceDat = _ref.trafficSourceData,
|
|
4141
|
+
trafficSourceData = _ref$trafficSourceDat === void 0 ? {} : _ref$trafficSourceDat,
|
|
4142
|
+
_ref$orderBumpData = _ref.orderBumpData,
|
|
4143
|
+
orderBumpData = _ref$orderBumpData === void 0 ? {} : _ref$orderBumpData,
|
|
4144
|
+
_ref$upsellData = _ref.upsellData,
|
|
4145
|
+
upsellData = _ref$upsellData === void 0 ? {} : _ref$upsellData,
|
|
4146
|
+
_ref$downsellData = _ref.downsellData,
|
|
4147
|
+
downsellData = _ref$downsellData === void 0 ? {} : _ref$downsellData,
|
|
4148
|
+
_ref$referralData = _ref.referralData,
|
|
4149
|
+
referralData = _ref$referralData === void 0 ? {} : _ref$referralData,
|
|
4150
|
+
_ref$refundsChargebac = _ref.refundsChargebacksData,
|
|
4151
|
+
refundsChargebacksData = _ref$refundsChargebac === void 0 ? [] : _ref$refundsChargebac,
|
|
4152
|
+
_ref$dateName = _ref.dateName,
|
|
4153
|
+
dateName = _ref$dateName === void 0 ? "Last Period" : _ref$dateName;
|
|
4154
|
+
var _donorMix$newDonors = donorMix.newDonors,
|
|
4155
|
+
newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
|
|
4156
|
+
_donorMix$returningDo = donorMix.returningDonors,
|
|
4157
|
+
returningDonors = _donorMix$returningDo === void 0 ? 0 : _donorMix$returningDo,
|
|
4158
|
+
_donorMix$totalMix = donorMix.totalMix,
|
|
4159
|
+
totalMix = _donorMix$totalMix === void 0 ? 0 : _donorMix$totalMix,
|
|
4160
|
+
_donorMix$newPct = donorMix.newPct,
|
|
4161
|
+
newPct = _donorMix$newPct === void 0 ? 0 : _donorMix$newPct,
|
|
4162
|
+
_donorMix$retPct = donorMix.retPct,
|
|
4163
|
+
retPct = _donorMix$retPct === void 0 ? 0 : _donorMix$retPct,
|
|
4164
|
+
_donorMix$avgGift = donorMix.avgGift,
|
|
4165
|
+
avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
|
|
4166
|
+
_donorMix$donorMixPre = donorMix.donorMixPrev,
|
|
4167
|
+
donorMixPrev = _donorMix$donorMixPre === void 0 ? 0 : _donorMix$donorMixPre;
|
|
4168
|
+
var campaignsRow = exportMode ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4169
|
+
sx: {
|
|
4170
|
+
display: "grid",
|
|
4171
|
+
gridTemplateColumns: "2.25fr 1fr",
|
|
4172
|
+
gap: GRID_GAP,
|
|
4173
|
+
alignItems: "stretch"
|
|
4174
|
+
},
|
|
4175
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
|
|
4176
|
+
title: "Active campaigns",
|
|
4177
|
+
subtitle: "Live fundraisers ranked by velocity",
|
|
4178
|
+
columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
|
|
4179
|
+
rows: activeCampaignsRows
|
|
4180
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
4181
|
+
title: "Donor mix",
|
|
4182
|
+
subtitle: "Acquisition vs retention",
|
|
4183
|
+
series: [newDonors, returningDonors],
|
|
4184
|
+
labels: ["New donors", "Returning"],
|
|
4185
|
+
colors: ["rgb(99, 99, 230)", "#10B981"],
|
|
4186
|
+
centerLabel: "donors",
|
|
4187
|
+
centerValue: String(totalMix),
|
|
4188
|
+
items: [{
|
|
4189
|
+
label: "New donors",
|
|
4190
|
+
val: "".concat(newDonors, " \xB7 ").concat(newPct, "%"),
|
|
4191
|
+
color: "rgb(99, 99, 230)"
|
|
4192
|
+
}, {
|
|
4193
|
+
label: "Returning",
|
|
4194
|
+
val: "".concat(returningDonors, " \xB7 ").concat(retPct, "%"),
|
|
4195
|
+
color: "#10B981"
|
|
4196
|
+
}],
|
|
4197
|
+
bottomSummaryValue: "$".concat(avgGift),
|
|
4198
|
+
bottomSummaryTrend: "".concat(donorMixPrev, "% vs ").concat(dateName || "last month"),
|
|
4199
|
+
sx: {
|
|
4200
|
+
width: "100%"
|
|
4201
|
+
}
|
|
4202
|
+
})]
|
|
4203
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
|
|
4204
|
+
container: true,
|
|
4205
|
+
spacing: GRID_GAP,
|
|
4206
|
+
sx: {
|
|
4207
|
+
mt: GRID_GAP
|
|
4208
|
+
},
|
|
4209
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
4210
|
+
item: true,
|
|
4211
|
+
xs: 12,
|
|
4212
|
+
md: 9,
|
|
4213
|
+
sx: {
|
|
4214
|
+
paddingTop: "0px !important"
|
|
4215
|
+
},
|
|
4216
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
|
|
4217
|
+
title: "Active campaigns",
|
|
4218
|
+
subtitle: "Live fundraisers ranked by velocity",
|
|
4219
|
+
columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
|
|
4220
|
+
rows: activeCampaignsRows
|
|
4221
|
+
})
|
|
4222
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
4223
|
+
item: true,
|
|
4224
|
+
xs: 12,
|
|
4225
|
+
md: 3,
|
|
4226
|
+
sx: {
|
|
4227
|
+
display: "flex",
|
|
4228
|
+
paddingTop: "0px !important",
|
|
4229
|
+
marginTop: {
|
|
4230
|
+
xs: GRID_GAP,
|
|
4231
|
+
md: 0
|
|
4232
|
+
}
|
|
4233
|
+
},
|
|
4234
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
4235
|
+
title: "Donor mix",
|
|
4236
|
+
subtitle: "Acquisition vs retention",
|
|
4237
|
+
series: [newDonors, returningDonors],
|
|
4238
|
+
labels: ["New donors", "Returning"],
|
|
4239
|
+
colors: ["rgb(99, 99, 230)", "#10B981"],
|
|
4240
|
+
centerLabel: "donors",
|
|
4241
|
+
centerValue: String(totalMix),
|
|
4242
|
+
items: [{
|
|
4243
|
+
label: "New donors",
|
|
4244
|
+
val: "".concat(newDonors, " \xB7 ").concat(newPct, "%"),
|
|
4245
|
+
color: "rgb(99, 99, 230)"
|
|
4246
|
+
}, {
|
|
4247
|
+
label: "Returning",
|
|
4248
|
+
val: "".concat(returningDonors, " \xB7 ").concat(retPct, "%"),
|
|
4249
|
+
color: "#10B981"
|
|
4250
|
+
}],
|
|
4251
|
+
bottomSummaryValue: "$".concat(avgGift),
|
|
4252
|
+
bottomSummaryTrend: "".concat(donorMixPrev, "% vs ").concat(dateName || "last month"),
|
|
4253
|
+
sx: {
|
|
4254
|
+
width: "100%"
|
|
4255
|
+
}
|
|
4256
|
+
})
|
|
4257
|
+
})]
|
|
4258
|
+
});
|
|
4259
|
+
var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4260
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
|
|
4261
|
+
sx: CARD_SX,
|
|
4262
|
+
donationTypeData: donationTypeData
|
|
4263
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
|
|
4264
|
+
sx: CARD_SX,
|
|
4265
|
+
donorGeographyData: donorGeographyData
|
|
4266
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
|
|
4267
|
+
sx: CARD_SX,
|
|
4268
|
+
refundsChargebacksData: refundsChargebacksData
|
|
4269
|
+
}), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
|
|
4270
|
+
sx: CARD_SX,
|
|
4271
|
+
trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
|
|
4272
|
+
total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0))
|
|
4273
|
+
})]
|
|
4274
|
+
});
|
|
4275
|
+
var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4276
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
4277
|
+
title: "Order Bump",
|
|
4278
|
+
subtitle: "Revenue trend \xB7 last 30 days",
|
|
4279
|
+
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
|
|
4280
|
+
trend: "".concat((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) || 0).toFixed(1), "% vs last month"),
|
|
4281
|
+
chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
|
|
4282
|
+
return {
|
|
4283
|
+
label: item.label,
|
|
4284
|
+
value: item.revenue
|
|
4285
|
+
};
|
|
4286
|
+
})) || [],
|
|
4287
|
+
footerMetrics: [{
|
|
4288
|
+
label: "Avg / Day",
|
|
4289
|
+
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
|
|
4290
|
+
}, {
|
|
4291
|
+
label: "Orders",
|
|
4292
|
+
value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
|
|
4293
|
+
}, {
|
|
4294
|
+
label: "Peak Day",
|
|
4295
|
+
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
|
|
4296
|
+
subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
|
|
4297
|
+
}],
|
|
4298
|
+
sx: CARD_SX,
|
|
4299
|
+
bottomSection: true
|
|
4300
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
4301
|
+
title: "Upsell",
|
|
4302
|
+
subtitle: "Acceptance & raised",
|
|
4303
|
+
acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
|
|
4304
|
+
acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.totalUpsellsAttached) || 0)),
|
|
4305
|
+
acceptanceTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
|
|
4306
|
+
raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
|
|
4307
|
+
raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
|
|
4308
|
+
sx: CARD_SX
|
|
4309
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
4310
|
+
title: "Downsell",
|
|
4311
|
+
subtitle: "Acceptance & raised",
|
|
4312
|
+
acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
|
|
4313
|
+
acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
|
|
4314
|
+
acceptanceTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) || 0), "%"),
|
|
4315
|
+
raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
|
|
4316
|
+
raisedTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0), "%"),
|
|
4317
|
+
sx: CARD_SX
|
|
4318
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
4319
|
+
title: "Referrals",
|
|
4320
|
+
subtitle: "Revenue trend \xB7 last 30 days",
|
|
4321
|
+
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
|
|
4322
|
+
trend: "\u25B2 ".concat((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) || 0, "% vs last month"),
|
|
4323
|
+
chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
|
|
4324
|
+
return {
|
|
4325
|
+
label: item.date,
|
|
4326
|
+
value: item.revenue
|
|
4327
|
+
};
|
|
4328
|
+
})) || [],
|
|
4329
|
+
footerMetrics: [{
|
|
4330
|
+
label: "Referrers",
|
|
4331
|
+
value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
|
|
4332
|
+
}, {
|
|
4333
|
+
label: "Avg gift",
|
|
4334
|
+
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
|
|
4335
|
+
}, {
|
|
4336
|
+
label: "Conv. rate",
|
|
4337
|
+
value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
|
|
4338
|
+
}],
|
|
4339
|
+
sx: CARD_SX,
|
|
4340
|
+
bottomSection: true
|
|
4341
|
+
})]
|
|
4342
|
+
});
|
|
4343
|
+
if (section === "campaigns") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4344
|
+
children: campaignsRow
|
|
4345
|
+
});
|
|
4346
|
+
if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4347
|
+
sx: fourColGridSx(exportMode),
|
|
4348
|
+
children: middleCards
|
|
4349
|
+
});
|
|
4350
|
+
if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4351
|
+
sx: fourColGridSx(exportMode),
|
|
4352
|
+
children: bottomCards
|
|
4353
|
+
});
|
|
4354
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4355
|
+
children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4356
|
+
sx: fourColGridSx(exportMode),
|
|
4357
|
+
children: middleCards
|
|
4358
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4359
|
+
sx: fourColGridSx(exportMode),
|
|
4360
|
+
children: bottomCards
|
|
4361
|
+
})]
|
|
4362
|
+
});
|
|
4363
|
+
};
|
|
4364
|
+
|
|
4141
4365
|
var ReportDetailsSection = function ReportDetailsSection(_ref) {
|
|
4142
|
-
var _orderBumpData$chart, _orderBumpData$peakDa, _referralData$chartDa;
|
|
4143
4366
|
var reportData = _ref.reportData,
|
|
4144
4367
|
dateName = _ref.dateName,
|
|
4145
4368
|
_ref$exportMode = _ref.exportMode,
|
|
4146
|
-
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode
|
|
4369
|
+
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode,
|
|
4370
|
+
_ref$section = _ref.section,
|
|
4371
|
+
section = _ref$section === void 0 ? "all" : _ref$section;
|
|
4147
4372
|
var activeCampaigns = reportData.activeCampaigns,
|
|
4148
4373
|
donorMix = reportData.donorMix,
|
|
4149
4374
|
donationTypeData = reportData.donationTypeData,
|
|
@@ -4154,161 +4379,20 @@ var ReportDetailsSection = function ReportDetailsSection(_ref) {
|
|
|
4154
4379
|
downsellData = reportData.downsellData,
|
|
4155
4380
|
referralData = reportData.referralData,
|
|
4156
4381
|
refundsChargebacksData = reportData.refundsChargebacksData;
|
|
4157
|
-
return /*#__PURE__*/jsxRuntime.
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
|
|
4172
|
-
title: "Active campaigns",
|
|
4173
|
-
subtitle: "Live fundraisers ranked by velocity",
|
|
4174
|
-
actionLabel: "View all",
|
|
4175
|
-
columns: ["Campaign", "Raised", "Progress", "Donors", "Status"],
|
|
4176
|
-
gridTemplateColumns: "2.5fr 1fr 1.5fr 0.7fr 0.9fr",
|
|
4177
|
-
rows: activeCampaigns
|
|
4178
|
-
})
|
|
4179
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
4180
|
-
item: true,
|
|
4181
|
-
xs: 12,
|
|
4182
|
-
lg: 3,
|
|
4183
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
4184
|
-
title: "Donor mix",
|
|
4185
|
-
subtitle: "Acquisition vs retention",
|
|
4186
|
-
series: [donorMix.newDonors, donorMix.returningDonors],
|
|
4187
|
-
labels: ["New donors", "Returning"],
|
|
4188
|
-
colors: ["#10B981", "rgb(99, 99, 230)"],
|
|
4189
|
-
centerLabel: "donors",
|
|
4190
|
-
centerValue: String(donorMix.totalMix),
|
|
4191
|
-
items: [{
|
|
4192
|
-
label: "New donors",
|
|
4193
|
-
val: "".concat(donorMix.newDonors, " \xB7 ").concat(donorMix.newPct, "%"),
|
|
4194
|
-
color: "#10B981"
|
|
4195
|
-
}, {
|
|
4196
|
-
label: "Returning",
|
|
4197
|
-
val: "".concat(donorMix.returningDonors, " \xB7 ").concat(donorMix.retPct, "%"),
|
|
4198
|
-
color: "rgb(99, 99, 230)"
|
|
4199
|
-
}],
|
|
4200
|
-
bottomSummaryValue: "$".concat(formatNumber(donorMix.avgGift)),
|
|
4201
|
-
bottomSummaryTrend: "".concat(donorMix.donorMixPrev, "% vs ").concat(dateName || "last month"),
|
|
4202
|
-
sx: {
|
|
4203
|
-
height: "100%"
|
|
4204
|
-
}
|
|
4205
|
-
})
|
|
4206
|
-
})]
|
|
4207
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4208
|
-
sx: {
|
|
4209
|
-
display: "grid",
|
|
4210
|
-
gridTemplateColumns: exportMode ? "repeat(4, 1fr)" : {
|
|
4211
|
-
xs: "1fr",
|
|
4212
|
-
sm: "1fr 1fr",
|
|
4213
|
-
lg: "repeat(4, 1fr)"
|
|
4214
|
-
},
|
|
4215
|
-
gap: exportMode ? 1 : 2
|
|
4216
|
-
},
|
|
4217
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
|
|
4218
|
-
sx: {
|
|
4219
|
-
maxHeight: cardHeight(exportMode)
|
|
4220
|
-
},
|
|
4221
|
-
donationTypeData: donationTypeData
|
|
4222
|
-
}), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
|
|
4223
|
-
sx: {
|
|
4224
|
-
maxHeight: cardHeight(exportMode)
|
|
4225
|
-
},
|
|
4226
|
-
donorGeographyData: donorGeographyData
|
|
4227
|
-
}), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
|
|
4228
|
-
sx: {
|
|
4229
|
-
maxHeight: cardHeight(exportMode)
|
|
4230
|
-
},
|
|
4231
|
-
refundsChargebacksData: refundsChargebacksData
|
|
4232
|
-
}), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
|
|
4233
|
-
sx: {
|
|
4234
|
-
maxHeight: cardHeight(exportMode)
|
|
4235
|
-
},
|
|
4236
|
-
trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
|
|
4237
|
-
total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0))
|
|
4238
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
4239
|
-
title: "Order Bump",
|
|
4240
|
-
subtitle: "Revenue trend \xB7 last 30 days",
|
|
4241
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
|
|
4242
|
-
trend: "".concat((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) || 0).toFixed(1), "% vs last month"),
|
|
4243
|
-
chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
|
|
4244
|
-
return {
|
|
4245
|
-
label: item.label,
|
|
4246
|
-
value: item.revenue
|
|
4247
|
-
};
|
|
4248
|
-
})) || [],
|
|
4249
|
-
footerMetrics: [{
|
|
4250
|
-
label: "Avg/day",
|
|
4251
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
|
|
4252
|
-
}, {
|
|
4253
|
-
label: "Peak day",
|
|
4254
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0))
|
|
4255
|
-
}, {
|
|
4256
|
-
label: "Orders",
|
|
4257
|
-
value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
|
|
4258
|
-
}],
|
|
4259
|
-
sx: {
|
|
4260
|
-
maxHeight: cardHeight(exportMode)
|
|
4261
|
-
},
|
|
4262
|
-
bottomSection: true
|
|
4263
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
4264
|
-
title: "Upsell",
|
|
4265
|
-
subtitle: "Acceptance & raised",
|
|
4266
|
-
acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
|
|
4267
|
-
acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.totalUpsellsAttached) || 0)),
|
|
4268
|
-
acceptanceTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
|
|
4269
|
-
raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
|
|
4270
|
-
raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
|
|
4271
|
-
sx: {
|
|
4272
|
-
maxHeight: cardHeight(exportMode)
|
|
4273
|
-
}
|
|
4274
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
4275
|
-
title: "Downsell",
|
|
4276
|
-
subtitle: "Acceptance & raised",
|
|
4277
|
-
acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
|
|
4278
|
-
acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
|
|
4279
|
-
acceptanceTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) || 0), "%"),
|
|
4280
|
-
raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
|
|
4281
|
-
raisedTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0), "%"),
|
|
4282
|
-
sx: {
|
|
4283
|
-
maxHeight: cardHeight(exportMode)
|
|
4284
|
-
}
|
|
4285
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
4286
|
-
title: "Referrals",
|
|
4287
|
-
subtitle: "Revenue trend \xB7 last 30 days",
|
|
4288
|
-
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
|
|
4289
|
-
trend: "\u25B2 ".concat((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) || 0, "% vs last month"),
|
|
4290
|
-
chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
|
|
4291
|
-
return {
|
|
4292
|
-
label: item.date,
|
|
4293
|
-
value: item.revenue
|
|
4294
|
-
};
|
|
4295
|
-
})) || [],
|
|
4296
|
-
footerMetrics: [{
|
|
4297
|
-
label: "Referrers",
|
|
4298
|
-
value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
|
|
4299
|
-
}, {
|
|
4300
|
-
label: "Avg gift",
|
|
4301
|
-
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
|
|
4302
|
-
}, {
|
|
4303
|
-
label: "Conv. rate",
|
|
4304
|
-
value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
|
|
4305
|
-
}],
|
|
4306
|
-
sx: {
|
|
4307
|
-
maxHeight: cardHeight(exportMode)
|
|
4308
|
-
},
|
|
4309
|
-
bottomSection: true
|
|
4310
|
-
})]
|
|
4311
|
-
})]
|
|
4382
|
+
return /*#__PURE__*/jsxRuntime.jsx(OverallDetailsGrid, {
|
|
4383
|
+
exportMode: exportMode,
|
|
4384
|
+
section: section,
|
|
4385
|
+
activeCampaignsRows: activeCampaigns,
|
|
4386
|
+
donorMix: donorMix,
|
|
4387
|
+
donationTypeData: donationTypeData,
|
|
4388
|
+
donorGeographyData: donorGeographyData,
|
|
4389
|
+
trafficSourceData: trafficSourceData,
|
|
4390
|
+
orderBumpData: orderBumpData,
|
|
4391
|
+
upsellData: upsellData,
|
|
4392
|
+
downsellData: downsellData,
|
|
4393
|
+
referralData: referralData,
|
|
4394
|
+
refundsChargebacksData: refundsChargebacksData,
|
|
4395
|
+
dateName: dateName
|
|
4312
4396
|
});
|
|
4313
4397
|
};
|
|
4314
4398
|
|
|
@@ -4329,27 +4413,28 @@ var ReportBody = function ReportBody(_ref) {
|
|
|
4329
4413
|
}, [apiData]);
|
|
4330
4414
|
var chartBlock = /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
4331
4415
|
container: true,
|
|
4332
|
-
spacing: exportMode ?
|
|
4416
|
+
spacing: exportMode ? "6px" : 2,
|
|
4333
4417
|
sx: {
|
|
4334
|
-
mb: 0
|
|
4418
|
+
mb: 0,
|
|
4419
|
+
mt: exportMode ? "6px" : 0
|
|
4335
4420
|
},
|
|
4336
4421
|
children: /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
4337
4422
|
item: _objectSpread2(_objectSpread2({}, reportData.mainChart), {}, {
|
|
4338
|
-
height: exportMode ?
|
|
4423
|
+
height: exportMode ? 250 : 320,
|
|
4424
|
+
exportMode: exportMode
|
|
4339
4425
|
}),
|
|
4340
4426
|
index: 0,
|
|
4341
4427
|
md: 12,
|
|
4342
4428
|
isPremium: true,
|
|
4343
4429
|
isPrimary: true,
|
|
4344
|
-
metric: "Revenue"
|
|
4345
|
-
type: "line"
|
|
4430
|
+
metric: "Revenue"
|
|
4346
4431
|
})
|
|
4347
4432
|
});
|
|
4348
4433
|
if (variant === "page1") {
|
|
4349
4434
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4350
4435
|
sx: {
|
|
4351
4436
|
px: exportMode ? 2.5 : 0,
|
|
4352
|
-
py: exportMode ?
|
|
4437
|
+
py: exportMode ? 1.5 : 0
|
|
4353
4438
|
},
|
|
4354
4439
|
children: [/*#__PURE__*/jsxRuntime.jsx(ReportHeader, {
|
|
4355
4440
|
dateName: dateName,
|
|
@@ -4366,12 +4451,41 @@ var ReportBody = function ReportBody(_ref) {
|
|
|
4366
4451
|
return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4367
4452
|
sx: {
|
|
4368
4453
|
px: exportMode ? 2.5 : 0,
|
|
4369
|
-
py: exportMode ?
|
|
4454
|
+
py: exportMode ? 1.5 : 0
|
|
4370
4455
|
},
|
|
4371
4456
|
children: /*#__PURE__*/jsxRuntime.jsx(ReportDetailsSection, {
|
|
4372
4457
|
reportData: reportData,
|
|
4373
4458
|
dateName: dateName,
|
|
4374
|
-
exportMode: exportMode
|
|
4459
|
+
exportMode: exportMode,
|
|
4460
|
+
section: "campaigns"
|
|
4461
|
+
})
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
if (variant === "page3") {
|
|
4465
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4466
|
+
sx: {
|
|
4467
|
+
px: exportMode ? 2.5 : 0,
|
|
4468
|
+
py: exportMode ? 1.5 : 0
|
|
4469
|
+
},
|
|
4470
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReportDetailsSection, {
|
|
4471
|
+
reportData: reportData,
|
|
4472
|
+
dateName: dateName,
|
|
4473
|
+
exportMode: exportMode,
|
|
4474
|
+
section: "middle"
|
|
4475
|
+
})
|
|
4476
|
+
});
|
|
4477
|
+
}
|
|
4478
|
+
if (variant === "page4") {
|
|
4479
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4480
|
+
sx: {
|
|
4481
|
+
px: exportMode ? 2.5 : 0,
|
|
4482
|
+
py: exportMode ? 1.5 : 0
|
|
4483
|
+
},
|
|
4484
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReportDetailsSection, {
|
|
4485
|
+
reportData: reportData,
|
|
4486
|
+
dateName: dateName,
|
|
4487
|
+
exportMode: exportMode,
|
|
4488
|
+
section: "bottom"
|
|
4375
4489
|
})
|
|
4376
4490
|
});
|
|
4377
4491
|
}
|
|
@@ -4384,18 +4498,16 @@ var ReportBody = function ReportBody(_ref) {
|
|
|
4384
4498
|
metrics: reportData.metrics
|
|
4385
4499
|
}), chartBlock, /*#__PURE__*/jsxRuntime.jsx(ReportDetailsSection, {
|
|
4386
4500
|
reportData: reportData,
|
|
4387
|
-
dateName: dateName
|
|
4501
|
+
dateName: dateName,
|
|
4502
|
+
section: "all"
|
|
4388
4503
|
})]
|
|
4389
4504
|
});
|
|
4390
4505
|
};
|
|
4391
4506
|
|
|
4392
4507
|
var PAGE_W = 794;
|
|
4393
|
-
var PAGE_H = 1123;
|
|
4394
4508
|
var pageStyle = {
|
|
4395
4509
|
width: PAGE_W,
|
|
4396
|
-
height: PAGE_H,
|
|
4397
4510
|
background: "#F3F4F6",
|
|
4398
|
-
overflow: "hidden",
|
|
4399
4511
|
boxSizing: "border-box",
|
|
4400
4512
|
fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
4401
4513
|
};
|
|
@@ -4418,7 +4530,8 @@ var ReportExportLayout = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4418
4530
|
ref: ref,
|
|
4419
4531
|
style: {
|
|
4420
4532
|
display: "inline-flex",
|
|
4421
|
-
flexDirection: "column"
|
|
4533
|
+
flexDirection: "column",
|
|
4534
|
+
width: PAGE_W
|
|
4422
4535
|
},
|
|
4423
4536
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4424
4537
|
"data-export-page": "1",
|
|
@@ -4432,6 +4545,18 @@ var ReportExportLayout = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4432
4545
|
children: /*#__PURE__*/jsxRuntime.jsx(ReportBody, _objectSpread2(_objectSpread2({}, bodyProps), {}, {
|
|
4433
4546
|
variant: "page2"
|
|
4434
4547
|
}))
|
|
4548
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4549
|
+
"data-export-page": "3",
|
|
4550
|
+
style: pageStyle,
|
|
4551
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReportBody, _objectSpread2(_objectSpread2({}, bodyProps), {}, {
|
|
4552
|
+
variant: "page3"
|
|
4553
|
+
}))
|
|
4554
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4555
|
+
"data-export-page": "4",
|
|
4556
|
+
style: pageStyle,
|
|
4557
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReportBody, _objectSpread2(_objectSpread2({}, bodyProps), {}, {
|
|
4558
|
+
variant: "page4"
|
|
4559
|
+
}))
|
|
4435
4560
|
})]
|
|
4436
4561
|
})
|
|
4437
4562
|
});
|
|
@@ -4440,13 +4565,14 @@ ReportExportLayout.displayName = "ReportExportLayout";
|
|
|
4440
4565
|
|
|
4441
4566
|
/**
|
|
4442
4567
|
* Captures [data-export-page] elements and saves a multi-page A4 PDF.
|
|
4568
|
+
* Each page is scaled to fit without cropping.
|
|
4443
4569
|
*/
|
|
4444
4570
|
function exportReportPdf(_x, _x2) {
|
|
4445
4571
|
return _exportReportPdf.apply(this, arguments);
|
|
4446
4572
|
}
|
|
4447
4573
|
function _exportReportPdf() {
|
|
4448
4574
|
_exportReportPdf = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(container, filename) {
|
|
4449
|
-
var pageEls, _yield$Promise$all, _yield$Promise$all2, jsPDF, html2canvasModule, html2canvas, doc, pdfW, pdfH, i, el, canvas, safeDate;
|
|
4575
|
+
var pageEls, _yield$Promise$all, _yield$Promise$all2, jsPDF, html2canvasModule, html2canvas, doc, pdfW, pdfH, i, el, captureHeight, canvas, imgData, imgW, imgH, scale, drawW, drawH, offsetX, offsetY, safeDate;
|
|
4450
4576
|
return _regenerator().w(function (_context) {
|
|
4451
4577
|
while (1) switch (_context.n) {
|
|
4452
4578
|
case 0:
|
|
@@ -4484,22 +4610,31 @@ function _exportReportPdf() {
|
|
|
4484
4610
|
break;
|
|
4485
4611
|
}
|
|
4486
4612
|
el = pageEls[i];
|
|
4613
|
+
captureHeight = el.scrollHeight || el.offsetHeight;
|
|
4487
4614
|
_context.n = 5;
|
|
4488
4615
|
return html2canvas(el, {
|
|
4489
4616
|
scale: 2,
|
|
4490
4617
|
useCORS: true,
|
|
4491
4618
|
backgroundColor: "#F3F4F6",
|
|
4492
4619
|
width: el.offsetWidth,
|
|
4493
|
-
height:
|
|
4620
|
+
height: captureHeight,
|
|
4494
4621
|
windowWidth: el.offsetWidth,
|
|
4495
|
-
windowHeight:
|
|
4622
|
+
windowHeight: captureHeight,
|
|
4496
4623
|
logging: false,
|
|
4497
4624
|
foreignObjectRendering: false
|
|
4498
4625
|
});
|
|
4499
4626
|
case 5:
|
|
4500
4627
|
canvas = _context.v;
|
|
4628
|
+
imgData = canvas.toDataURL("image/png");
|
|
4629
|
+
imgW = canvas.width;
|
|
4630
|
+
imgH = canvas.height;
|
|
4631
|
+
scale = Math.min(pdfW / imgW, pdfH / imgH);
|
|
4632
|
+
drawW = imgW * scale;
|
|
4633
|
+
drawH = imgH * scale;
|
|
4634
|
+
offsetX = (pdfW - drawW) / 2;
|
|
4635
|
+
offsetY = 0;
|
|
4501
4636
|
if (i > 0) doc.addPage();
|
|
4502
|
-
doc.addImage(
|
|
4637
|
+
doc.addImage(imgData, "PNG", offsetX, offsetY, drawW, drawH, undefined, "FAST");
|
|
4503
4638
|
case 6:
|
|
4504
4639
|
i++;
|
|
4505
4640
|
_context.n = 4;
|
|
@@ -4583,7 +4718,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
4583
4718
|
case 1:
|
|
4584
4719
|
_context.n = 2;
|
|
4585
4720
|
return new Promise(function (r) {
|
|
4586
|
-
return setTimeout(r,
|
|
4721
|
+
return setTimeout(r, 1500);
|
|
4587
4722
|
});
|
|
4588
4723
|
case 2:
|
|
4589
4724
|
container = exportLayoutRef.current;
|
|
@@ -4821,9 +4956,9 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
4821
4956
|
position: "fixed",
|
|
4822
4957
|
top: 0,
|
|
4823
4958
|
left: 0,
|
|
4959
|
+
transform: "translateX(-10000px)",
|
|
4824
4960
|
zIndex: -1,
|
|
4825
4961
|
pointerEvents: "none",
|
|
4826
|
-
opacity: 0.01,
|
|
4827
4962
|
overflow: "hidden"
|
|
4828
4963
|
},
|
|
4829
4964
|
children: /*#__PURE__*/jsxRuntime.jsx(ReportExportLayout, {
|
|
@@ -14333,7 +14468,7 @@ var MetricCard = function MetricCard(_ref) {
|
|
|
14333
14468
|
};
|
|
14334
14469
|
|
|
14335
14470
|
var OverallSection = function OverallSection(_ref) {
|
|
14336
|
-
var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$roasCard, _apiData$roasCardPrev, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13
|
|
14471
|
+
var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$roasCard, _apiData$roasCardPrev, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13;
|
|
14337
14472
|
var _ref$apiData = _ref.apiData,
|
|
14338
14473
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
14339
14474
|
primaryCharts = _ref.primaryCharts,
|
|
@@ -14834,188 +14969,38 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
14834
14969
|
isPrimary: true,
|
|
14835
14970
|
metric: activeMetric.includes("Raised") || activeMetric.includes("donation") ? "Revenue" : "Donors"
|
|
14836
14971
|
})
|
|
14837
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
}
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
return word[0];
|
|
14860
|
-
}).join("").toUpperCase().slice(0, 2) : "??",
|
|
14861
|
-
name: campaign.title || "Untitled Campaign",
|
|
14862
|
-
val1: "$".concat(formatNumber(campaign.collectedAmount || 0)),
|
|
14863
|
-
type: "progress",
|
|
14864
|
-
progress: Math.round((campaign.collectedAmount || 0) / (campaign.usdTargetAmount || 1) * 100),
|
|
14865
|
-
val3: formatNumber(campaign.uniqueDonationsCount || 0),
|
|
14866
|
-
val4: "$".concat(formatNumber(campaign.avgGift || 0))
|
|
14867
|
-
};
|
|
14868
|
-
})
|
|
14869
|
-
})
|
|
14870
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
14871
|
-
item: true,
|
|
14872
|
-
xs: 12,
|
|
14873
|
-
md: 3,
|
|
14874
|
-
sx: {
|
|
14875
|
-
display: "flex",
|
|
14876
|
-
paddingTop: "0px !important",
|
|
14877
|
-
marginTop: {
|
|
14878
|
-
xs: "6px",
|
|
14879
|
-
md: "0px"
|
|
14880
|
-
}
|
|
14881
|
-
},
|
|
14882
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
14883
|
-
title: "Donor mix",
|
|
14884
|
-
subtitle: "Acquisition vs retention",
|
|
14885
|
-
series: [newDonorsCount, returningDonorsCount],
|
|
14886
|
-
labels: ["New donors", "Returning"],
|
|
14887
|
-
colors: ["rgb(99, 99, 230)", "#10B981"],
|
|
14888
|
-
centerLabel: "donors",
|
|
14889
|
-
centerValue: totalDonorsMix.toString(),
|
|
14890
|
-
items: [{
|
|
14891
|
-
label: "New donors",
|
|
14892
|
-
val: "".concat(newDonorsCount, " \xB7 ").concat(newDonorsPerc, "%"),
|
|
14893
|
-
color: "rgb(99, 99, 230)"
|
|
14894
|
-
}, {
|
|
14895
|
-
label: "Returning",
|
|
14896
|
-
val: "".concat(returningDonorsCount, " \xB7 ").concat(returningDonorsPerc, "%"),
|
|
14897
|
-
color: "#10B981"
|
|
14898
|
-
}],
|
|
14899
|
-
bottomSummaryValue: "$".concat(avgGift),
|
|
14900
|
-
bottomSummaryTrend: "".concat(donorMixPrev, "% vs ").concat(dateName || "last month"),
|
|
14901
|
-
sx: {
|
|
14902
|
-
width: "100%"
|
|
14903
|
-
}
|
|
14904
|
-
})
|
|
14905
|
-
})]
|
|
14906
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
14907
|
-
sx: {
|
|
14908
|
-
display: "grid",
|
|
14909
|
-
gridTemplateColumns: {
|
|
14910
|
-
xs: "1fr",
|
|
14911
|
-
// 1 card
|
|
14912
|
-
sm: "repeat(2, 1fr)",
|
|
14913
|
-
// 2 cards
|
|
14914
|
-
md: "repeat(4, 1fr)" // 4 cards
|
|
14915
|
-
},
|
|
14916
|
-
gap: "6px",
|
|
14917
|
-
mt: "6px",
|
|
14918
|
-
alignItems: "stretch"
|
|
14972
|
+
}), /*#__PURE__*/jsxRuntime.jsx(OverallDetailsGrid, {
|
|
14973
|
+
activeCampaignsRows: activeCampaignsData.map(function (campaign) {
|
|
14974
|
+
return {
|
|
14975
|
+
id: campaign.campaignName ? campaign.campaignName.split(" ").filter(Boolean).map(function (word) {
|
|
14976
|
+
return word[0];
|
|
14977
|
+
}).join("").toUpperCase().slice(0, 2) : "??",
|
|
14978
|
+
name: campaign.title || "Untitled Campaign",
|
|
14979
|
+
val1: "$".concat(formatNumber(campaign.collectedAmount || 0)),
|
|
14980
|
+
type: "progress",
|
|
14981
|
+
progress: Math.round((campaign.collectedAmount || 0) / (campaign.usdTargetAmount || 1) * 100),
|
|
14982
|
+
val3: formatNumber(campaign.uniqueDonationsCount || 0),
|
|
14983
|
+
val4: "$".concat(formatNumber(campaign.avgGift || 0))
|
|
14984
|
+
};
|
|
14985
|
+
}),
|
|
14986
|
+
donorMix: {
|
|
14987
|
+
newDonors: newDonorsCount,
|
|
14988
|
+
returningDonors: returningDonorsCount,
|
|
14989
|
+
totalMix: totalDonorsMix,
|
|
14990
|
+
newPct: newDonorsPerc,
|
|
14991
|
+
retPct: returningDonorsPerc,
|
|
14992
|
+
avgGift: avgGift,
|
|
14993
|
+
donorMixPrev: donorMixPrev
|
|
14919
14994
|
},
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
donorGeographyData: donorGeographyData
|
|
14930
|
-
}), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
|
|
14931
|
-
sx: {
|
|
14932
|
-
maxHeight: 280
|
|
14933
|
-
},
|
|
14934
|
-
refundsChargebacksData: refundsChargebacksData
|
|
14935
|
-
}), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
|
|
14936
|
-
sx: {
|
|
14937
|
-
maxHeight: 280
|
|
14938
|
-
},
|
|
14939
|
-
trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
|
|
14940
|
-
total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0))
|
|
14941
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
14942
|
-
title: "Order Bump",
|
|
14943
|
-
subtitle: "Revenue trend \xB7 last 30 days",
|
|
14944
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
|
|
14945
|
-
trend: "".concat((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) || 0).toFixed(1), "% vs last month"),
|
|
14946
|
-
chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
|
|
14947
|
-
return {
|
|
14948
|
-
label: item.label,
|
|
14949
|
-
value: item.revenue
|
|
14950
|
-
};
|
|
14951
|
-
})) || [],
|
|
14952
|
-
footerMetrics: [{
|
|
14953
|
-
label: "Avg / Day",
|
|
14954
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
|
|
14955
|
-
}, {
|
|
14956
|
-
label: "Orders",
|
|
14957
|
-
value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
|
|
14958
|
-
}, {
|
|
14959
|
-
label: "Peak Day",
|
|
14960
|
-
value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
|
|
14961
|
-
subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
|
|
14962
|
-
}],
|
|
14963
|
-
sx: {
|
|
14964
|
-
maxHeight: 280
|
|
14965
|
-
},
|
|
14966
|
-
bottomSection: true
|
|
14967
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
14968
|
-
title: "Upsell",
|
|
14969
|
-
subtitle: "Acceptance & raised",
|
|
14970
|
-
acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
|
|
14971
|
-
acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.totalUpsellsAttached) || 0)),
|
|
14972
|
-
acceptanceTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
|
|
14973
|
-
raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
|
|
14974
|
-
raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
|
|
14975
|
-
sx: {
|
|
14976
|
-
maxHeight: 280
|
|
14977
|
-
}
|
|
14978
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
|
|
14979
|
-
title: "Downsell",
|
|
14980
|
-
subtitle: "Acceptance & raised",
|
|
14981
|
-
acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
|
|
14982
|
-
acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
|
|
14983
|
-
acceptanceTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) || 0), "%"),
|
|
14984
|
-
raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
|
|
14985
|
-
raisedTrend: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0), "%"),
|
|
14986
|
-
sx: {
|
|
14987
|
-
maxHeight: 280
|
|
14988
|
-
}
|
|
14989
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
|
|
14990
|
-
title: "Referrals",
|
|
14991
|
-
subtitle: "Revenue trend \xB7 last 30 days",
|
|
14992
|
-
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
|
|
14993
|
-
trend: "\u25B2 ".concat((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) || 0, "% vs last month"),
|
|
14994
|
-
chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
|
|
14995
|
-
return {
|
|
14996
|
-
label: item.date,
|
|
14997
|
-
value: item.revenue
|
|
14998
|
-
};
|
|
14999
|
-
})) || []
|
|
15000
|
-
// chartData={
|
|
15001
|
-
// referralData?.chartData?.map(item => item.revenue) || []
|
|
15002
|
-
// }
|
|
15003
|
-
,
|
|
15004
|
-
footerMetrics: [{
|
|
15005
|
-
label: "Referrers",
|
|
15006
|
-
value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
|
|
15007
|
-
}, {
|
|
15008
|
-
label: "Avg gift",
|
|
15009
|
-
value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
|
|
15010
|
-
}, {
|
|
15011
|
-
label: "Conv. rate",
|
|
15012
|
-
value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
|
|
15013
|
-
}],
|
|
15014
|
-
sx: {
|
|
15015
|
-
maxHeight: 280
|
|
15016
|
-
},
|
|
15017
|
-
bottomSection: true
|
|
15018
|
-
})]
|
|
14995
|
+
donationTypeData: donationTypeData,
|
|
14996
|
+
donorGeographyData: donorGeographyData,
|
|
14997
|
+
trafficSourceData: trafficSourceData,
|
|
14998
|
+
orderBumpData: orderBumpData,
|
|
14999
|
+
upsellData: upsellData,
|
|
15000
|
+
downsellData: downsellData,
|
|
15001
|
+
referralData: referralData,
|
|
15002
|
+
refundsChargebacksData: refundsChargebacksData,
|
|
15003
|
+
dateName: dateName
|
|
15019
15004
|
})]
|
|
15020
15005
|
});
|
|
15021
15006
|
};
|