@ammarkhalidfarooq/dashboard-package 0.6.72 → 0.6.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1450,15 +1450,47 @@ var parseDonationTypeChartData = function parseDonationTypeChartData(donationTyp
1450
1450
  return _objectSpread2(_objectSpread2({}, empty), parseDonationTypeTotals(donationTypeData));
1451
1451
  };
1452
1452
 
1453
+ /** Normalizes refundAndChargeBacks from API for PDF + report cards. */
1454
+ var parseRefundsChargebacks = function parseRefundsChargebacks(refundsData) {
1455
+ var _raw$refundRate, _raw$chargebackRate, _raw$totalRefundedAmo, _raw$totalRefunds, _raw$totalChargebacks, _raw$wonChargebacks, _raw$lostChargebacks, _raw$growthPercentage, _raw$totalRevenue;
1456
+ var raw = refundsData && _typeof(refundsData) === "object" ? refundsData : {};
1457
+ return {
1458
+ refundRate: Number((_raw$refundRate = raw.refundRate) !== null && _raw$refundRate !== void 0 ? _raw$refundRate : 0),
1459
+ chargebackRate: Number((_raw$chargebackRate = raw.chargebackRate) !== null && _raw$chargebackRate !== void 0 ? _raw$chargebackRate : 0),
1460
+ totalRefundedAmount: Number((_raw$totalRefundedAmo = raw.totalRefundedAmount) !== null && _raw$totalRefundedAmo !== void 0 ? _raw$totalRefundedAmo : 0),
1461
+ totalRefunds: Number((_raw$totalRefunds = raw.totalRefunds) !== null && _raw$totalRefunds !== void 0 ? _raw$totalRefunds : 0),
1462
+ totalChargebacks: Number((_raw$totalChargebacks = raw.totalChargebacks) !== null && _raw$totalChargebacks !== void 0 ? _raw$totalChargebacks : 0),
1463
+ wonChargebacks: Number((_raw$wonChargebacks = raw.wonChargebacks) !== null && _raw$wonChargebacks !== void 0 ? _raw$wonChargebacks : 0),
1464
+ lostChargebacks: Number((_raw$lostChargebacks = raw.lostChargebacks) !== null && _raw$lostChargebacks !== void 0 ? _raw$lostChargebacks : 0),
1465
+ growthPercentage: Number((_raw$growthPercentage = raw.growthPercentage) !== null && _raw$growthPercentage !== void 0 ? _raw$growthPercentage : 0),
1466
+ chartData: Array.isArray(raw.chartData) ? raw.chartData : [],
1467
+ totalRevenue: Number((_raw$totalRevenue = raw.totalRevenue) !== null && _raw$totalRevenue !== void 0 ? _raw$totalRevenue : 0)
1468
+ };
1469
+ };
1470
+
1471
+ /** Median / top-decile for avg donation KPI (not shown in Overall section UI). */
1472
+ var parseAvgDonationDetail = function parseAvgDonationDetail() {
1473
+ var _apiData$overviewStat, _ref, _ref2, _ref3, _ref4, _ref5, _overview$medianDonat, _ref6, _ref7, _ref8, _ref9, _ref0, _overview$topDecileDo;
1474
+ var apiData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1475
+ var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
1476
+ 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);
1477
+ 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);
1478
+ return {
1479
+ median: median,
1480
+ topDecile: topDecile
1481
+ // detail: `Median $${formatNumber(median)} · top decile $${formatNumber(topDecile)}`,
1482
+ };
1483
+ };
1484
+
1453
1485
  /** Mirrors PaidDonorGeographyCard row mapping from donorGeography. */
1454
1486
  var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
1455
1487
  var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
1456
1488
  return rawCountries.map(function (item) {
1457
- var _item$percentage, _ref, _ref2, _item$value;
1489
+ var _item$percentage, _ref1, _ref10, _item$value;
1458
1490
  return {
1459
1491
  country: item.countryName || item.country || item.name || "Unknown",
1460
1492
  percentage: typeof item.percentage === "number" ? item.percentage : Number((_item$percentage = item.percentage) !== null && _item$percentage !== void 0 ? _item$percentage : 0),
1461
- value: item.donations !== undefined ? item.donations : (_ref = (_ref2 = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.totalDonors) !== null && _ref2 !== void 0 ? _ref2 : item.donors) !== null && _ref !== void 0 ? _ref : 0
1493
+ 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
1462
1494
  };
1463
1495
  });
1464
1496
  };
@@ -1474,12 +1506,13 @@ var getActiveFilterChips = function getActiveFilterChips(apiData) {
1474
1506
  return ["Status: Successful", "Country: United States, UAE", "Amount: $50 – $5,000"];
1475
1507
  };
