@ammarkhalidfarooq/dashboard-package 0.6.112 → 0.6.113

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
@@ -3872,9 +3872,9 @@ var NewOverview = function NewOverview(_ref) {
3872
3872
  activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters,
3873
3873
  setExportLoading = _ref.setExportLoading;
3874
3874
  var initialMetric = "Revenue";
3875
- var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
3876
- var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
3877
- var categories = (apiData === null || apiData === void 0 ? void 0 : apiData.categories) || ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
3875
+ var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [0];
3876
+ var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [0];
3877
+ var categories = (apiData === null || apiData === void 0 ? void 0 : apiData.categories) || [];
3878
3878
  var _useState = React.useState(initialMetric),
3879
3879
  _useState2 = _slicedToArray(_useState, 2),
3880
3880
  metric = _useState2[0];
@@ -3990,7 +3990,7 @@ var NewOverview = function NewOverview(_ref) {
3990
3990
  }) : categories;
3991
3991
  var oneTimeTotal = oneTimeData.length > 0 ? oneTimeValues.reduce(function (sum, val) {
3992
3992
  return sum + val;
3993
- }, 0) : 7100;
3993
+ }, 0) : 0;
3994
3994
  var firstInstData = (apiData === null || apiData === void 0 ? void 0 : apiData.firstInstallmentRevenue) || [];
3995
3995
  var firstInstValues = firstInstData.length > 0 ? firstInstData.map(function (item) {
3996
3996
  return item.value;
@@ -4000,7 +4000,7 @@ var NewOverview = function NewOverview(_ref) {
4000
4000
  }) : categories.slice(-7);
4001
4001
  var firstInstTotal = firstInstData.length > 0 ? firstInstValues.reduce(function (sum, val) {
4002
4002
  return sum + val;
4003
- }, 0) : 510;
4003
+ }, 0) : 0;
4004
4004
  var totalRevData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) ? apiData.totalRevenue : [];
4005
4005
  var totalRevValues = totalRevData.length > 0 ? totalRevData.map(function (item) {
4006
4006
  return item.value;
@@ -4010,67 +4010,67 @@ var NewOverview = function NewOverview(_ref) {
4010
4010
  }) : categories;
4011
4011
  var totalRevTotal = totalRevData.length > 0 ? totalRevValues.reduce(function (sum, val) {
4012
4012
  return sum + val;
4013
- }, 0) : 9200;
4013
+ }, 0) : 0;
4014
4014
  var avgDonData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.averageDonation) ? apiData.averageDonation : [];
4015
4015
  var avgDonValues = avgDonData.length > 0 ? avgDonData.map(function (item) {
4016
4016
  return item.value;
4017
- }) : currentData.map(function (v) {
4018
- return v * 0.5;
4017
+ }) : currentData.map(function () {
4018
+ return 0;
4019
4019
  });
4020
4020
  var avgDonCategories = avgDonData.length > 0 ? avgDonData.map(function (item) {
4021
4021
  return item.date;
4022
4022
  }) : categories;
4023
4023
  var avgDonOverall = avgDonData.length > 0 ? avgDonValues.reduce(function (sum, val) {
4024
4024
  return sum + val;
4025
- }, 0) / avgDonValues.length : 42.80;
4025
+ }, 0) / avgDonValues.length : 0;
4026
4026
  var tipData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.tipAmount) ? apiData.tipAmount : [];
4027
4027
  var tipValues = tipData.length > 0 ? tipData.map(function (item) {
4028
4028
  return item.value;
4029
- }) : currentData.map(function (v) {
4030
- return v * 0.2;
4029
+ }) : currentData.map(function () {
4030
+ return 0;
4031
4031
  });
4032
4032
  var tipCategories = tipData.length > 0 ? tipData.map(function (item) {
4033
4033
  return item.date;
4034
4034
  }) : categories;
4035
4035
  var tipTotal = tipData.length > 0 ? tipValues.reduce(function (sum, val) {
4036
4036
  return sum + val;
4037
- }, 0) : 1250;
4037
+ }, 0) : 0;
4038
4038
  var convRateData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.conversionRate) ? apiData.conversionRate : [];
4039
4039
  var convRateValues = convRateData.length > 0 ? convRateData.map(function (item) {
4040
4040
  return item.value;
4041
- }) : [1.5, 1.8, 1.7, 2.1, 2.0, 1.9, 2.2, 2.5, 2.0];
4041
+ }) : [0];
4042
4042
  var convRateCategories = convRateData.length > 0 ? convRateData.map(function (item) {
4043
4043
  return item.date;
4044
4044
  }) : categories;
4045
4045
  var convRateAvg = convRateData.length > 0 ? convRateValues.reduce(function (sum, val) {
4046
4046
  return sum + val;
4047
- }, 0) / convRateValues.length : 2.0;
4047
+ }, 0) / convRateValues.length : 0;
4048
4048
  var organicVisData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.organicVisits) ? apiData.organicVisits : [];
4049
4049
  var paidVisData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.paidVisits) ? apiData.paidVisits : [];
4050
4050
  var organicVisValues = organicVisData.length > 0 ? organicVisData.map(function (item) {
4051
4051
  return item.value;
4052
- }) : [500, 600, 550, 700, 800, 750, 900, 1000, 950];
4052
+ }) : [0];
4053
4053
  var paidVisValues = paidVisData.length > 0 ? paidVisData.map(function (item) {
4054
4054
  return item.value;
4055
- }) : [200, 250, 220, 300, 350, 320, 400, 450, 420];
4055
+ }) : [0];
4056
4056
  var trafficCategories = organicVisData.length > 0 ? organicVisData.map(function (item) {
4057
4057
  return item.date;
4058
4058
  }) : categories;
