@ammarkhalidfarooq/dashboard-package 0.6.58 → 0.6.60
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 +178 -95
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +178 -95
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -952,6 +952,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
952
952
|
numberOfDays = _ref$numberOfDays === void 0 ? 1 : _ref$numberOfDays,
|
|
953
953
|
_ref$activeFilters = _ref.activeFilters,
|
|
954
954
|
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters;
|
|
955
|
+
_ref.exportLoading;
|
|
956
|
+
var setExportLoading = _ref.setExportLoading;
|
|
955
957
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
956
958
|
theme: theme,
|
|
957
959
|
children: /*#__PURE__*/jsx(Suspense, {
|
|
@@ -969,7 +971,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
969
971
|
dateName: dateName,
|
|
970
972
|
exportTrigger: exportTrigger,
|
|
971
973
|
apiLoading: apiLoading,
|
|
972
|
-
activeFilters: activeFilters
|
|
974
|
+
activeFilters: activeFilters,
|
|
975
|
+
setExportLoading: setExportLoading
|
|
973
976
|
})
|
|
974
977
|
})
|
|
975
978
|
});
|
|
@@ -1353,6 +1356,59 @@ var trendPillSx = function trendPillSx(value) {
|
|
|
1353
1356
|
whiteSpace: "nowrap"
|
|
1354
1357
|
};
|
|
1355
1358
|
};
|
|
1359
|
+
|
|
1360
|
+
/** Mirrors DonationTypeBarChart summary totals from recurringBarChartData. */
|
|
1361
|
+
var parseDonationTypeTotals = function parseDonationTypeTotals(donationTypeData) {
|
|
1362
|
+
var _dataObj$summary$recu, _dataObj$summary, _dataObj$summary$oneT, _dataObj$summary2;
|
|
1363
|
+
if (donationTypeData !== null && donationTypeData !== void 0 && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
1364
|
+
var _donationTypeData$tot, _donationTypeData$tot2;
|
|
1365
|
+
return {
|
|
1366
|
+
recurringTotal: Number((_donationTypeData$tot = donationTypeData.totalRecurringDonations) !== null && _donationTypeData$tot !== void 0 ? _donationTypeData$tot : 0),
|
|
1367
|
+
oneTimeTotal: Number((_donationTypeData$tot2 = donationTypeData.totalOneTimeDonations) !== null && _donationTypeData$tot2 !== void 0 ? _donationTypeData$tot2 : 0)
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
1371
|
+
var _recurring$totalAmoun, _oneTime$totalAmount;
|
|
1372
|
+
var recurring = donationTypeData.find(function (item) {
|
|
1373
|
+
return /recurring/i.test(item.type || "");
|
|
1374
|
+
}) || {};
|
|
1375
|
+
var oneTime = donationTypeData.find(function (item) {
|
|
1376
|
+
return /one.?time/i.test(item.type || "");
|
|
1377
|
+
}) || {};
|
|
1378
|
+
return {
|
|
1379
|
+
recurringTotal: Number((_recurring$totalAmoun = recurring.totalAmount) !== null && _recurring$totalAmoun !== void 0 ? _recurring$totalAmoun : 0),
|
|
1380
|
+
oneTimeTotal: Number((_oneTime$totalAmount = oneTime.totalAmount) !== null && _oneTime$totalAmount !== void 0 ? _oneTime$totalAmount : 0)
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && (donationTypeData[0].recurring !== undefined || donationTypeData[0].oneTime !== undefined || donationTypeData[0].recurringAmount !== undefined || donationTypeData[0].oneTimeAmount !== undefined)) {
|
|
1384
|
+
return {
|
|
1385
|
+
recurringTotal: donationTypeData.reduce(function (sum, item) {
|
|
1386
|
+
return sum + Number(item.recurring || item.recurringAmount || 0);
|
|
1387
|
+
}, 0),
|
|
1388
|
+
oneTimeTotal: donationTypeData.reduce(function (sum, item) {
|
|
1389
|
+
return sum + Number(item.oneTime || item.oneTimeAmount || 0);
|
|
1390
|
+
}, 0)
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
var dataObj = donationTypeData && _typeof(donationTypeData) === "object" ? donationTypeData : {};
|
|
1394
|
+
return {
|
|
1395
|
+
recurringTotal: Number((_dataObj$summary$recu = dataObj === null || dataObj === void 0 || (_dataObj$summary = dataObj.summary) === null || _dataObj$summary === void 0 || (_dataObj$summary = _dataObj$summary.recurring) === null || _dataObj$summary === void 0 ? void 0 : _dataObj$summary.total) !== null && _dataObj$summary$recu !== void 0 ? _dataObj$summary$recu : 0),
|
|
1396
|
+
oneTimeTotal: Number((_dataObj$summary$oneT = dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.oneTime) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) !== null && _dataObj$summary$oneT !== void 0 ? _dataObj$summary$oneT : 0)
|
|
1397
|
+
};
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
/** Mirrors PaidDonorGeographyCard row mapping from donorGeography. */
|
|
1401
|
+
var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
|
|
1402
|
+
var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
|
|
1403
|
+
return rawCountries.map(function (item) {
|
|
1404
|
+
var _item$percentage, _ref, _ref2, _item$value;
|
|
1405
|
+
return {
|
|
1406
|
+
country: item.countryName || item.country || item.name || "Unknown",
|
|
1407
|
+
percentage: typeof item.percentage === "number" ? item.percentage : Number((_item$percentage = item.percentage) !== null && _item$percentage !== void 0 ? _item$percentage : 0),
|
|
1408
|
+
value: item.donations !== undefined ? item.donations : (_ref = (_ref2 = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.totalDonors) !== null && _ref2 !== void 0 ? _ref2 : item.donors) !== null && _ref !== void 0 ? _ref : 0
|
|
1409
|
+
};
|
|
1410
|
+
});
|
|
1411
|
+
};
|
|
1356
1412
|
var getActiveFilterChips = function getActiveFilterChips(apiData) {
|
|
1357
1413
|
if (Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.activeFilterChips) && apiData.activeFilterChips.length) {
|
|
1358
1414
|
return apiData.activeFilterChips;
|
|
@@ -1564,7 +1620,9 @@ var buildReportData = function buildReportData() {
|
|
|
1564
1620
|
},
|
|
1565
1621
|
activeCampaigns: activeCampaigns,
|
|
1566
1622
|
donationTypeData: (apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData) || [],
|
|
1623
|
+
donationTypeTotals: parseDonationTypeTotals(apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData),
|
|
1567
1624
|
donorGeographyData: (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [],
|
|
1625
|
+
donorGeographyList: parseDonorGeographyList(apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography),
|
|
1568
1626
|
trafficSourceData: (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSourceData) || [],
|
|
1569
1627
|
orderBumpData: (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpDetails) || [],
|
|
1570
1628
|
upsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.upSellDetails) || {},
|
|
@@ -1968,7 +2026,9 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
1968
2026
|
var _ref8$head = _ref8.head,
|
|
1969
2027
|
head = _ref8$head === void 0 ? [] : _ref8$head,
|
|
1970
2028
|
_ref8$rows = _ref8.rows,
|
|
1971
|
-
rows = _ref8$rows === void 0 ? [] : _ref8$rows
|
|
2029
|
+
rows = _ref8$rows === void 0 ? [] : _ref8$rows,
|
|
2030
|
+
_ref8$colAlign = _ref8.colAlign,
|
|
2031
|
+
colAlign = _ref8$colAlign === void 0 ? [] : _ref8$colAlign;
|
|
1972
2032
|
return /*#__PURE__*/jsxs("table", {
|
|
1973
2033
|
style: {
|
|
1974
2034
|
width: "100%",
|
|
@@ -1986,7 +2046,7 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
1986
2046
|
return /*#__PURE__*/jsx("th", {
|
|
1987
2047
|
style: {
|
|
1988
2048
|
padding: "4px 6px",
|
|
1989
|
-
textAlign: i === 0 ? "left" : "right",
|
|
2049
|
+
textAlign: colAlign[i] || (i === 0 ? "left" : "right"),
|
|
1990
2050
|
fontWeight: 700,
|
|
1991
2051
|
fontSize: 8.5,
|
|
1992
2052
|
letterSpacing: "0.3px",
|
|
@@ -2007,9 +2067,10 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
2007
2067
|
return /*#__PURE__*/jsx("td", {
|
|
2008
2068
|
style: {
|
|
2009
2069
|
padding: "4px 6px",
|
|
2010
|
-
textAlign: ci === 0 ? "left" : "right",
|
|
2070
|
+
textAlign: colAlign[ci] || (ci === 0 ? "left" : "right"),
|
|
2011
2071
|
color: "#334155",
|
|
2012
|
-
borderBottom: ri < rows.length - 1 ? "1px solid #EEF2F7" : "none"
|
|
2072
|
+
borderBottom: ri < rows.length - 1 ? "1px solid #EEF2F7" : "none",
|
|
2073
|
+
verticalAlign: "middle"
|
|
2013
2074
|
},
|
|
2014
2075
|
children: cell
|
|
2015
2076
|
}, ci);
|
|
@@ -2019,15 +2080,62 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
2019
2080
|
})]
|
|
2020
2081
|
});
|
|
2021
2082
|
};
|
|
2022
|
-
var
|
|
2023
|
-
var
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
_ref9$
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2083
|
+
var ProgressBar = function ProgressBar(_ref9) {
|
|
2084
|
+
var value = _ref9.value,
|
|
2085
|
+
_ref9$color = _ref9.color,
|
|
2086
|
+
color = _ref9$color === void 0 ? "rgb(99, 99, 230)" : _ref9$color,
|
|
2087
|
+
_ref9$height = _ref9.height,
|
|
2088
|
+
height = _ref9$height === void 0 ? 6 : _ref9$height;
|
|
2089
|
+
var pct = Math.min(100, Math.max(0, Number(value !== null && value !== void 0 ? value : 0)));
|
|
2090
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2091
|
+
style: {
|
|
2092
|
+
display: "flex",
|
|
2093
|
+
alignItems: "center",
|
|
2094
|
+
gap: 6,
|
|
2095
|
+
width: "100%"
|
|
2096
|
+
},
|
|
2097
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
2098
|
+
style: {
|
|
2099
|
+
flex: 1,
|
|
2100
|
+
minWidth: 0
|
|
2101
|
+
},
|
|
2102
|
+
children: /*#__PURE__*/jsx("div", {
|
|
2103
|
+
style: {
|
|
2104
|
+
height: height,
|
|
2105
|
+
background: "#F3F4F6",
|
|
2106
|
+
borderRadius: 4,
|
|
2107
|
+
overflow: "hidden"
|
|
2108
|
+
},
|
|
2109
|
+
children: /*#__PURE__*/jsx("div", {
|
|
2110
|
+
style: {
|
|
2111
|
+
width: "".concat(pct, "%"),
|
|
2112
|
+
height: "100%",
|
|
2113
|
+
background: color,
|
|
2114
|
+
borderRadius: 4
|
|
2115
|
+
}
|
|
2116
|
+
})
|
|
2117
|
+
})
|
|
2118
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
2119
|
+
style: {
|
|
2120
|
+
fontSize: 9,
|
|
2121
|
+
color: "rgba(0, 0, 0, 0.4)",
|
|
2122
|
+
minWidth: 26,
|
|
2123
|
+
flexShrink: 0,
|
|
2124
|
+
textAlign: "right"
|
|
2125
|
+
},
|
|
2126
|
+
children: [pct, "%"]
|
|
2127
|
+
})]
|
|
2128
|
+
});
|
|
2129
|
+
};
|
|
2130
|
+
var KpiCard = function KpiCard(_ref0) {
|
|
2131
|
+
var title = _ref0.title,
|
|
2132
|
+
value = _ref0.value,
|
|
2133
|
+
trend = _ref0.trend,
|
|
2134
|
+
detail = _ref0.detail,
|
|
2135
|
+
_ref0$variant = _ref0.variant,
|
|
2136
|
+
variant = _ref0$variant === void 0 ? "secondary" : _ref0$variant,
|
|
2137
|
+
_ref0$trendPositiveWh = _ref0.trendPositiveWhenNegative,
|
|
2138
|
+
trendPositiveWhenNegative = _ref0$trendPositiveWh === void 0 ? false : _ref0$trendPositiveWh;
|
|
2031
2139
|
var displayTrend = withTrendArrow(trend);
|
|
2032
2140
|
var isPrimary = variant === "primary";
|
|
2033
2141
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -2078,10 +2186,10 @@ var KpiCard = function KpiCard(_ref9) {
|
|
|
2078
2186
|
})]
|
|
2079
2187
|
});
|
|
2080
2188
|
};
|
|
2081
|
-
var StatPair = function StatPair(
|
|
2082
|
-
var label =
|
|
2083
|
-
val =
|
|
2084
|
-
trend =
|
|
2189
|
+
var StatPair = function StatPair(_ref1) {
|
|
2190
|
+
var label = _ref1.label,
|
|
2191
|
+
val = _ref1.val,
|
|
2192
|
+
trend = _ref1.trend;
|
|
2085
2193
|
var displayTrend = withTrendArrow(trend);
|
|
2086
2194
|
return /*#__PURE__*/jsxs("div", {
|
|
2087
2195
|
style: {
|
|
@@ -2118,12 +2226,12 @@ var StatPair = function StatPair(_ref0) {
|
|
|
2118
2226
|
})]
|
|
2119
2227
|
});
|
|
2120
2228
|
};
|
|
2121
|
-
var PageHeader = function PageHeader(
|
|
2122
|
-
var dateLabel =
|
|
2123
|
-
generatedLabel =
|
|
2124
|
-
activeFilters =
|
|
2125
|
-
page =
|
|
2126
|
-
windowLabel =
|
|
2229
|
+
var PageHeader = function PageHeader(_ref10) {
|
|
2230
|
+
var dateLabel = _ref10.dateLabel,
|
|
2231
|
+
generatedLabel = _ref10.generatedLabel,
|
|
2232
|
+
activeFilters = _ref10.activeFilters,
|
|
2233
|
+
page = _ref10.page,
|
|
2234
|
+
windowLabel = _ref10.windowLabel;
|
|
2127
2235
|
return /*#__PURE__*/jsxs("div", {
|
|
2128
2236
|
style: {
|
|
2129
2237
|
padding: "22px ".concat(MX, "px 12px"),
|
|
@@ -2229,9 +2337,9 @@ var PageHeader = function PageHeader(_ref1) {
|
|
|
2229
2337
|
})]
|
|
2230
2338
|
});
|
|
2231
2339
|
};
|
|
2232
|
-
var PageFooter = function PageFooter(
|
|
2233
|
-
var generatedLabel =
|
|
2234
|
-
page =
|
|
2340
|
+
var PageFooter = function PageFooter(_ref11) {
|
|
2341
|
+
var generatedLabel = _ref11.generatedLabel,
|
|
2342
|
+
page = _ref11.page;
|
|
2235
2343
|
return /*#__PURE__*/jsx("div", {
|
|
2236
2344
|
style: {
|
|
2237
2345
|
padding: "7px ".concat(MX, "px"),
|
|
@@ -2251,16 +2359,16 @@ var PageFooter = function PageFooter(_ref10) {
|
|
|
2251
2359
|
};
|
|
2252
2360
|
|
|
2253
2361
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
2254
|
-
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (
|
|
2255
|
-
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3,
|
|
2256
|
-
var
|
|
2257
|
-
apiData =
|
|
2258
|
-
|
|
2259
|
-
dateName =
|
|
2260
|
-
|
|
2261
|
-
numberOfDays =
|
|
2262
|
-
|
|
2263
|
-
activeFilters =
|
|
2362
|
+
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
2363
|
+
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3, _ref15, _refundsRaw$refundRat2, _ob$growthPercentage, _ob$peakDay, _refCard$growthPercen;
|
|
2364
|
+
var _ref12$apiData = _ref12.apiData,
|
|
2365
|
+
apiData = _ref12$apiData === void 0 ? {} : _ref12$apiData,
|
|
2366
|
+
_ref12$dateName = _ref12.dateName,
|
|
2367
|
+
dateName = _ref12$dateName === void 0 ? "Last Period" : _ref12$dateName,
|
|
2368
|
+
_ref12$numberOfDays = _ref12.numberOfDays,
|
|
2369
|
+
numberOfDays = _ref12$numberOfDays === void 0 ? 30 : _ref12$numberOfDays,
|
|
2370
|
+
_ref12$activeFilters = _ref12.activeFilters,
|
|
2371
|
+
activeFilters = _ref12$activeFilters === void 0 ? [] : _ref12$activeFilters;
|
|
2264
2372
|
var now = new Date();
|
|
2265
2373
|
var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
|
|
2266
2374
|
var windowLabel = "".concat(numberOfDays, "-day window");
|
|
@@ -2315,7 +2423,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2315
2423
|
mainChart = report.mainChart,
|
|
2316
2424
|
growth = report.growth,
|
|
2317
2425
|
totalDonors = report.totalDonors,
|
|
2318
|
-
donorMix = report.donorMix
|
|
2426
|
+
donorMix = report.donorMix,
|
|
2427
|
+
activeCampaigns = report.activeCampaigns;
|
|
2319
2428
|
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
|
|
2320
2429
|
var totalRaised = Number((_overview$totalRevenu = overview === null || overview === void 0 ? void 0 : overview.totalRevenue) !== null && _overview$totalRevenu !== void 0 ? _overview$totalRevenu : 240938);
|
|
2321
2430
|
var netRaised = Number((_overview$netRevenue = overview === null || overview === void 0 ? void 0 : overview.netRevenue) !== null && _overview$netRevenue !== void 0 ? _overview$netRevenue : 222300);
|
|
@@ -2333,43 +2442,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2333
2442
|
retPct = donorMix.retPct,
|
|
2334
2443
|
mixAvgGift = donorMix.avgGift,
|
|
2335
2444
|
donorMixPrev = donorMix.donorMixPrev;
|
|
2336
|
-
var
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
var oneTimeTotal = recData.length ? recData.reduce(function (s, i) {
|
|
2341
|
-
return s + Number(i.oneTime || i.oneTimeAmount || 0);
|
|
2342
|
-
}, 0) : 188001;
|
|
2343
|
-
var geoRaw = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
|
|
2344
|
-
var geoList = function () {
|
|
2345
|
-
var raw = Array.isArray(geoRaw) ? geoRaw : Array.isArray(geoRaw === null || geoRaw === void 0 ? void 0 : geoRaw.data) ? geoRaw.data : [];
|
|
2346
|
-
if (raw.length) return raw;
|
|
2347
|
-
return [{
|
|
2348
|
-
country: "United States",
|
|
2349
|
-
totalDonors: 78,
|
|
2350
|
-
percentage: 36
|
|
2351
|
-
}, {
|
|
2352
|
-
country: "United Kingdom",
|
|
2353
|
-
totalDonors: 42,
|
|
2354
|
-
percentage: 20
|
|
2355
|
-
}, {
|
|
2356
|
-
country: "Canada",
|
|
2357
|
-
totalDonors: 28,
|
|
2358
|
-
percentage: 13
|
|
2359
|
-
}, {
|
|
2360
|
-
country: "UAE",
|
|
2361
|
-
totalDonors: 24,
|
|
2362
|
-
percentage: 11
|
|
2363
|
-
}, {
|
|
2364
|
-
country: "Saudi Arabia",
|
|
2365
|
-
totalDonors: 19,
|
|
2366
|
-
percentage: 9
|
|
2367
|
-
}, {
|
|
2368
|
-
country: "Other",
|
|
2369
|
-
totalDonors: 24,
|
|
2370
|
-
percentage: 11
|
|
2371
|
-
}];
|
|
2372
|
-
}();
|
|
2445
|
+
var _report$donationTypeT = report.donationTypeTotals,
|
|
2446
|
+
recurringTotal = _report$donationTypeT.recurringTotal,
|
|
2447
|
+
oneTimeTotal = _report$donationTypeT.oneTimeTotal;
|
|
2448
|
+
var geoList = report.donorGeographyList;
|
|
2373
2449
|
var trafficItems = function (_apiData$trafficSourc) {
|
|
2374
2450
|
var items = Array.isArray(apiData === null || apiData === void 0 || (_apiData$trafficSourc = apiData.trafficSourceData) === null || _apiData$trafficSourc === void 0 ? void 0 : _apiData$trafficSourc.data) ? apiData.trafficSourceData.data : [];
|
|
2375
2451
|
if (items.length) return items;
|
|
@@ -2439,6 +2515,9 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2439
2515
|
averageDonation: 1940,
|
|
2440
2516
|
status: "Active"
|
|
2441
2517
|
}];
|
|
2518
|
+
var campaignStatusByIndex = campaigns.map(function (c) {
|
|
2519
|
+
return c.status || "Active";
|
|
2520
|
+
});
|
|
2442
2521
|
var ob = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpDetails) || {};
|
|
2443
2522
|
var obData = ((ob === null || ob === void 0 ? void 0 : ob.chart) || []).map(function (i) {
|
|
2444
2523
|
return Number(i.revenue || 0);
|
|
@@ -2601,10 +2680,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2601
2680
|
gap: 14,
|
|
2602
2681
|
marginBottom: 6
|
|
2603
2682
|
},
|
|
2604
|
-
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (
|
|
2605
|
-
var
|
|
2606
|
-
name =
|
|
2607
|
-
color =
|
|
2683
|
+
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref13) {
|
|
2684
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
2685
|
+
name = _ref14[0],
|
|
2686
|
+
color = _ref14[1];
|
|
2608
2687
|
return /*#__PURE__*/jsxs("div", {
|
|
2609
2688
|
style: {
|
|
2610
2689
|
display: "flex",
|
|
@@ -2668,11 +2747,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2668
2747
|
children: [/*#__PURE__*/jsx(Panel, {
|
|
2669
2748
|
title: "Active campaigns",
|
|
2670
2749
|
subtitle: "Live fundraisers ranked by velocity",
|
|
2671
|
-
action: "View all \u2192",
|
|
2672
2750
|
children: /*#__PURE__*/jsx(MiniTable, {
|
|
2673
2751
|
head: ["CAMPAIGN", "RAISED", "PROGRESS", "DONORS", "AVG GIFT", "STATUS"],
|
|
2674
|
-
|
|
2675
|
-
|
|
2752
|
+
colAlign: ["left", "right", "left", "right", "right", "right"],
|
|
2753
|
+
rows: activeCampaigns.map(function (c, i) {
|
|
2754
|
+
return [c.name, c.val1, /*#__PURE__*/jsx(ProgressBar, {
|
|
2755
|
+
value: c.progress
|
|
2756
|
+
}, "campaign-progress-".concat(i)), c.val3, c.val4, campaignStatusByIndex[i] || "Active"];
|
|
2676
2757
|
})
|
|
2677
2758
|
})
|
|
2678
2759
|
}), /*#__PURE__*/jsx(Panel, {
|
|
@@ -2767,7 +2848,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2767
2848
|
style: {
|
|
2768
2849
|
fontSize: 9
|
|
2769
2850
|
},
|
|
2770
|
-
children: "".concat(Number((
|
|
2851
|
+
children: "".concat(Number((_ref15 = donorMixPrev !== null && donorMixPrev !== void 0 ? donorMixPrev : growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _ref15 !== void 0 ? _ref15 : 0).toFixed(2), "% vs pp")
|
|
2771
2852
|
})
|
|
2772
2853
|
})]
|
|
2773
2854
|
})]
|
|
@@ -2884,13 +2965,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2884
2965
|
fontSize: 9,
|
|
2885
2966
|
color: "#374151"
|
|
2886
2967
|
},
|
|
2887
|
-
children: g.country
|
|
2968
|
+
children: g.country
|
|
2888
2969
|
}), /*#__PURE__*/jsxs("span", {
|
|
2889
2970
|
style: {
|
|
2890
2971
|
fontSize: 9,
|
|
2891
2972
|
color: "#6B7280"
|
|
2892
2973
|
},
|
|
2893
|
-
children: [formatNumber(g.
|
|
2974
|
+
children: [formatNumber(g.value), " \xB7 ", formatNumber(g.percentage), "%"]
|
|
2894
2975
|
})]
|
|
2895
2976
|
}, i);
|
|
2896
2977
|
})
|
|
@@ -3023,10 +3104,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3023
3104
|
display: "flex",
|
|
3024
3105
|
gap: 12
|
|
3025
3106
|
},
|
|
3026
|
-
children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (
|
|
3027
|
-
var
|
|
3028
|
-
l =
|
|
3029
|
-
v =
|
|
3107
|
+
children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (_ref16) {
|
|
3108
|
+
var _ref17 = _slicedToArray(_ref16, 2),
|
|
3109
|
+
l = _ref17[0],
|
|
3110
|
+
v = _ref17[1];
|
|
3030
3111
|
return /*#__PURE__*/jsxs("div", {
|
|
3031
3112
|
children: [/*#__PURE__*/jsx("div", {
|
|
3032
3113
|
style: {
|
|
@@ -3153,10 +3234,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3153
3234
|
display: "flex",
|
|
3154
3235
|
gap: 12
|
|
3155
3236
|
},
|
|
3156
|
-
children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (
|
|
3157
|
-
var
|
|
3158
|
-
l =
|
|
3159
|
-
v =
|
|
3237
|
+
children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (_ref18) {
|
|
3238
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
3239
|
+
l = _ref19[0],
|
|
3240
|
+
v = _ref19[1];
|
|
3160
3241
|
return /*#__PURE__*/jsxs("div", {
|
|
3161
3242
|
children: [/*#__PURE__*/jsx("div", {
|
|
3162
3243
|
style: {
|
|
@@ -3299,7 +3380,8 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3299
3380
|
_ref$apiLoading = _ref.apiLoading,
|
|
3300
3381
|
apiLoading = _ref$apiLoading === void 0 ? false : _ref$apiLoading,
|
|
3301
3382
|
_ref$activeFilters = _ref.activeFilters,
|
|
3302
|
-
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters
|
|
3383
|
+
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters,
|
|
3384
|
+
setExportLoading = _ref.setExportLoading;
|
|
3303
3385
|
var initialMetric = "Revenue";
|
|
3304
3386
|
var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
|
|
3305
3387
|
var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
|
|
@@ -3378,6 +3460,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3378
3460
|
case 6:
|
|
3379
3461
|
_context.p = 6;
|
|
3380
3462
|
setShowExportLayout(false);
|
|
3463
|
+
setExportLoading === null || setExportLoading === void 0 || setExportLoading(false);
|
|
3381
3464
|
return _context.f(6);
|
|
3382
3465
|
case 7:
|
|
3383
3466
|
return _context.a(2);
|
|
@@ -3389,7 +3472,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3389
3472
|
};
|
|
3390
3473
|
}();
|
|
3391
3474
|
doPdfExport();
|
|
3392
|
-
}, [showExportLayout, exportFiltersSnapshot]);
|
|
3475
|
+
}, [showExportLayout, exportFiltersSnapshot, setExportLoading]);
|
|
3393
3476
|
var currentData = metric === "Revenue" ? revenueData : donationsData;
|
|
3394
3477
|
var oneTimeData = (apiData === null || apiData === void 0 ? void 0 : apiData.oneTimeDonations) || [];
|
|
3395
3478
|
var oneTimeValues = oneTimeData.length > 0 ? oneTimeData.map(function (item) {
|