1476
1508
  var buildReportData = function buildReportData() {
1477
- var _apiData$overviewStat, _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$medianGift, _apiData$topDecileGif, _apiData$roasCard, _apiData$roasCardPrev, _apiData$adSpend, _apiData$attributedRe, _growth$conversionRat, _refundsRaw$refundRat, _refundsRaw$refundRat2, _refundsRaw$refundCou, _apiData$overviewStat2, _growth$totalRevenue2;
1509
+ 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;
1478
1510
  var apiData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1479
- var dateName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Last Period";
1480
- var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
1511
+ var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat2 = apiData.overviewStats) === null || _apiData$overviewStat2 === void 0 ? void 0 : _apiData$overviewStat2.overview) || {};
1481
1512
  var growth = (overview === null || overview === void 0 ? void 0 : overview.growthPercentage) || {};
1482
1513
  var refundsRaw = (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || {};
1514
+ var refunds = parseRefundsChargebacks(refundsRaw);
1515
+ var avgDonationDetail = parseAvgDonationDetail(apiData);
1483
1516
  var totalRaised = Number((_overview$totalRevenu = overview === null || overview === void 0 ? void 0 : overview.totalRevenue) !== null && _overview$totalRevenu !== void 0 ? _overview$totalRevenu : 240938);
1484
1517
  var netRaised = Number((_overview$netRevenue = overview === null || overview === void 0 ? void 0 : overview.netRevenue) !== null && _overview$netRevenue !== void 0 ? _overview$netRevenue : 222300);
1485
1518
  var totalDonors = Number((_overview$totalDonati = overview === null || overview === void 0 ? void 0 : overview.totalDonations) !== null && _overview$totalDonati !== void 0 ? _overview$totalDonati : 215);
@@ -1510,8 +1543,8 @@ var buildReportData = function buildReportData() {
1510
1543
  var retPct = totalMix > 0 ? 100 - newPct : 0;
1511
1544
  var hero = {
1512
1545
  value: "$".concat(formatNumber(totalRaised)),
1513
- trend: "".concat(formatTrend((_growth$totalRevenue = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue !== void 0 ? _growth$totalRevenue : 18), " vs ").concat(dateName || "last month"),
1514
- detail: "".concat(passThrough, " \xB7 ").concat(formatNumber(totalDonors), " donors \xB7 $").concat(formatNumber(avgDonation), " avg \xB7 ").concat(formatNumber(totalVisits), " visits")
1546
+ trend: "".concat(formatTrend((_growth$totalRevenue = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue !== void 0 ? _growth$totalRevenue : 18), " vs pp"),
1547
+ detail: "".concat(passThrough, " \xB7 ").concat(formatNumber(totalDonors), " donors \xB7 $").concat(formatNumber(Number(avgDonation).toFixed(2)), " avg \xB7 ").concat(formatNumber(totalVisits), " visits")
1515
1548
  };
1516
1549
  var metrics = [{
1517
1550
  title: "Net Raised",
@@ -1526,8 +1559,8 @@ var buildReportData = function buildReportData() {
1526
1559
  }, {
1527
1560
  title: "Avg Donation",
1528
1561
  value: "$".concat(formatNumber(avgDonation)),
1529
- trend: formatTrend((_growth$overallAVGDon2 = growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _growth$overallAVGDon2 !== void 0 ? _growth$overallAVGDon2 : 8.4),
1530
- detail: "Median $".concat(formatNumber((_apiData$medianGift = apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) !== null && _apiData$medianGift !== void 0 ? _apiData$medianGift : 75), " \xB7 top decile $").concat(formatNumber((_apiData$topDecileGif = apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) !== null && _apiData$topDecileGif !== void 0 ? _apiData$topDecileGif : 850))
1562
+ trend: formatTrend((_growth$overallAVGDon2 = growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _growth$overallAVGDon2 !== void 0 ? _growth$overallAVGDon2 : 0),
1563
+ detail: avgDonationDetail.detail
1531
1564
  }, {
1532
1565
  title: "ROAS",
1533
1566
  value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
@@ -1540,18 +1573,18 @@ var buildReportData = function buildReportData() {
1540
1573
  detail: "".concat(formatNumber(totalDonors), " from ").concat(formatNumber(totalVisits), " visits")
1541
1574
  }, {
1542
1575
  title: "Refund Rate",
1543
- value: "".concat(Number((_refundsRaw$refundRat = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRate) !== null && _refundsRaw$refundRat !== void 0 ? _refundsRaw$refundRat : 0.84).toFixed(2), "%"),
1544
- trend: formatTrend((_refundsRaw$refundRat2 = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) !== null && _refundsRaw$refundRat2 !== void 0 ? _refundsRaw$refundRat2 : -0.3, "pp"),
1545
- detail: "".concat(formatNumber((_refundsRaw$refundCou = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) !== null && _refundsRaw$refundCou !== void 0 ? _refundsRaw$refundCou : 2), " refunds this period"),
1576
+ value: "".concat(refunds.refundRate.toFixed(2), "%"),
1577
+ trend: formatTrend(refunds.growthPercentage),
1578
+ detail: "".concat(formatNumber(refunds.totalRefunds), " refunds this period"),
1546
1579
  trendPositiveWhenNegative: true
1547
1580
  }];
1548
- var stackedTR = (apiData === null || apiData === void 0 || (_apiData$overviewStat2 = apiData.overviewStats) === null || _apiData$overviewStat2 === void 0 ? void 0 : _apiData$overviewStat2.totalRaised) || {};
1581
+ var stackedTR = (apiData === null || apiData === void 0 || (_apiData$overviewStat3 = apiData.overviewStats) === null || _apiData$overviewStat3 === void 0 ? void 0 : _apiData$overviewStat3.totalRaised) || {};
1549
1582
  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);
1550
1583
  var mainChart = {
1551
1584
  label: "Total revenue trend",
1552
1585
  subtitle: "Last 30 days · daily aggregation",
1553
1586
  value: "$".concat(formatNumber(totalRaised)),
1554
- 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"),
1587
+ trend: "".concat(formatTrend((_growth$totalRevenue2 = growth === null || growth === void 0 ? void 0 : growth.totalRevenue) !== null && _growth$totalRevenue2 !== void 0 ? _growth$totalRevenue2 : 18), " vs pp"),
1555
1588
  hideControls: true,
1556
1589
  stacked: true,
1557
1590
  colors: ["#6366F1", "#10B981", "#06B6D4"],
@@ -1676,7 +1709,7 @@ var buildReportData = function buildReportData() {
1676
1709
  upsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.upSellDetails) || {},
1677
1710
  downsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.downSellDetails) || {},
1678
1711
  referralData: (apiData === null || apiData === void 0 ? void 0 : apiData.referralDetails) || {},
1679
- refundsChargebacksData: (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || []
1712
+ refundsChargebacksData: refunds
1680
1713
  };
1681
1714
  };
1682
1715
 
@@ -2725,7 +2758,7 @@ var PageFooter = function PageFooter(_ref13) {
2725
2758
 
2726
2759
  // ─── Main component ───────────────────────────────────────────────────────────
2727
2760
  var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2728
- var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc, _apiData$trafficSourc2, _apiData$trafficSourc3, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3, _mainChart$stacked, _refundsRaw$refundRat2, _ob$growthPercentage, _ob$peakDay, _up$acceptanceGrowth, _up$raisedGrowth, _dn$acceptanceGrowth, _dn$raisedGrowth, _refCard$growthPercen;
2761
+ 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;
2729
2762
  var _ref14$apiData = _ref14.apiData,
2730
2763
  apiData = _ref14$apiData === void 0 ? {} : _ref14$apiData,
2731
2764
  _ref14$dateName = _ref14.dateName,
@@ -2797,9 +2830,15 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2797
2830
  var convRate = Number((_overview$conversionR = overview === null || overview === void 0 ? void 0 : overview.conversionRate) !== null && _overview$conversionR !== void 0 ? _overview$conversionR : 1.7);
2798
2831
  var totalVisits = Number((_apiData$totalVisits = apiData === null || apiData === void 0 ? void 0 : apiData.totalVisits) !== null && _apiData$totalVisits !== void 0 ? _apiData$totalVisits : 12438);
2799
2832
  var passThrough = totalRaised > 0 ? "".concat((netRaised / totalRaised * 100).toFixed(1), "% pass-through") : "92.3% pass-through";
2800
- var refundsRaw = (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || {};
2801
- var refundRate = Number((_refundsRaw$refundRat = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRate) !== null && _refundsRaw$refundRat !== void 0 ? _refundsRaw$refundRat : 0.84);
2802
- var chargebackRate = Number((_refundsRaw$chargebac = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.chargebackRate) !== null && _refundsRaw$chargebac !== void 0 ? _refundsRaw$chargebac : 0.1);
2833
+ var avgDonationDetail = parseAvgDonationDetail(apiData);
2834
+ var refunds = parseRefundsChargebacks(apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks);
2835
+ var refundRate = refunds.refundRate,
2836
+ chargebackRate = refunds.chargebackRate,
2837
+ growthPercentage = refunds.growthPercentage,
2838
+ totalRefundedAmount = refunds.totalRefundedAmount,
2839
+ totalRefunds = refunds.totalRefunds,
2840
+ totalChargebacks = refunds.totalChargebacks,
2841
+ lostChargebacks = refunds.lostChargebacks;
2803
2842
  var newDonors = donorMix.newDonors,
2804
2843
  returningDonors = donorMix.returningDonors,
2805
2844
  totalMix = donorMix.totalMix,
@@ -2952,8 +2991,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2952
2991
  }), /*#__PURE__*/jsxRuntime.jsx(KpiCard, {
2953
2992
  title: "Avg Donation",
2954
2993
  value: kpi$(avgDonation),
2955
- 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) || 8.4),
2956
- detail: ((_metricByTitle$AvgDo2 = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo2 === void 0 ? void 0 : _metricByTitle$AvgDo2.detail) || "Median ".concat(d$((_apiData$medianGift = apiData === null || apiData === void 0 ? void 0 : apiData.medianGift) !== null && _apiData$medianGift !== void 0 ? _apiData$medianGift : 75), " \xB7 top decile ").concat(d$((_apiData$topDecileGif = apiData === null || apiData === void 0 ? void 0 : apiData.topDecileGift) !== null && _apiData$topDecileGif !== void 0 ? _apiData$topDecileGif : 850))
2994
+ 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),
2995
+ detail: ((_metricByTitle$AvgDo2 = metricByTitle["Avg Donation"]) === null || _metricByTitle$AvgDo2 === void 0 ? void 0 : _metricByTitle$AvgDo2.detail) || avgDonationDetail.detail
2957
2996
  })]
2958
2997
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2959
2998
  style: {
@@ -2974,8 +3013,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2974
3013
  }), /*#__PURE__*/jsxRuntime.jsx(KpiCard, {
2975
3014
  title: "Refund Rate",
2976
3015
  value: pct(refundRate, 2),
2977
- trend: ((_metricByTitle$Refund = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund === void 0 ? void 0 : _metricByTitle$Refund.trend) || signed((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) || -0.3, "pp"),
2978
- detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber((_refundsRaw$refundCou = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundCount) !== null && _refundsRaw$refundCou !== void 0 ? _refundsRaw$refundCou : 2), " refunds this period"),
3016
+ trend: ((_metricByTitle$Refund = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund === void 0 ? void 0 : _metricByTitle$Refund.trend) || signed(growthPercentage),
3017
+ detail: ((_metricByTitle$Refund2 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund2 === void 0 ? void 0 : _metricByTitle$Refund2.detail) || "".concat(formatNumber(totalRefunds), " refunds this period"),
2979
3018
  trendPositiveWhenNegative: (_metricByTitle$Refund3 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund3 === void 0 ? void 0 : _metricByTitle$Refund3.trendPositiveWhenNegative
2980
3019
  })]
2981
3020
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -3316,9 +3355,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3316
3355
  style: {
3317
3356
  fontSize: 9
3318
3357
  },
3319
- children: formatArrowTrend((_refundsRaw$refundRat2 = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) !== null && _refundsRaw$refundRat2 !== void 0 ? _refundsRaw$refundRat2 : 0, {
3320
- suffix: "pp"
3321
- })
3358
+ children: growthPercentage === 0 ? "stable" : formatArrowTrend(growthPercentage)
3322
3359
  })
3323
3360
  })]
