@ammarkhalidfarooq/dashboard-package 0.4.6 → 0.4.7

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 CHANGED
@@ -2893,7 +2893,7 @@ var PerformanceSection = function PerformanceSection(_ref) {
2893
2893
  });
2894
2894
  };
2895
2895
 
2896
- var data$1 = [{
2896
+ var data$2 = [{
2897
2897
  range: "$0 – $12",
2898
2898
  plans: 21,
2899
2899
  share: 24
@@ -2953,7 +2953,7 @@ var RecurringDonationAmounts = function RecurringDonationAmounts() {
2953
2953
  flexDirection: "column",
2954
2954
  gap: 2
2955
2955
  },
2956
- children: data$1.map(function (item, index) {
2956
+ children: data$2.map(function (item, index) {
2957
2957
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
2958
2958
  sx: {
2959
2959
  display: "flex",
@@ -3486,7 +3486,7 @@ var UTMPerformance = function UTMPerformance() {
3486
3486
  });
3487
3487
  };
3488
3488
 
3489
- var data = [{
3489
+ var data$1 = [{
3490
3490
  step: "Step 1: Amount Selection",
3491
3491
  share: 22
3492
3492
  }, {
@@ -3538,7 +3538,7 @@ var DropOffPoints = function DropOffPoints() {
3538
3538
  flexDirection: "column",
3539
3539
  gap: 2
3540
3540
  },
3541
- children: data.map(function (item, index) {
3541
+ children: data$1.map(function (item, index) {
3542
3542
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
3543
3543
  sx: {
3544
3544
  display: "flex",
@@ -4532,28 +4532,8 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4532
4532
  title = _ref$title === void 0 ? "Traffic source" : _ref$title,
4533
4533
  _ref$subtitle = _ref.subtitle,
4534
4534
  subtitle = _ref$subtitle === void 0 ? "Revenue by channel · 30 days" : _ref$subtitle,
4535
- _ref$data = _ref.data,
4536
- data = _ref$data === void 0 ? [{
4537
- label: "Paid Ads",
4538
- revenue: "$98.4K",
4539
- share: 41,
4540
- color: "rgb(99, 99, 230)"
4541
- }, {
4542
- label: "Organic",
4543
- revenue: "$62.1K",
4544
- share: 26,
4545
- color: "#10B981"
4546
- }, {
4547
- label: "Email",
4548
- revenue: "$38.6K",
4549
- share: 16,
4550
- color: "#0EA5E9"
4551
- }, {
4552
- label: "Direct",
4553
- revenue: "$15.5K",
4554
- share: 6,
4555
- color: "#94A3B8"
4556
- }] : _ref$data,
4535
+ _ref$trafficSourceDat = _ref.trafficSourceData,
4536
+ trafficSourceData = _ref$trafficSourceDat === void 0 ? [] : _ref$trafficSourceDat,
4557
4537
  _ref$total = _ref.total,
4558
4538
  total = _ref$total === void 0 ? "$240.9K" : _ref$total,
4559
4539
  sx = _ref.sx;
@@ -4627,7 +4607,8 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4627
4607
  sx: {
4628
4608
  flexGrow: 1
4629
4609
  },
4630
- children: data.map(function (item, index) {
4610
+ children: trafficSourceData.map(function (item, index) {
4611
+ var _item$share;
4631
4612
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
4632
4613
  sx: {
4633
4614
  display: "grid",
@@ -4658,13 +4639,13 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4658
4639
  },
4659
4640
  children: item.label
4660
4641
  })]
4661
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4642
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
4662
4643
  sx: {
4663
4644
  fontSize: "14px",
4664
4645
  fontWeight: 700,
4665
4646
  color: "#000"
4666
4647
  },
4667
- children: item.revenue
4648
+ children: ["$", formatNumber(item.revenue)]
4668
4649
  }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
4669
4650
  sx: {
4670
4651
  display: "flex",
@@ -4698,7 +4679,7 @@ var TrafficSourceCard = function TrafficSourceCard(_ref) {
4698
4679
  minWidth: "30px",
4699
4680
  textAlign: "right"
4700
4681
  },
4701
- children: [item.share, "%"]
4682
+ children: [(_item$share = item.share) === null || _item$share === void 0 ? void 0 : _item$share.toFixed(2), "%"]
4702
4683
  })]
4703
4684
  })]
4704
4685
  }, index);
@@ -5144,7 +5125,7 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
5144
5125
  });
5145
5126
  };
5146
5127
 
5147
- function formatNumber(num) {
5128
+ function formatNumber$1(num) {
5148
5129
  if (num >= 1000000000) {
5149
5130
  return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
5150
5131
  }
@@ -5189,7 +5170,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5189
5170
  dataLabels: {
5190
5171
  enabled: true,
5191
5172
  formatter: function formatter(val) {
5192
- return "$".concat(formatNumber(val));
5173
+ return "$".concat(formatNumber$1(val));
5193
5174
  },
5194
5175
  offsetY: -22,
5195
5176
  style: {
@@ -5223,7 +5204,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5223
5204
  tickAmount: 4,
5224
5205
  labels: {
5225
5206
  formatter: function formatter(val) {
5226
- return "$".concat(formatNumber(val));
5207
+ return "$".concat(formatNumber$1(val));
5227
5208
  },
5228
5209
  style: {
5229
5210
  colors: "rgba(0, 0, 0, 0.4)",
@@ -5254,7 +5235,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5254
5235
  tooltip: {
5255
5236
  y: {
5256
5237
  formatter: function formatter(val) {
5257
- return "$".concat(formatNumber(val));
5238
+ return "$".concat(formatNumber$1(val));
5258
5239
  }
5259
5240
  }
5260
5241
  }
@@ -5326,7 +5307,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5326
5307
  fontWeight: 600,
5327
5308
  color: "#000"
5328
5309
  },
5329
- 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)]
5310
+ 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)]
5330
5311
  })]
5331
5312
  }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
5332
5313
  sx: {
@@ -5354,7 +5335,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5354
5335
  fontWeight: 600,
5355
5336
  color: "#000"
5356
5337
  },
5357
- 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)]
5338
+ 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)]
5358
5339
  })]
