@ammarkhalidfarooq/dashboard-package 0.4.83 → 0.4.84
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 +92 -74
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +92 -74
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3675,13 +3675,56 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
3675
3675
|
};
|
|
3676
3676
|
|
|
3677
3677
|
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
3678
|
-
var _donationTypeData$sum, _donationTypeData$sum2, _donationTypeData$sum3, _donationTypeData$sum4, _donationTypeData$sum5, _donationTypeData$sum6;
|
|
3679
3678
|
var sx = _ref.sx,
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
var
|
|
3684
|
-
var
|
|
3679
|
+
donationTypeData = _ref.donationTypeData;
|
|
3680
|
+
var recurringColor = "rgb(99, 99, 230)";
|
|
3681
|
+
var oneTimeColor = "#10B981";
|
|
3682
|
+
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
3683
|
+
var categories = [];
|
|
3684
|
+
var series = [];
|
|
3685
|
+
var summaries = [];
|
|
3686
|
+
var title = "Donation Type";
|
|
3687
|
+
var isDistributed = false;
|
|
3688
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
3689
|
+
// New array format
|
|
3690
|
+
categories = donationTypeData.map(function (item) {
|
|
3691
|
+
return item.type || "";
|
|
3692
|
+
});
|
|
3693
|
+
series = [{
|
|
3694
|
+
name: "Amount",
|
|
3695
|
+
data: donationTypeData.map(function (item) {
|
|
3696
|
+
return item.totalAmount || 0;
|
|
3697
|
+
})
|
|
3698
|
+
}];
|
|
3699
|
+
summaries = donationTypeData.map(function (item, index) {
|
|
3700
|
+
return {
|
|
3701
|
+
label: item.type || "",
|
|
3702
|
+
total: item.totalAmount || 0,
|
|
3703
|
+
color: colors[index % colors.length]
|
|
3704
|
+
};
|
|
3705
|
+
});
|
|
3706
|
+
isDistributed = true;
|
|
3707
|
+
if (donationTypeData.length === 2) {
|
|
3708
|
+
title = "".concat(donationTypeData[0].type, " vs ").concat(donationTypeData[1].type);
|
|
3709
|
+
}
|
|
3710
|
+
} else {
|
|
3711
|
+
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
3712
|
+
// Object format or simple series array
|
|
3713
|
+
var dataObj = donationTypeData || {};
|
|
3714
|
+
categories = dataObj.categories || [];
|
|
3715
|
+
series = Array.isArray(donationTypeData) ? donationTypeData : dataObj.series || [];
|
|
3716
|
+
summaries = [{
|
|
3717
|
+
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary = dataObj.summary) === null || _dataObj$summary === void 0 || (_dataObj$summary = _dataObj$summary.recurring) === null || _dataObj$summary === void 0 ? void 0 : _dataObj$summary.label) || "Recurring",
|
|
3718
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
3719
|
+
color: recurringColor
|
|
3720
|
+
}, {
|
|
3721
|
+
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary3 = dataObj.summary) === null || _dataObj$summary3 === void 0 || (_dataObj$summary3 = _dataObj$summary3.oneTime) === null || _dataObj$summary3 === void 0 ? void 0 : _dataObj$summary3.label) || "One-time",
|
|
3722
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary4 = dataObj.summary) === null || _dataObj$summary4 === void 0 || (_dataObj$summary4 = _dataObj$summary4.oneTime) === null || _dataObj$summary4 === void 0 ? void 0 : _dataObj$summary4.total) || 0,
|
|
3723
|
+
color: oneTimeColor
|
|
3724
|
+
}];
|
|
3725
|
+
title = "Recurring vs one-time";
|
|
3726
|
+
isDistributed = false;
|
|
3727
|
+
}
|
|
3685
3728
|
var chartOptions = {
|
|
3686
3729
|
chart: {
|
|
3687
3730
|
type: "bar",
|
|
@@ -3696,8 +3739,9 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3696
3739
|
plotOptions: {
|
|
3697
3740
|
bar: {
|
|
3698
3741
|
horizontal: false,
|
|
3699
|
-
columnWidth: "
|
|
3742
|
+
columnWidth: "50%",
|
|
3700
3743
|
borderRadius: 4,
|
|
3744
|
+
distributed: isDistributed,
|
|
3701
3745
|
dataLabels: {
|
|
3702
3746
|
position: "top"
|
|
3703
3747
|
}
|
|
@@ -3708,10 +3752,10 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3708
3752
|
formatter: function formatter(val) {
|
|
3709
3753
|
return "$".concat(formatNumber(val));
|
|
3710
3754
|
},
|
|
3711
|
-
offsetY: -
|
|
3755
|
+
offsetY: -20,
|
|
3712
3756
|
style: {
|
|
3713
|
-
fontSize: "
|
|
3714
|
-
fontWeight:
|
|
3757
|
+
fontSize: "9px",
|
|
3758
|
+
fontWeight: 600,
|
|
3715
3759
|
colors: ["#000"]
|
|
3716
3760
|
}
|
|
3717
3761
|
},
|
|
@@ -3721,7 +3765,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3721
3765
|
colors: ["transparent"]
|
|
3722
3766
|
},
|
|
3723
3767
|
xaxis: {
|
|
3724
|
-
categories:
|
|
3768
|
+
categories: categories,
|
|
3725
3769
|
axisBorder: {
|
|
3726
3770
|
show: false
|
|
3727
3771
|
},
|
|
@@ -3751,7 +3795,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3751
3795
|
fill: {
|
|
3752
3796
|
opacity: 1
|
|
3753
3797
|
},
|
|
3754
|
-
colors:
|
|
3798
|
+
colors: colors,
|
|
3755
3799
|
grid: {
|
|
3756
3800
|
borderColor: "#f1f1f1",
|
|
3757
3801
|
strokeDashArray: 4,
|
|
@@ -3776,7 +3820,6 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3776
3820
|
}
|
|
3777
3821
|
}
|
|
3778
3822
|
};
|
|
3779
|
-
var series = (donationTypeData === null || donationTypeData === void 0 ? void 0 : donationTypeData.series) || [];
|
|
3780
3823
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
3781
3824
|
sx: _objectSpread2({
|
|
3782
3825
|
bgcolor: "#fff",
|
|
@@ -3800,78 +3843,53 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3800
3843
|
fontSize: "18px",
|
|
3801
3844
|
color: "#000"
|
|
3802
3845
|
},
|
|
3803
|
-
children:
|
|
3846
|
+
children: title
|
|
3804
3847
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
3805
3848
|
sx: {
|
|
3806
3849
|
fontSize: "13px",
|
|
3807
3850
|
color: "rgba(0, 0, 0, 0.4)",
|
|
3808
3851
|
mt: 0
|
|
3809
3852
|
},
|
|
3810
|
-
children: "Donation type
|
|
3853
|
+
children: "Donation type"
|
|
3811
3854
|
})]
|
|
3812
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
3855
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
3813
3856
|
sx: {
|
|
3814
3857
|
display: "flex",
|
|
3815
3858
|
gap: 1.5,
|
|
3816
|
-
mt: 0.5
|
|
3859
|
+
mt: 0.5,
|
|
3860
|
+
flexWrap: "wrap"
|
|
3817
3861
|
},
|
|
3818
|
-
children:
|
|
3819
|
-
|
|
3820
|
-
display: "flex",
|
|
3821
|
-
alignItems: "center",
|
|
3822
|
-
gap: 0.5
|
|
3823
|
-
},
|
|
3824
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
3825
|
-
sx: {
|
|
3826
|
-
width: 8,
|
|
3827
|
-
height: 8,
|
|
3828
|
-
bgcolor: "rgb(99, 99, 230)",
|
|
3829
|
-
borderRadius: "50%"
|
|
3830
|
-
}
|
|
3831
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
3832
|
-
sx: {
|
|
3833
|
-
fontSize: "13px",
|
|
3834
|
-
color: "rgba(0, 0, 0, 0.5)",
|
|
3835
|
-
fontWeight: 500
|
|
3836
|
-
},
|
|
3837
|
-
children: donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum3 = donationTypeData.summary) === null || _donationTypeData$sum3 === void 0 || (_donationTypeData$sum3 = _donationTypeData$sum3.recurring) === null || _donationTypeData$sum3 === void 0 ? void 0 : _donationTypeData$sum3.label
|
|
3838
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
3839
|
-
sx: {
|
|
3840
|
-
fontSize: "13px",
|
|
3841
|
-
fontWeight: 600,
|
|
3842
|
-
color: "#000"
|
|
3843
|
-
},
|
|
3844
|
-
children: ["$", formatNumber((donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum4 = donationTypeData.summary) === null || _donationTypeData$sum4 === void 0 || (_donationTypeData$sum4 = _donationTypeData$sum4.recurring) === null || _donationTypeData$sum4 === void 0 ? void 0 : _donationTypeData$sum4.total) || 0)]
|
|
3845
|
-
})]
|
|
3846
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
3847
|
-
sx: {
|
|
3848
|
-
display: "flex",
|
|
3849
|
-
alignItems: "center",
|
|
3850
|
-
gap: 0.5
|
|
3851
|
-
},
|
|
3852
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
3853
|
-
sx: {
|
|
3854
|
-
width: 8,
|
|
3855
|
-
height: 8,
|
|
3856
|
-
bgcolor: "#10B981",
|
|
3857
|
-
borderRadius: "50%"
|
|
3858
|
-
}
|
|
3859
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
3860
|
-
sx: {
|
|
3861
|
-
fontSize: "13px",
|
|
3862
|
-
color: "rgba(0, 0, 0, 0.5)",
|
|
3863
|
-
fontWeight: 500
|
|
3864
|
-
},
|
|
3865
|
-
children: donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum5 = donationTypeData.summary) === null || _donationTypeData$sum5 === void 0 || (_donationTypeData$sum5 = _donationTypeData$sum5.oneTime) === null || _donationTypeData$sum5 === void 0 ? void 0 : _donationTypeData$sum5.label
|
|
3866
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
3862
|
+
children: summaries.map(function (item, index) {
|
|
3863
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
3867
3864
|
sx: {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3865
|
+
display: "flex",
|
|
3866
|
+
alignItems: "center",
|
|
3867
|
+
gap: 0.5
|
|
3871
3868
|
},
|
|
3872
|
-
children: [
|
|
3873
|
-
|
|
3874
|
-
|
|
3869
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
3870
|
+
sx: {
|
|
3871
|
+
width: 8,
|
|
3872
|
+
height: 8,
|
|
3873
|
+
bgcolor: item.color,
|
|
3874
|
+
borderRadius: "50%"
|
|
3875
|
+
}
|
|
3876
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
3877
|
+
sx: {
|
|
3878
|
+
fontSize: "13px",
|
|
3879
|
+
color: "rgba(0, 0, 0, 0.5)",
|
|
3880
|
+
fontWeight: 500
|
|
3881
|
+
},
|
|
3882
|
+
children: item.label
|
|
3883
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
3884
|
+
sx: {
|
|
3885
|
+
fontSize: "13px",
|
|
3886
|
+
fontWeight: 600,
|
|
3887
|
+
color: "#000"
|
|
3888
|
+
},
|
|
3889
|
+
children: ["$", formatNumber(item.total || 0)]
|
|
3890
|
+
})]
|
|
3891
|
+
}, item.label || index);
|
|
3892
|
+
})
|
|
3875
3893
|
})]
|
|
3876
3894
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
3877
3895
|
sx: {
|
|
@@ -5196,7 +5214,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5196
5214
|
_useState2 = _slicedToArray(_useState, 2),
|
|
5197
5215
|
activeMetric = _useState2[0],
|
|
5198
5216
|
setActiveMetric = _useState2[1];
|
|
5199
|
-
var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.
|
|
5217
|
+
var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorPieChartData1) || [];
|
|
5200
5218
|
var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography1) || [];
|
|
5201
5219
|
var trafficSourceData = (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSource1) || [];
|
|
5202
5220
|
var orderBumpData = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpData1) || [];
|
|
@@ -5298,7 +5316,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5298
5316
|
};
|
|
5299
5317
|
var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
|
|
5300
5318
|
console.log("ACtive campaigns", activeCampaignsData);
|
|
5301
|
-
var donorMix = (apiData === null || apiData === void 0 ? void 0 : apiData.
|
|
5319
|
+
var donorMix = (apiData === null || apiData === void 0 ? void 0 : apiData.donorPieChartData) || {};
|
|
5302
5320
|
var totalDonorsMix = (donorMix.newDonors || 0) + (donorMix.returningDonors || 0);
|
|
5303
5321
|
var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
|
|
5304
5322
|
var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
|