@ammarkhalidfarooq/dashboard-package 0.4.88 → 0.4.89

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
@@ -4894,7 +4894,35 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref3) {
4894
4894
  };
4895
4895
 
4896
4896
  var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4897
- var sx = _ref.sx;
4897
+ var sx = _ref.sx,
4898
+ _ref$refundsChargebac = _ref.refundsChargebacksData,
4899
+ refundsChargebacksData = _ref$refundsChargebac === void 0 ? {} : _ref$refundsChargebac;
4900
+ var _refundsChargebacksDa = refundsChargebacksData.refundRate,
4901
+ refundRate = _refundsChargebacksDa === void 0 ? 0 : _refundsChargebacksDa,
4902
+ _refundsChargebacksDa2 = refundsChargebacksData.chargebackRate,
4903
+ chargebackRate = _refundsChargebacksDa2 === void 0 ? 0 : _refundsChargebacksDa2,
4904
+ _refundsChargebacksDa3 = refundsChargebacksData.totalRefundedAmount,
4905
+ totalRefundedAmount = _refundsChargebacksDa3 === void 0 ? 0 : _refundsChargebacksDa3,
4906
+ _refundsChargebacksDa4 = refundsChargebacksData.totalRefunds,
4907
+ totalRefunds = _refundsChargebacksDa4 === void 0 ? 0 : _refundsChargebacksDa4,
4908
+ _refundsChargebacksDa5 = refundsChargebacksData.totalChargebacks,
4909
+ totalChargebacks = _refundsChargebacksDa5 === void 0 ? 0 : _refundsChargebacksDa5,
4910
+ _refundsChargebacksDa6 = refundsChargebacksData.growthPercentage,
4911
+ growthPercentage = _refundsChargebacksDa6 === void 0 ? 0 : _refundsChargebacksDa6;
4912
+ refundsChargebacksData.totalRevenue;
4913
+ var _refundsChargebacksDa8 = refundsChargebacksData.chartData,
4914
+ chartData = _refundsChargebacksDa8 === void 0 ? [] : _refundsChargebacksDa8;
4915
+ var categories = chartData.map(function (item) {
4916
+ return item.date;
4917
+ });
4918
+ var refundSeries = chartData.map(function (item) {
4919
+ return parseFloat((item.refundRate || 0).toFixed(2));
4920
+ });
4921
+ var chargebackSeries = chartData.map(function (item) {
4922
+ return parseFloat((item.chargebackRate || 0).toFixed(2));
4923
+ });
4924
+ var maxVal = Math.max.apply(Math, _toConsumableArray(chargebackSeries).concat(_toConsumableArray(refundSeries), [1]));
4925
+ var yAxisMax = Math.ceil(maxVal * 1.2);
4898
4926
  var chartOptions = {
4899
4927
  chart: {
4900
4928
  type: "area",
@@ -4920,13 +4948,13 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4920
4948
  type: "gradient",
4921
4949
  gradient: {
4922
4950
  shadeIntensity: 1,
4923
- opacityFrom: 0.45,
4924
- opacityTo: 0.05,
4951
+ opacityFrom: 0.35,
4952
+ opacityTo: 0.02,
4925
4953
  stops: [20, 100]
4926
4954
  }
4927
4955
  },
4928
4956
  xaxis: {
4929
- categories: ["Apr 5", "Apr 12", "Apr 19", "Apr 26", "May 4"],
4957
+ categories: categories,
4930
4958
  axisBorder: {
4931
4959
  show: false
4932
4960
  },
@@ -4934,23 +4962,25 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4934
4962
  show: false
4935
4963
  },
4936
4964
  labels: {
4965
+ show: categories.length <= 15,
4966
+ rotate: -45,
4937
4967
  style: {
4938
4968
  colors: "rgba(0, 0, 0, 0.4)",
4939
- fontSize: "12px"
4969
+ fontSize: "10px"
4940
4970
  }
4941
4971
  }
4942
4972
  },
