@ammarkhalidfarooq/dashboard-package 0.5.17 → 0.5.18
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 +64 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +64 -33
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1276,7 +1276,7 @@ var KpiCard = function KpiCard(_ref7) {
|
|
|
1276
1276
|
borderRadius: 8,
|
|
1277
1277
|
padding: "10px 12px 9px",
|
|
1278
1278
|
background: "#fff",
|
|
1279
|
-
|
|
1279
|
+
width: "100%",
|
|
1280
1280
|
minWidth: 0,
|
|
1281
1281
|
boxSizing: "border-box",
|
|
1282
1282
|
display: "flex",
|
|
@@ -1487,7 +1487,7 @@ var PageFooter = function PageFooter(_ref0) {
|
|
|
1487
1487
|
|
|
1488
1488
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
1489
1489
|
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
|
|
1490
|
-
var _apiData$overviewStat, _apiData$trafficSourc, _apiData$trafficSourc2, _apiData$overviewStat2,
|
|
1490
|
+
var _apiData$overviewStat, _apiData$trafficSourc, _apiData$trafficSourc2, _apiData$overviewStat2, _ob$peakDay;
|
|
1491
1491
|
var _ref1$apiData = _ref1.apiData,
|
|
1492
1492
|
apiData = _ref1$apiData === void 0 ? {} : _ref1$apiData,
|
|
1493
1493
|
_ref1$dateName = _ref1.dateName,
|
|
@@ -1504,24 +1504,47 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
|
|
|
1504
1504
|
var dateLabel = dateName;
|
|
1505
1505
|
var activeFilters = (apiData === null || apiData === void 0 ? void 0 : apiData.activeFilters) || "";
|
|
1506
1506
|
|
|
1507
|
-
// ── data
|
|
1507
|
+
// ── data (reference-first defaults, with selective API overrides) ─────────
|
|
1508
1508
|
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
|
|
1509
1509
|
var growth = (overview === null || overview === void 0 ? void 0 : overview.growthPercentage) || {};
|
|
1510
|
-
var
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1510
|
+
var sample = {
|
|
1511
|
+
totalRaised: 240938,
|
|
1512
|
+
netRaised: 222300,
|
|
1513
|
+
totalDonors: 215,
|
|
1514
|
+
avgDonation: 130.58,
|
|
1515
|
+
convRate: 1.7,
|
|
1516
|
+
totalVisits: 12438,
|
|
1517
|
+
roas: 3.0,
|
|
1518
|
+
roasGrowth: 0.4,
|
|
1519
|
+
refundRate: 0.84,
|
|
1520
|
+
refundChange: -0.3,
|
|
1521
|
+
refundCount: 2,
|
|
1522
|
+
newDonors: 31,
|
|
1523
|
+
returningDonors: 184,
|
|
1524
|
+
medianGift: 75,
|
|
1525
|
+
topDecileGift: 850,
|
|
1526
|
+
adSpend: 72000,
|
|
1527
|
+
attributedRevenue: 215000
|
|
1528
|
+
};
|
|
1529
|
+
var prefer = function prefer(val, fallback) {
|
|
1530
|
+
var num = Number(val);
|
|
1531
|
+
return Number.isFinite(num) && num !== 0 ? num : fallback;
|
|
1532
|
+
};
|
|
1533
|
+
var totalRaised = prefer(overview === null || overview === void 0 ? void 0 : overview.totalRevenue, sample.totalRaised);
|
|
1534
|
+
var netRaised = prefer(overview === null || overview === void 0 ? void 0 : overview.netRevenue, sample.netRaised);
|
|
1535
|
+
var totalDonors = prefer(overview === null || overview === void 0 ? void 0 : overview.totalDonations, sample.totalDonors);
|
|
1536
|
+
var avgDonation = prefer(overview === null || overview === void 0 ? void 0 : overview.overallAVGDonations, sample.avgDonation);
|
|
1537
|
+
var convRate = prefer(overview === null || overview === void 0 ? void 0 : overview.conversionRate, sample.convRate);
|
|
1538
|
+
var totalVisits = prefer(apiData === null || apiData === void 0 ? void 0 : apiData.totalVisits, sample.totalVisits);
|
|
1539
|
+
var passThrough = totalRaised > 0 ? "".concat((netRaised / totalRaised * 100).toFixed(1), "% pass-through") : "92.3% pass-through";
|
|
1517
1540
|
var refundsRaw = (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || {};
|
|
1518
|
-
var refundRate =
|
|
1519
|
-
var chargebackRate =
|
|
1541
|
+
var refundRate = prefer(refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRate, sample.refundRate);
|
|
1542
|
+
var chargebackRate = prefer(refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.chargebackRate, 0.1);
|
|
1520
1543
|
|
|
1521
1544
|
// donor mix
|
|
1522
1545
|
var donorMixRaw = apiData === null || apiData === void 0 ? void 0 : apiData.donorPieChartData;
|
|
1523
|
-
var newDonors =
|
|
1524
|
-
returningDonors =
|
|
1546
|
+
var newDonors = sample.newDonors,
|
|
1547
|
+
returningDonors = sample.returningDonors,
|
|
1525
1548
|
mixAvgGift = avgDonation;
|
|
1526
1549
|
if (Array.isArray(donorMixRaw)) {
|
|
1527
1550
|
var nd = donorMixRaw.find(function (d) {
|
|
@@ -1644,46 +1667,54 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
|
|
|
1644
1667
|
gap: 10,
|
|
1645
1668
|
overflow: "hidden"
|
|
1646
1669
|
},
|
|
1647
|
-
children: [/*#__PURE__*/
|
|
1670
|
+
children: [/*#__PURE__*/jsx(KpiCard, {
|
|
1671
|
+
title: "Total Raised",
|
|
1672
|
+
value: d$(totalRaised),
|
|
1673
|
+
trend: "".concat(signed((growth === null || growth === void 0 ? void 0 : growth.totalRevenue) || 18), " vs last month"),
|
|
1674
|
+
detail: "".concat(passThrough, " \xB7 ").concat(formatNumber(totalDonors), " donors \xB7 ").concat(d$(avgDonation), " avg \xB7 ").concat(formatNumber(totalVisits), " visits")
|
|
1675
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1648
1676
|
style: {
|
|
1649
|
-
display: "
|
|
1677
|
+
display: "grid",
|
|
1678
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
1650
1679
|
gap: 7
|
|
1651
1680
|
},
|
|
1652
1681
|
children: [/*#__PURE__*/jsx(KpiCard, {
|
|
1653
|
-
title: "Total Raised",
|
|
1654
|
-
value: d$(totalRaised),
|
|
1655
|
-
trend: "".concat(signed(growth === null || growth === void 0 ? void 0 : growth.totalRevenue), " vs ").concat(dateLabel),
|
|
1656
|
-
detail: "".concat(passThrough, " \xB7 ").concat(formatNumber(totalDonors), " donors \xB7 ").concat(d$(avgDonation), " avg \xB7 ").concat(formatNumber(totalVisits), " visits")
|
|
1657
|
-
}), /*#__PURE__*/jsx(KpiCard, {
|
|
1658
1682
|
title: "Net Raised",
|
|
1659
1683
|
value: d$(netRaised),
|
|
1660
|
-
trend: signed(growth === null || growth === void 0 ? void 0 : growth.netRevenue),
|
|
1684
|
+
trend: signed((growth === null || growth === void 0 ? void 0 : growth.netRevenue) || 17.4),
|
|
1661
1685
|
detail: passThrough
|
|
1662
1686
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
1663
1687
|
title: "Total Donors",
|
|
1664
1688
|
value: "".concat(formatNumber(totalDonors)),
|
|
1665
|
-
trend: signed(growth === null || growth === void 0 ? void 0 : growth.totalDonations),
|
|
1689
|
+
trend: signed((growth === null || growth === void 0 ? void 0 : growth.totalDonations) || 16.8),
|
|
1666
1690
|
detail: "".concat(formatNumber(newDonors), " new \xB7 ").concat(formatNumber(returningDonors), " returning")
|
|
1667
1691
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
1668
1692
|
title: "Avg Donation",
|
|
1669
1693
|
value: d$(avgDonation),
|
|
1670
|
-
trend: signed(growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations),
|
|
1671
|
-
detail: "Median ".concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) ||
|
|
1672
|
-
})
|
|
1694
|
+
trend: signed((growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) || 8.4),
|
|
1695
|
+
detail: "Median ".concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) || sample.medianGift), " \xB7 top decile ").concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) || sample.topDecileGift))
|
|
1696
|
+
})]
|
|
1697
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1698
|
+
style: {
|
|
1699
|
+
display: "grid",
|
|
1700
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
1701
|
+
gap: 7
|
|
1702
|
+
},
|
|
1703
|
+
children: [/*#__PURE__*/jsx(KpiCard, {
|
|
1673
1704
|
title: "ROAS",
|
|
1674
|
-
value: "".concat(formatNumber((
|
|
1675
|
-
trend: signed(apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev, "×"),
|
|
1676
|
-
detail: "".concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.adSpend) ||
|
|
1705
|
+
value: "".concat(formatNumber((apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) || sample.roas), "\xD7"),
|
|
1706
|
+
trend: signed((apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) || sample.roasGrowth, "×"),
|
|
1707
|
+
detail: "".concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.adSpend) || sample.adSpend), " spend \xB7 ").concat(d$((apiData === null || apiData === void 0 ? void 0 : apiData.attributedRevenue) || sample.attributedRevenue), " attrib.")
|
|
1677
1708
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
1678
1709
|
title: "Conversion",
|
|
1679
1710
|
value: pct(convRate, 1),
|
|
1680
|
-
trend: "".concat(signed(growth === null || growth === void 0 ? void 0 : growth.conversionRate, "pp")),
|
|
1711
|
+
trend: "".concat(signed((growth === null || growth === void 0 ? void 0 : growth.conversionRate) || 0.21, "pp")),
|
|
1681
1712
|
detail: "".concat(formatNumber(totalDonors), " from ").concat(formatNumber(totalVisits), " visits")
|
|
1682
1713
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
1683
1714
|
title: "Refund Rate",
|
|
1684
1715
|
value: pct(refundRate, 2),
|
|
1685
|
-
trend: "".concat(signed(refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange, "pp")),
|
|
1686
|
-
detail: "".concat(formatNumber((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) ||
|
|
1716
|
+
trend: "".concat(signed((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) || sample.refundChange, "pp")),
|
|
1717
|
+
detail: "".concat(formatNumber((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) || sample.refundCount), " refunds this period")
|
|
1687
1718
|
})]
|
|
1688
1719
|
}), /*#__PURE__*/jsxs("div", {
|
|
1689
1720
|
style: {
|
|
@@ -1773,7 +1804,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
|
|
|
1773
1804
|
series: revSeries,
|
|
1774
1805
|
categories: revCats,
|
|
1775
1806
|
width: CW - 28,
|
|
1776
|
-
height:
|
|
1807
|
+
height: 300
|
|
1777
1808
|
})]
|
|
1778
1809
|
})]
|
|
1779
1810
|
}), /*#__PURE__*/jsx(PageFooter, {
|