@ammarkhalidfarooq/dashboard-package 0.4.6 → 0.4.8

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.es.js CHANGED
@@ -4530,28 +4530,8 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4530
4530
  title = _ref$title === void 0 ? "Traffic source" : _ref$title,
4531
4531
  _ref$subtitle = _ref.subtitle,
4532
4532
  subtitle = _ref$subtitle === void 0 ? "Revenue by channel · 30 days" : _ref$subtitle,
4533
- _ref$data = _ref.data,
4534
- data = _ref$data === void 0 ? [{
4535
- label: "Paid Ads",
4536
- revenue: "$98.4K",
4537
- share: 41,
4538
- color: "rgb(99, 99, 230)"
4539
- }, {
4540
- label: "Organic",
4541
- revenue: "$62.1K",
4542
- share: 26,
4543
- color: "#10B981"
4544
- }, {
4545
- label: "Email",
4546
- revenue: "$38.6K",
4547
- share: 16,
4548
- color: "#0EA5E9"
4549
- }, {
4550
- label: "Direct",
4551
- revenue: "$15.5K",
4552
- share: 6,
4553
- color: "#94A3B8"
4554
- }] : _ref$data,
4533
+ _ref$trafficSourceDat = _ref.trafficSourceData,
4534
+ trafficSourceData = _ref$trafficSourceDat === void 0 ? [] : _ref$trafficSourceDat,
4555
4535
  _ref$total = _ref.total,
4556
4536
  total = _ref$total === void 0 ? "$240.9K" : _ref$total,
4557
4537
  sx = _ref.sx;
@@ -4625,7 +4605,8 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4625
4605
  sx: {
4626
4606
  flexGrow: 1
4627
4607
  },
4628
- children: data.map(function (item, index) {
4608
+ children: trafficSourceData.map(function (item, index) {
4609
+ var _item$share;
4629
4610
  return /*#__PURE__*/jsxs(Box, {
4630
4611
  sx: {
4631
4612
  display: "grid",
@@ -4633,7 +4614,7 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4633
4614
  gap: 2,
4634
4615
  py: 1.5,
4635
4616
  alignItems: "center",
4636
- borderBottom: index === data.length - 1 ? "none" : "1px solid #f5f5f5"
4617
+ borderBottom: index === trafficSourceData.length - 1 ? "none" : "1px solid #f5f5f5"
4637
4618
  },
4638
4619
  children: [/*#__PURE__*/jsxs(Box, {
4639
4620
  sx: {
@@ -4656,13 +4637,13 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4656
4637
  },
4657
4638
  children: item.label
4658
4639
  })]
4659
- }), /*#__PURE__*/jsx(Typography, {
4640
+ }), /*#__PURE__*/jsxs(Typography, {
4660
4641
  sx: {
4661
4642
  fontSize: "14px",
4662
4643
  fontWeight: 700,
4663
4644
  color: "#000"
4664
4645
  },
4665
- children: item.revenue
4646
+ children: ["$", formatNumber(item.revenue)]
4666
4647
  }), /*#__PURE__*/jsxs(Box, {
4667
4648
  sx: {
4668
4649
  display: "flex",
@@ -4696,7 +4677,7 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4696
4677
  minWidth: "30px",
4697
4678
  textAlign: "right"
4698
4679
  },
4699
- children: [item.share, "%"]
4680
+ children: [(_item$share = item.share) === null || _item$share === void 0 ? void 0 : _item$share.toFixed(2), "%"]
4700
4681
  })]
4701
4682
  })]
4702
4683
  }, index);
@@ -5142,7 +5123,7 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
5142
5123
  });
5143
5124
  };
5144
5125
 