5359
5340
  })]
5360
5341
  })]
@@ -5675,6 +5656,7 @@ var OverallSection = function OverallSection(_ref) {
5675
5656
  setActiveMetric = _useState2[1];
5676
5657
  var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationTypeData) || [];
5677
5658
  var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [];
5659
+ var trafficSourceData = (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSource) || [];
5678
5660
  var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
5679
5661
  var getExtendedCharts = function getExtendedCharts() {
5680
5662
  var charts = _toConsumableArray(allCharts);
@@ -5715,13 +5697,13 @@ var OverallSection = function OverallSection(_ref) {
5715
5697
  };
5716
5698
  var metricInfo = {
5717
5699
  "Total Raised": {
5718
- value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5700
+ value: "$".concat(formatNumber$1(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5719
5701
  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"),
5720
5702
  label: "Total Raised",
5721
5703
  icon: iconsMaterial.PaidOutlined
5722
5704
  },
5723
5705
  "Net Raised": {
5724
- value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5706
+ value: "$".concat(formatNumber$1((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5725
5707
  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"),
5726
5708
  label: "Net Raised",
5727
5709
  icon: iconsMaterial.FavoriteOutlined
@@ -5733,13 +5715,13 @@ var OverallSection = function OverallSection(_ref) {
5733
5715
  icon: iconsMaterial.PeopleAltOutlined
5734
5716
  },
5735
5717
  "Avg donation": {
5736
- value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5718
+ value: "$".concat(formatNumber$1((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5737
5719
  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"),
5738
5720
  label: "Average Donation Amount",
5739
5721
  icon: iconsMaterial.PaidOutlined
5740
5722
  },
5741
5723
  "ROAS": {
5742
- value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5724
+ value: "".concat(formatNumber$1((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5743
5725
  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"),
5744
5726
  label: "ROAS",
5745
5727
  icon: iconsMaterial.TrendingUp
@@ -6102,11 +6084,11 @@ var OverallSection = function OverallSection(_ref) {
6102
6084
  return word[0];
6103
6085
  }).join("").toUpperCase().slice(0, 2) : "??",
6104
6086
  name: campaign.campaignName || "Untitled Campaign",
6105
- val1: "$".concat(formatNumber(campaign.raisedAmount || 0)),
6087
+ val1: "$".concat(formatNumber$1(campaign.raisedAmount || 0)),
6106
6088
  type: "progress",
6107
6089
  progress: Math.round((campaign.raisedAmount || 0) / (campaign.totalAmount || 1) * 100),
6108
- val3: formatNumber(campaign.donors || 0),
6109
- val4: "$".concat(formatNumber(campaign.avgGift || 0))
6090
+ val3: formatNumber$1(campaign.donors || 0),
6091
+ val4: "$".concat(formatNumber$1(campaign.avgGift || 0))
6110
6092
  };
6111
6093
  })
6112
6094
  })
@@ -6184,7 +6166,8 @@ var OverallSection = function OverallSection(_ref) {
6184
6166
  children: /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
6185
6167
  sx: {
6186
6168
  height: 330
6187
- }
6169
+ },
6170
+ trafficSourceData: trafficSourceData
6188
6171
  })
6189
6172
  })]
6190
6173
  }), /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {