@ammarkhalidfarooq/dashboard-package 0.6.78 → 0.6.80

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
@@ -6486,6 +6486,31 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref8) {
6486
6486
  });
6487
6487
  };
6488
6488
 
6489
+ var formatCategoryLabel$1 = function formatCategoryLabel(val) {
6490
+ if (!val || typeof val !== "string") return val;
6491
+ var ddMmYyyy = val.match(/^(\d{2})-(\d{2})-(\d{4})$/);
6492
+ if (ddMmYyyy) {
6493
+ var _ddMmYyyy = _slicedToArray(ddMmYyyy, 4),
6494
+ day = _ddMmYyyy[1],
6495
+ month = _ddMmYyyy[2],
6496
+ year = _ddMmYyyy[3];
6497
+ var _date = new Date(Number(year), Number(month) - 1, Number(day));
6498
+ if (!Number.isNaN(_date.getTime())) {
6499
+ return _date.toLocaleDateString("en-US", {
6500
+ month: "short",
6501
+ day: "numeric"
6502
+ });
6503
+ }
6504
+ }
6505
+ var date = new Date(val);
6506
+ if (!Number.isNaN(date.getTime())) {
6507
+ return date.toLocaleDateString("en-US", {
6508
+ month: "short",
6509
+ day: "numeric"
6510
+ });
6511
+ }
6512
+ return val;
6513
+ };
6489
6514
  var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6490
6515
  var sx = _ref.sx,
6491
6516
  _ref$refundsChargebac = _ref.refundsChargebacksData,
@@ -6520,6 +6545,8 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6520
6545
  var dataMax = Math.max.apply(Math, [0].concat(_toConsumableArray(chargebackSeries), _toConsumableArray(refundSeries)));
6521
6546
  var hasChartData = dataMax > 0;
6522
6547
  var yAxisMax = hasChartData ? Math.ceil(Math.max(dataMax, 1) * 1.2) : 0.5;
6548
+ var showXAxisLabels = categories.length <= 15;
6549
+ var yAxisTickAmount = hasChartData ? 4 : 2;
6523
6550
  var chartOptions = {
6524
6551
  chart: {
6525
6552
  type: "area",
@@ -6554,6 +6581,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6554
6581
  },
6555
6582
  xaxis: {
6556
6583
  categories: categories,
6584
+ tickAmount: 5,
6557
6585
  axisBorder: {
6558
6586
  show: false
6559
6587
  },
@@ -6561,8 +6589,10 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6561
6589
  show: false
6562
6590
  },
6563
6591
  labels: {
6564
- show: categories.length <= 15,
6565
- rotate: -45,
6592
+ show: showXAxisLabels,
6593
+ rotate: 0,
6594
+ hideOverlappingLabels: true,
6595
+ formatter: formatCategoryLabel$1,
6566
6596
  style: {
6567
6597
  colors: "rgba(0, 0, 0, 0.4)",
6568
6598
  fontSize: "10px"
@@ -6572,7 +6602,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6572
6602
  yaxis: {
6573
6603
  min: 0,
6574
6604
  max: yAxisMax,
6575
- tickAmount: 4,
6605
+ tickAmount: yAxisTickAmount,
6576
6606
  labels: {
6577
6607
  formatter: function formatter(val) {
6578
6608
  return "".concat(parseFloat(val.toFixed(1)), "%");
@@ -6626,6 +6656,12 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6626
6656
  } : {},
6627
6657
  tooltip: {
6628
6658
  shared: true,
6659
+ x: {
6660
+ formatter: function formatter(_, _ref2) {
6661
+ var dataPointIndex = _ref2.dataPointIndex;
6662
+ return formatCategoryLabel$1(categories[dataPointIndex]);
6663
+ }
6664
+ },
6629
6665
  y: {
6630
6666
  formatter: function formatter(val) {
6631
6667
  return "".concat(parseFloat(val.toFixed(2)), "%");
@@ -6798,7 +6834,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6798
6834
  })
6799
6835
  }), /*#__PURE__*/jsx(Box, {
6800
6836
  sx: {
6801
- height: 140,
6837
+ height: showXAxisLabels ? 160 : 140,
6802
6838
  width: "100%",
6803
6839
  flexShrink: 0
6804
6840
  },
@@ -18525,7 +18561,8 @@ var OrganicSection = function OrganicSection(_ref) {
18525
18561
  trend: selectedInfo.subValue,
18526
18562
  data: selectedInfo.data,
18527
18563
  categories: chartCategories,
18528
- hideControls: true
18564
+ hideControls: true,
18565
+ isAmount: selectedInfo.money
18529
18566
  };
18530
18567
  if (apiLoading) {
18531
18568
  return /*#__PURE__*/jsx(OrganicSectionSkeleton, {});
@@ -18557,7 +18594,8 @@ var OrganicSection = function OrganicSection(_ref) {
18557
18594
  type: "area",
18558
18595
  isPrimary: true,
18559
18596
  isPremium: true,
18560
- numberOfDays: numberOfDays
18597
+ numberOfDays: numberOfDays,
18598
+ metric: activeMetric === "Conversion Rate" ? "Percent" : selectedInfo.money ? "Revenue" : "Donors"
18561
18599
  }), /*#__PURE__*/jsx(Grid, {
18562
18600
  item: true,
18563
18601
  xs: 12,