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