@ammarkhalidfarooq/dashboard-package 0.6.103 → 0.6.105

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
@@ -6585,7 +6585,7 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard(_ref8) {
6585
6585
  var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6586
6586
  var sx = _ref9.sx,
6587
6587
  donorGeographyData = _ref9.donorGeographyData;
6588
- var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || [];
6588
+ var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
6589
6589
  var data = rawCountries.map(function (item) {
6590
6590
  return {
6591
6591
  country: item.countryName || item.country || "Unknown",
@@ -6622,7 +6622,14 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6622
6622
  },
6623
6623
  children: "Where ad-acquired donors come from"
6624
6624
  })]
6625
- }), data.map(function (item, index) {
6625
+ }), data.length === 0 ? /*#__PURE__*/jsx(Typography, {
6626
+ sx: {
6627
+ fontSize: "13px",
6628
+ color: "rgba(0, 0, 0, 0.4)",
6629
+ py: 2
6630
+ },
6631
+ children: "No geography data for this period"
6632
+ }) : data.map(function (item, index) {
6626
6633
  return /*#__PURE__*/jsxs(Box, {
6627
6634
  sx: {
6628
6635
  display: "flex",
@@ -18504,6 +18511,12 @@ var PaidSection = function PaidSection(_ref) {
18504
18511
  };
18505
18512
  });
18506
18513
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns, hasPaidOverview]);
18514
+ var donorGeographyData = useMemo(function () {
18515
+ var geography = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
18516
+ if (!hasPaidOverview) return [];
18517
+ var rawCountries = Array.isArray(geography) ? geography : (geography === null || geography === void 0 ? void 0 : geography.countries) || (geography === null || geography === void 0 ? void 0 : geography.data) || [];
18518
+ return Array.isArray(rawCountries) ? rawCountries : [];
18519
+ }, [apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography, hasPaidOverview]);
18507
18520
  var renderCard = function renderCard(title) {
18508
18521
  return /*#__PURE__*/jsx(MetricCard$1, {
18509
18522
  title: title,
@@ -18737,7 +18750,7 @@ var PaidSection = function PaidSection(_ref) {
18737
18750
  }
18738
18751
  },
18739
18752
  children: /*#__PURE__*/jsx(PaidDonorGeographyCard, {
18740
- donorGeographyData: apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography
18753
+ donorGeographyData: donorGeographyData
18741
18754
  })
18742
18755
  })]
18743
18756
  })]