3324
3361
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -3343,7 +3380,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3343
3380
  fontSize: 9,
3344
3381
  color: "#9CA3AF"
3345
3382
  },
3346
- children: "stable"
3383
+ children: growthPercentage === 0 ? "stable" : /*#__PURE__*/jsxRuntime.jsx(TrendText, {
3384
+ invert: true,
3385
+ style: {
3386
+ fontSize: 9
3387
+ },
3388
+ children: formatArrowTrend(growthPercentage)
3389
+ })
3347
3390
  })]
3348
3391
  })]
3349
3392
  }), /*#__PURE__*/jsxRuntime.jsx(Divider, {
@@ -3354,7 +3397,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3354
3397
  color: "#6B7280",
3355
3398
  lineHeight: 1.45
3356
3399
  },
3357
- children: [d$((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundAmount) || 0), " refunded \xB7 ", d$((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.disputedAmount) || 0), " disputed \xB7 ", formatNumber((refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.casesLost) || 0), " cases lost"]
3400
+ children: [d$(totalRefundedAmount), " refunded \xB7 ", formatNumber(totalChargebacks), " chargebacks \xB7 ", formatNumber(lostChargebacks), " cases lost"]
3358
3401
  })]
3359
3402
  }), /*#__PURE__*/jsxRuntime.jsx(Panel, {
3360
3403
  title: "Traffic source",