@ammarkhalidfarooq/dashboard-package 0.4.8 → 0.4.9
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 +45 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +45 -27
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4527,6 +4527,19 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
|
|
|
4527
4527
|
});
|
|
4528
4528
|
};
|
|
4529
4529
|
|
|
4530
|
+
function formatNumber(num) {
|
|
4531
|
+
if (num >= 1000000000) {
|
|
4532
|
+
return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
|
|
4533
|
+
}
|
|
4534
|
+
if (num >= 1000000) {
|
|
4535
|
+
return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
|
|
4536
|
+
}
|
|
4537
|
+
if (num >= 1000) {
|
|
4538
|
+
return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
|
|
4539
|
+
}
|
|
4540
|
+
return (num !== null && num !== void 0 ? num : 0).toString();
|
|
4541
|
+
}
|
|
4542
|
+
|
|
4530
4543
|
var TrafficSourceCard = function TrafficSourceCard(_ref) {
|
|
4531
4544
|
var _ref$title = _ref.title,
|
|
4532
4545
|
title = _ref$title === void 0 ? "Traffic source" : _ref$title,
|
|
@@ -4537,6 +4550,24 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
|
|
|
4537
4550
|
_ref$total = _ref.total,
|
|
4538
4551
|
total = _ref$total === void 0 ? "$240.9K" : _ref$total,
|
|
4539
4552
|
sx = _ref.sx;
|
|
4553
|
+
var paidAdsColor = "rgb(99, 99, 230)";
|
|
4554
|
+
var organicColor = "#10B981";
|
|
4555
|
+
var emailColor = "#0EA5E9";
|
|
4556
|
+
var directColor = "#94A3B8";
|
|
4557
|
+
var getSourceColor = function getSourceColor(label) {
|
|
4558
|
+
switch (label) {
|
|
4559
|
+
case "Paid Ads":
|
|
4560
|
+
return paidAdsColor;
|
|
4561
|
+
case "Organic":
|
|
4562
|
+
return organicColor;
|
|
4563
|
+
case "Email":
|
|
4564
|
+
return emailColor;
|
|
4565
|
+
case "Direct":
|
|
4566
|
+
return directColor;
|
|
4567
|
+
default:
|
|
4568
|
+
return "#CBD5E1";
|
|
4569
|
+
}
|
|
4570
|
+
};
|
|
4540
4571
|
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
4541
4572
|
sx: _objectSpread2({
|
|
4542
4573
|
p: 3,
|
|
@@ -4628,7 +4659,7 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
|
|
|
4628
4659
|
sx: {
|
|
4629
4660
|
width: 10,
|
|
4630
4661
|
height: 10,
|
|
4631
|
-
bgcolor: item.
|
|
4662
|
+
bgcolor: getSourceColor(item.label),
|
|
4632
4663
|
borderRadius: "2px"
|
|
4633
4664
|
}
|
|
4634
4665
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
@@ -4667,7 +4698,7 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
|
|
|
4667
4698
|
bgcolor: "#F3F4F6",
|
|
4668
4699
|
"& .MuiLinearProgress-bar": {
|
|
4669
4700
|
borderRadius: 3,
|
|
4670
|
-
bgcolor: item.
|
|
4701
|
+
bgcolor: getSourceColor(item.label)
|
|
4671
4702
|
}
|
|
4672
4703
|
}
|
|
4673
4704
|
})
|
|
@@ -5125,19 +5156,6 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
|
|
|
5125
5156
|
});
|
|
5126
5157
|
};
|
|
5127
5158
|
|
|
5128
|
-
function formatNumber$1(num) {
|
|
5129
|
-
if (num >= 1000000000) {
|
|
5130
|
-
return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
|
|
5131
|
-
}
|
|
5132
|
-
if (num >= 1000000) {
|
|
5133
|
-
return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
|
|
5134
|
-
}
|
|
5135
|
-
if (num >= 1000) {
|
|
5136
|
-
return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
|
|
5137
|
-
}
|
|
5138
|
-
return (num !== null && num !== void 0 ? num : 0).toString();
|
|
5139
|
-
}
|
|
5140
|
-
|
|
5141
5159
|
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
5142
5160
|
var _donationTypeData$sum, _donationTypeData$sum2, _donationTypeData$sum3, _donationTypeData$sum4, _donationTypeData$sum5, _donationTypeData$sum6;
|
|
5143
5161
|
var sx = _ref.sx,
|
|
@@ -5170,7 +5188,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5170
5188
|
dataLabels: {
|
|
5171
5189
|
enabled: true,
|
|
5172
5190
|
formatter: function formatter(val) {
|
|
5173
|
-
return "$".concat(formatNumber
|
|
5191
|
+
return "$".concat(formatNumber(val));
|
|
5174
5192
|
},
|
|
5175
5193
|
offsetY: -22,
|
|
5176
5194
|
style: {
|
|
@@ -5204,7 +5222,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5204
5222
|
tickAmount: 4,
|
|
5205
5223
|
labels: {
|
|
5206
5224
|
formatter: function formatter(val) {
|
|
5207
|
-
return "$".concat(formatNumber
|
|
5225
|
+
return "$".concat(formatNumber(val));
|
|
5208
5226
|
},
|
|
5209
5227
|
style: {
|
|
5210
5228
|
colors: "rgba(0, 0, 0, 0.4)",
|
|
@@ -5235,7 +5253,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5235
5253
|
tooltip: {
|
|
5236
5254
|
y: {
|
|
5237
5255
|
formatter: function formatter(val) {
|
|
5238
|
-
return "$".concat(formatNumber
|
|
5256
|
+
return "$".concat(formatNumber(val));
|
|
5239
5257
|
}
|
|
5240
5258
|
}
|
|
5241
5259
|
}
|
|
@@ -5307,7 +5325,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5307
5325
|
fontWeight: 600,
|
|
5308
5326
|
color: "#000"
|
|
5309
5327
|
},
|
|
5310
|
-
children: ["$", formatNumber
|
|
5328
|
+
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)]
|
|
5311
5329
|
})]
|
|
5312
5330
|
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
5313
5331
|
sx: {
|
|
@@ -5335,7 +5353,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5335
5353
|
fontWeight: 600,
|
|
5336
5354
|
color: "#000"
|
|
5337
5355
|
},
|
|
5338
|
-
children: ["$", formatNumber
|
|
5356
|
+
children: ["$", formatNumber((donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum6 = donationTypeData.summary) === null || _donationTypeData$sum6 === void 0 || (_donationTypeData$sum6 = _donationTypeData$sum6.oneTime) === null || _donationTypeData$sum6 === void 0 ? void 0 : _donationTypeData$sum6.total) || 0)]
|
|
5339
5357
|
})]
|
|
5340
5358
|
})]
|
|
5341
5359
|
})]
|
|
@@ -5697,13 +5715,13 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5697
5715
|
};
|
|
5698
5716
|
var metricInfo = {
|
|
5699
5717
|
"Total Raised": {
|
|
5700
|
-
value: "$".concat(formatNumber
|
|
5718
|
+
value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
|
|
5701
5719
|
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"),
|
|
5702
5720
|
label: "Total Raised",
|
|
5703
5721
|
icon: iconsMaterial.PaidOutlined
|
|
5704
5722
|
},
|
|
5705
5723
|
"Net Raised": {
|
|
5706
|
-
value: "$".concat(formatNumber
|
|
5724
|
+
value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
|
|
5707
5725
|
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"),
|
|
5708
5726
|
label: "Net Raised",
|
|
5709
5727
|
icon: iconsMaterial.FavoriteOutlined
|
|
@@ -5715,13 +5733,13 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5715
5733
|
icon: iconsMaterial.PeopleAltOutlined
|
|
5716
5734
|
},
|
|
5717
5735
|
"Avg donation": {
|
|
5718
|
-
value: "$".concat(formatNumber
|
|
5736
|
+
value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
|
|
5719
5737
|
subValue: "".concat(Number((_apiData$averageDonat2 = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat2 !== void 0 ? _apiData$averageDonat2 : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5720
5738
|
label: "Average Donation Amount",
|
|
5721
5739
|
icon: iconsMaterial.PaidOutlined
|
|
5722
5740
|
},
|
|
5723
5741
|
"ROAS": {
|
|
5724
|
-
value: "".concat(formatNumber
|
|
5742
|
+
value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
|
|
5725
5743
|
subValue: "".concat(Number((_apiData$roasCardPrev = apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) !== null && _apiData$roasCardPrev !== void 0 ? _apiData$roasCardPrev : 0).toFixed(2), "x vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5726
5744
|
label: "ROAS",
|
|
5727
5745
|
icon: iconsMaterial.TrendingUp
|
|
@@ -6084,11 +6102,11 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
6084
6102
|
return word[0];
|
|
6085
6103
|
}).join("").toUpperCase().slice(0, 2) : "??",
|
|
6086
6104
|
name: campaign.campaignName || "Untitled Campaign",
|
|
6087
|
-
val1: "$".concat(formatNumber
|
|
6105
|
+
val1: "$".concat(formatNumber(campaign.raisedAmount || 0)),
|
|
6088
6106
|
type: "progress",
|
|
6089
6107
|
progress: Math.round((campaign.raisedAmount || 0) / (campaign.totalAmount || 1) * 100),
|
|
6090
|
-
val3: formatNumber
|
|
6091
|
-
val4: "$".concat(formatNumber
|
|
6108
|
+
val3: formatNumber(campaign.donors || 0),
|
|
6109
|
+
val4: "$".concat(formatNumber(campaign.avgGift || 0))
|
|
6092
6110
|
};
|
|
6093
6111
|
})
|
|
6094
6112
|
})
|