4943
4973
  yaxis: {
4944
4974
  min: 0,
4945
- max: 2,
4946
- tickAmount: 2,
4975
+ max: yAxisMax,
4976
+ tickAmount: 4,
4947
4977
  labels: {
4948
4978
  formatter: function formatter(val) {
4949
- return "".concat(val, "%");
4979
+ return "".concat(parseFloat(val.toFixed(1)), "%");
4950
4980
  },
4951
4981
  style: {
4952
4982
  colors: "rgba(0, 0, 0, 0.4)",
4953
- fontSize: "12px"
4983
+ fontSize: "11px"
4954
4984
  }
4955
4985
  }
4956
4986
  },
@@ -4961,6 +4991,10 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4961
4991
  lines: {
4962
4992
  show: true
4963
4993
  }
4994
+ },
4995
+ padding: {
4996
+ left: 0,
4997
+ right: 0
4964
4998
  }
4965
4999
  },
4966
5000
  colors: ["#F59E0B", "#EF4444"],
@@ -4980,7 +5014,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4980
5014
  fontSize: "10px",
4981
5015
  fontWeight: 700
4982
5016
  },
4983
- // text: "1% chargeback threshold",
4984
5017
  position: "left",
4985
5018
  offsetY: -10,
4986
5019
  offsetX: 10
@@ -4988,20 +5021,27 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
4988
5021
  }]
4989
5022
  },
4990
5023
  tooltip: {
5024
+ shared: true,
4991
5025
  y: {
4992
5026
  formatter: function formatter(val) {
4993
- return "".concat(val, "%");
5027
+ return "".concat(parseFloat(val.toFixed(2)), "%");
4994
5028
  }
4995
5029
  }
4996
5030
  }
4997
5031
  };
4998
5032
  var series = [{
4999
5033
  name: "Refunds",
5000
- data: [1.2, 0.9, 1.3, 0.8, 1.5, 0.9, 0.7, 0.9, 0.8]
5034
+ data: refundSeries
5001
5035
  }, {
5002
5036
  name: "Chargebacks",
5003
- data: [0.1, 0.2, 0.1, 0.15, 0.1, 0.2, 0.1, 0.15, 0.1]
5037
+ data: chargebackSeries
5004
5038
  }];
5039
+ var fmt = function fmt(n) {
5040
+ var _n$toFixed;
5041
+ return n >= 1000 ? "".concat((n / 1000).toFixed(1), "k") : parseFloat((_n$toFixed = n === null || n === void 0 ? void 0 : n.toFixed(2)) !== null && _n$toFixed !== void 0 ? _n$toFixed : 0).toString();
5042
+ };
5043
+ var growthColor = growthPercentage > 0 ? "#EF4444" : growthPercentage < 0 ? "#22C55E" : "rgba(0,0,0,0.4)";
5044
+ var growthLabel = growthPercentage > 0 ? "\u25B2 ".concat(growthPercentage.toFixed(1), "%") : growthPercentage < 0 ? "\u25BC ".concat(Math.abs(growthPercentage).toFixed(1), "%") : "stable";
5005
5045
  return /*#__PURE__*/jsxs(Card, {
5006
5046
  sx: _objectSpread2({
5007
5047
  bgcolor: "#fff",
@@ -5009,7 +5049,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5009
5049
  border: "1px solid #f0f0f0",
5010
5050
  boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
5011
5051
  p: 3,
5012
- // height: "100%",
5013
5052
  display: "flex",
5014
5053
  flexDirection: "column"
5015
5054
  }, sx),
@@ -5037,9 +5076,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5037
5076
  sx: {
5038
5077
  display: "flex",
5039
5078
  gap: 2,
5040
- // mt: 0.5,
5041
5079
  mb: 0.75,
5042
- flexWrap: "wrap"
5080
+ flexWrap: "wrap",
5081
+ mt: 1
5043
5082
  },
5044
5083
  children: [/*#__PURE__*/jsxs(Box, {
5045
5084
  sx: {
@@ -5070,24 +5109,23 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5070
5109
  fontWeight: 500
5071
5110
  },
5072
5111
  children: "Refunds"
5073
- }), /*#__PURE__*/jsx(Typography, {
5112
+ }), /*#__PURE__*/jsxs(Typography, {
5074
5113
  sx: {
5075
5114
  fontSize: "13px",
5076
5115
  fontWeight: 600,
5077
5116
  color: "#000"
5078
5117
  },
5079
- children: "0.8%"
5118
+ children: [refundRate.toFixed(2), "%"]
5080
5119
  })]
5081
- }), /*#__PURE__*/jsx(Typography, {
5120
+ }), /*#__PURE__*/jsxs(Typography, {
5082
5121
  sx: {
5083
5122
  fontSize: "12px",
5084
- fontWeight: 700,
5085
- color: "#22C55E",
5123
+ fontWeight: 600,
5124
+ color: "rgba(0,0,0,0.4)",
5086
5125
  lineHeight: 1.2,
5087
- mt: 0.2,
5088
- ml: "-14px"
5126
+ mt: 0.2
5089
5127
  },
5090
- children: "\u25BC 0.3pp"
5128
+ children: ["$", fmt(totalRefundedAmount), " refunded"]
5091
5129
  })]
