@ammarkhalidfarooq/dashboard-package 0.6.71 → 0.6.73
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 +105 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +105 -33
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1448,15 +1448,47 @@ var parseDonationTypeChartData = function parseDonationTypeChartData(donationTyp
|
|
|
1448
1448
|
return _objectSpread2(_objectSpread2({}, empty), parseDonationTypeTotals(donationTypeData));
|
|
1449
1449
|
};
|
|
1450
1450
|
|
|
1451
|
+
/** Normalizes refundAndChargeBacks from API for PDF + report cards. */
|
|
1452
|
+
var parseRefundsChargebacks = function parseRefundsChargebacks(refundsData) {
|
|
1453
|
+
var _raw$refundRate, _raw$chargebackRate, _raw$totalRefundedAmo, _raw$totalRefunds, _raw$totalChargebacks, _raw$wonChargebacks, _raw$lostChargebacks, _raw$growthPercentage, _raw$totalRevenue;
|
|
1454
|
+
var raw = refundsData && _typeof(refundsData) === "object" ? refundsData : {};
|
|
1455
|
+
return {
|
|
1456
|
+
refundRate: Number((_raw$refundRate = raw.refundRate) !== null && _raw$refundRate !== void 0 ? _raw$refundRate : 0),
|
|
1457
|
+
chargebackRate: Number((_raw$chargebackRate = raw.chargebackRate) !== null && _raw$chargebackRate !== void 0 ? _raw$chargebackRate : 0),
|
|
1458
|
+
totalRefundedAmount: Number((_raw$totalRefundedAmo = raw.totalRefundedAmount) !== null && _raw$totalRefundedAmo !== void 0 ? _raw$totalRefundedAmo : 0),
|
|
1459
|
+
totalRefunds: Number((_raw$totalRefunds = raw.totalRefunds) !== null && _raw$totalRefunds !== void 0 ? _raw$totalRefunds : 0),
|
|
1460
|
+
totalChargebacks: Number((_raw$totalChargebacks = raw.totalChargebacks) !== null && _raw$totalChargebacks !== void 0 ? _raw$totalChargebacks : 0),
|
|
1461
|
+
wonChargebacks: Number((_raw$wonChargebacks = raw.wonChargebacks) !== null && _raw$wonChargebacks !== void 0 ? _raw$wonChargebacks : 0),
|
|
1462
|
+
lostChargebacks: Number((_raw$lostChargebacks = raw.lostChargebacks) !== null && _raw$lostChargebacks !== void 0 ? _raw$lostChargebacks : 0),
|
|
1463
|
+
growthPercentage: Number((_raw$growthPercentage = raw.growthPercentage) !== null && _raw$growthPercentage !== void 0 ? _raw$growthPercentage : 0),
|
|
1464
|
+
chartData: Array.isArray(raw.chartData) ? raw.chartData : [],
|
|
1465
|
+
totalRevenue: Number((_raw$totalRevenue = raw.totalRevenue) !== null && _raw$totalRevenue !== void 0 ? _raw$totalRevenue : 0)
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
/** Median / top-decile for avg donation KPI (not shown in Overall section UI). */
|
|
1470
|
+
var parseAvgDonationDetail = function parseAvgDonationDetail() {
|
|
1471
|
+
var _apiData$overviewStat, _ref, _ref2, _ref3, _ref4, _ref5, _overview$medianDonat, _ref6, _ref7, _ref8, _ref9, _ref0, _overview$topDecileDo;
|
|
1472
|
+
var apiData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1473
|
+
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
|
|
1474
|
+
var median = Number((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_overview$medianDonat = overview === null || overview === void 0 ? void 0 : overview.medianDonation) !== null && _overview$medianDonat !== void 0 ? _overview$medianDonat : overview === null || overview === void 0 ? void 0 : overview.medianGift) !== null && _ref5 !== void 0 ? _ref5 : overview === null || overview === void 0 ? void 0 : overview.median) !== null && _ref4 !== void 0 ? _ref4 : apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) !== null && _ref3 !== void 0 ? _ref3 : apiData === null || apiData === void 0 ? void 0 : apiData.medianDonation) !== null && _ref2 !== void 0 ? _ref2 : apiData === null || apiData === void 0 ? void 0 : apiData.median) !== null && _ref !== void 0 ? _ref : 0);
|
|
1475
|
+
var topDecile = Number((_ref6 = (_ref7 = (_ref8 = (_ref9 = (_ref0 = (_overview$topDecileDo = overview === null || overview === void 0 ? void 0 : overview.topDecileDonation) !== null && _overview$topDecileDo !== void 0 ? _overview$topDecileDo : overview === null || overview === void 0 ? void 0 : overview.topDecileGift) !== null && _ref0 !== void 0 ? _ref0 : overview === null || overview === void 0 ? void 0 : overview.topDecile) !== null && _ref9 !== void 0 ? _ref9 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) !== null && _ref8 !== void 0 ? _ref8 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecileDonation) !== null && _ref7 !== void 0 ? _ref7 : apiData === null || apiData === void 0 ? void 0 : apiData.topDecile) !== null && _ref6 !== void 0 ? _ref6 : 0);
|
|
1476
|
+
return {
|
|
1477
|
+
median: median,
|
|
1478
|
+
topDecile: topDecile
|
|
1479
|
+
// detail: `Median $${formatNumber(median)} · top decile $${formatNumber(topDecile)}`,
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1451
1483
|
/** Mirrors PaidDonorGeographyCard row mapping from donorGeography. */
|
|
1452
1484
|
var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
|
|
1453
1485
|
var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
|
|
1454
1486
|
return rawCountries.map(function (item) {
|
|
1455
|
-
var _item$percentage,
|
|
1487
|
+
var _item$percentage, _ref1, _ref10, _item$value;
|
|
1456
1488
|
return {
|
|
1457
1489
|
country: item.countryName || item.country || item.name || "Unknown",
|
|
1458
1490
|
percentage: typeof item.percentage === "number" ? item.percentage : Number((_item$percentage = item.percentage) !== null && _item$percentage !== void 0 ? _item$percentage : 0),
|
|
1459
|
-
value: item.donations !== undefined ? item.donations : (
|
|
1491
|
+
value: item.donations !== undefined ? item.donations : (_ref1 = (_ref10 = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.totalDonors) !== null && _ref10 !== void 0 ? _ref10 : item.donors) !== null && _ref1 !== void 0 ? _ref1 : 0
|
|
1460
1492
|
};
|
|
1461
1493
|
});
|
|
1462
1494
|
};
|
|
@@ -1472,12 +1504,13 @@ var getActiveFilterChips = function getActiveFilterChips(apiData) {
|
|
|
1472
1504
|
return ["Status: Successful", "Country: United States, UAE", "Amount: $50 – $5,000"];
|
|
1473
1505
|
};
|
|
1474
1506
|
var buildReportData = function buildReportData() {
|
|
1475
|
-
var _apiData$
|
|
1507
|
+
var _apiData$overviewStat2, _overview$totalRevenu, _overview$netRevenue, _overview$totalDonati, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _overview$overallAVGD2, _growth$overallAVGDon, _growth$totalRevenue, _growth$netRevenue, _growth$totalDonation, _growth$overallAVGDon2, _apiData$roasCard, _apiData$roasCardPrev, _apiData$adSpend, _apiData$attributedRe, _growth$conversionRat, _apiData$overviewStat3, _growth$totalRevenue2;
|
|
1476
1508
|
var apiData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1477
|
-
var
|
|
1478
|
-
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
|
|
1509
|
+
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat2 = apiData.overviewStats) === null || _apiData$overviewStat2 === void 0 ? void 0 : _apiData$overviewStat2.overview) || {};
|
|
1479
1510
|
var growth = (overview === null || overview === void 0 ? void 0 : overview.growthPercentage) || {};
|
|
1480
1511
|
var refundsRaw = (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || {};
|
|
1512
|
+
var refunds = parseRefundsChargebacks(refundsRaw);
|
|
1513
|
+
var avgDonationDetail = parseAvgDonationDetail(apiData);
|
|
1481
1514
|
var totalRaised = Number((_overview$totalRevenu = overview === null || overview === void 0 ? void 0 : overview.totalRevenue) !== null && _overview$totalRevenu !== void 0 ? _overview$totalRevenu : 240938);
|
|
1482
1515
|
var netRaised = Number((_overview$netRevenue = overview === null || overview === void 0 ? void 0 : overview.netRevenue) !== null && _overview$netRevenue !== void 0 ? _overview$netRevenue : 222300);
|
|
1483
1516
|
var totalDonors = Number((_overview$totalDonati = overview === null || overview === void 0 ? void 0 : overview.totalDonations) !== null && _overview$totalDonati !== void 0 ? _overview$totalDonati : 215);
|
|
@@ -1508,7 +1541,7 @@ var buildReportData = function buildReportData() {
|
|
|
1508
1541
|
var retPct = totalMix > 0 ? 100 - newPct : 0;
|
|
1509
1542
|
var hero = {
|
|
1510
1543
|
value: "$".concat(formatNumber(totalRaised)),
|
|
1511
|
-
trend: "".concat(formatTrend((_growth$totalRevenue = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue !== void 0 ? _growth$totalRevenue : 18), " vs ")
|
|
1544
|
+
trend: "".concat(formatTrend((_growth$totalRevenue = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue !== void 0 ? _growth$totalRevenue : 18), " vs pp"),
|
|
1512
1545
|
detail: "".concat(passThrough, " \xB7 ").concat(formatNumber(totalDonors), " donors \xB7 $").concat(formatNumber(avgDonation), " avg \xB7 ").concat(formatNumber(totalVisits), " visits")
|
|
1513
1546
|
};
|
|
1514
1547
|
var metrics = [{
|
|
@@ -1524,8 +1557,8 @@ var buildReportData = function buildReportData() {
|
|
|
1524
1557
|
}, {
|
|
1525
1558
|
title: "Avg Donation",
|
|
1526
1559
|
value: "$".concat(formatNumber(avgDonation)),
|
|
1527
|
-
trend: formatTrend((_growth$overallAVGDon2 = growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _growth$overallAVGDon2 !== void 0 ? _growth$overallAVGDon2 :
|
|
1528
|
-
detail:
|
|
1560
|
+
trend: formatTrend((_growth$overallAVGDon2 = growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _growth$overallAVGDon2 !== void 0 ? _growth$overallAVGDon2 : 0),
|
|
1561
|
+
detail: avgDonationDetail.detail
|
|
1529
1562
|
}, {
|
|
1530
1563
|
title: "ROAS",
|
|
1531
1564
|
value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
|
|
@@ -1538,18 +1571,18 @@ var buildReportData = function buildReportData() {
|
|
|
1538
1571
|
detail: "".concat(formatNumber(totalDonors), " from ").concat(formatNumber(totalVisits), " visits")
|
|
1539
1572
|
}, {
|
|
1540
1573
|
title: "Refund Rate",
|
|
1541
|
-
value: "".concat(
|
|
1542
|
-
trend: formatTrend(
|
|
1543
|
-
detail: "".concat(formatNumber(
|
|
1574
|
+
value: "".concat(refunds.refundRate.toFixed(2), "%"),
|
|
1575
|
+
trend: formatTrend(refunds.growthPercentage),
|
|
1576
|
+
detail: "".concat(formatNumber(refunds.totalRefunds), " refunds this period"),
|
|
1544
1577
|
trendPositiveWhenNegative: true
|
|
1545
1578
|
}];
|
|
1546
|
-
var stackedTR = (apiData === null || apiData === void 0 || (_apiData$
|
|
1579
|
+
var stackedTR = (apiData === null || apiData === void 0 || (_apiData$overviewStat3 = apiData.overviewStats) === null || _apiData$overviewStat3 === void 0 ? void 0 : _apiData$overviewStat3.totalRaised) || {};
|
|
1547
1580
|
var hasStackedData = (stackedTR === null || stackedTR === void 0 ? void 0 : stackedTR.paidAds) || (stackedTR === null || stackedTR === void 0 ? void 0 : stackedTR.email) || (stackedTR === null || stackedTR === void 0 ? void 0 : stackedTR.organic);
|
|
1548
1581
|
var mainChart = {
|
|
1549
1582
|
label: "Total revenue trend",
|
|
1550
1583
|
subtitle: "Last 30 days · daily aggregation",
|
|
1551
1584
|
value: "$".concat(formatNumber(totalRaised)),
|
|
1552
|
-
trend: "".concat(formatTrend((_growth$totalRevenue2 = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue2 !== void 0 ? _growth$totalRevenue2 : 18), " vs ")
|
|
1585
|
+
trend: "".concat(formatTrend((_growth$totalRevenue2 = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue2 !== void 0 ? _growth$totalRevenue2 : 18), " vs pp"),
|
|
1553
1586
|
hideControls: true,
|
|
1554
1587
|
stacked: true,
|
|
1555
1588
|
colors: ["#6366F1", "#10B981", "#06B6D4"],
|
|
@@ -1674,7 +1707,7 @@ var buildReportData = function buildReportData() {
|
|
|
1674
1707
|
upsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.upSellDetails) || {},
|
|
1675
1708
|
downsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.downSellDetails) || {},
|
|
1676
1709
|
referralData: (apiData === null || apiData === void 0 ? void 0 : apiData.referralDetails) || {},
|
|
1677
|
-
refundsChargebacksData:
|
|
1710
|
+
refundsChargebacksData: refunds
|
|
1678
1711
|
};
|
|
1679
1712
|
};
|
|
1680
1713
|
|
|
@@ -2160,6 +2193,21 @@ var DonorGeographyPanel = function DonorGeographyPanel(_ref9) {
|
|
|
2160
2193
|
})
|
|
2161
2194
|
});
|
|
2162
2195
|
};
|
|
2196
|
+
var formatDonationTypeCategory = function formatDonationTypeCategory(label, slotWidth) {
|
|
2197
|
+
var str = String(label !== null && label !== void 0 ? label : "").trim();
|
|
2198
|
+
if (!str) return "";
|
|
2199
|
+
var monthRange = str.match(/^([A-Za-z]{3})-([A-Za-z]{3})(?:\s+\d{2,4})?$/);
|
|
2200
|
+
if (monthRange) {
|
|
2201
|
+
var full = "".concat(monthRange[1], "-").concat(monthRange[2]);
|
|
2202
|
+
var mini = "".concat(monthRange[1][0], "-").concat(monthRange[2][0]);
|
|
2203
|
+
var fullWidth = full.length * 3.1;
|
|
2204
|
+
return fullWidth <= slotWidth - 2 ? full : mini;
|
|
2205
|
+
}
|
|
2206
|
+
var noYear = str.replace(/\s+['']?\d{2,4}$/, "").trim();
|
|
2207
|
+
var maxChars = Math.max(3, Math.floor(slotWidth / 3.1));
|
|
2208
|
+
if (noYear.length <= maxChars) return noYear;
|
|
2209
|
+
return "".concat(noYear.slice(0, Math.max(1, maxChars - 1)), "\u2026");
|
|
2210
|
+
};
|
|
2163
2211
|
var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
|
|
2164
2212
|
var _ref0$categories = _ref0.categories,
|
|
2165
2213
|
categories = _ref0$categories === void 0 ? [] : _ref0$categories,
|
|
@@ -2176,13 +2224,15 @@ var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
|
|
|
2176
2224
|
var padL = 30;
|
|
2177
2225
|
var padR = 2;
|
|
2178
2226
|
var padT = 14;
|
|
2179
|
-
var padB =
|
|
2227
|
+
var padB = 20;
|
|
2180
2228
|
var chartW = width - padL - padR;
|
|
2181
2229
|
var chartH = height - padT - padB;
|
|
2182
2230
|
var allVals = [].concat(_toConsumableArray(recurring), _toConsumableArray(oneTime));
|
|
2183
2231
|
var maxVal = Math.max.apply(Math, _toConsumableArray(allVals).concat([0])) || 1;
|
|
2184
2232
|
var n = categories.length;
|
|
2185
2233
|
var yTicks = [0, maxVal / 2, maxVal];
|
|
2234
|
+
var groupW = n > 0 ? chartW / n : chartW;
|
|
2235
|
+
var labelFontSize = n > 3 ? 5 : 5.5;
|
|
2186
2236
|
if (!n) {
|
|
2187
2237
|
return /*#__PURE__*/jsxs("svg", {
|
|
2188
2238
|
width: "100%",
|
|
@@ -2207,7 +2257,6 @@ var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
|
|
|
2207
2257
|
})]
|
|
2208
2258
|
});
|
|
2209
2259
|
}
|
|
2210
|
-
var groupW = chartW / n;
|
|
2211
2260
|
var barW = Math.min(groupW * 0.3, 12);
|
|
2212
2261
|
var baseY = padT + chartH;
|
|
2213
2262
|
return /*#__PURE__*/jsxs("svg", {
|
|
@@ -2217,7 +2266,19 @@ var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
|
|
|
2217
2266
|
style: {
|
|
2218
2267
|
display: "block"
|
|
2219
2268
|
},
|
|
2220
|
-
children: [
|
|
2269
|
+
children: [/*#__PURE__*/jsx("defs", {
|
|
2270
|
+
children: categories.map(function (_, i) {
|
|
2271
|
+
return /*#__PURE__*/jsx("clipPath", {
|
|
2272
|
+
id: "donation-type-cat-clip-".concat(i),
|
|
2273
|
+
children: /*#__PURE__*/jsx("rect", {
|
|
2274
|
+
x: padL + i * groupW,
|
|
2275
|
+
y: baseY + 2,
|
|
2276
|
+
width: groupW,
|
|
2277
|
+
height: padB - 2
|
|
2278
|
+
})
|
|
2279
|
+
}, "clip-".concat(i));
|
|
2280
|
+
})
|
|
2281
|
+
}), yTicks.map(function (tick, i) {
|
|
2221
2282
|
var y = padT + chartH - tick / maxVal * chartH;
|
|
2222
2283
|
return /*#__PURE__*/jsxs("g", {
|
|
2223
2284
|
children: [/*#__PURE__*/jsx("line", {
|
|
@@ -2281,11 +2342,12 @@ var DonationTypeBarSvg = function DonationTypeBarSvg(_ref0) {
|
|
|
2281
2342
|
})]
|
|
2282
2343
|
}), /*#__PURE__*/jsx("text", {
|
|
2283
2344
|
x: groupX,
|
|
2284
|
-
y: height -
|
|
2345
|
+
y: height - 5,
|
|
2285
2346
|
textAnchor: "middle",
|
|
2286
|
-
fontSize:
|
|
2347
|
+
fontSize: labelFontSize,
|
|
2287
2348
|
fill: "rgba(0,0,0,0.4)",
|
|
2288
|
-
|
|
2349
|
+
clipPath: "url(#donation-type-cat-clip-".concat(i, ")"),
|
|
2350
|
+
children: formatDonationTypeCategory(cat, groupW)
|
|
2289
2351
|
})]
|
|
2290
2352
|
}, "bar-".concat(i));
|
|
2291
2353
|
})]
|
|
@@ -2694,7 +2756,7 @@ var PageFooter = function PageFooter(_ref13) {
|
|
|
2694
2756
|
|
|
2695
2757
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
2696
2758
|
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
2697
|
-
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits,
|
|
2759
|
+
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _apiData$trafficSourc, _apiData$trafficSourc2, _apiData$trafficSourc3, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _growth$overallAVGDon, _metricByTitle$AvgDo2, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _metricByTitle$Refund3, _mainChart$stacked, _ob$growthPercentage, _ob$peakDay, _up$acceptanceGrowth, _up$raisedGrowth, _dn$acceptanceGrowth, _dn$raisedGrowth, _refCard$growthPercen;
|
|
2698
2760
|
var _ref14$apiData = _ref14.apiData,
|
|
2699
2761
|
apiData = _ref14$apiData === void 0 ? {} : _ref14$apiData,
|
|
2700
2762
|
_ref14$dateName = _ref14.dateName,
|
|
@@ -2766,9 +2828,15 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
2766
2828
|
var convRate = Number((_overview$conversionR = overview === null || overview === void 0 ? void 0 : overview.conversionRate) !== null && _overview$conversionR !== void 0 ? _overview$conversionR : 1.7);
|
|
2767
2829
|
var totalVisits = Number((_apiData$totalVisits = apiData === null || apiData === void 0 ? void 0 : apiData.totalVisits) !== null && _apiData$totalVisits !== void 0 ? _apiData$totalVisits : 12438);
|
|
2768
2830
|
var passThrough = totalRaised > 0 ? "".concat((netRaised / totalRaised * 100).toFixed(1), "% pass-through") : "92.3% pass-through";
|
|
2769
|
-
var
|
|
2770
|
-
var
|
|
2771
|
-
var
|
|
2831
|
+
var avgDonationDetail = parseAvgDonationDetail(apiData);
|
|
2832
|
+
var refunds = parseRefundsChargebacks(apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks);
|
|
2833
|
+
var refundRate = refunds.refundRate,
|
|
2834
|
+
chargebackRate = refunds.chargebackRate,
|
|
2835
|
+
growthPercentage = refunds.growthPercentage,
|
|
2836
|
+
totalRefundedAmount = refunds.totalRefundedAmount,
|
|
2837
|
+
totalRefunds = refunds.totalRefunds,
|
|
2838
|
+
totalChargebacks = refunds.totalChargebacks,
|
|
2839
|
+
lostChargebacks = refunds.lostChargebacks;
|
|
2772
2840
|
var newDonors = donorMix.newDonors,
|
|
2773
2841
|
returningDonors = donorMix.returningDonors,
|
|
2774
2842
|
totalMix = donorMix.totalMix,
|
|
@@ -2921,8 +2989,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
2921
2989
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
2922
2990
|
title: "Avg Donation",
|
|
2923
2991
|
value: kpi$(avgDonation),
|
|
2924
|
-
trend: ((_metricByTitle$AvgDo = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo === void 0 ? void 0 : _metricByTitle$AvgDo.trend) || signed((growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations)
|
|
2925
|
-
detail: ((_metricByTitle$AvgDo2 = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo2 === void 0 ? void 0 : _metricByTitle$AvgDo2.detail) ||
|
|
2992
|
+
trend: ((_metricByTitle$AvgDo = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo === void 0 ? void 0 : _metricByTitle$AvgDo.trend) || signed((_growth$overallAVGDon = growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _growth$overallAVGDon !== void 0 ? _growth$overallAVGDon : 0),
|
|
2993
|
+
detail: ((_metricByTitle$AvgDo2 = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo2 === void 0 ? void 0 : _metricByTitle$AvgDo2.detail) || avgDonationDetail.detail
|
|
2926
2994
|
})]
|
|
2927
2995
|
}), /*#__PURE__*/jsxs("div", {
|
|
2928
2996
|
style: {
|
|
@@ -2943,8 +3011,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
2943
3011
|
}), /*#__PURE__*/jsx(KpiCard, {
|
|
2944
3012
|
title: "Refund Rate",
|
|
2945
3013
|
value: pct(refundRate, 2),
|
|
2946
|
-
trend: ((_metricByTitle$Refund = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund === void 0 ? void 0 : _metricByTitle$Refund.trend) || signed(
|
|
2947
|
-
detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber(
|
|
3014
|
+
trend: ((_metricByTitle$Refund = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund === void 0 ? void 0 : _metricByTitle$Refund.trend) || signed(growthPercentage),
|
|
3015
|
+
detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber(totalRefunds), " refunds this period"),
|
|
2948
3016
|
trendPositiveWhenNegative: (_metricByTitle$Refund3 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund3 === void 0 ? void 0 : _metricByTitle$Refund3.trendPositiveWhenNegative
|
|
2949
3017
|
})]
|
|
2950
3018
|
}), /*#__PURE__*/jsxs("div", {
|
|
@@ -3285,9 +3353,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
3285
3353
|
style: {
|
|
3286
3354
|
fontSize: 9
|
|
3287
3355
|
},
|
|
3288
|
-
children:
|
|
3289
|
-
suffix: "pp"
|
|
3290
|
-
})
|
|
3356
|
+
children: growthPercentage === 0 ? "stable" : formatArrowTrend(growthPercentage)
|
|
3291
3357
|
})
|
|
3292
3358
|
})]
|
|
3293
3359
|
}), /*#__PURE__*/jsxs("div", {
|
|
@@ -3312,7 +3378,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
3312
3378
|
fontSize: 9,
|
|
3313
3379
|
color: "#9CA3AF"
|
|
3314
3380
|
},
|
|
3315
|
-
children: "stable"
|
|
3381
|
+
children: growthPercentage === 0 ? "stable" : /*#__PURE__*/jsx(TrendText, {
|
|
3382
|
+
invert: true,
|
|
3383
|
+
style: {
|
|
3384
|
+
fontSize: 9
|
|
3385
|
+
},
|
|
3386
|
+
children: formatArrowTrend(growthPercentage)
|
|
3387
|
+
})
|
|
3316
3388
|
})]
|
|
3317
3389
|
})]
|
|
3318
3390
|
}), /*#__PURE__*/jsx(Divider, {
|
|
@@ -3323,7 +3395,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
|
|
|
3323
3395
|
color: "#6B7280",
|
|
3324
3396
|
lineHeight: 1.45
|
|
3325
3397
|
},
|
|
3326
|
-
children: [d$(
|
|
3398
|
+
children: [d$(totalRefundedAmount), " refunded \xB7 ", formatNumber(totalChargebacks), " chargebacks \xB7 ", formatNumber(lostChargebacks), " cases lost"]
|
|
3327
3399
|
})]
|
|
3328
3400
|
}), /*#__PURE__*/jsx(Panel, {
|
|
3329
3401
|
title: "Traffic source",
|