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