5092
5130
  })]
5093
5131
  }), /*#__PURE__*/jsxs(Box, {
@@ -5119,39 +5157,38 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5119
5157
  fontWeight: 500
5120
5158
  },
5121
5159
  children: "Chargebacks"
5122
- }), /*#__PURE__*/jsx(Typography, {
5160
+ }), /*#__PURE__*/jsxs(Typography, {
5123
5161
  sx: {
5124
5162
  fontSize: "13px",
5125
5163
  fontWeight: 600,
5126
5164
  color: "#000"
5127
5165
  },
5128
- children: "0.1%"
5166
+ children: [chargebackRate.toFixed(2), "%"]
5129
5167
  })]
5130
5168
  }), /*#__PURE__*/jsx(Typography, {
5131
5169
  sx: {
5132
5170
  fontSize: "12px",
5133
- color: "rgba(0, 0, 0, 0.4)",
5134
- fontWeight: 500,
5171
+ fontWeight: 600,
5172
+ color: growthColor,
5135
5173
  lineHeight: 1.2,
5136
- mt: 0.2,
5137
- ml: "-14px"
5174
+ mt: 0.2
5138
5175
  },
5139
- children: "stable"
5176
+ children: growthLabel
5140
5177
  })]
5141
5178
  })]
5142
5179
  })]
5143
5180
  }), /*#__PURE__*/jsx(Box, {
5144
5181
  sx: {
5145
- mb: 0
5182
+ mb: 0.5
5146
5183
  },
5147
- children: /*#__PURE__*/jsx(Typography, {
5184
+ children: /*#__PURE__*/jsxs(Typography, {
5148
5185
  sx: {
5149
5186
  fontSize: "12px",
5150
5187
  color: "rgba(0, 0, 0, 0.3)",
5151
5188
  fontWeight: 500,
5152
5189
  textAlign: "left"
5153
5190
  },
5154
- children: "$1,927 refunded \xB7 $215 disputed \xB7 0 cases total"
5191
+ children: ["$", fmt(totalRefundedAmount), " refunded \xB7 ", totalChargebacks, " chargebacks \xB7 ", totalRefunds, " refunds"]
5155
5192
  })
5156
5193
  }), /*#__PURE__*/jsx(Box, {
5157
5194
  sx: {
@@ -5252,6 +5289,7 @@ var OverallSection = function OverallSection(_ref) {
5252
5289
  var orderBumpData = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpData1) || [];
5253
5290
  var upsellData = (apiData === null || apiData === void 0 ? void 0 : apiData.upsellData1) || [];
5254
5291
  var downsellData = (apiData === null || apiData === void 0 ? void 0 : apiData.downsellData1) || [];
5292
+ (apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || [];
5255
5293
  var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
5256
5294
  var getExtendedCharts = function getExtendedCharts() {
5257
5295
  var charts = _toConsumableArray(allCharts);