@ammarkhalidfarooq/dashboard-package 0.4.84 → 0.4.85
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 +37 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +37 -9
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5316,10 +5316,38 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5316
5316
|
};
|
|
5317
5317
|
var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
|
|
5318
5318
|
console.log("ACtive campaigns", activeCampaignsData);
|
|
5319
|
-
var donorMix =
|
|
5320
|
-
var
|
|
5321
|
-
var
|
|
5322
|
-
var
|
|
5319
|
+
var donorMix = apiData === null || apiData === void 0 ? void 0 : apiData.donorPieChartData;
|
|
5320
|
+
var newDonorsCount = 0;
|
|
5321
|
+
var returningDonorsCount = 0;
|
|
5322
|
+
var totalDonorsMix = 0;
|
|
5323
|
+
var newDonorsPerc = 0;
|
|
5324
|
+
var returningDonorsPerc = 0;
|
|
5325
|
+
var avgGift = 0;
|
|
5326
|
+
var donorMixPrev = 0;
|
|
5327
|
+
if (Array.isArray(donorMix)) {
|
|
5328
|
+
var newDonorsObj = donorMix.find(function (d) {
|
|
5329
|
+
return d.type === "New Donors" || d.type === "New donors";
|
|
5330
|
+
}) || {};
|
|
5331
|
+
var returningDonorsObj = donorMix.find(function (d) {
|
|
5332
|
+
return d.type === "Returning Donors" || d.type === "Returning";
|
|
5333
|
+
}) || {};
|
|
5334
|
+
newDonorsCount = newDonorsObj.totalDonations || 0;
|
|
5335
|
+
returningDonorsCount = returningDonorsObj.totalDonations || 0;
|
|
5336
|
+
totalDonorsMix = newDonorsCount + returningDonorsCount;
|
|
5337
|
+
newDonorsPerc = totalDonorsMix > 0 ? Math.round(newDonorsCount / totalDonorsMix * 100) : 0;
|
|
5338
|
+
returningDonorsPerc = totalDonorsMix > 0 ? Math.round(returningDonorsCount / totalDonorsMix * 100) : 0;
|
|
5339
|
+
var totalAmount = (newDonorsObj.totalAmount || 0) + (returningDonorsObj.totalAmount || 0);
|
|
5340
|
+
avgGift = totalDonorsMix > 0 ? Number((totalAmount / totalDonorsMix).toFixed(2)) : 0;
|
|
5341
|
+
donorMixPrev = (apiData === null || apiData === void 0 ? void 0 : apiData.donorMixPrev) || 0;
|
|
5342
|
+
} else if (donorMix && _typeof(donorMix) === "object") {
|
|
5343
|
+
newDonorsCount = donorMix.newDonors || 0;
|
|
5344
|
+
returningDonorsCount = donorMix.returningDonors || 0;
|
|
5345
|
+
totalDonorsMix = newDonorsCount + returningDonorsCount;
|
|
5346
|
+
newDonorsPerc = totalDonorsMix > 0 ? Math.round(newDonorsCount / totalDonorsMix * 100) : 0;
|
|
5347
|
+
returningDonorsPerc = totalDonorsMix > 0 ? Math.round(returningDonorsCount / totalDonorsMix * 100) : 0;
|
|
5348
|
+
avgGift = donorMix.avgGift || 0;
|
|
5349
|
+
donorMixPrev = donorMix.donorMixPrev || 0;
|
|
5350
|
+
}
|
|
5323
5351
|
var renderCard = function renderCard(title) {
|
|
5324
5352
|
return /*#__PURE__*/jsxRuntime.jsx(MetricCard
|
|
5325
5353
|
// key={title}
|
|
@@ -5718,22 +5746,22 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5718
5746
|
children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
5719
5747
|
title: "Donor mix",
|
|
5720
5748
|
subtitle: "Acquisition vs retention",
|
|
5721
|
-
series: [
|
|
5749
|
+
series: [newDonorsCount, returningDonorsCount],
|
|
5722
5750
|
labels: ["New donors", "Returning"],
|
|
5723
5751
|
colors: ["rgb(99, 99, 230)", "#10B981"],
|
|
5724
5752
|
centerLabel: "donors",
|
|
5725
5753
|
centerValue: totalDonorsMix.toString(),
|
|
5726
5754
|
items: [{
|
|
5727
5755
|
label: "New donors",
|
|
5728
|
-
val: "".concat(
|
|
5756
|
+
val: "".concat(newDonorsCount, " \xB7 ").concat(newDonorsPerc, "%"),
|
|
5729
5757
|
color: "rgb(99, 99, 230)"
|
|
5730
5758
|
}, {
|
|
5731
5759
|
label: "Returning",
|
|
5732
|
-
val: "".concat(
|
|
5760
|
+
val: "".concat(returningDonorsCount, " \xB7 ").concat(returningDonorsPerc, "%"),
|
|
5733
5761
|
color: "#10B981"
|
|
5734
5762
|
}],
|
|
5735
|
-
bottomSummaryValue: "$".concat(
|
|
5736
|
-
bottomSummaryTrend: "".concat(
|
|
5763
|
+
bottomSummaryValue: "$".concat(avgGift),
|
|
5764
|
+
bottomSummaryTrend: "".concat(donorMixPrev, "% vs ").concat(dateName || "last month"),
|
|
5737
5765
|
sx: {
|
|
5738
5766
|
width: "100%"
|
|
5739
5767
|
}
|