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