@ammarkhalidfarooq/dashboard-package 0.3.18 → 0.3.20

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
@@ -253,7 +253,8 @@ var RevenueChart = function RevenueChart(_ref) {
253
253
  _ref$type = _ref.type,
254
254
  type = _ref$type === void 0 ? "area" : _ref$type,
255
255
  _ref$id = _ref.id,
256
- id = _ref$id === void 0 ? "revenue-chart" : _ref$id;
256
+ id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
257
+ colors = _ref.colors;
257
258
  var theme = useTheme();
258
259
  var isRadial = type === 'donut' || type === 'pie';
259
260
 
@@ -272,7 +273,7 @@ var RevenueChart = function RevenueChart(_ref) {
272
273
  enabled: false
273
274
  }
274
275
  },
275
- colors: [theme.palette.primary.main, '#4B4BC2', '#7E7EE6', '#A3A3F0', '#C8C8FA'],
276
+ colors: colors || [theme.palette.primary.main, '#4B4BC2', '#7E7EE6', '#A3A3F0', '#C8C8FA'],
276
277
  tooltip: {
277
278
  theme: 'light',
278
279
  y: {
@@ -577,7 +578,8 @@ var RenderChartCard = function RenderChartCard(_ref) {
577
578
  categories: item.categories,
578
579
  height: isPrimary ? 250 : 200,
579
580
  stacked: item.stacked,
580
- type: type || item.type || "area"
581
+ type: type || item.type || "area",
582
+ colors: item.colors
581
583
  })
582
584
  }), item.footer && /*#__PURE__*/jsxs(Box, {
583
585
  sx: {
@@ -2296,7 +2298,7 @@ var NewOverview = function NewOverview(_ref) {
2296
2298
  return item.date;
2297
2299
  }) : categories;
2298
2300
  var primaryCharts = [{
2299
- label: "Total Revenue",
2301
+ label: "Total Raised",
2300
2302
  value: totalRevData.length > 0 ? "$".concat(totalRevTotal.toLocaleString()) : typeof (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) === "string" ? apiData.totalRevenue : "$9,200.00",
2301
2303
  subValue: "Total Donations: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalDonations) || 215),
2302
2304
  data: totalRevValues,
@@ -4735,7 +4737,7 @@ function formatNumber(num) {
4735
4737
  if (num >= 1000) {
4736
4738
  return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
4737
4739
  }
4738
- return num.toString();
4740
+ return (num !== null && num !== void 0 ? num : 0).toString();
4739
4741
  }
4740
4742
 
4741
4743
  var OverallSection = function OverallSection(_ref) {
@@ -4794,7 +4796,7 @@ var OverallSection = function OverallSection(_ref) {
4794
4796
  "Total Raised": {
4795
4797
  value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
4796
4798
  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"),
4797
- label: "Total Revenue",
4799
+ label: "Total Raised",
4798
4800
  icon: PaidOutlined
4799
4801
  },
4800
4802
  "Net Raised": {
@@ -4852,8 +4854,36 @@ var OverallSection = function OverallSection(_ref) {
4852
4854
  var mainChart = extendedCharts.find(function (c) {
4853
4855
  return c.label === selectedInfo.label;
4854
4856
  }) || primaryCharts[0];
4857
+ if (activeMetric === "Total Raised" && (apiData !== null && apiData !== void 0 && apiData.paidAds || apiData !== null && apiData !== void 0 && apiData.email || apiData !== null && apiData !== void 0 && apiData.organic)) {
4858
+ var categories = ((apiData === null || apiData === void 0 ? void 0 : apiData.organic) || (apiData === null || apiData === void 0 ? void 0 : apiData.paidAds) || (apiData === null || apiData === void 0 ? void 0 : apiData.email) || []).map(function (item) {
4859
+ return item.date;
4860
+ });
4861
+ var series = [{
4862
+ name: "Paid Ads",
4863
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.paidAds) || []).map(function (item) {
4864
+ return item.value;
4865
+ })
4866
+ }, {
4867
+ name: "Organic",
4868
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.organic) || []).map(function (item) {
4869
+ return item.value;
4870
+ })
4871
+ }, {
4872
+ name: "Email",
4873
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.email) || []).map(function (item) {
4874
+ return item.value;
4875
+ })
4876
+ }];
4877
+ mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
4878
+ label: "Total revenue trend",
4879
+ series: series,
4880
+ categories: categories,
4881
+ stacked: true,
4882
+ colors: ["#6366F1", "#10B981", "#06B6D4"]
4883
+ });
4884
+ }
4855
4885
  mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
4856
- label: activeMetric,
4886
+ label: mainChart.label || activeMetric,
4857
4887
  value: selectedInfo.value,
4858
4888
  trend: selectedInfo.subValue
4859
4889
  });
@@ -4877,7 +4907,8 @@ var OverallSection = function OverallSection(_ref) {
4877
4907
  index: 0,
4878
4908
  md: 12,
4879
4909
  isPremium: true,
4880
- isPrimary: true
4910
+ isPrimary: true,
4911
+ metric: activeMetric.includes("Raised") || activeMetric.includes("donation") ? "Revenue" : "Donors"
4881
4912
  })
4882
4913
  }), /*#__PURE__*/jsxs(Grid, {
4883
4914
  container: true,