@ammarkhalidfarooq/dashboard-package 0.6.100 → 0.6.102
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 +122 -63
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +122 -63
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6427,7 +6427,7 @@ var TopCampaignsConvRateCard = function TopCampaignsConvRateCard(_ref7) {
|
|
|
6427
6427
|
})]
|
|
6428
6428
|
});
|
|
6429
6429
|
};
|
|
6430
|
-
var getCampaignInitials$
|
|
6430
|
+
var getCampaignInitials$2 = function getCampaignInitials() {
|
|
6431
6431
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
6432
6432
|
var words = name.trim().split(/\s+/).filter(Boolean);
|
|
6433
6433
|
if (words.length >= 2) {
|
|
@@ -6540,7 +6540,7 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard(_ref8) {
|
|
|
6540
6540
|
fontSize: "10px",
|
|
6541
6541
|
fontWeight: 700
|
|
6542
6542
|
},
|
|
6543
|
-
children: item.id || getCampaignInitials$
|
|
6543
|
+
children: item.id || getCampaignInitials$2(item.name)
|
|
6544
6544
|
}), /*#__PURE__*/jsx(Typography, {
|
|
6545
6545
|
sx: {
|
|
6546
6546
|
fontSize: "13px",
|
|
@@ -17635,7 +17635,7 @@ var EmailSectionSkeleton = function EmailSectionSkeleton() {
|
|
|
17635
17635
|
};
|
|
17636
17636
|
|
|
17637
17637
|
var OverallSection = function OverallSection(_ref) {
|
|
17638
|
-
var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13, _apiData$
|
|
17638
|
+
var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13, _apiData$overviewStat14, _apiData$overviewStat15, _apiData$overviewStat16, _apiData$overviewStat17, _apiData$overviewStat18, _apiData$overviewStat19, _apiData$overviewStat20, _apiData$overviewStat21, _apiData$overviewStat22, _apiData$overviewStat23, _apiData$overviewStat24, _apiData$overviewStat25;
|
|
17639
17639
|
var _ref$apiData = _ref.apiData,
|
|
17640
17640
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
17641
17641
|
primaryCharts = _ref.primaryCharts,
|
|
@@ -17738,8 +17738,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17738
17738
|
warning: false
|
|
17739
17739
|
},
|
|
17740
17740
|
"ROAS": {
|
|
17741
|
-
value: "".concat(formatNumber(((_apiData$
|
|
17742
|
-
subValue: "".concat(Number((_apiData$
|
|
17741
|
+
value: "".concat(formatNumber(((_apiData$overviewStat14 = apiData === null || apiData === void 0 || (_apiData$overviewStat15 = apiData.overviewStats) === null || _apiData$overviewStat15 === void 0 || (_apiData$overviewStat15 = _apiData$overviewStat15.overview) === null || _apiData$overviewStat15 === void 0 ? void 0 : _apiData$overviewStat15.roas) !== null && _apiData$overviewStat14 !== void 0 ? _apiData$overviewStat14 : 0).toFixed(2)), "x"),
|
|
17742
|
+
subValue: "".concat(Number((_apiData$overviewStat16 = apiData === null || apiData === void 0 || (_apiData$overviewStat17 = apiData.overviewStats) === null || _apiData$overviewStat17 === void 0 || (_apiData$overviewStat17 = _apiData$overviewStat17.overview) === null || _apiData$overviewStat17 === void 0 || (_apiData$overviewStat17 = _apiData$overviewStat17.growthPercentage) === null || _apiData$overviewStat17 === void 0 ? void 0 : _apiData$overviewStat17.roas) !== null && _apiData$overviewStat16 !== void 0 ? _apiData$overviewStat16 : 0).toFixed(2), "x vs pp"),
|
|
17743
17743
|
label: "ROAS",
|
|
17744
17744
|
icon: /*#__PURE__*/jsx(TrendingUp, {}),
|
|
17745
17745
|
money: false,
|
|
@@ -17747,8 +17747,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17747
17747
|
warning: false
|
|
17748
17748
|
},
|
|
17749
17749
|
"Conversion": {
|
|
17750
|
-
value: "".concat(formatNumber(((_apiData$
|
|
17751
|
-
subValue: "".concat(((_apiData$
|
|
17750
|
+
value: "".concat(formatNumber(((_apiData$overviewStat18 = apiData === null || apiData === void 0 || (_apiData$overviewStat19 = apiData.overviewStats) === null || _apiData$overviewStat19 === void 0 || (_apiData$overviewStat19 = _apiData$overviewStat19.overview) === null || _apiData$overviewStat19 === void 0 ? void 0 : _apiData$overviewStat19.conversionRate) !== null && _apiData$overviewStat18 !== void 0 ? _apiData$overviewStat18 : 0).toFixed(2)), "%"),
|
|
17751
|
+
subValue: "".concat(((_apiData$overviewStat20 = apiData === null || apiData === void 0 || (_apiData$overviewStat21 = apiData.overviewStats) === null || _apiData$overviewStat21 === void 0 || (_apiData$overviewStat21 = _apiData$overviewStat21.overview) === null || _apiData$overviewStat21 === void 0 || (_apiData$overviewStat21 = _apiData$overviewStat21.growthPercentage) === null || _apiData$overviewStat21 === void 0 ? void 0 : _apiData$overviewStat21.conversionRate) !== null && _apiData$overviewStat20 !== void 0 ? _apiData$overviewStat20 : 0).toFixed(2), "%") || "0%",
|
|
17752
17752
|
label: "Conversion Rate",
|
|
17753
17753
|
icon: /*#__PURE__*/jsx(ConversionRateIcon, {}),
|
|
17754
17754
|
money: false,
|
|
@@ -17782,8 +17782,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17782
17782
|
newDonorsPerc = totalDonorsMix > 0 ? Math.round(newDonorsCount / totalDonorsMix * 100) : 0;
|
|
17783
17783
|
returningDonorsPerc = totalDonorsMix > 0 ? Math.round(returningDonorsCount / totalDonorsMix * 100) : 0;
|
|
17784
17784
|
}
|
|
17785
|
-
var avgGift = Number(((_apiData$
|
|
17786
|
-
var donorMixPrev = Number(((_apiData$
|
|
17785
|
+
var avgGift = Number(((_apiData$overviewStat22 = apiData === null || apiData === void 0 || (_apiData$overviewStat23 = apiData.overviewStats) === null || _apiData$overviewStat23 === void 0 || (_apiData$overviewStat23 = _apiData$overviewStat23.overview) === null || _apiData$overviewStat23 === void 0 ? void 0 : _apiData$overviewStat23.overallAVGDonations) !== null && _apiData$overviewStat22 !== void 0 ? _apiData$overviewStat22 : 0).toFixed(2));
|
|
17786
|
+
var donorMixPrev = Number(((_apiData$overviewStat24 = apiData === null || apiData === void 0 || (_apiData$overviewStat25 = apiData.overviewStats) === null || _apiData$overviewStat25 === void 0 || (_apiData$overviewStat25 = _apiData$overviewStat25.overview) === null || _apiData$overviewStat25 === void 0 || (_apiData$overviewStat25 = _apiData$overviewStat25.growthPercentage) === null || _apiData$overviewStat25 === void 0 ? void 0 : _apiData$overviewStat25.overallAVGDonations) !== null && _apiData$overviewStat24 !== void 0 ? _apiData$overviewStat24 : 0).toFixed(2));
|
|
17787
17787
|
var renderCard = function renderCard(title) {
|
|
17788
17788
|
return /*#__PURE__*/jsx(MetricCard$1
|
|
17789
17789
|
// key={title}
|
|
@@ -17869,8 +17869,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17869
17869
|
};
|
|
17870
17870
|
};
|
|
17871
17871
|
if (activeMetric === "Total Raised") {
|
|
17872
|
-
var _apiData$
|
|
17873
|
-
var stackedData = apiData === null || apiData === void 0 || (_apiData$
|
|
17872
|
+
var _apiData$overviewStat26;
|
|
17873
|
+
var stackedData = apiData === null || apiData === void 0 || (_apiData$overviewStat26 = apiData.overviewStats) === null || _apiData$overviewStat26 === void 0 ? void 0 : _apiData$overviewStat26.totalRaised;
|
|
17874
17874
|
var hasStackedData = (stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic);
|
|
17875
17875
|
if (hasStackedData) {
|
|
17876
17876
|
var _buildStackedSeries = buildStackedSeries(stackedData),
|
|
@@ -17893,8 +17893,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17893
17893
|
}
|
|
17894
17894
|
}
|
|
17895
17895
|
if (activeMetric === "Net Raised") {
|
|
17896
|
-
var _apiData$
|
|
17897
|
-
var netData = apiData === null || apiData === void 0 || (_apiData$
|
|
17896
|
+
var _apiData$overviewStat27;
|
|
17897
|
+
var netData = apiData === null || apiData === void 0 || (_apiData$overviewStat27 = apiData.overviewStats) === null || _apiData$overviewStat27 === void 0 ? void 0 : _apiData$overviewStat27.netRaised;
|
|
17898
17898
|
var _hasStackedData = (netData === null || netData === void 0 ? void 0 : netData.paidAds) || (netData === null || netData === void 0 ? void 0 : netData.email) || (netData === null || netData === void 0 ? void 0 : netData.organic);
|
|
17899
17899
|
if (_hasStackedData) {
|
|
17900
17900
|
var _buildStackedSeries2 = buildStackedSeries(netData),
|
|
@@ -17925,8 +17925,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17925
17925
|
}
|
|
17926
17926
|
}
|
|
17927
17927
|
if (activeMetric === "Total Donors") {
|
|
17928
|
-
var _apiData$
|
|
17929
|
-
var donorsData = apiData === null || apiData === void 0 || (_apiData$
|
|
17928
|
+
var _apiData$overviewStat28;
|
|
17929
|
+
var donorsData = apiData === null || apiData === void 0 || (_apiData$overviewStat28 = apiData.overviewStats) === null || _apiData$overviewStat28 === void 0 ? void 0 : _apiData$overviewStat28.totalDonations;
|
|
17930
17930
|
var _hasStackedData2 = (donorsData === null || donorsData === void 0 ? void 0 : donorsData.paidAds) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.email) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.organic);
|
|
17931
17931
|
if (_hasStackedData2) {
|
|
17932
17932
|
var _buildStackedSeries3 = buildStackedSeries(donorsData),
|
|
@@ -17957,7 +17957,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17957
17957
|
}
|
|
17958
17958
|
}
|
|
17959
17959
|
if (activeMetric === "ROAS") {
|
|
17960
|
-
var
|
|
17960
|
+
var _apiData$overviewStat29;
|
|
17961
|
+
var roasData = apiData === null || apiData === void 0 || (_apiData$overviewStat29 = apiData.overviewStats) === null || _apiData$overviewStat29 === void 0 ? void 0 : _apiData$overviewStat29.roas;
|
|
17961
17962
|
var _hasStackedData3 = (roasData === null || roasData === void 0 ? void 0 : roasData.paidAds) || (roasData === null || roasData === void 0 ? void 0 : roasData.email) || (roasData === null || roasData === void 0 ? void 0 : roasData.organic);
|
|
17962
17963
|
if (_hasStackedData3) {
|
|
17963
17964
|
var _buildStackedSeries4 = buildStackedSeries(roasData),
|
|
@@ -17988,8 +17989,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17988
17989
|
}
|
|
17989
17990
|
}
|
|
17990
17991
|
if (activeMetric === "Conversion") {
|
|
17991
|
-
var _apiData$
|
|
17992
|
-
var conversionData = apiData === null || apiData === void 0 || (_apiData$
|
|
17992
|
+
var _apiData$overviewStat30;
|
|
17993
|
+
var conversionData = apiData === null || apiData === void 0 || (_apiData$overviewStat30 = apiData.overviewStats) === null || _apiData$overviewStat30 === void 0 ? void 0 : _apiData$overviewStat30.conversionRate;
|
|
17993
17994
|
var _hasStackedData4 = (conversionData === null || conversionData === void 0 ? void 0 : conversionData.paidAds) || (conversionData === null || conversionData === void 0 ? void 0 : conversionData.email) || (conversionData === null || conversionData === void 0 ? void 0 : conversionData.organic);
|
|
17994
17995
|
if (_hasStackedData4) {
|
|
17995
17996
|
var _buildStackedSeries5 = buildStackedSeries(conversionData),
|
|
@@ -18020,8 +18021,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
18020
18021
|
}
|
|
18021
18022
|
}
|
|
18022
18023
|
if (activeMetric === "Avg Donation") {
|
|
18023
|
-
var _apiData$
|
|
18024
|
-
var avgData = apiData === null || apiData === void 0 || (_apiData$
|
|
18024
|
+
var _apiData$overviewStat31;
|
|
18025
|
+
var avgData = apiData === null || apiData === void 0 || (_apiData$overviewStat31 = apiData.overviewStats) === null || _apiData$overviewStat31 === void 0 ? void 0 : _apiData$overviewStat31.avgDonations;
|
|
18025
18026
|
var _hasStackedData5 = (avgData === null || avgData === void 0 ? void 0 : avgData.paidAds) || (avgData === null || avgData === void 0 ? void 0 : avgData.email) || (avgData === null || avgData === void 0 ? void 0 : avgData.organic);
|
|
18026
18027
|
if (_hasStackedData5) {
|
|
18027
18028
|
var _buildStackedSeries6 = buildStackedSeries(avgData),
|
|
@@ -18210,8 +18211,38 @@ var mapChannelTrend = function mapChannelTrend(trend) {
|
|
|
18210
18211
|
var getRoasColor = function getRoasColor(roas) {
|
|
18211
18212
|
return Number(roas !== null && roas !== void 0 ? roas : 0) >= 2.5 ? "#22C55E" : "#EF4444";
|
|
18212
18213
|
};
|
|
18214
|
+
var getCampaignInitials$1 = function getCampaignInitials() {
|
|
18215
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
18216
|
+
var words = name.trim().split(/\s+/).filter(Boolean);
|
|
18217
|
+
if (words.length >= 2) {
|
|
18218
|
+
return (words[0][0] + words[1][0]).toUpperCase();
|
|
18219
|
+
}
|
|
18220
|
+
return name.slice(0, 2).toUpperCase() || "—";
|
|
18221
|
+
};
|
|
18222
|
+
var buildEmptySpendAllocation = function buildEmptySpendAllocation() {
|
|
18223
|
+
var channels = Object.keys(CHANNEL_STYLES);
|
|
18224
|
+
return {
|
|
18225
|
+
series: channels.map(function () {
|
|
18226
|
+
return 0;
|
|
18227
|
+
}),
|
|
18228
|
+
labels: channels,
|
|
18229
|
+
colors: channels.map(function (channel) {
|
|
18230
|
+
return CHANNEL_STYLES[channel].color;
|
|
18231
|
+
}),
|
|
18232
|
+
centerLabel: "total spend",
|
|
18233
|
+
centerValue: "$".concat(formatNumber(0)),
|
|
18234
|
+
subtitle: "Where $".concat(formatNumber(0), " went"),
|
|
18235
|
+
items: channels.map(function (channel) {
|
|
18236
|
+
return {
|
|
18237
|
+
label: channel,
|
|
18238
|
+
val: "0.0%",
|
|
18239
|
+
color: CHANNEL_STYLES[channel].color
|
|
18240
|
+
};
|
|
18241
|
+
})
|
|
18242
|
+
};
|
|
18243
|
+
};
|
|
18213
18244
|
var PaidSection = function PaidSection(_ref) {
|
|
18214
|
-
var _apiData$spendVsReven, _apiData$spendVsReven2, _selectedInfo$categor, _spendAllocation$subt, _spendAllocation$seri, _spendAllocation$labe, _spendAllocation$colo, _spendAllocation$cent, _spendAllocation$cent2, _spendAllocation$item;
|
|
18245
|
+
var _ref2, _rawOverview$totalSpe, _ref3, _rawOverview$totalRev, _ref4, _rawOverview$roas, _ref5, _rawOverview$costPerD, _rawOverview$conversi, _ref6, _rawOverview$averageD, _ref7, _rawOverview$totalDon, _ref8, _rawOverview$growthPe, _rawOverview$growthPe2, _ref9, _rawOverview$growthPe3, _rawOverview$growthPe4, _ref0, _rawOverview$growthPe5, _rawOverview$growthPe6, _rawOverview$growthPe7, _rawOverview$growthPe8, _rawOverview$growthPe9, _rawOverview$growthPe0, _rawOverview$growthPe1, _rawOverview$growthPe10, _apiData$spendVsReven, _apiData$spendVsReven2, _selectedInfo$categor, _spendAllocation$subt, _spendAllocation$seri, _spendAllocation$labe, _spendAllocation$colo, _spendAllocation$cent, _spendAllocation$cent2, _spendAllocation$item;
|
|
18215
18246
|
var _ref$apiData = _ref.apiData,
|
|
18216
18247
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData;
|
|
18217
18248
|
_ref.dateName;
|
|
@@ -18223,8 +18254,25 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18223
18254
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18224
18255
|
activeMetric = _useState2[0],
|
|
18225
18256
|
setActiveMetric = _useState2[1];
|
|
18226
|
-
var
|
|
18227
|
-
var
|
|
18257
|
+
var rawOverview = (apiData === null || apiData === void 0 ? void 0 : apiData.overview) || {};
|
|
18258
|
+
var metaSummary = (apiData === null || apiData === void 0 ? void 0 : apiData.metaSummary) || {};
|
|
18259
|
+
var overview = {
|
|
18260
|
+
totalSpent: (_ref2 = (_rawOverview$totalSpe = rawOverview.totalSpent) !== null && _rawOverview$totalSpe !== void 0 ? _rawOverview$totalSpe : metaSummary.metaSpend) !== null && _ref2 !== void 0 ? _ref2 : 0,
|
|
18261
|
+
totalRevenue: (_ref3 = (_rawOverview$totalRev = rawOverview.totalRevenue) !== null && _rawOverview$totalRev !== void 0 ? _rawOverview$totalRev : metaSummary.attributedAmount) !== null && _ref3 !== void 0 ? _ref3 : 0,
|
|
18262
|
+
roas: (_ref4 = (_rawOverview$roas = rawOverview.roas) !== null && _rawOverview$roas !== void 0 ? _rawOverview$roas : metaSummary.roas) !== null && _ref4 !== void 0 ? _ref4 : 0,
|
|
18263
|
+
costPerDonor: (_ref5 = (_rawOverview$costPerD = rawOverview.costPerDonor) !== null && _rawOverview$costPerD !== void 0 ? _rawOverview$costPerD : metaSummary.cpa) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
18264
|
+
conversionRate: (_rawOverview$conversi = rawOverview.conversionRate) !== null && _rawOverview$conversi !== void 0 ? _rawOverview$conversi : 0,
|
|
18265
|
+
averageDonation: (_ref6 = (_rawOverview$averageD = rawOverview.averageDonation) !== null && _rawOverview$averageD !== void 0 ? _rawOverview$averageD : metaSummary.averageGift) !== null && _ref6 !== void 0 ? _ref6 : 0,
|
|
18266
|
+
totalDonations: (_ref7 = (_rawOverview$totalDon = rawOverview.totalDonations) !== null && _rawOverview$totalDon !== void 0 ? _rawOverview$totalDon : metaSummary.donationsCount) !== null && _ref7 !== void 0 ? _ref7 : 0
|
|
18267
|
+
};
|
|
18268
|
+
var growth = {
|
|
18269
|
+
totalSpent: (_ref8 = (_rawOverview$growthPe = (_rawOverview$growthPe2 = rawOverview.growthPercentage) === null || _rawOverview$growthPe2 === void 0 ? void 0 : _rawOverview$growthPe2.totalSpent) !== null && _rawOverview$growthPe !== void 0 ? _rawOverview$growthPe : metaSummary.metaSpendChangePercent) !== null && _ref8 !== void 0 ? _ref8 : 0,
|
|
18270
|
+
totalRevenue: (_ref9 = (_rawOverview$growthPe3 = (_rawOverview$growthPe4 = rawOverview.growthPercentage) === null || _rawOverview$growthPe4 === void 0 ? void 0 : _rawOverview$growthPe4.totalRevenue) !== null && _rawOverview$growthPe3 !== void 0 ? _rawOverview$growthPe3 : metaSummary.attributedChangePercent) !== null && _ref9 !== void 0 ? _ref9 : 0,
|
|
18271
|
+
roas: (_ref0 = (_rawOverview$growthPe5 = (_rawOverview$growthPe6 = rawOverview.growthPercentage) === null || _rawOverview$growthPe6 === void 0 ? void 0 : _rawOverview$growthPe6.roas) !== null && _rawOverview$growthPe5 !== void 0 ? _rawOverview$growthPe5 : metaSummary.roasChange) !== null && _ref0 !== void 0 ? _ref0 : 0,
|
|
18272
|
+
costPerDonor: (_rawOverview$growthPe7 = (_rawOverview$growthPe8 = rawOverview.growthPercentage) === null || _rawOverview$growthPe8 === void 0 ? void 0 : _rawOverview$growthPe8.costPerDonor) !== null && _rawOverview$growthPe7 !== void 0 ? _rawOverview$growthPe7 : 0,
|
|
18273
|
+
conversionRate: (_rawOverview$growthPe9 = (_rawOverview$growthPe0 = rawOverview.growthPercentage) === null || _rawOverview$growthPe0 === void 0 ? void 0 : _rawOverview$growthPe0.conversionRate) !== null && _rawOverview$growthPe9 !== void 0 ? _rawOverview$growthPe9 : 0,
|
|
18274
|
+
averageDonation: (_rawOverview$growthPe1 = (_rawOverview$growthPe10 = rawOverview.growthPercentage) === null || _rawOverview$growthPe10 === void 0 ? void 0 : _rawOverview$growthPe10.averageDonation) !== null && _rawOverview$growthPe1 !== void 0 ? _rawOverview$growthPe1 : 0
|
|
18275
|
+
};
|
|
18228
18276
|
var hasPaidOverview = Boolean(apiData === null || apiData === void 0 ? void 0 : apiData.overview);
|
|
18229
18277
|
var spendSeries = mapTimeSeries$2(apiData === null || apiData === void 0 || (_apiData$spendVsReven = apiData.spendVsRevenue) === null || _apiData$spendVsReven === void 0 ? void 0 : _apiData$spendVsReven.spend);
|
|
18230
18278
|
var revenueSeries = mapTimeSeries$2(apiData === null || apiData === void 0 || (_apiData$spendVsReven2 = apiData.spendVsRevenue) === null || _apiData$spendVsReven2 === void 0 ? void 0 : _apiData$spendVsReven2.revenue);
|
|
@@ -18249,7 +18297,6 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18249
18297
|
}) : [Number(value !== null && value !== void 0 ? value : 0)];
|
|
18250
18298
|
};
|
|
18251
18299
|
var metricInfo = useMemo(function () {
|
|
18252
|
-
var _overview$totalSpent, _overview$totalRevenu, _overview$roas, _overview$roas2, _overview$costPerDono, _overview$costPerDono2, _overview$conversionR, _overview$conversionR2, _overview$averageDona, _overview$averageDona2;
|
|
18253
18300
|
if (!hasPaidOverview) {
|
|
18254
18301
|
return {
|
|
18255
18302
|
"Total Spent": {
|
|
@@ -18314,62 +18361,63 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18314
18361
|
}
|
|
18315
18362
|
};
|
|
18316
18363
|
}
|
|
18364
|
+
var chartCategories = spendSeries.categories.length > 0 ? spendSeries.categories : revenueSeries.categories.length > 0 ? revenueSeries.categories : fallbackCategories;
|
|
18317
18365
|
return {
|
|
18318
18366
|
"Total Spent": {
|
|
18319
|
-
value: "$".concat(formatNumber(
|
|
18367
|
+
value: "$".concat(formatNumber(overview.totalSpent)),
|
|
18320
18368
|
subValue: formatGrowth$2(growth.totalSpent),
|
|
18321
|
-
data: spendSeries.data,
|
|
18322
|
-
categories:
|
|
18369
|
+
data: spendSeries.data.length > 0 ? spendSeries.data : flatSeries(0),
|
|
18370
|
+
categories: chartCategories,
|
|
18323
18371
|
icon: /*#__PURE__*/jsx(IndeterminateCheckBoxOutlined, {}),
|
|
18324
18372
|
money: true,
|
|
18325
18373
|
error: false,
|
|
18326
18374
|
warning: false
|
|
18327
18375
|
},
|
|
18328
18376
|
"Revinue Raised": {
|
|
18329
|
-
value: "$".concat(formatNumber(
|
|
18377
|
+
value: "$".concat(formatNumber(overview.totalRevenue)),
|
|
18330
18378
|
subValue: formatGrowth$2(growth.totalRevenue),
|
|
18331
|
-
data: revenueSeries.data,
|
|
18332
|
-
categories:
|
|
18379
|
+
data: revenueSeries.data.length > 0 ? revenueSeries.data : flatSeries(0),
|
|
18380
|
+
categories: chartCategories,
|
|
18333
18381
|
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
18334
18382
|
money: true,
|
|
18335
18383
|
error: false,
|
|
18336
18384
|
warning: false
|
|
18337
18385
|
},
|
|
18338
18386
|
ROAS: {
|
|
18339
|
-
value: "".concat(Number(
|
|
18387
|
+
value: "".concat(Number(overview.roas).toFixed(1), "x"),
|
|
18340
18388
|
subValue: formatGrowth$2(growth.roas),
|
|
18341
|
-
data: roasChartData.length > 0 ? roasChartData : flatSeries(
|
|
18342
|
-
categories:
|
|
18389
|
+
data: roasChartData.length > 0 ? roasChartData : flatSeries(0),
|
|
18390
|
+
categories: chartCategories,
|
|
18343
18391
|
icon: /*#__PURE__*/jsx(TrendingUp, {}),
|
|
18344
18392
|
money: false,
|
|
18345
18393
|
error: false,
|
|
18346
18394
|
warning: false
|
|
18347
18395
|
},
|
|
18348
18396
|
"Cost Per Donor": {
|
|
18349
|
-
value: "$".concat(formatNumber(
|
|
18397
|
+
value: "$".concat(formatNumber(overview.costPerDonor)),
|
|
18350
18398
|
subValue: formatGrowth$2(growth.costPerDonor),
|
|
18351
|
-
data: flatSeries(
|
|
18352
|
-
categories:
|
|
18399
|
+
data: flatSeries(overview.costPerDonor),
|
|
18400
|
+
categories: chartCategories,
|
|
18353
18401
|
icon: /*#__PURE__*/jsx(PersonOutlined, {}),
|
|
18354
18402
|
money: true,
|
|
18355
18403
|
error: false,
|
|
18356
18404
|
warning: false
|
|
18357
18405
|
},
|
|
18358
18406
|
"Conversion Rate": {
|
|
18359
|
-
value: "".concat(Number(
|
|
18407
|
+
value: "".concat(Number(overview.conversionRate).toFixed(2), "%"),
|
|
18360
18408
|
subValue: formatGrowth$2(growth.conversionRate),
|
|
18361
|
-
data: flatSeries(
|
|
18362
|
-
categories:
|
|
18409
|
+
data: flatSeries(overview.conversionRate),
|
|
18410
|
+
categories: chartCategories,
|
|
18363
18411
|
icon: /*#__PURE__*/jsx(ConversionRateIcon, {}),
|
|
18364
18412
|
money: false,
|
|
18365
18413
|
error: false,
|
|
18366
18414
|
warning: false
|
|
18367
18415
|
},
|
|
18368
18416
|
"Avg Donation": {
|
|
18369
|
-
value: "$".concat(formatNumber(
|
|
18417
|
+
value: "$".concat(formatNumber(overview.averageDonation)),
|
|
18370
18418
|
subValue: formatGrowth$2(growth.averageDonation),
|
|
18371
|
-
data: flatSeries(
|
|
18372
|
-
categories:
|
|
18419
|
+
data: flatSeries(overview.averageDonation),
|
|
18420
|
+
categories: chartCategories,
|
|
18373
18421
|
icon: /*#__PURE__*/jsx(AverageDonationIcon, {}),
|
|
18374
18422
|
money: true,
|
|
18375
18423
|
error: false,
|
|
@@ -18403,7 +18451,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18403
18451
|
var allocation = apiData === null || apiData === void 0 ? void 0 : apiData.spendAllocation;
|
|
18404
18452
|
if (!hasPaidOverview) return null;
|
|
18405
18453
|
if (!allocation || !Array.isArray(allocation.data) || allocation.data.length === 0) {
|
|
18406
|
-
return
|
|
18454
|
+
return buildEmptySpendAllocation();
|
|
18407
18455
|
}
|
|
18408
18456
|
var items = allocation.data.map(function (item) {
|
|
18409
18457
|
var _item$percentage, _item$spend2, _item$percentage2;
|
|
@@ -18429,10 +18477,10 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18429
18477
|
centerLabel: "total spend",
|
|
18430
18478
|
centerValue: "$".concat(formatNumber((_allocation$totalSpen = allocation.totalSpend) !== null && _allocation$totalSpen !== void 0 ? _allocation$totalSpen : 0)),
|
|
18431
18479
|
subtitle: "Where $".concat(formatNumber((_allocation$totalSpen2 = allocation.totalSpend) !== null && _allocation$totalSpen2 !== void 0 ? _allocation$totalSpen2 : 0), " went"),
|
|
18432
|
-
items: items.map(function (
|
|
18433
|
-
var label =
|
|
18434
|
-
val =
|
|
18435
|
-
color =
|
|
18480
|
+
items: items.map(function (_ref1) {
|
|
18481
|
+
var label = _ref1.label,
|
|
18482
|
+
val = _ref1.val,
|
|
18483
|
+
color = _ref1.color;
|
|
18436
18484
|
return {
|
|
18437
18485
|
label: label,
|
|
18438
18486
|
val: val,
|
|
@@ -18444,12 +18492,14 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18444
18492
|
var topCampaignsData = useMemo(function () {
|
|
18445
18493
|
var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns;
|
|
18446
18494
|
if (!hasPaidOverview) return null;
|
|
18447
|
-
if (!Array.isArray(campaigns)) return
|
|
18495
|
+
if (!Array.isArray(campaigns)) return [];
|
|
18448
18496
|
if (campaigns.length === 0) return [];
|
|
18449
18497
|
return campaigns.map(function (item) {
|
|
18450
18498
|
var _item$spend3, _item$revenue2, _item$roas2;
|
|
18499
|
+
var name = item.campaignName || item.campaign || item.name || "Unknown";
|
|
18451
18500
|
return {
|
|
18452
|
-
|
|
18501
|
+
id: getCampaignInitials$1(name),
|
|
18502
|
+
name: name,
|
|
18453
18503
|
spend: "$".concat(formatNumber((_item$spend3 = item.spend) !== null && _item$spend3 !== void 0 ? _item$spend3 : 0)),
|
|
18454
18504
|
revenue: "$".concat(formatNumber((_item$revenue2 = item.revenue) !== null && _item$revenue2 !== void 0 ? _item$revenue2 : 0)),
|
|
18455
18505
|
roas: "".concat(Number((_item$roas2 = item.roas) !== null && _item$roas2 !== void 0 ? _item$roas2 : 0).toFixed(1), "x")
|
|
@@ -18474,6 +18524,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18474
18524
|
});
|
|
18475
18525
|
};
|
|
18476
18526
|
var selectedInfo = metricInfo[activeMetric] || metricInfo["Total Spent"];
|
|
18527
|
+
var emptySpendAllocation = buildEmptySpendAllocation();
|
|
18477
18528
|
var chartCategories = ((_selectedInfo$categor = selectedInfo.categories) === null || _selectedInfo$categor === void 0 ? void 0 : _selectedInfo$categor.length) > 0 ? selectedInfo.categories : fallbackCategories;
|
|
18478
18529
|
var mainChart = {
|
|
18479
18530
|
label: activeMetric,
|
|
@@ -18497,7 +18548,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18497
18548
|
md: "1fr 1fr 1fr",
|
|
18498
18549
|
lg: "repeat(6, 1fr)"
|
|
18499
18550
|
},
|
|
18500
|
-
gap:
|
|
18551
|
+
gap: "6px",
|
|
18501
18552
|
mb: 0
|
|
18502
18553
|
},
|
|
18503
18554
|
children: Object.keys(metricInfo).map(renderCard)
|
|
@@ -18505,7 +18556,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18505
18556
|
container: true,
|
|
18506
18557
|
spacing: 3,
|
|
18507
18558
|
sx: {
|
|
18508
|
-
mt:
|
|
18559
|
+
mt: "12px"
|
|
18509
18560
|
},
|
|
18510
18561
|
children: /*#__PURE__*/jsx(RenderChartCard, {
|
|
18511
18562
|
item: mainChart,
|
|
@@ -18521,7 +18572,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18521
18572
|
container: true,
|
|
18522
18573
|
spacing: 3,
|
|
18523
18574
|
sx: {
|
|
18524
|
-
mt:
|
|
18575
|
+
mt: "6px"
|
|
18525
18576
|
},
|
|
18526
18577
|
children: [/*#__PURE__*/jsx(Grid, {
|
|
18527
18578
|
item: true,
|
|
@@ -18537,7 +18588,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18537
18588
|
columns: ["Channel", "Ppend", "Revenue", "ROAS", "CPA", "Trend"],
|
|
18538
18589
|
gridTemplateColumns: "2.2fr 1fr 1fr 0.8fr 0.8fr 1.2fr",
|
|
18539
18590
|
height: "100%",
|
|
18540
|
-
rows: channelRows !== null && channelRows !== void 0 ? channelRows : [{
|
|
18591
|
+
rows: channelRows !== null && channelRows !== void 0 ? channelRows : hasPaidOverview ? [] : [{
|
|
18541
18592
|
id: "M",
|
|
18542
18593
|
avatarBg: "#4267B2",
|
|
18543
18594
|
name: "Meta Ads",
|
|
@@ -18611,20 +18662,24 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18611
18662
|
sx: {
|
|
18612
18663
|
paddingTop: "0px !important",
|
|
18613
18664
|
minHeight: "430px",
|
|
18665
|
+
paddingLeft: {
|
|
18666
|
+
xs: "24px !important",
|
|
18667
|
+
md: "6px !important"
|
|
18668
|
+
},
|
|
18614
18669
|
marginTop: {
|
|
18615
|
-
xs:
|
|
18670
|
+
xs: "6px",
|
|
18616
18671
|
md: "0px"
|
|
18617
18672
|
}
|
|
18618
18673
|
},
|
|
18619
18674
|
children: /*#__PURE__*/jsx(DonorMixCard, {
|
|
18620
18675
|
title: "Spend Allocation",
|
|
18621
|
-
subtitle: (_spendAllocation$subt = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.subtitle) !== null && _spendAllocation$subt !== void 0 ? _spendAllocation$subt : "Where $80.3K went this month",
|
|
18622
|
-
series: (_spendAllocation$seri = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.series) !== null && _spendAllocation$seri !== void 0 ? _spendAllocation$seri : [40.8, 35.1, 14.2, 6.6, 3.3],
|
|
18623
|
-
labels: (_spendAllocation$labe = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.labels) !== null && _spendAllocation$labe !== void 0 ? _spendAllocation$labe : ["Meta Ads", "Google Ads", "TikTok", "YouTube", "Snapchat"],
|
|
18624
|
-
colors: (_spendAllocation$colo = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.colors) !== null && _spendAllocation$colo !== void 0 ? _spendAllocation$colo : ["#4267B2", "#4285F4", "#cd249dff", "#FF0000", "#FFFC00"],
|
|
18676
|
+
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",
|
|
18677
|
+
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],
|
|
18678
|
+
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"],
|
|
18679
|
+
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"],
|
|
18625
18680
|
centerLabel: (_spendAllocation$cent = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerLabel) !== null && _spendAllocation$cent !== void 0 ? _spendAllocation$cent : "total spend",
|
|
18626
|
-
centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : "$80.3K",
|
|
18627
|
-
items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : [{
|
|
18681
|
+
centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : hasPaidOverview ? emptySpendAllocation.centerValue : "$80.3K",
|
|
18682
|
+
items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : hasPaidOverview ? emptySpendAllocation.items : [{
|
|
18628
18683
|
label: "Meta Ads",
|
|
18629
18684
|
val: "40.8%",
|
|
18630
18685
|
color: "#4267B2"
|
|
@@ -18656,7 +18711,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18656
18711
|
container: true,
|
|
18657
18712
|
spacing: 3,
|
|
18658
18713
|
sx: {
|
|
18659
|
-
mt:
|
|
18714
|
+
mt: "6px"
|
|
18660
18715
|
},
|
|
18661
18716
|
children: [/*#__PURE__*/jsx(Grid, {
|
|
18662
18717
|
item: true,
|
|
@@ -18666,7 +18721,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18666
18721
|
paddingTop: "0px !important"
|
|
18667
18722
|
},
|
|
18668
18723
|
children: /*#__PURE__*/jsx(TopPerformingCampaignsCard, {
|
|
18669
|
-
data: topCampaignsData
|
|
18724
|
+
data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
|
|
18670
18725
|
})
|
|
18671
18726
|
}), /*#__PURE__*/jsx(Grid, {
|
|
18672
18727
|
item: true,
|
|
@@ -18674,8 +18729,12 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18674
18729
|
md: 6,
|
|
18675
18730
|
sx: {
|
|
18676
18731
|
paddingTop: "0px !important",
|
|
18732
|
+
paddingLeft: {
|
|
18733
|
+
xs: "24px !important",
|
|
18734
|
+
md: "6px !important"
|
|
18735
|
+
},
|
|
18677
18736
|
marginTop: {
|
|
18678
|
-
xs:
|
|
18737
|
+
xs: "6px",
|
|
18679
18738
|
md: "0px"
|
|
18680
18739
|
}
|
|
18681
18740
|
},
|