4059
4059
  var primaryCharts = [{
4060
4060
  label: "Total Raised",
4061
- value: totalRevData.length > 0 ? "$".concat(totalRevTotal.toLocaleString()) : typeof (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) === "string" ? apiData.totalRevenue : "$9,200.00",
4061
+ value: totalRevData.length > 0 ? "$".concat(totalRevTotal.toLocaleString()) : typeof (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) === "string" ? apiData.totalRevenue : "$0.00",
4062
4062
  subValue: "Total Donations: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalDonations) || 0),
4063
4063
  data: totalRevValues,
4064
4064
  categories: totalRevCategories,
4065
4065
  showSelector: true
4066
4066
  }, {
4067
4067
  label: "First installments",
4068
- value: apiData !== null && apiData !== void 0 && apiData.firstInstallmentRevenue ? "$".concat(firstInstTotal.toLocaleString()) : "$510.00",
4068
+ value: apiData !== null && apiData !== void 0 && apiData.firstInstallmentRevenue ? "$".concat(firstInstTotal.toLocaleString()) : "$0.00",
4069
4069
  data: firstInstValues,
4070
4070
  categories: firstInstCategories
4071
4071
  }, {
4072
4072
  label: "One-time donations",
4073
- value: apiData !== null && apiData !== void 0 && apiData.oneTimeDonations ? "$".concat(oneTimeTotal.toLocaleString()) : "$7,100.00",
4073
+ value: apiData !== null && apiData !== void 0 && apiData.oneTimeDonations ? "$".concat(oneTimeTotal.toLocaleString()) : "$0.00",
4074
4074
  data: oneTimeValues,
4075
4075
  categories: oneTimeCategories
4076
4076
  }];
@@ -4078,32 +4078,36 @@ var NewOverview = function NewOverview(_ref) {
4078
4078
  label: "New vs Returning Donors",
4079
4079
  series: [{
4080
4080
  name: "New Donors",
4081
- data: [10, 15, 12, 20, 18, 25, 30, 35, 20]
4081
+ data: categories.length > 0 ? categories.map(function () {
4082
+ return 0;
4083
+ }) : [0]
4082
4084
  }, {
4083
4085
  name: "Returning",
4084
- data: [5, 7, 6, 10, 7, 10, 12, 10, 8]
4086
+ data: categories.length > 0 ? categories.map(function () {
4087
+ return 0;
4088
+ }) : [0]
4085
4089
  }],
4086
4090
  categories: categories,
4087
4091
  stacked: true,
4088
4092
  footer: {
4089
- left: "New donors: 195",
4090
- right: "Returning donors: 20"
4093
+ left: "New donors: 0",
4094
+ right: "Returning donors: 0"
4091
4095
  }
4092
4096
  }, {
4093
4097
  label: "Average Donation Amount",
4094
- value: apiData !== null && apiData !== void 0 && apiData.averageDonation ? "$".concat(avgDonOverall.toFixed(2)) : "$42.80",
4098
+ value: apiData !== null && apiData !== void 0 && apiData.averageDonation ? "$".concat(avgDonOverall.toFixed(2)) : "$0.00",
4095
4099
  data: avgDonValues,
4096
4100
  categories: avgDonCategories
4097
4101
  }, {
4098
4102
  label: "Tip Amount",
4099
- value: apiData !== null && apiData !== void 0 && apiData.tipAmount ? "$".concat(tipTotal.toLocaleString()) : "$1,250.00",
4100
- subValue: "Number of Tips: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalTips) || 110),
4103
+ value: apiData !== null && apiData !== void 0 && apiData.tipAmount ? "$".concat(tipTotal.toLocaleString()) : "$0.00",
4104
+ subValue: "Number of Tips: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalTips) || 0),
4101
4105
  data: tipValues,
4102
4106
  categories: tipCategories
4103
4107
  }];
