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