5145
- function formatNumber(num) {
5126
+ function formatNumber$1(num) {
5146
5127
  if (num >= 1000000000) {
5147
5128
  return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
5148
5129
  }
@@ -5187,7 +5168,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5187
5168
  dataLabels: {
5188
5169
  enabled: true,
5189
5170
  formatter: function formatter(val) {
5190
- return "$".concat(formatNumber(val));
5171
+ return "$".concat(formatNumber$1(val));
5191
5172
  },
5192
5173
  offsetY: -22,
5193
5174
  style: {
@@ -5221,7 +5202,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5221
5202
  tickAmount: 4,
5222
5203
  labels: {
5223
5204
  formatter: function formatter(val) {
5224
- return "$".concat(formatNumber(val));
5205
+ return "$".concat(formatNumber$1(val));
5225
5206
  },
5226
5207
  style: {
5227
5208
  colors: "rgba(0, 0, 0, 0.4)",
@@ -5252,7 +5233,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5252
5233
  tooltip: {
5253
5234
  y: {
5254
5235
  formatter: function formatter(val) {
5255
- return "$".concat(formatNumber(val));
5236
+ return "$".concat(formatNumber$1(val));
5256
5237
  }
5257
5238
  }
5258
5239
  }
@@ -5324,7 +5305,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5324
5305
  fontWeight: 600,
5325
5306
  color: "#000"
5326
5307
  },
5327
- 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)]
5308
+ children: ["$", formatNumber$1((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)]
5328
5309
  })]
5329
5310
  }), /*#__PURE__*/jsxs(Box, {
5330
5311
  sx: {
@@ -5352,7 +5333,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5352
5333
  fontWeight: 600,
5353
5334
  color: "#000"
5354
5335
  },
5355
- 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)]
5336
+ children: ["$", formatNumber$1((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)]
5356
5337
  })]
5357
5338
  })]
5358
5339
  })]
@@ -5673,6 +5654,7 @@ var OverallSection = function OverallSection(_ref) {
5673
5654
  setActiveMetric = _useState2[1];
5674
5655
  var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationTypeData) || [];
5675
5656
  var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [];
5657
+ var trafficSourceData = (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSource) || [];
5676
5658
  var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
5677
5659
  var getExtendedCharts = function getExtendedCharts() {
5678
5660
  var charts = _toConsumableArray(allCharts);
@@ -5713,13 +5695,13 @@ var OverallSection = function OverallSection(_ref) {
5713
5695
  };
5714
5696
  var metricInfo = {
5715
5697
  "Total Raised": {
5716
- value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5698
+ value: "$".concat(formatNumber$1(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5717
5699
  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"),
5718
5700
  label: "Total Raised",
5719
5701
  icon: PaidOutlined
5720
5702
  },
5721
5703
  "Net Raised": {
5722
- value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5704
+ value: "$".concat(formatNumber$1((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5723
5705
  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"),
5724
5706
  label: "Net Raised",
5725
5707
  icon: FavoriteOutlined
@@ -5731,13 +5713,13 @@ var OverallSection = function OverallSection(_ref) {
5731
5713
  icon: PeopleAltOutlined
5732
5714
  },
5733
5715
  "Avg donation": {
5734
- value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5716
+ value: "$".concat(formatNumber$1((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5735
5717
  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"),
5736
5718
  label: "Average Donation Amount",
5737
5719
  icon: PaidOutlined
5738
5720
  },
5739
5721
  "ROAS": {
5740
- value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5722
+ value: "".concat(formatNumber$1((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5741
5723
  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"),
5742
5724
  label: "ROAS",
5743
5725
  icon: TrendingUp
@@ -6100,11 +6082,11 @@ var OverallSection = function OverallSection(_ref) {
6100
6082
  return word[0];
6101
6083
  }).join("").toUpperCase().slice(0, 2) : "??",
6102
6084
  name: campaign.campaignName || "Untitled Campaign",
6103
- val1: "$".concat(formatNumber(campaign.raisedAmount || 0)),
6085
+ val1: "$".concat(formatNumber$1(campaign.raisedAmount || 0)),
6104
6086
  type: "progress",
6105
6087
  progress: Math.round((campaign.raisedAmount || 0) / (campaign.totalAmount || 1) * 100),
6106
- val3: formatNumber(campaign.donors || 0),
6107
- val4: "$".concat(formatNumber(campaign.avgGift || 0))
6088
+ val3: formatNumber$1(campaign.donors || 0),
6089
+ val4: "$".concat(formatNumber$1(campaign.avgGift || 0))
6108
6090
  };
6109
6091
  })
6110
6092
  })
@@ -6182,7 +6164,8 @@ var OverallSection = function OverallSection(_ref) {
6182
6164
  children: /*#__PURE__*/jsx(TrafficSourceCard, {
6183
6165
  sx: {
6184
6166
  height: 330
6185
- }
6167
+ },
6168
+ trafficSourceData: trafficSourceData
6186
6169
  })
6187
6170
  })]
6188
6171
  }), /*#__PURE__*/jsxs(Grid, {