4104
4108
  var tertiaryCharts = [{
4105
4109
  label: "Conversion Rate",
4106
- value: apiData !== null && apiData !== void 0 && apiData.conversionRate ? "".concat(convRateAvg.toFixed(1), "%") : "2%",
4110
+ value: apiData !== null && apiData !== void 0 && apiData.conversionRate ? "".concat(convRateAvg.toFixed(1), "%") : "0%",
4107
4111
  data: convRateValues,
4108
4112
  categories: convRateCategories
4109
4113
  }, {
@@ -4119,24 +4123,32 @@ var NewOverview = function NewOverview(_ref) {
4119
4123
  stacked: true
4120
4124
  }, {
4121
4125
  label: "Organic Donations",
4122
- value: "120",
4123
- data: [8, 12, 10, 15, 14, 18, 22, 20, 12],
4126
+ value: "0",
4127
+ data: categories.length > 0 ? categories.map(function () {
4128
+ return 0;
4129
+ }) : [0],
4124
4130
  categories: categories
4125
4131
  }];
4126
4132
  var quaternaryCharts = [{
4127
4133
  label: "Email Marketing",
4128
- value: "56",
4129
- data: [45, 48, 52, 50, 56, 54, 58, 60, 56],
4134
+ value: "0",
4135
+ data: categories.length > 0 ? categories.map(function () {
4136
+ return 0;
4137
+ }) : [0],
4130
4138
  categories: categories
4131
4139
  }, {
4132
4140
  label: "Traffic source",
4133
- value: "23%",
4134
- data: [18, 22, 20, 25, 23, 21, 24, 26, 23],
4141
+ value: "0%",
4142
+ data: categories.length > 0 ? categories.map(function () {
4143
+ return 0;
4144
+ }) : [0],
4135
4145
  categories: categories
4136
4146
  }, {
4137
4147
  label: "URL",
4138
- value: "10%",
4139
- data: [8, 9, 11, 10, 10, 12, 9, 11, 10],
4148
+ value: "0%",
4149
+ data: categories.length > 0 ? categories.map(function () {
4150
+ return 0;
4151
+ }) : [0],
4140
4152
  categories: categories
4141
4153
  }];
4142
4154
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
@@ -17999,34 +18011,38 @@ var OverallSection = function OverallSection(_ref) {
17999
18011
  var getExtendedCharts = function getExtendedCharts() {
18000
18012
  var charts = _toConsumableArray(allCharts);
18001
18013
  var categories = (apiData === null || apiData === void 0 ? void 0 : apiData.categories) || [];
18014
+ var zeroData = categories.length > 0 ? categories.map(function () {
18015
+ return 0;
18016
+ }) : [0];
18002
18017
  if (!charts.find(function (c) {
18003
18018
  return c.label === "Net Raised";
18004
18019
  })) {
18020
+ var _apiData$netRaised;
18005
18021
  charts.push({
18006
18022
  label: "Net Raised",
18007
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.netRaised) || "$222.3K",
18008
- data: ((apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000]).map(function (v) {
18009
- return v * 0.92;
18010
- }),
18023
+ value: (_apiData$netRaised = apiData === null || apiData === void 0 ? void 0 : apiData.netRaised) !== null && _apiData$netRaised !== void 0 ? _apiData$netRaised : "$0",
18024
+ data: zeroData,
18011
18025
  categories: categories
18012
18026
  });
18013
18027
  }
18014
18028
  if (!charts.find(function (c) {
18015
18029
  return c.label === "Total Donors";
18016
18030
  })) {
18031
+ var _apiData$totalDonors;
18017
18032
  charts.push({
18018
18033
  label: "Total Donors",
18019
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "0",
18020
- data: (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28],
18034
+ value: (_apiData$totalDonors = apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) !== null && _apiData$totalDonors !== void 0 ? _apiData$totalDonors : "0",
18035
+ data: zeroData,
18021
18036
  categories: categories
18022
18037
  });
18023
18038
  }
18024
18039
  if (!charts.find(function (c) {
18025
18040
  return c.label === "ROAS";
18026
18041
  })) {
18042
+ var _apiData$roas;
18027
18043
  charts.push({
18028
18044
  label: "ROAS",
18029
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.roas) || "3.0x",
18045
+ value: (_apiData$roas = apiData === null || apiData === void 0 ? void 0 : apiData.roas) !== null && _apiData$roas !== void 0 ? _apiData$roas : "0.0x",
18030
18046
  data: [],
18031
18047
  categories: categories
18032
18048
  });
@@ -18636,9 +18652,9 @@ var PaidSection = function PaidSection(_ref) {
18636
18652
  if (!hasPaidOverview) {
18637
18653
  return {
18638
18654
  "Total Spent": {
18639
- value: "$".concat(formatNumber(80313)),
18640
- subValue: "12% vs pp",
18641
- data: [800, 950, 700, 1100, 900, 1200, 1300],
18655
+ value: "$".concat(formatNumber(0)),
18656
+ subValue: formatGrowth$2(0),
18657
+ data: flatSeries(0),
18642
18658
  categories: fallbackCategories,
18643
18659
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.IndeterminateCheckBoxOutlined, {}),
18644
18660
  money: true,
@@ -18646,9 +18662,9 @@ var PaidSection = function PaidSection(_ref) {
18646
18662
  warning: false
18647
18663
  },
18648
18664
  "Revinue Raised": {
18649
- value: "$".concat(formatNumber(240398)),
18650
- subValue: "12% vs pp",
18651
- data: [3200, 4100, 2800, 5600, 4200, 6100, 7500],
18665
+ value: "$".concat(formatNumber(0)),
18666
+ subValue: formatGrowth$2(0),
18667
+ data: flatSeries(0),
18652
18668
  categories: fallbackCategories,
18653
18669
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
18654
18670
  money: true,
@@ -18656,9 +18672,9 @@ var PaidSection = function PaidSection(_ref) {
18656
18672
  warning: false
18657
18673
  },
18658
18674
  ROAS: {
18659
- value: "3.0x",
18660
- subValue: "12% vs pp",
18661
- data: [2.5, 3.1, 2.8, 4.2, 3.8, 4.5, 5.2],
18675
+ value: "0.0x",
18676
+ subValue: formatGrowth$2(0),
18677
+ data: flatSeries(0),
18662
18678
  categories: fallbackCategories,
18663
18679
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
18664
18680
  money: false,
@@ -18666,9 +18682,9 @@ var PaidSection = function PaidSection(_ref) {
18666
18682
  warning: false
18667
18683
  },
18668
18684
  "Cost Per Donor": {
18669
- value: "$".concat(formatNumber(373)),
18670
- subValue: "12% vs pp",
18671
- data: [350, 380, 360, 410, 390, 370, 373],
18685
+ value: "$".concat(formatNumber(0)),
18686
+ subValue: formatGrowth$2(0),
18687
+ data: flatSeries(0),
18672
18688
  categories: fallbackCategories,
18673
18689
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PersonOutlined, {}),
18674
18690
  money: true,
@@ -18676,9 +18692,9 @@ var PaidSection = function PaidSection(_ref) {
18676
18692
  warning: false
18677
18693
  },
18678
18694
  "Conversion Rate": {
18679
- value: "3.1%",
18680
- subValue: "12% vs pp",
18681
- data: [2.8, 3.0, 2.9, 3.4, 3.2, 3.1, 3.1],
18695
+ value: "0.00%",
18696
+ subValue: formatGrowth$2(0),
18697
+ data: flatSeries(0),
18682
18698
  categories: fallbackCategories,
18683
18699
  icon: /*#__PURE__*/jsxRuntime.jsx(ConversionRateIcon, {}),
18684
18700
  money: false,
@@ -18686,9 +18702,9 @@ var PaidSection = function PaidSection(_ref) {
18686
18702
  warning: false
18687
18703
  },
18688
18704
  "Avg Donation": {
18689
- value: "$".concat(formatNumber(130.58)),
18690
- subValue: "12% vs pp",
18691
- data: [120, 135, 125, 140, 130, 128, 130.58],
18705
+ value: "$".concat(formatNumber(0)),
18706
+ subValue: formatGrowth$2(0),
18707
+ data: flatSeries(0),
18692
18708
  categories: fallbackCategories,
18693
18709
  icon: /*#__PURE__*/jsxRuntime.jsx(AverageDonationIcon, {}),
18694
18710
  money: true,
@@ -18763,7 +18779,7 @@ var PaidSection = function PaidSection(_ref) {
18763
18779
  }, [fallbackCategories, growth, hasPaidOverview, overview, revenueSeries, roasChartData, spendSeries]);
18764
18780
  var channelRows = React.useMemo(function () {
18765
18781
  var channels = apiData === null || apiData === void 0 ? void 0 : apiData.channelPerformance;
18766
- if (!hasPaidOverview) return null;
18782
+ if (!hasPaidOverview) return [];
18767
18783
  if (!Array.isArray(channels) || channels.length === 0) return [];
18768
18784
  return channels.map(function (item) {
18769
18785
  var _item$roas, _item$spend, _item$revenue, _item$cpa;
@@ -18785,7 +18801,7 @@ var PaidSection = function PaidSection(_ref) {
18785
18801
  var spendAllocation = React.useMemo(function () {
18786
18802
  var _allocation$totalSpen, _allocation$totalSpen2;
18787
18803
  var allocation = apiData === null || apiData === void 0 ? void 0 : apiData.spendAllocation;
18788
- if (!hasPaidOverview) return null;
18804
+ if (!hasPaidOverview) return [];
18789
18805
  if (!allocation || !Array.isArray(allocation.data) || allocation.data.length === 0) {
18790
18806
  return buildEmptySpendAllocation();
18791
18807
  }
@@ -18827,7 +18843,7 @@ var PaidSection = function PaidSection(_ref) {
18827
18843
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.spendAllocation, hasPaidOverview]);
18828
18844
  var topCampaignsData = React.useMemo(function () {
18829
18845
  var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns;
18830
- if (!hasPaidOverview) return null;
18846
+ if (!hasPaidOverview) return [];
18831
18847
  if (!Array.isArray(campaigns)) return [];
18832
18848
  if (campaigns.length === 0) return [];
18833
18849
  return campaigns.map(function (item) {
@@ -18861,8 +18877,11 @@ var PaidSection = function PaidSection(_ref) {
18861
18877
  },
18862
18878
  sx: metricInfo[title].error ? {
18863
18879
  border: "2px solid #ef4444",
18864
- bgcolor: "#fffafa"
18865
- } : {}
18880
+ bgcolor: "#fffafa",
18881
+ cursor: "pointer"
18882
+ } : {
18883
+ cursor: "pointer"
18884
+ }
18866
18885
  });
18867
18886
  };
18868
18887
  var selectedInfo = metricInfo[activeMetric] || metricInfo["Total Spent"];
@@ -18930,72 +18949,7 @@ var PaidSection = function PaidSection(_ref) {
18930
18949
  columns: ["Channel", "Ppend", "Revenue", "ROAS", "CPA", "Trend"],
18931
18950
  gridTemplateColumns: "2.2fr 1fr 1fr 0.8fr 0.8fr 1.2fr",
18932
18951
  height: "100%",
18933
- rows: channelRows !== null && channelRows !== void 0 ? channelRows : hasPaidOverview ? [] : [{
18934
- id: "M",
18935
- avatarBg: "#4267B2",
18936
- name: "Meta Ads",
18937
- val1: "$32,800",
18938
- val2: "$112,400",
18939
- val3: "3.4x",
18940
- val4: "$340",
18941
- type: "trend",
18942
- trendType: "up",
18943
- trendLabel: "Improving",
18944
- highlightVal3: true,
18945
- val3Color: "#22C55E"
18946
- }, {
18947
- id: "G",
18948
- avatarBg: "#4285F4",
18949
- name: "Google Ads",
18950
- val1: "$28,200",
18951
- val2: "$78,300",
18952
- val3: "2.8x",
18953
- val4: "$385",
18954
- type: "trend",
18955
- trendType: "up",
18956
- trendLabel: "Improving",
18957
- highlightVal3: true,
18958
- val3Color: "#22C55E"
18959
- }, {
18960
- id: "T",
18961
- avatarBg: "#000000",
18962
- name: "TikTok Ads",
18963
- val1: "$11,400",
18964
- val2: "$31,200",
18965
- val3: "2.7x",
18966
- val4: "$402",
18967
- type: "trend",
18968
- trendType: "up",
18969
- trendLabel: "Improving",
18970
- highlightVal3: true,
18971
- val3Color: "#22C55E"
18972
- }, {
18973
- id: "Y",
18974
- avatarBg: "#FF0000",
18975
- name: "YouTube",
18976
- val1: "$5,313",
18977
- val2: "$12,600",
18978
- val3: "2.4x",
18979
- val4: "$443",
18980
- type: "trend",
18981
- trendType: "down",
18982
- trendLabel: "Declining",
18983
- highlightVal3: true,
18984
- val3Color: "#EF4444"
18985
- }, {
18986
- id: "S",
18987
- avatarBg: "#FFFC00",
18988
- name: "Snapchat",
18989
- val1: "$2,600",
18990
- val2: "$6,438",
18991
- val3: "2.5x",
18992
- val4: "$418",
18993
- type: "trend",
18994
- trendType: "up",
18995
- trendLabel: "Improving",
18996
- highlightVal3: true,
18997
- val3Color: "#22C55E"
18998
- }]
18952
+ rows: channelRows !== null && channelRows !== void 0 ? channelRows : []
18999
18953
  })
19000
18954
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
19001
18955
  item: true,
@@ -19015,33 +18969,13 @@ var PaidSection = function PaidSection(_ref) {
19015
18969
  },
19016
18970
  children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
19017
18971
  title: "Spend Allocation",
19018
- subtitle: (_spendAllocation$subt = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.subtitle) !== null && _spendAllocation$subt !== void 0 ? _spendAllocation$subt : hasPaidOverview ? emptySpendAllocation.subtitle : "Where $80.3K went this month",
19019
- series: (_spendAllocation$seri = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.series) !== null && _spendAllocation$seri !== void 0 ? _spendAllocation$seri : hasPaidOverview ? emptySpendAllocation.series : [40.8, 35.1, 14.2, 6.6, 3.3],
19020
- labels: (_spendAllocation$labe = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.labels) !== null && _spendAllocation$labe !== void 0 ? _spendAllocation$labe : hasPaidOverview ? emptySpendAllocation.labels : ["Meta Ads", "Google Ads", "TikTok", "YouTube", "Snapchat"],
19021
- colors: (_spendAllocation$colo = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.colors) !== null && _spendAllocation$colo !== void 0 ? _spendAllocation$colo : hasPaidOverview ? emptySpendAllocation.colors : ["#4267B2", "#4285F4", "#cd249dff", "#FF0000", "#FFFC00"],
18972
+ subtitle: (_spendAllocation$subt = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.subtitle) !== null && _spendAllocation$subt !== void 0 ? _spendAllocation$subt : emptySpendAllocation.subtitle,
18973
+ series: (_spendAllocation$seri = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.series) !== null && _spendAllocation$seri !== void 0 ? _spendAllocation$seri : emptySpendAllocation.series,
18974
+ labels: (_spendAllocation$labe = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.labels) !== null && _spendAllocation$labe !== void 0 ? _spendAllocation$labe : emptySpendAllocation.labels,
18975
+ colors: (_spendAllocation$colo = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.colors) !== null && _spendAllocation$colo !== void 0 ? _spendAllocation$colo : emptySpendAllocation.colors,
19022
18976
  centerLabel: (_spendAllocation$cent = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerLabel) !== null && _spendAllocation$cent !== void 0 ? _spendAllocation$cent : "total spend",
19023
- centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : hasPaidOverview ? emptySpendAllocation.centerValue : "$80.3K",
19024
- items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : hasPaidOverview ? emptySpendAllocation.items : [{
19025
- label: "Meta Ads",
19026
- val: "40.8%",
19027
- color: "#4267B2"
19028
- }, {
19029
- label: "Google Ads",
19030
- val: "35.1%",
19031
- color: "#4285F4"
19032
- }, {
19033
- label: "TikTok",
19034
- val: "14.2%",
19035
- color: "#cd249dff"
19036
- }, {
19037
- label: "YouTube",
19038
- val: "6.6%",
19039
- color: "#FF0000"
19040
- }, {
19041
- label: "Snapchat",
19042
- val: "3.3%",
19043
- color: "#FFFC00"
19044
- }],
18977
+ centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : emptySpendAllocation.centerValue,
18978
+ items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : emptySpendAllocation.items,
19045
18979
  showBottomSummary: false,
19046
18980
  sx: {
19047
18981
  pb: 3.5,
@@ -19069,7 +19003,7 @@ var PaidSection = function PaidSection(_ref) {
19069
19003
  width: "100%"
19070
19004
  },
19071
19005
  children: /*#__PURE__*/jsxRuntime.jsx(TopPerformingCampaignsCard, {
19072
- data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
19006
+ data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : []
19073
19007
  })
19074
19008
  })
19075
19009
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
@@ -19144,6 +19078,12 @@ var OrganicSection = function OrganicSection(_ref) {
19144
19078
  var revenueSeries = mapTimeSeries$1(apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue);
19145
19079
  var avgDonationSeries = mapTimeSeries$1(apiData === null || apiData === void 0 ? void 0 : apiData.avgDonations);
19146
19080
  var fallbackCategories = organicUsersSeries.categories.length ? organicUsersSeries.categories : ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
19081
+ var flatZeroData = function flatZeroData() {
19082
+ var categories = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fallbackCategories;
19083
+ return categories.length > 0 ? categories.map(function () {
19084
+ return 0;
19085
+ }) : [0];
19086
+ };
19147
19087
  var growthCaption = function growthCaption(key) {
19148
19088
  return formatGrowth$1(growth[key]);
19149
19089
  };
@@ -19152,9 +19092,9 @@ var OrganicSection = function OrganicSection(_ref) {
19152
19092
  if (!hasOrganicOverview) {
19153
19093
  return {
19154
19094
  "Organic Users": {
19155
- value: "".concat(formatNumber(8420)),
19156
- subValue: "18% vs pp",
19157
- data: [3200, 4100, 2800, 5600, 4200, 6100, 7500],
19095
+ value: formatNumber(0),
19096
+ subValue: formatGrowth$1(0),
19097
+ data: flatZeroData(),
19158
19098
  categories: fallbackCategories,
19159
19099
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PeopleAltOutlined, {}),
19160
19100
  money: false,
@@ -19162,9 +19102,9 @@ var OrganicSection = function OrganicSection(_ref) {
19162
19102
  error: false
19163
19103
  },
19164
19104
  "Search Clicks": {
19165
- value: "".concat(formatNumber(5842)),
19166
- subValue: "92.3% pass-through",
19167
- data: [1500, 1800, 1600, 2200, 2000, 2400, 2800],
19105
+ value: formatNumber(0),
19106
+ subValue: formatGrowth$1(0),
19107
+ data: flatZeroData(),
19168
19108
  categories: fallbackCategories,
19169
19109
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.SearchOutlined, {}),
19170
19110
  money: false,
@@ -19172,9 +19112,9 @@ var OrganicSection = function OrganicSection(_ref) {
19172
19112
  error: false
19173
19113
  },
19174
19114
  Donations: {
19175
- value: "".concat(formatNumber(420)),
19176
- subValue: "18% vs pp",
19177
- data: [15, 22, 18, 30, 25, 35, 42],
19115
+ value: formatNumber(0),
19116
+ subValue: formatGrowth$1(0),
19117
+ data: flatZeroData(),
19178
19118
  categories: fallbackCategories,
19179
19119
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.FavoriteOutlined, {}),
19180
19120
  money: false,
@@ -19182,9 +19122,9 @@ var OrganicSection = function OrganicSection(_ref) {
19182
19122
  error: false
19183
19123
  },
19184
19124
  "Conversion Rate": {
19185
- value: "3.1%",
19186
- subValue: "8.4% vs pp",
19187
- data: [2.5, 2.7, 2.6, 3.1, 3.0, 2.9, 3.1],
19125
+ value: "0.00%",
19126
+ subValue: formatGrowth$1(0),
19127
+ data: flatZeroData(),
19188
19128
  categories: fallbackCategories,
19189
19129
  icon: /*#__PURE__*/jsxRuntime.jsx(ConversionRateIcon, {}),
19190
19130
  money: false,
@@ -19192,9 +19132,9 @@ var OrganicSection = function OrganicSection(_ref) {
19192
19132
  error: false
19193
19133
  },
19194
19134
  "Revenue Raised": {
19195
- value: "$".concat(formatNumber(240398)),
19196
- subValue: "0.4x vs pp",
19197
- data: [2.5, 3.1, 2.8, 4.2, 3.8, 4.5, 5.2],
19135
+ value: "$".concat(formatNumber(0)),
19136
+ subValue: formatGrowth$1(0),
19137
+ data: flatZeroData(),
19198
19138
  categories: fallbackCategories,
19199
19139
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
19200
19140
  money: true,
@@ -19202,9 +19142,9 @@ var OrganicSection = function OrganicSection(_ref) {
19202
19142
  error: false
19203
19143
  },
19204
19144
  "Avg Donation": {
19205
- value: "$".concat(formatNumber(130.58)),
19206
- subValue: "18% vs pp",
19207
- data: [110, 125, 120, 135, 130, 128, 130.58],
19145
+ value: "$".concat(formatNumber(0)),
19146
+ subValue: formatGrowth$1(0),
19147
+ data: flatZeroData(),
19208
19148
  categories: fallbackCategories,
19209
19149
  icon: /*#__PURE__*/jsxRuntime.jsx(AverageDonationIcon, {}),
19210
19150
  money: true,
@@ -19288,7 +19228,7 @@ var OrganicSection = function OrganicSection(_ref) {
19288
19228
  }, [apiData === null || apiData === void 0 || (_apiData$topOrganicKe2 = apiData.topOrganicKeywords) === null || _apiData$topOrganicKe2 === void 0 ? void 0 : _apiData$topOrganicKe2.available, conversionSeries, donationsSeries, fallbackCategories, growth, hasOrganicOverview, organicUsersSeries, overview, dateName]);
19289
19229
  var landingPagesData = React.useMemo(function () {
19290
19230
  var pages = apiData === null || apiData === void 0 ? void 0 : apiData.topLandingPages;
19291
- if (!hasOrganicOverview) return null;
19231
+ if (!hasOrganicOverview) return [];
19292
19232
  if (!Array.isArray(pages) || pages.length === 0) return [];
19293
19233
  return pages.map(function (item) {
19294
19234
  var _item$visitors, _item$donations, _item$revenue, _item$conversionRate;
@@ -19303,7 +19243,7 @@ var OrganicSection = function OrganicSection(_ref) {
19303
19243
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topLandingPages, hasOrganicOverview]);
19304
19244
  var keywordsData = React.useMemo(function () {
19305
19245
  var keywords = apiData === null || apiData === void 0 ? void 0 : apiData.topOrganicKeywords;
19306
- if (!hasOrganicOverview) return null;
19246
+ if (!hasOrganicOverview) return [];
19307
19247
  if (!(keywords !== null && keywords !== void 0 && keywords.available) || !Array.isArray(keywords.data) || keywords.data.length === 0) {
19308
19248
  return [];
19309
19249
  }
@@ -19321,7 +19261,7 @@ var OrganicSection = function OrganicSection(_ref) {
19321
19261
  var geographyData = React.useMemo(function () {
19322
19262
  var _apiData$geographyIns;
19323
19263
  var countries = apiData === null || apiData === void 0 || (_apiData$geographyIns = apiData.geographyInsights) === null || _apiData$geographyIns === void 0 ? void 0 : _apiData$geographyIns.countries;
19324
- if (!hasOrganicOverview) return null;
19264
+ if (!hasOrganicOverview) return [];
19325
19265
  if (!Array.isArray(countries) || countries.length === 0) return [];
19326
19266
  return countries.map(function (item) {
19327
19267
  var _item$visitors2, _item$percentage, _item$percentage2;
@@ -19336,7 +19276,7 @@ var OrganicSection = function OrganicSection(_ref) {
19336
19276
  var _breakdown$totalVisit;
19337
19277
  var breakdown = apiData === null || apiData === void 0 ? void 0 : apiData.sourceBreakdown;
19338
19278
  var sources = breakdown === null || breakdown === void 0 ? void 0 : breakdown.data;
19339
- if (!hasOrganicOverview) return null;
19279
+ if (!hasOrganicOverview) return [];
19340
19280
  if (!Array.isArray(sources) || sources.length === 0) return null;
19341
19281
  var colors = sources.map(function (_, index) {
19342
19282
  return SOURCE_COLORS[index % SOURCE_COLORS.length];
@@ -19451,28 +19391,12 @@ var OrganicSection = function OrganicSection(_ref) {
19451
19391
  children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
19452
19392
  title: "Source Breakdown",
19453
19393
  subtitle: "Where organic visitors come from",
19454
- series: (_sourceBreakdown$seri = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.series) !== null && _sourceBreakdown$seri !== void 0 ? _sourceBreakdown$seri : [40.8, 35.1, 14.2, 3.3],
19455
- labels: (_sourceBreakdown$labe = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.labels) !== null && _sourceBreakdown$labe !== void 0 ? _sourceBreakdown$labe : ["Meta Ads", "Google Ads", "TikTok", "Snapchat"],
19456
- colors: (_sourceBreakdown$colo = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.colors) !== null && _sourceBreakdown$colo !== void 0 ? _sourceBreakdown$colo : ["#4267B2", "#4285F4", "#06510bff", "#f2b61dff"],
19457
- centerLabel: (_sourceBreakdown$cent = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.centerLabel) !== null && _sourceBreakdown$cent !== void 0 ? _sourceBreakdown$cent : "total spend",
19458
- centerValue: (_sourceBreakdown$cent2 = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.centerValue) !== null && _sourceBreakdown$cent2 !== void 0 ? _sourceBreakdown$cent2 : "$8.3K",
19459
- items: (_sourceBreakdown$item = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.items) !== null && _sourceBreakdown$item !== void 0 ? _sourceBreakdown$item : [{
19460
- label: "Google Search",
19461
- val: "40.8%",
19462
- color: "#4267B2"
19463
- }, {
19464
- label: "Direct",
19465
- val: "35.1%",
19466
- color: "#4285F4"
19467
- }, {
19468
- label: "Bing / Other",
19469
- val: "14.2%",
19470
- color: "#06510bff"
19471
- }, {
19472
- label: "Referalls",
19473
- val: "3.3%",
19474
- color: "#f2b61dff"
19475
- }],
19394
+ series: (_sourceBreakdown$seri = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.series) !== null && _sourceBreakdown$seri !== void 0 ? _sourceBreakdown$seri : [0],
19395
+ labels: (_sourceBreakdown$labe = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.labels) !== null && _sourceBreakdown$labe !== void 0 ? _sourceBreakdown$labe : [""],
19396
+ colors: (_sourceBreakdown$colo = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.colors) !== null && _sourceBreakdown$colo !== void 0 ? _sourceBreakdown$colo : ["#E5E7EB"],
19397
+ centerLabel: (_sourceBreakdown$cent = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.centerLabel) !== null && _sourceBreakdown$cent !== void 0 ? _sourceBreakdown$cent : "visitors",
19398
+ centerValue: (_sourceBreakdown$cent2 = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.centerValue) !== null && _sourceBreakdown$cent2 !== void 0 ? _sourceBreakdown$cent2 : "0",
19399
+ items: (_sourceBreakdown$item = sourceBreakdown === null || sourceBreakdown === void 0 ? void 0 : sourceBreakdown.items) !== null && _sourceBreakdown$item !== void 0 ? _sourceBreakdown$item : [],
19476
19400
  showBottomSummary: false,
19477
19401
  sx: {
19478
19402
  pb: 2
@@ -19488,7 +19412,7 @@ var OrganicSection = function OrganicSection(_ref) {
19488
19412
  },
19489
19413
  children: /*#__PURE__*/jsxRuntime.jsx(KeywordsCard, {
19490
19414
  data: keywordsData,
19491
- available: hasOrganicOverview ? (apiData === null || apiData === void 0 || (_apiData$topOrganicKe3 = apiData.topOrganicKeywords) === null || _apiData$topOrganicKe3 === void 0 ? void 0 : _apiData$topOrganicKe3.available) !== false : true,
19415
+ available: hasOrganicOverview ? (apiData === null || apiData === void 0 || (_apiData$topOrganicKe3 = apiData.topOrganicKeywords) === null || _apiData$topOrganicKe3 === void 0 ? void 0 : _apiData$topOrganicKe3.available) !== false : false,
19492
19416
  numberOfDays: numberOfDays
19493
19417
  })
19494
19418
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
@@ -20007,80 +19931,80 @@ var EmailSection = function EmailSection(_ref) {
20007
19931
  if (!hasEmailOverview) {
20008
19932
  return {
20009
19933
  "Total Raised": {
20010
- value: "$".concat(formatNumber(48920)),
20011
- subValue: "12% vs pp",
19934
+ value: "$".concat(formatNumber(0)),
19935
+ subValue: formatGrowth(0),
20012
19936
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
20013
19937
  money: true,
20014
19938
  error: false,
20015
19939
  warning: false
20016
19940
  },
20017
19941
  Donations: {
20018
- value: "62",
20019
- subValue: "12% vs pp",
19942
+ value: formatNumber(0),
19943
+ subValue: formatGrowth(0),
20020
19944
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.FavoriteOutlined, {}),
20021
19945
  money: false,
20022
19946
  error: false,
20023
19947
  warning: false
20024
19948
  },
20025
19949
  "Conversion Rate": {
20026
- value: "3.2%",
20027
- subValue: "12% vs pp",
19950
+ value: "0.00%",
19951
+ subValue: formatGrowth(0),
20028
19952
  icon: /*#__PURE__*/jsxRuntime.jsx(ConversionRateIcon, {}),
20029
19953
  money: false,
20030
19954
  error: false,
20031
19955
  warning: false
20032
19956
  },
20033
19957
  CTR: {
20034
- value: "8.1%",
20035
- subValue: "12% vs pp",
19958
+ value: "0.00%",
19959
+ subValue: formatGrowth(0),
20036
19960
  icon: /*#__PURE__*/jsxRuntime.jsx(CtrIcon, {}),
20037
19961
  money: false,
20038
19962
  error: false,
20039
19963
  warning: false
20040
19964
  },
20041
19965
  "Revenue Per Email": {
20042
- value: "$".concat(formatNumber(2.45)),
20043
- subValue: "12% vs pp",
19966
+ value: "$".concat(formatNumber(0)),
19967
+ subValue: formatGrowth(0),
20044
19968
  icon: /*#__PURE__*/jsxRuntime.jsx(RevenuePerEmailIcon, {}),
20045
19969
  money: true,
20046
19970
  error: false,
20047
19971
  warning: false
20048
19972
  },
20049
19973
  "Open Rate": {
20050
- value: "42.3%",
20051
- subValue: "12% vs pp",
19974
+ value: "0.00%",
19975
+ subValue: formatGrowth(0),
20052
19976
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Email, {}),
20053
19977
  money: false,
20054
19978
  error: false,
20055
19979
  warning: false
20056
19980
  },
20057
19981
  Clicks: {
20058
- value: "1,612",
20059
- subValue: "12% vs pp",
19982
+ value: formatNumber(0),
19983
+ subValue: formatGrowth(0),
20060
19984
  icon: /*#__PURE__*/jsxRuntime.jsx(ClicksIcon, {}),
20061
19985
  money: false,
20062
19986
  error: false,
20063
19987
  warning: false
20064
19988
  },
20065
19989
  "Unique Clicks": {
20066
- value: formatNumber(1148),
20067
- subValue: "12% vs pp",
19990
+ value: formatNumber(0),
19991
+ subValue: formatGrowth(0),
20068
19992
  icon: /*#__PURE__*/jsxRuntime.jsx(UniqueClicksIcon, {}),
20069
19993
  money: false,
20070
19994
  error: false,
20071
19995
  warning: false
20072
19996
  },
20073
19997
  "Bounce Rate": {
20074
- value: "1.8%",
20075
- subValue: "12% vs pp",
19998
+ value: "0.00%",
19999
+ subValue: formatGrowth(0),
20076
20000
  icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.HighlightOff, {}),
20077
20001
  money: false,
20078
20002
  error: false,
20079
20003
  warning: false
20080
20004
  },
20081
20005
  "Revenue Per Click": {
20082
- value: "$".concat(formatNumber(30.35)),
20083
- subValue: "12% vs pp",
20006
+ value: "$".concat(formatNumber(0)),
20007
+ subValue: formatGrowth(0),
20084
20008
  icon: /*#__PURE__*/jsxRuntime.jsx(RevenuePerClickIcon, {}),
20085
20009
  money: true,
20086
20010
  error: false,
@@ -20173,7 +20097,7 @@ var EmailSection = function EmailSection(_ref) {
20173
20097
  }, [deliverability, deliverabilityGrowth, hasEmailOverview, overview, overviewGrowth, dateName]);
20174
20098
  var campaignsRaisedData = React.useMemo(function () {
20175
20099
  var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByRaised;
20176
- if (!hasEmailOverview) return null;
20100
+ if (!hasEmailOverview) return [];
20177
20101
  if (!Array.isArray(campaigns) || campaigns.length === 0) return [];
20178
20102
  return campaigns.map(function (item) {
20179
20103
  var _item$value2;
@@ -20186,7 +20110,7 @@ var EmailSection = function EmailSection(_ref) {
20186
20110
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByRaised, hasEmailOverview]);
20187
20111
  var campaignsCtrData = React.useMemo(function () {
20188
20112
  var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByCtr;
20189
- if (!hasEmailOverview) return null;
20113
+ if (!hasEmailOverview) return [];
20190
20114
  if (!Array.isArray(campaigns) || campaigns.length === 0) return [];
20191
20115
  return campaigns.map(function (item) {
20192
20116
  var _item$value3;
@@ -20199,7 +20123,7 @@ var EmailSection = function EmailSection(_ref) {
20199
20123
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByCtr, hasEmailOverview]);
20200
20124
  var campaignsConversionData = React.useMemo(function () {
20201
20125
  var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByConversion;
20202
- if (!hasEmailOverview) return null;
20126
+ if (!hasEmailOverview) return [];
20203
20127
  if (!Array.isArray(campaigns) || campaigns.length === 0) return [];
20204
20128
  return campaigns.map(function (item) {
20205
20129
  var _item$value4;
@@ -20260,14 +20184,14 @@ var EmailSection = function EmailSection(_ref) {
20260
20184
  children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
20261
20185
  title: "Open Rate Trend",
20262
20186
  subtitle: "Daily - ".concat(daysLabel),
20263
- value: hasEmailOverview ? "".concat(Number((_deliverability$openR2 = deliverability.openRate) !== null && _deliverability$openR2 !== void 0 ? _deliverability$openR2 : 0).toFixed(2), "%") : "42.3%",
20264
- trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.openRate, true) : "2.1pp",
20187
+ value: hasEmailOverview ? "".concat(Number((_deliverability$openR2 = deliverability.openRate) !== null && _deliverability$openR2 !== void 0 ? _deliverability$openR2 : 0).toFixed(2), "%") : "0.00%",
20188
+ trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.openRate, true) : formatTrendBadge(0, true),
20265
20189
  trendData: hasEmailOverview ? apiData === null || apiData === void 0 ? void 0 : apiData.openRateTrend : undefined,
20266
20190
  series: [{
20267
20191
  name: "Open Rate",
20268
- data: [38, 42, 41, 43, 42.3]
20192
+ data: hasEmailOverview && openRateTrend.data.length > 0 ? openRateTrend.data : [0]
20269
20193
  }],
20270
- categories: ["Apr 5", "Apr 12", "Apr 19", "Apr 26", "May 4"],
20194
+ categories: hasEmailOverview && openRateTrend.categories.length > 0 ? openRateTrend.categories : [""],
20271
20195
  colors: ["rgb(99, 99, 230)"],
20272
20196
  yAxisMax: computeYAxisMax(openRateTrend.data, 5),
20273
20197
  yAxisTickAmount: 3
@@ -20290,8 +20214,8 @@ var EmailSection = function EmailSection(_ref) {
20290
20214
  children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
20291
20215
  title: "Clicks Trend",
20292
20216
  subtitle: "Total + unique - ".concat(daysLabel),
20293
- value: hasEmailOverview ? formatNumber((_deliverability$total2 = deliverability.totalClicks) !== null && _deliverability$total2 !== void 0 ? _deliverability$total2 : 0) : "1,612",
20294
- trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.totalClicks) : "14%",
20217
+ value: hasEmailOverview ? formatNumber((_deliverability$total2 = deliverability.totalClicks) !== null && _deliverability$total2 !== void 0 ? _deliverability$total2 : 0) : formatNumber(0),
20218
+ trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.totalClicks) : formatTrendBadge(0),
20295
20219
  trendSeries: hasEmailOverview ? [{
20296
20220
  name: "Total Clicks",
20297
20221
  data: apiData === null || apiData === void 0 ? void 0 : apiData.totalClicksTrend
@@ -20302,13 +20226,13 @@ var EmailSection = function EmailSection(_ref) {
20302
20226
  }] : undefined,
20303
20227
  series: [{
20304
20228
  name: "Total Clicks",
20305
- data: [56, 112, 80, 150, 112]
20229
+ data: hasEmailOverview && totalClicksTrend.data.length > 0 ? totalClicksTrend.data : [0]
20306
20230
  }, {
20307
20231
  name: "Unique Clicks",
20308
- data: [30, 70, 45, 100, 75],
20232
+ data: hasEmailOverview && uniqueClicksTrend.data.length > 0 ? uniqueClicksTrend.data : [0],
20309
20233
  dashed: true
20310
20234
  }],
20311
- categories: ["Apr 5", "Apr 12", "Apr 19", "Apr 26", "May 4"],
20235
+ categories: hasEmailOverview && totalClicksTrend.categories.length > 0 ? totalClicksTrend.categories : [""],
20312
20236
  colors: ["#10B981", "#10B981"],
20313
20237
  yAxisMax: computeYAxisMax([].concat(_toConsumableArray(totalClicksTrend.data), _toConsumableArray(uniqueClicksTrend.data)), 10),
20314
20238
  yAxisTickAmount: 3,
@@ -20334,14 +20258,14 @@ var EmailSection = function EmailSection(_ref) {
20334
20258
  children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
20335
20259
  title: "Bounce Rate Trend",
20336
20260
  subtitle: "Daily - lower is better",
20337
- value: hasEmailOverview ? "".concat(Number((_deliverability$bounc2 = deliverability.bounceRate) !== null && _deliverability$bounc2 !== void 0 ? _deliverability$bounc2 : 0).toFixed(2), "%") : "1.8%",
20338
- trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.bounceRate, true) : "0.3pp",
20261
+ value: hasEmailOverview ? "".concat(Number((_deliverability$bounc2 = deliverability.bounceRate) !== null && _deliverability$bounc2 !== void 0 ? _deliverability$bounc2 : 0).toFixed(2), "%") : "0.00%",
20262
+ trend: hasEmailOverview ? formatTrendBadge(deliverabilityGrowth.bounceRate, true) : formatTrendBadge(0, true),
20339
20263
  trendData: hasEmailOverview ? apiData === null || apiData === void 0 ? void 0 : apiData.bounceRateTrend : undefined,
20340
20264
  series: [{
20341
20265
  name: "Bounce Rate",
20342
- data: [2.2, 1.9, 2.0, 1.7, 1.8]
20266
+ data: hasEmailOverview && bounceRateTrend.data.length > 0 ? bounceRateTrend.data : [0]
20343
20267
  }],
20344
- categories: ["Apr 5", "Apr 12", "Apr 19", "Apr 26", "May 4"],
20268
+ categories: hasEmailOverview && bounceRateTrend.categories.length > 0 ? bounceRateTrend.categories : [""],
20345
20269
  colors: ["#f2994a"],
20346
20270
  yAxisMax: computeYAxisMax(bounceRateTrend.data, 2.5),
20347
20271
  yAxisTickAmount: 3