@ammarkhalidfarooq/dashboard-package 0.6.100 → 0.6.101
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 +108 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +108 -57
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6429,7 +6429,7 @@ var TopCampaignsConvRateCard = function TopCampaignsConvRateCard(_ref7) {
|
|
|
6429
6429
|
})]
|
|
6430
6430
|
});
|
|
6431
6431
|
};
|
|
6432
|
-
var getCampaignInitials$
|
|
6432
|
+
var getCampaignInitials$2 = function getCampaignInitials() {
|
|
6433
6433
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
6434
6434
|
var words = name.trim().split(/\s+/).filter(Boolean);
|
|
6435
6435
|
if (words.length >= 2) {
|
|
@@ -6542,7 +6542,7 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard(_ref8) {
|
|
|
6542
6542
|
fontSize: "10px",
|
|
6543
6543
|
fontWeight: 700
|
|
6544
6544
|
},
|
|
6545
|
-
children: item.id || getCampaignInitials$
|
|
6545
|
+
children: item.id || getCampaignInitials$2(item.name)
|
|
6546
6546
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
6547
6547
|
sx: {
|
|
6548
6548
|
fontSize: "13px",
|
|
@@ -17637,7 +17637,7 @@ var EmailSectionSkeleton = function EmailSectionSkeleton() {
|
|
|
17637
17637
|
};
|
|
17638
17638
|
|
|
17639
17639
|
var OverallSection = function OverallSection(_ref) {
|
|
17640
|
-
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$
|
|
17640
|
+
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;
|
|
17641
17641
|
var _ref$apiData = _ref.apiData,
|
|
17642
17642
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
17643
17643
|
primaryCharts = _ref.primaryCharts,
|
|
@@ -17740,8 +17740,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17740
17740
|
warning: false
|
|
17741
17741
|
},
|
|
17742
17742
|
"ROAS": {
|
|
17743
|
-
value: "".concat(formatNumber(((_apiData$
|
|
17744
|
-
subValue: "".concat(Number((_apiData$
|
|
17743
|
+
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"),
|
|
17744
|
+
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"),
|
|
17745
17745
|
label: "ROAS",
|
|
17746
17746
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
|
|
17747
17747
|
money: false,
|
|
@@ -17749,8 +17749,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17749
17749
|
warning: false
|
|
17750
17750
|
},
|
|
17751
17751
|
"Conversion": {
|
|
17752
|
-
value: "".concat(formatNumber(((_apiData$
|
|
17753
|
-
subValue: "".concat(((_apiData$
|
|
17752
|
+
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)), "%"),
|
|
17753
|
+
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%",
|
|
17754
17754
|
label: "Conversion Rate",
|
|
17755
17755
|
icon: /*#__PURE__*/jsxRuntime.jsx(ConversionRateIcon, {}),
|
|
17756
17756
|
money: false,
|
|
@@ -17784,8 +17784,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17784
17784
|
newDonorsPerc = totalDonorsMix > 0 ? Math.round(newDonorsCount / totalDonorsMix * 100) : 0;
|
|
17785
17785
|
returningDonorsPerc = totalDonorsMix > 0 ? Math.round(returningDonorsCount / totalDonorsMix * 100) : 0;
|
|
17786
17786
|
}
|
|
17787
|
-
var avgGift = Number(((_apiData$
|
|
17788
|
-
var donorMixPrev = Number(((_apiData$
|
|
17787
|
+
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));
|
|
17788
|
+
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));
|
|
17789
17789
|
var renderCard = function renderCard(title) {
|
|
17790
17790
|
return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1
|
|
17791
17791
|
// key={title}
|
|
@@ -17871,8 +17871,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17871
17871
|
};
|
|
17872
17872
|
};
|
|
17873
17873
|
if (activeMetric === "Total Raised") {
|
|
17874
|
-
var _apiData$
|
|
17875
|
-
var stackedData = apiData === null || apiData === void 0 || (_apiData$
|
|
17874
|
+
var _apiData$overviewStat26;
|
|
17875
|
+
var stackedData = apiData === null || apiData === void 0 || (_apiData$overviewStat26 = apiData.overviewStats) === null || _apiData$overviewStat26 === void 0 ? void 0 : _apiData$overviewStat26.totalRaised;
|
|
17876
17876
|
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);
|
|
17877
17877
|
if (hasStackedData) {
|
|
17878
17878
|
var _buildStackedSeries = buildStackedSeries(stackedData),
|
|
@@ -17895,8 +17895,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17895
17895
|
}
|
|
17896
17896
|
}
|
|
17897
17897
|
if (activeMetric === "Net Raised") {
|
|
17898
|
-
var _apiData$
|
|
17899
|
-
var netData = apiData === null || apiData === void 0 || (_apiData$
|
|
17898
|
+
var _apiData$overviewStat27;
|
|
17899
|
+
var netData = apiData === null || apiData === void 0 || (_apiData$overviewStat27 = apiData.overviewStats) === null || _apiData$overviewStat27 === void 0 ? void 0 : _apiData$overviewStat27.netRaised;
|
|
17900
17900
|
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);
|
|
17901
17901
|
if (_hasStackedData) {
|
|
17902
17902
|
var _buildStackedSeries2 = buildStackedSeries(netData),
|
|
@@ -17927,8 +17927,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17927
17927
|
}
|
|
17928
17928
|
}
|
|
17929
17929
|
if (activeMetric === "Total Donors") {
|
|
17930
|
-
var _apiData$
|
|
17931
|
-
var donorsData = apiData === null || apiData === void 0 || (_apiData$
|
|
17930
|
+
var _apiData$overviewStat28;
|
|
17931
|
+
var donorsData = apiData === null || apiData === void 0 || (_apiData$overviewStat28 = apiData.overviewStats) === null || _apiData$overviewStat28 === void 0 ? void 0 : _apiData$overviewStat28.totalDonations;
|
|
17932
17932
|
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);
|
|
17933
17933
|
if (_hasStackedData2) {
|
|
17934
17934
|
var _buildStackedSeries3 = buildStackedSeries(donorsData),
|
|
@@ -17959,7 +17959,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17959
17959
|
}
|
|
17960
17960
|
}
|
|
17961
17961
|
if (activeMetric === "ROAS") {
|
|
17962
|
-
var
|
|
17962
|
+
var _apiData$overviewStat29;
|
|
17963
|
+
var roasData = apiData === null || apiData === void 0 || (_apiData$overviewStat29 = apiData.overviewStats) === null || _apiData$overviewStat29 === void 0 ? void 0 : _apiData$overviewStat29.roas;
|
|
17963
17964
|
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);
|
|
17964
17965
|
if (_hasStackedData3) {
|
|
17965
17966
|
var _buildStackedSeries4 = buildStackedSeries(roasData),
|
|
@@ -17990,8 +17991,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
17990
17991
|
}
|
|
17991
17992
|
}
|
|
17992
17993
|
if (activeMetric === "Conversion") {
|
|
17993
|
-
var _apiData$
|
|
17994
|
-
var conversionData = apiData === null || apiData === void 0 || (_apiData$
|
|
17994
|
+
var _apiData$overviewStat30;
|
|
17995
|
+
var conversionData = apiData === null || apiData === void 0 || (_apiData$overviewStat30 = apiData.overviewStats) === null || _apiData$overviewStat30 === void 0 ? void 0 : _apiData$overviewStat30.conversionRate;
|
|
17995
17996
|
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);
|
|
17996
17997
|
if (_hasStackedData4) {
|
|
17997
17998
|
var _buildStackedSeries5 = buildStackedSeries(conversionData),
|
|
@@ -18022,8 +18023,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
18022
18023
|
}
|
|
18023
18024
|
}
|
|
18024
18025
|
if (activeMetric === "Avg Donation") {
|
|
18025
|
-
var _apiData$
|
|
18026
|
-
var avgData = apiData === null || apiData === void 0 || (_apiData$
|
|
18026
|
+
var _apiData$overviewStat31;
|
|
18027
|
+
var avgData = apiData === null || apiData === void 0 || (_apiData$overviewStat31 = apiData.overviewStats) === null || _apiData$overviewStat31 === void 0 ? void 0 : _apiData$overviewStat31.avgDonations;
|
|
18027
18028
|
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);
|
|
18028
18029
|
if (_hasStackedData5) {
|
|
18029
18030
|
var _buildStackedSeries6 = buildStackedSeries(avgData),
|
|
@@ -18212,8 +18213,38 @@ var mapChannelTrend = function mapChannelTrend(trend) {
|
|
|
18212
18213
|
var getRoasColor = function getRoasColor(roas) {
|
|
18213
18214
|
return Number(roas !== null && roas !== void 0 ? roas : 0) >= 2.5 ? "#22C55E" : "#EF4444";
|
|
18214
18215
|
};
|
|
18216
|
+
var getCampaignInitials$1 = function getCampaignInitials() {
|
|
18217
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
18218
|
+
var words = name.trim().split(/\s+/).filter(Boolean);
|
|
18219
|
+
if (words.length >= 2) {
|
|
18220
|
+
return (words[0][0] + words[1][0]).toUpperCase();
|
|
18221
|
+
}
|
|
18222
|
+
return name.slice(0, 2).toUpperCase() || "—";
|
|
18223
|
+
};
|
|
18224
|
+
var buildEmptySpendAllocation = function buildEmptySpendAllocation() {
|
|
18225
|
+
var channels = Object.keys(CHANNEL_STYLES);
|
|
18226
|
+
return {
|
|
18227
|
+
series: channels.map(function () {
|
|
18228
|
+
return 0;
|
|
18229
|
+
}),
|
|
18230
|
+
labels: channels,
|
|
18231
|
+
colors: channels.map(function (channel) {
|
|
18232
|
+
return CHANNEL_STYLES[channel].color;
|
|
18233
|
+
}),
|
|
18234
|
+
centerLabel: "total spend",
|
|
18235
|
+
centerValue: "$".concat(formatNumber(0)),
|
|
18236
|
+
subtitle: "Where $".concat(formatNumber(0), " went"),
|
|
18237
|
+
items: channels.map(function (channel) {
|
|
18238
|
+
return {
|
|
18239
|
+
label: channel,
|
|
18240
|
+
val: "0.0%",
|
|
18241
|
+
color: CHANNEL_STYLES[channel].color
|
|
18242
|
+
};
|
|
18243
|
+
})
|
|
18244
|
+
};
|
|
18245
|
+
};
|
|
18215
18246
|
var PaidSection = function PaidSection(_ref) {
|
|
18216
|
-
var _apiData$spendVsReven, _apiData$spendVsReven2, _selectedInfo$categor, _spendAllocation$subt, _spendAllocation$seri, _spendAllocation$labe, _spendAllocation$colo, _spendAllocation$cent, _spendAllocation$cent2, _spendAllocation$item;
|
|
18247
|
+
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;
|
|
18217
18248
|
var _ref$apiData = _ref.apiData,
|
|
18218
18249
|
apiData = _ref$apiData === void 0 ? {} : _ref$apiData;
|
|
18219
18250
|
_ref.dateName;
|
|
@@ -18225,8 +18256,25 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18225
18256
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18226
18257
|
activeMetric = _useState2[0],
|
|
18227
18258
|
setActiveMetric = _useState2[1];
|
|
18228
|
-
var
|
|
18229
|
-
var
|
|
18259
|
+
var rawOverview = (apiData === null || apiData === void 0 ? void 0 : apiData.overview) || {};
|
|
18260
|
+
var metaSummary = (apiData === null || apiData === void 0 ? void 0 : apiData.metaSummary) || {};
|
|
18261
|
+
var overview = {
|
|
18262
|
+
totalSpent: (_ref2 = (_rawOverview$totalSpe = rawOverview.totalSpent) !== null && _rawOverview$totalSpe !== void 0 ? _rawOverview$totalSpe : metaSummary.metaSpend) !== null && _ref2 !== void 0 ? _ref2 : 0,
|
|
18263
|
+
totalRevenue: (_ref3 = (_rawOverview$totalRev = rawOverview.totalRevenue) !== null && _rawOverview$totalRev !== void 0 ? _rawOverview$totalRev : metaSummary.attributedAmount) !== null && _ref3 !== void 0 ? _ref3 : 0,
|
|
18264
|
+
roas: (_ref4 = (_rawOverview$roas = rawOverview.roas) !== null && _rawOverview$roas !== void 0 ? _rawOverview$roas : metaSummary.roas) !== null && _ref4 !== void 0 ? _ref4 : 0,
|
|
18265
|
+
costPerDonor: (_ref5 = (_rawOverview$costPerD = rawOverview.costPerDonor) !== null && _rawOverview$costPerD !== void 0 ? _rawOverview$costPerD : metaSummary.cpa) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
18266
|
+
conversionRate: (_rawOverview$conversi = rawOverview.conversionRate) !== null && _rawOverview$conversi !== void 0 ? _rawOverview$conversi : 0,
|
|
18267
|
+
averageDonation: (_ref6 = (_rawOverview$averageD = rawOverview.averageDonation) !== null && _rawOverview$averageD !== void 0 ? _rawOverview$averageD : metaSummary.averageGift) !== null && _ref6 !== void 0 ? _ref6 : 0,
|
|
18268
|
+
totalDonations: (_ref7 = (_rawOverview$totalDon = rawOverview.totalDonations) !== null && _rawOverview$totalDon !== void 0 ? _rawOverview$totalDon : metaSummary.donationsCount) !== null && _ref7 !== void 0 ? _ref7 : 0
|
|
18269
|
+
};
|
|
18270
|
+
var growth = {
|
|
18271
|
+
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,
|
|
18272
|
+
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,
|
|
18273
|
+
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,
|
|
18274
|
+
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,
|
|
18275
|
+
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,
|
|
18276
|
+
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
|
|
18277
|
+
};
|
|
18230
18278
|
var hasPaidOverview = Boolean(apiData === null || apiData === void 0 ? void 0 : apiData.overview);
|
|
18231
18279
|
var spendSeries = mapTimeSeries$2(apiData === null || apiData === void 0 || (_apiData$spendVsReven = apiData.spendVsRevenue) === null || _apiData$spendVsReven === void 0 ? void 0 : _apiData$spendVsReven.spend);
|
|
18232
18280
|
var revenueSeries = mapTimeSeries$2(apiData === null || apiData === void 0 || (_apiData$spendVsReven2 = apiData.spendVsRevenue) === null || _apiData$spendVsReven2 === void 0 ? void 0 : _apiData$spendVsReven2.revenue);
|
|
@@ -18251,7 +18299,6 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18251
18299
|
}) : [Number(value !== null && value !== void 0 ? value : 0)];
|
|
18252
18300
|
};
|
|
18253
18301
|
var metricInfo = React.useMemo(function () {
|
|
18254
|
-
var _overview$totalSpent, _overview$totalRevenu, _overview$roas, _overview$roas2, _overview$costPerDono, _overview$costPerDono2, _overview$conversionR, _overview$conversionR2, _overview$averageDona, _overview$averageDona2;
|
|
18255
18302
|
if (!hasPaidOverview) {
|
|
18256
18303
|
return {
|
|
18257
18304
|
"Total Spent": {
|
|
@@ -18316,62 +18363,63 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18316
18363
|
}
|
|
18317
18364
|
};
|
|
18318
18365
|
}
|
|
18366
|
+
var chartCategories = spendSeries.categories.length > 0 ? spendSeries.categories : revenueSeries.categories.length > 0 ? revenueSeries.categories : fallbackCategories;
|
|
18319
18367
|
return {
|
|
18320
18368
|
"Total Spent": {
|
|
18321
|
-
value: "$".concat(formatNumber(
|
|
18369
|
+
value: "$".concat(formatNumber(overview.totalSpent)),
|
|
18322
18370
|
subValue: formatGrowth$2(growth.totalSpent),
|
|
18323
|
-
data: spendSeries.data,
|
|
18324
|
-
categories:
|
|
18371
|
+
data: spendSeries.data.length > 0 ? spendSeries.data : flatSeries(0),
|
|
18372
|
+
categories: chartCategories,
|
|
18325
18373
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.IndeterminateCheckBoxOutlined, {}),
|
|
18326
18374
|
money: true,
|
|
18327
18375
|
error: false,
|
|
18328
18376
|
warning: false
|
|
18329
18377
|
},
|
|
18330
18378
|
"Revinue Raised": {
|
|
18331
|
-
value: "$".concat(formatNumber(
|
|
18379
|
+
value: "$".concat(formatNumber(overview.totalRevenue)),
|
|
18332
18380
|
subValue: formatGrowth$2(growth.totalRevenue),
|
|
18333
|
-
data: revenueSeries.data,
|
|
18334
|
-
categories:
|
|
18381
|
+
data: revenueSeries.data.length > 0 ? revenueSeries.data : flatSeries(0),
|
|
18382
|
+
categories: chartCategories,
|
|
18335
18383
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
|
|
18336
18384
|
money: true,
|
|
18337
18385
|
error: false,
|
|
18338
18386
|
warning: false
|
|
18339
18387
|
},
|
|
18340
18388
|
ROAS: {
|
|
18341
|
-
value: "".concat(Number(
|
|
18389
|
+
value: "".concat(Number(overview.roas).toFixed(1), "x"),
|
|
18342
18390
|
subValue: formatGrowth$2(growth.roas),
|
|
18343
|
-
data: roasChartData.length > 0 ? roasChartData : flatSeries(
|
|
18344
|
-
categories:
|
|
18391
|
+
data: roasChartData.length > 0 ? roasChartData : flatSeries(0),
|
|
18392
|
+
categories: chartCategories,
|
|
18345
18393
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
|
|
18346
18394
|
money: false,
|
|
18347
18395
|
error: false,
|
|
18348
18396
|
warning: false
|
|
18349
18397
|
},
|
|
18350
18398
|
"Cost Per Donor": {
|
|
18351
|
-
value: "$".concat(formatNumber(
|
|
18399
|
+
value: "$".concat(formatNumber(overview.costPerDonor)),
|
|
18352
18400
|
subValue: formatGrowth$2(growth.costPerDonor),
|
|
18353
|
-
data: flatSeries(
|
|
18354
|
-
categories:
|
|
18401
|
+
data: flatSeries(overview.costPerDonor),
|
|
18402
|
+
categories: chartCategories,
|
|
18355
18403
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PersonOutlined, {}),
|
|
18356
18404
|
money: true,
|
|
18357
18405
|
error: false,
|
|
18358
18406
|
warning: false
|
|
18359
18407
|
},
|
|
18360
18408
|
"Conversion Rate": {
|
|
18361
|
-
value: "".concat(Number(
|
|
18409
|
+
value: "".concat(Number(overview.conversionRate).toFixed(2), "%"),
|
|
18362
18410
|
subValue: formatGrowth$2(growth.conversionRate),
|
|
18363
|
-
data: flatSeries(
|
|
18364
|
-
categories:
|
|
18411
|
+
data: flatSeries(overview.conversionRate),
|
|
18412
|
+
categories: chartCategories,
|
|
18365
18413
|
icon: /*#__PURE__*/jsxRuntime.jsx(ConversionRateIcon, {}),
|
|
18366
18414
|
money: false,
|
|
18367
18415
|
error: false,
|
|
18368
18416
|
warning: false
|
|
18369
18417
|
},
|
|
18370
18418
|
"Avg Donation": {
|
|
18371
|
-
value: "$".concat(formatNumber(
|
|
18419
|
+
value: "$".concat(formatNumber(overview.averageDonation)),
|
|
18372
18420
|
subValue: formatGrowth$2(growth.averageDonation),
|
|
18373
|
-
data: flatSeries(
|
|
18374
|
-
categories:
|
|
18421
|
+
data: flatSeries(overview.averageDonation),
|
|
18422
|
+
categories: chartCategories,
|
|
18375
18423
|
icon: /*#__PURE__*/jsxRuntime.jsx(AverageDonationIcon, {}),
|
|
18376
18424
|
money: true,
|
|
18377
18425
|
error: false,
|
|
@@ -18405,7 +18453,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18405
18453
|
var allocation = apiData === null || apiData === void 0 ? void 0 : apiData.spendAllocation;
|
|
18406
18454
|
if (!hasPaidOverview) return null;
|
|
18407
18455
|
if (!allocation || !Array.isArray(allocation.data) || allocation.data.length === 0) {
|
|
18408
|
-
return
|
|
18456
|
+
return buildEmptySpendAllocation();
|
|
18409
18457
|
}
|
|
18410
18458
|
var items = allocation.data.map(function (item) {
|
|
18411
18459
|
var _item$percentage, _item$spend2, _item$percentage2;
|
|
@@ -18431,10 +18479,10 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18431
18479
|
centerLabel: "total spend",
|
|
18432
18480
|
centerValue: "$".concat(formatNumber((_allocation$totalSpen = allocation.totalSpend) !== null && _allocation$totalSpen !== void 0 ? _allocation$totalSpen : 0)),
|
|
18433
18481
|
subtitle: "Where $".concat(formatNumber((_allocation$totalSpen2 = allocation.totalSpend) !== null && _allocation$totalSpen2 !== void 0 ? _allocation$totalSpen2 : 0), " went"),
|
|
18434
|
-
items: items.map(function (
|
|
18435
|
-
var label =
|
|
18436
|
-
val =
|
|
18437
|
-
color =
|
|
18482
|
+
items: items.map(function (_ref1) {
|
|
18483
|
+
var label = _ref1.label,
|
|
18484
|
+
val = _ref1.val,
|
|
18485
|
+
color = _ref1.color;
|
|
18438
18486
|
return {
|
|
18439
18487
|
label: label,
|
|
18440
18488
|
val: val,
|
|
@@ -18446,12 +18494,14 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18446
18494
|
var topCampaignsData = React.useMemo(function () {
|
|
18447
18495
|
var campaigns = apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns;
|
|
18448
18496
|
if (!hasPaidOverview) return null;
|
|
18449
|
-
if (!Array.isArray(campaigns)) return
|
|
18497
|
+
if (!Array.isArray(campaigns)) return [];
|
|
18450
18498
|
if (campaigns.length === 0) return [];
|
|
18451
18499
|
return campaigns.map(function (item) {
|
|
18452
18500
|
var _item$spend3, _item$revenue2, _item$roas2;
|
|
18501
|
+
var name = item.campaignName || item.campaign || item.name || "Unknown";
|
|
18453
18502
|
return {
|
|
18454
|
-
|
|
18503
|
+
id: getCampaignInitials$1(name),
|
|
18504
|
+
name: name,
|
|
18455
18505
|
spend: "$".concat(formatNumber((_item$spend3 = item.spend) !== null && _item$spend3 !== void 0 ? _item$spend3 : 0)),
|
|
18456
18506
|
revenue: "$".concat(formatNumber((_item$revenue2 = item.revenue) !== null && _item$revenue2 !== void 0 ? _item$revenue2 : 0)),
|
|
18457
18507
|
roas: "".concat(Number((_item$roas2 = item.roas) !== null && _item$roas2 !== void 0 ? _item$roas2 : 0).toFixed(1), "x")
|
|
@@ -18476,6 +18526,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18476
18526
|
});
|
|
18477
18527
|
};
|
|
18478
18528
|
var selectedInfo = metricInfo[activeMetric] || metricInfo["Total Spent"];
|
|
18529
|
+
var emptySpendAllocation = buildEmptySpendAllocation();
|
|
18479
18530
|
var chartCategories = ((_selectedInfo$categor = selectedInfo.categories) === null || _selectedInfo$categor === void 0 ? void 0 : _selectedInfo$categor.length) > 0 ? selectedInfo.categories : fallbackCategories;
|
|
18480
18531
|
var mainChart = {
|
|
18481
18532
|
label: activeMetric,
|
|
@@ -18539,7 +18590,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18539
18590
|
columns: ["Channel", "Ppend", "Revenue", "ROAS", "CPA", "Trend"],
|
|
18540
18591
|
gridTemplateColumns: "2.2fr 1fr 1fr 0.8fr 0.8fr 1.2fr",
|
|
18541
18592
|
height: "100%",
|
|
18542
|
-
rows: channelRows !== null && channelRows !== void 0 ? channelRows : [{
|
|
18593
|
+
rows: channelRows !== null && channelRows !== void 0 ? channelRows : hasPaidOverview ? [] : [{
|
|
18543
18594
|
id: "M",
|
|
18544
18595
|
avatarBg: "#4267B2",
|
|
18545
18596
|
name: "Meta Ads",
|
|
@@ -18620,13 +18671,13 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18620
18671
|
},
|
|
18621
18672
|
children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
|
|
18622
18673
|
title: "Spend Allocation",
|
|
18623
|
-
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",
|
|
18624
|
-
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],
|
|
18625
|
-
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"],
|
|
18626
|
-
colors: (_spendAllocation$colo = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.colors) !== null && _spendAllocation$colo !== void 0 ? _spendAllocation$colo : ["#4267B2", "#4285F4", "#cd249dff", "#FF0000", "#FFFC00"],
|
|
18674
|
+
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",
|
|
18675
|
+
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],
|
|
18676
|
+
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"],
|
|
18677
|
+
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"],
|
|
18627
18678
|
centerLabel: (_spendAllocation$cent = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerLabel) !== null && _spendAllocation$cent !== void 0 ? _spendAllocation$cent : "total spend",
|
|
18628
|
-
centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : "$80.3K",
|
|
18629
|
-
items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : [{
|
|
18679
|
+
centerValue: (_spendAllocation$cent2 = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.centerValue) !== null && _spendAllocation$cent2 !== void 0 ? _spendAllocation$cent2 : hasPaidOverview ? emptySpendAllocation.centerValue : "$80.3K",
|
|
18680
|
+
items: (_spendAllocation$item = spendAllocation === null || spendAllocation === void 0 ? void 0 : spendAllocation.items) !== null && _spendAllocation$item !== void 0 ? _spendAllocation$item : hasPaidOverview ? emptySpendAllocation.items : [{
|
|
18630
18681
|
label: "Meta Ads",
|
|
18631
18682
|
val: "40.8%",
|
|
18632
18683
|
color: "#4267B2"
|
|
@@ -18668,7 +18719,7 @@ var PaidSection = function PaidSection(_ref) {
|
|
|
18668
18719
|
paddingTop: "0px !important"
|
|
18669
18720
|
},
|
|
18670
18721
|
children: /*#__PURE__*/jsxRuntime.jsx(TopPerformingCampaignsCard, {
|
|
18671
|
-
data: topCampaignsData
|
|
18722
|
+
data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
|
|
18672
18723
|
})
|
|
18673
18724
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
18674
18725
|
item: true,
|