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