@ammarkhalidfarooq/dashboard-package 0.4.88 → 0.4.90
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 +80 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +80 -41
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
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.
|
|
4924
|
-
opacityTo: 0.
|
|
4951
|
+
opacityFrom: 0.35,
|
|
4952
|
+
opacityTo: 0.02,
|
|
4925
4953
|
stops: [20, 100]
|
|
4926
4954
|
}
|
|
4927
4955
|
},
|
|
4928
4956
|
xaxis: {
|
|
4929
|
-
categories:
|
|
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: "
|
|
4969
|
+
fontSize: "10px"
|
|
4940
4970
|
}
|
|
4941
4971
|
}
|
|
4942
4972
|
},
|
|
4943
4973
|
yaxis: {
|
|
4944
4974
|
min: 0,
|
|
4945
|
-
max:
|
|
4946
|
-
tickAmount:
|
|
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: "
|
|
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:
|
|
5034
|
+
data: refundSeries
|
|
5001
5035
|
}, {
|
|
5002
5036
|
name: "Chargebacks",
|
|
5003
|
-
data:
|
|
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__*/
|
|
5112
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5074
5113
|
sx: {
|
|
5075
5114
|
fontSize: "13px",
|
|
5076
5115
|
fontWeight: 600,
|
|
5077
5116
|
color: "#000"
|
|
5078
5117
|
},
|
|
5079
|
-
children: "
|
|
5118
|
+
children: [refundRate.toFixed(2), "%"]
|
|
5080
5119
|
})]
|
|
5081
|
-
}), /*#__PURE__*/
|
|
5120
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5082
5121
|
sx: {
|
|
5083
5122
|
fontSize: "12px",
|
|
5084
|
-
fontWeight:
|
|
5085
|
-
color: "
|
|
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: "
|
|
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__*/
|
|
5160
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
5123
5161
|
sx: {
|
|
5124
5162
|
fontSize: "13px",
|
|
5125
5163
|
fontWeight: 600,
|
|
5126
5164
|
color: "#000"
|
|
5127
5165
|
},
|
|
5128
|
-
children: "
|
|
5166
|
+
children: [chargebackRate.toFixed(2), "%"]
|
|
5129
5167
|
})]
|
|
5130
5168
|
}), /*#__PURE__*/jsx(Typography, {
|
|
5131
5169
|
sx: {
|
|
5132
5170
|
fontSize: "12px",
|
|
5133
|
-
|
|
5134
|
-
|
|
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:
|
|
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__*/
|
|
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: "$
|
|
5191
|
+
children: ["$", fmt(totalRefundedAmount), " refunded \xB7 ", totalChargebacks, " chargebacks \xB7 ", totalRefunds, " refunds"]
|
|
5155
5192
|
})
|
|
5156
5193
|
}), /*#__PURE__*/jsx(Box, {
|
|
5157
5194
|
sx: {
|
|
@@ -5234,7 +5271,7 @@ var MetricCard = function MetricCard(_ref) {
|
|
|
5234
5271
|
};
|
|
5235
5272
|
|
|
5236
5273
|
var OverallSection = function OverallSection(_ref) {
|
|
5237
|
-
var _apiData$totalRaisedP, _apiData$
|
|
5274
|
+
var _apiData$overviewStat, _apiData$totalRaisedP, _apiData$overviewStat2, _apiData$netRaisedPre, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$averageDonat, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
|
|
5238
5275
|
var _ref$apiData = _ref.apiData,
|
|
5239
5276
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
5240
5277
|
primaryCharts = _ref.primaryCharts,
|
|
@@ -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);
|
|
@@ -5292,7 +5330,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5292
5330
|
};
|
|
5293
5331
|
var metricInfo = {
|
|
5294
5332
|
"Total Raised": {
|
|
5295
|
-
value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 :
|
|
5333
|
+
value: "$".concat(formatNumber(apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 || (_apiData$overviewStat = _apiData$overviewStat.overview) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.totalRevenue)) || "$240.9K",
|
|
5296
5334
|
subValue: "".concat(Number((_apiData$totalRaisedP = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev) !== null && _apiData$totalRaisedP !== void 0 ? _apiData$totalRaisedP : 0).toFixed(2), "% vs ").concat(dateName || "last month"),
|
|
5297
5335
|
label: "Total Raised",
|
|
5298
5336
|
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
@@ -5301,7 +5339,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5301
5339
|
warning: false
|
|
5302
5340
|
},
|
|
5303
5341
|
"Net Raised": {
|
|
5304
|
-
value: "$".concat(formatNumber((_apiData$
|
|
5342
|
+
value: "$".concat(formatNumber(apiData === null || apiData === void 0 || (_apiData$overviewStat2 = apiData.overviewStats) === null || _apiData$overviewStat2 === void 0 || (_apiData$overviewStat2 = _apiData$overviewStat2.overview) === null || _apiData$overviewStat2 === void 0 ? void 0 : _apiData$overviewStat2.netRevenue)),
|
|
5305
5343
|
subValue: "".concat(Number((_apiData$netRaisedPre = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedPrev) !== null && _apiData$netRaisedPre !== void 0 ? _apiData$netRaisedPre : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "previous period"),
|
|
5306
5344
|
label: "Net Raised",
|
|
5307
5345
|
icon: /*#__PURE__*/jsx(FavoriteOutlined, {}),
|
|
@@ -5310,7 +5348,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5310
5348
|
warning: false
|
|
5311
5349
|
},
|
|
5312
5350
|
"Total Donors": {
|
|
5313
|
-
value: (apiData === null || apiData === void 0 ? void 0 :
|
|
5351
|
+
value: (apiData === null || apiData === void 0 || (_apiData$overviewStat3 = apiData.overviewStats) === null || _apiData$overviewStat3 === void 0 || (_apiData$overviewStat3 = _apiData$overviewStat3.overview) === null || _apiData$overviewStat3 === void 0 ? void 0 : _apiData$overviewStat3.totalDonations) || "215",
|
|
5314
5352
|
subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsPrev, " new") || "31 new",
|
|
5315
5353
|
label: "Total Donors",
|
|
5316
5354
|
icon: /*#__PURE__*/jsx(PeopleAltOutlined, {}),
|
|
@@ -5319,8 +5357,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5319
5357
|
warning: false
|
|
5320
5358
|
},
|
|
5321
5359
|
"Avg donation": {
|
|
5322
|
-
value: "$".concat(formatNumber((_apiData$
|
|
5323
|
-
subValue: "".concat(Number((_apiData$
|
|
5360
|
+
value: "$".concat(formatNumber(apiData === null || apiData === void 0 || (_apiData$overviewStat4 = apiData.overviewStats) === null || _apiData$overviewStat4 === void 0 || (_apiData$overviewStat4 = _apiData$overviewStat4.overview) === null || _apiData$overviewStat4 === void 0 ? void 0 : _apiData$overviewStat4.overallAVGDonations)),
|
|
5361
|
+
subValue: "".concat(Number((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5324
5362
|
label: "Average Donation Amount",
|
|
5325
5363
|
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
5326
5364
|
money: true,
|
|
@@ -5421,7 +5459,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5421
5459
|
return c.label === selectedInfo.label;
|
|
5422
5460
|
}) || primaryCharts[0];
|
|
5423
5461
|
if (activeMetric === "Total Raised") {
|
|
5424
|
-
var
|
|
5462
|
+
var _apiData$overviewStat5;
|
|
5463
|
+
var stackedData = apiData === null || apiData === void 0 || (_apiData$overviewStat5 = apiData.overviewStats) === null || _apiData$overviewStat5 === void 0 ? void 0 : _apiData$overviewStat5.totalRaised;
|
|
5425
5464
|
var hasStackedData = (stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic);
|
|
5426
5465
|
if (hasStackedData) {
|
|
5427
5466
|
var categories = ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || []).map(function (item) {
|