@ammarkhalidfarooq/dashboard-package 0.6.72 → 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.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, _ref, _ref2, _item$value;
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 : (_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
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$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;
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 dateName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Last Period";
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 ").concat(dateName || "last month"),
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 : 8.4),
1528
- 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))
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(Number((_refundsRaw$refundRat = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRate) !== null && _refundsRaw$refundRat !== void 0 ? _refundsRaw$refundRat : 0.84).toFixed(2), "%"),
1542
- trend: formatTrend((_refundsRaw$refundRat2 = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) !== null && _refundsRaw$refundRat2 !== void 0 ? _refundsRaw$refundRat2 : -0.3, "pp"),
1543
- 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"),
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$overviewStat2 = apiData.overviewStats) === null || _apiData$overviewStat2 === void 0 ? void 0 : _apiData$overviewStat2.totalRaised) || {};
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 ").concat(dateName || "last month"),
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: (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || []
1710
+ refundsChargebacksData: refunds
1678
1711
  };
1679
1712
  };
1680
1713
 
@@ -2723,7 +2756,7 @@ var PageFooter = function PageFooter(_ref13) {
2723
2756
 
2724
2757
  // ─── Main component ───────────────────────────────────────────────────────────
2725
2758
  var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2726
- 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;
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;
2727
2760
  var _ref14$apiData = _ref14.apiData,
2728
2761
  apiData = _ref14$apiData === void 0 ? {} : _ref14$apiData,
2729
2762
  _ref14$dateName = _ref14.dateName,
@@ -2795,9 +2828,15 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2795
2828
  var convRate = Number((_overview$conversionR = overview === null || overview === void 0 ? void 0 : overview.conversionRate) !== null && _overview$conversionR !== void 0 ? _overview$conversionR : 1.7);
2796
2829
  var totalVisits = Number((_apiData$totalVisits = apiData === null || apiData === void 0 ? void 0 : apiData.totalVisits) !== null && _apiData$totalVisits !== void 0 ? _apiData$totalVisits : 12438);
2797
2830
  var passThrough = totalRaised > 0 ? "".concat((netRaised / totalRaised * 100).toFixed(1), "% pass-through") : "92.3% pass-through";
2798
- var refundsRaw = (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || {};
2799
- var refundRate = Number((_refundsRaw$refundRat = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRate) !== null && _refundsRaw$refundRat !== void 0 ? _refundsRaw$refundRat : 0.84);
2800
- var chargebackRate = Number((_refundsRaw$chargebac = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.chargebackRate) !== null && _refundsRaw$chargebac !== void 0 ? _refundsRaw$chargebac : 0.1);
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;
2801
2840
  var newDonors = donorMix.newDonors,
2802
2841
  returningDonors = donorMix.returningDonors,
2803
2842
  totalMix = donorMix.totalMix,
@@ -2950,8 +2989,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2950
2989
  }), /*#__PURE__*/jsx(KpiCard, {
2951
2990
  title: "Avg Donation",
2952
2991
  value: kpi$(avgDonation),
2953
- 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),
2954
- 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))
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
2955
2994
  })]
2956
2995
  }), /*#__PURE__*/jsxs("div", {
2957
2996
  style: {
@@ -2972,8 +3011,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
2972
3011
  }), /*#__PURE__*/jsx(KpiCard, {
2973
3012
  title: "Refund Rate",
2974
3013
  value: pct(refundRate, 2),
2975
- 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"),
2976
- 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"),
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"),
2977
3016
  trendPositiveWhenNegative: (_metricByTitle$Refund3 = metricByTitle["Refund Rate"]) === null || _metricByTitle$Refund3 === void 0 ? void 0 : _metricByTitle$Refund3.trendPositiveWhenNegative
2978
3017
  })]
2979
3018
  }), /*#__PURE__*/jsxs("div", {
@@ -3314,9 +3353,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3314
3353
  style: {
3315
3354
  fontSize: 9
3316
3355
  },
3317
- children: formatArrowTrend((_refundsRaw$refundRat2 = refundsRaw === null || refundsRaw === void 0 ? void 0 : refundsRaw.refundRateChange) !== null && _refundsRaw$refundRat2 !== void 0 ? _refundsRaw$refundRat2 : 0, {
3318
- suffix: "pp"
3319
- })
3356
+ children: growthPercentage === 0 ? "stable" : formatArrowTrend(growthPercentage)
3320
3357
  })
3321
3358
  })]
3322
3359
  }), /*#__PURE__*/jsxs("div", {
@@ -3341,7 +3378,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3341
3378
  fontSize: 9,
3342
3379
  color: "#9CA3AF"
3343
3380
  },
3344
- children: "stable"
3381
+ children: growthPercentage === 0 ? "stable" : /*#__PURE__*/jsx(TrendText, {
3382
+ invert: true,
3383
+ style: {
3384
+ fontSize: 9
3385
+ },
3386
+ children: formatArrowTrend(growthPercentage)
3387
+ })
3345
3388
  })]
3346
3389
  })]
3347
3390
  }), /*#__PURE__*/jsx(Divider, {
@@ -3352,7 +3395,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref14, ref) {
3352
3395
  color: "#6B7280",
3353
3396
  lineHeight: 1.45
3354
3397
  },
3355
- 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"]
3398
+ children: [d$(totalRefundedAmount), " refunded \xB7 ", formatNumber(totalChargebacks), " chargebacks \xB7 ", formatNumber(lostChargebacks), " cases lost"]
3356
3399
  })]
3357
3400
  }), /*#__PURE__*/jsx(Panel, {
3358
3401
  title: "Traffic source",