@ammarkhalidfarooq/dashboard-package 0.4.87 → 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 +81 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +81 -36
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -4809,7 +4809,14 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard() {
|
|
|
4809
4809
|
var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref3) {
|
|
4810
4810
|
var sx = _ref3.sx,
|
|
4811
4811
|
donorGeographyData = _ref3.donorGeographyData;
|
|
4812
|
-
var
|
|
4812
|
+
var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || [];
|
|
4813
|
+
var data = rawCountries.map(function (item) {
|
|
4814
|
+
return {
|
|
4815
|
+
country: item.countryName || item.country || "Unknown",
|
|
4816
|
+
percentage: typeof item.percentage === "number" ? item.percentage : 0,
|
|
4817
|
+
value: item.donations !== undefined ? item.donations : item.value || 0
|
|
4818
|
+
};
|
|
4819
|
+
});
|
|
4813
4820
|
return /*#__PURE__*/jsxs(Card, {
|
|
4814
4821
|
sx: _objectSpread2({
|
|
4815
4822
|
bgcolor: "#fff",
|
|
@@ -4887,7 +4894,35 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref3) {
|
|
|
4887
4894
|
};
|
|
4888
4895
|
|
|
4889
4896
|
var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
4890
|
-
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);
|
|
4891
4926
|
var chartOptions = {
|
|
4892
4927
|
chart: {
|
|
4893
4928
|
type: "area",
|
|
@@ -4913,13 +4948,13 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4913
4948
|
type: "gradient",
|
|
4914
4949
|
gradient: {
|
|
4915
4950
|
shadeIntensity: 1,
|
|
4916
|
-
opacityFrom: 0.
|
|
4917
|
-
opacityTo: 0.
|
|
4951
|
+
opacityFrom: 0.35,
|
|
4952
|
+
opacityTo: 0.02,
|
|
4918
4953
|
stops: [20, 100]
|
|
4919
4954
|
}
|
|
4920
4955
|
},
|
|
4921
4956
|
xaxis: {
|
|
4922
|
-
categories:
|
|
4957
|
+
categories: categories,
|
|
4923
4958
|
axisBorder: {
|
|
4924
4959
|
show: false
|
|
4925
4960
|
},
|
|
@@ -4927,23 +4962,25 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4927
4962
|
show: false
|
|
4928
4963
|
},
|
|
4929
4964
|
labels: {
|
|
4965
|
+
show: categories.length <= 15,
|
|
4966
|
+
rotate: -45,
|
|
4930
4967
|
style: {
|
|
4931
4968
|
colors: "rgba(0, 0, 0, 0.4)",
|
|
4932
|
-
fontSize: "
|
|
4969
|
+
fontSize: "10px"
|
|
4933
4970
|
}
|
|
4934
4971
|
}
|
|
4935
4972
|
},
|
|
4936
4973
|
yaxis: {
|
|
4937
4974
|
min: 0,
|
|
4938
|
-
max:
|
|
4939
|
-
tickAmount:
|
|
4975
|
+
max: yAxisMax,
|
|
4976
|
+
tickAmount: 4,
|
|
4940
4977
|
labels: {
|
|
4941
4978
|
formatter: function formatter(val) {
|
|
4942
|
-
return "".concat(val, "%");
|
|
4979
|
+
return "".concat(parseFloat(val.toFixed(1)), "%");
|
|
4943
4980
|
},
|
|
4944
4981
|
style: {
|
|
4945
4982
|
colors: "rgba(0, 0, 0, 0.4)",
|
|
4946
|
-
fontSize: "
|
|
4983
|
+
fontSize: "11px"
|
|
4947
4984
|
}
|
|
4948
4985
|
}
|
|
4949
4986
|
},
|
|
@@ -4954,6 +4991,10 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4954
4991
|
lines: {
|
|
4955
4992
|
show: true
|
|
4956
4993
|
}
|
|
4994
|
+
},
|
|
4995
|
+
padding: {
|
|
4996
|
+
left: 0,
|
|
4997
|
+
right: 0
|
|
4957
4998
|
}
|
|
4958
4999
|
},
|
|
4959
5000
|
colors: ["#F59E0B", "#EF4444"],
|
|
@@ -4973,7 +5014,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4973
5014
|
fontSize: "10px",
|
|
4974
5015
|
fontWeight: 700
|
|
4975
5016
|
},
|
|
4976
|
-
// text: "1% chargeback threshold",
|
|
4977
5017
|
position: "left",
|
|
4978
5018
|
offsetY: -10,
|
|
4979
5019
|
offsetX: 10
|
|
@@ -4981,20 +5021,27 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
4981
5021
|
}]
|
|
4982
5022
|
},
|
|
4983
5023
|
tooltip: {
|
|
5024
|
+
shared: true,
|
|
4984
5025
|
y: {
|
|
4985
5026
|
formatter: function formatter(val) {
|
|
4986
|
-
return "".concat(val, "%");
|
|
5027
|
+
return "".concat(parseFloat(val.toFixed(2)), "%");
|
|
4987
5028
|
}
|
|
4988
5029
|
}
|
|
4989
5030
|
}
|
|
4990
5031
|
};
|
|
4991
5032
|
var series = [{
|
|
4992
5033
|
name: "Refunds",
|
|
4993
|
-
data:
|
|
5034
|
+
data: refundSeries
|
|
4994
5035
|
}, {
|
|
4995
5036
|
name: "Chargebacks",
|
|
4996
|
-
data:
|
|
5037
|
+
data: chargebackSeries
|
|
4997
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";
|
|
4998
5045
|
return /*#__PURE__*/jsxs(Card, {
|
|
4999
5046
|
sx: _objectSpread2({
|
|
5000
5047
|
bgcolor: "#fff",
|
|
@@ -5002,7 +5049,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5002
5049
|
border: "1px solid #f0f0f0",
|
|
5003
5050
|
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
5004
5051
|
p: 3,
|
|
5005
|
-
// height: "100%",
|
|
5006
5052
|
display: "flex",
|
|
5007
5053
|
flexDirection: "column"
|
|
5008
5054
|
}, sx),
|
|
@@ -5030,9 +5076,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5030
5076
|
sx: {
|
|
5031
5077
|
display: "flex",
|
|
5032
5078
|
gap: 2,
|
|
5033
|
-
// mt: 0.5,
|
|
5034
5079
|
mb: 0.75,
|
|
5035
|
-
flexWrap: "wrap"
|
|
5080
|
+
flexWrap: "wrap",
|
|
5081
|
+
mt: 1
|
|
5036
5082
|
},
|
|
5037
5083
|
children: [/*#__PURE__*/jsxs(Box, {
|
|
5038
5084
|
sx: {
|
|
@@ -5063,24 +5109,23 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5063
5109
|
fontWeight: 500
|
|
5064
5110
|
},
|
|
5065
5111
|
children: "Refunds"
|
|
5066
|
-
}), /*#__PURE__*/
|
|
5112
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5067
5113
|
sx: {
|
|
5068
5114
|
fontSize: "13px",
|
|
5069
5115
|
fontWeight: 600,
|
|
5070
5116
|
color: "#000"
|
|
5071
5117
|
},
|
|
5072
|
-
children: "
|
|
5118
|
+
children: [refundRate.toFixed(2), "%"]
|
|
5073
5119
|
})]
|
|
5074
|
-
}), /*#__PURE__*/
|
|
5120
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5075
5121
|
sx: {
|
|
5076
5122
|
fontSize: "12px",
|
|
5077
|
-
fontWeight:
|
|
5078
|
-
color: "
|
|
5123
|
+
fontWeight: 600,
|
|
5124
|
+
color: "rgba(0,0,0,0.4)",
|
|
5079
5125
|
lineHeight: 1.2,
|
|
5080
|
-
mt: 0.2
|
|
5081
|
-
ml: "-14px"
|
|
5126
|
+
mt: 0.2
|
|
5082
5127
|
},
|
|
5083
|
-
children: "
|
|
5128
|
+
children: ["$", fmt(totalRefundedAmount), " refunded"]
|
|
5084
5129
|
})]
|
|
5085
5130
|
})]
|
|
5086
5131
|
}), /*#__PURE__*/jsxs(Box, {
|
|
@@ -5112,39 +5157,38 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5112
5157
|
fontWeight: 500
|
|
5113
5158
|
},
|
|
5114
5159
|
children: "Chargebacks"
|
|
5115
|
-
}), /*#__PURE__*/
|
|
5160
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5116
5161
|
sx: {
|
|
5117
5162
|
fontSize: "13px",
|
|
5118
5163
|
fontWeight: 600,
|
|
5119
5164
|
color: "#000"
|
|
5120
5165
|
},
|
|
5121
|
-
children: "
|
|
5166
|
+
children: [chargebackRate.toFixed(2), "%"]
|
|
5122
5167
|
})]
|
|
5123
5168
|
}), /*#__PURE__*/jsx(Typography, {
|
|
5124
5169
|
sx: {
|
|
5125
5170
|
fontSize: "12px",
|
|
5126
|
-
|
|
5127
|
-
|
|
5171
|
+
fontWeight: 600,
|
|
5172
|
+
color: growthColor,
|
|
5128
5173
|
lineHeight: 1.2,
|
|
5129
|
-
mt: 0.2
|
|
5130
|
-
ml: "-14px"
|
|
5174
|
+
mt: 0.2
|
|
5131
5175
|
},
|
|
5132
|
-
children:
|
|
5176
|
+
children: growthLabel
|
|
5133
5177
|
})]
|
|
5134
5178
|
})]
|
|
5135
5179
|
})]
|
|
5136
5180
|
}), /*#__PURE__*/jsx(Box, {
|
|
5137
5181
|
sx: {
|
|
5138
|
-
mb: 0
|
|
5182
|
+
mb: 0.5
|
|
5139
5183
|
},
|
|
5140
|
-
children: /*#__PURE__*/
|
|
5184
|
+
children: /*#__PURE__*/jsxs(Typography, {
|
|
5141
5185
|
sx: {
|
|
5142
5186
|
fontSize: "12px",
|
|
5143
5187
|
color: "rgba(0, 0, 0, 0.3)",
|
|
5144
5188
|
fontWeight: 500,
|
|
5145
5189
|
textAlign: "left"
|
|
5146
5190
|
},
|
|
5147
|
-
children: "$
|
|
5191
|
+
children: ["$", fmt(totalRefundedAmount), " refunded \xB7 ", totalChargebacks, " chargebacks \xB7 ", totalRefunds, " refunds"]
|
|
5148
5192
|
})
|
|
5149
5193
|
}), /*#__PURE__*/jsx(Box, {
|
|
5150
5194
|
sx: {
|
|
@@ -5240,11 +5284,12 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5240
5284
|
activeMetric = _useState2[0],
|
|
5241
5285
|
setActiveMetric = _useState2[1];
|
|
5242
5286
|
var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData) || [];
|
|
5243
|
-
var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.
|
|
5287
|
+
var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [];
|
|
5244
5288
|
var trafficSourceData = (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSource1) || [];
|
|
5245
5289
|
var orderBumpData = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpData1) || [];
|
|
5246
5290
|
var upsellData = (apiData === null || apiData === void 0 ? void 0 : apiData.upsellData1) || [];
|
|
5247
5291
|
var downsellData = (apiData === null || apiData === void 0 ? void 0 : apiData.downsellData1) || [];
|
|
5292
|
+
(apiData === null || apiData === void 0 ? void 0 : apiData.refundAndChargeBacks) || [];
|
|
5248
5293
|
var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
|
|
5249
5294
|
var getExtendedCharts = function getExtendedCharts() {
|
|
5250
5295
|
var charts = _toConsumableArray(allCharts);
|