@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.cjs.js
CHANGED
|
@@ -954,6 +954,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
954
954
|
numberOfDays = _ref$numberOfDays === void 0 ? 1 : _ref$numberOfDays,
|
|
955
955
|
_ref$activeFilters = _ref.activeFilters,
|
|
956
956
|
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters;
|
|
957
|
+
_ref.exportLoading;
|
|
958
|
+
var setExportLoading = _ref.setExportLoading;
|
|
957
959
|
return /*#__PURE__*/jsxRuntime.jsx(material.ThemeProvider, {
|
|
958
960
|
theme: theme,
|
|
959
961
|
children: /*#__PURE__*/jsxRuntime.jsx(React.Suspense, {
|
|
@@ -971,7 +973,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
971
973
|
dateName: dateName,
|
|
972
974
|
exportTrigger: exportTrigger,
|
|
973
975
|
apiLoading: apiLoading,
|
|
974
|
-
activeFilters: activeFilters
|
|
976
|
+
activeFilters: activeFilters,
|
|
977
|
+
setExportLoading: setExportLoading
|
|
975
978
|
})
|
|
976
979
|
})
|
|
977
980
|
});
|
|
@@ -1355,6 +1358,59 @@ var trendPillSx = function trendPillSx(value) {
|
|
|
1355
1358
|
whiteSpace: "nowrap"
|
|
1356
1359
|
};
|
|
1357
1360
|
};
|
|
1361
|
+
|
|
1362
|
+
/** Mirrors DonationTypeBarChart summary totals from recurringBarChartData. */
|
|
1363
|
+
var parseDonationTypeTotals = function parseDonationTypeTotals(donationTypeData) {
|
|
1364
|
+
var _dataObj$summary$recu, _dataObj$summary, _dataObj$summary$oneT, _dataObj$summary2;
|
|
1365
|
+
if (donationTypeData !== null && donationTypeData !== void 0 && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
1366
|
+
var _donationTypeData$tot, _donationTypeData$tot2;
|
|
1367
|
+
return {
|
|
1368
|
+
recurringTotal: Number((_donationTypeData$tot = donationTypeData.totalRecurringDonations) !== null && _donationTypeData$tot !== void 0 ? _donationTypeData$tot : 0),
|
|
1369
|
+
oneTimeTotal: Number((_donationTypeData$tot2 = donationTypeData.totalOneTimeDonations) !== null && _donationTypeData$tot2 !== void 0 ? _donationTypeData$tot2 : 0)
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
1373
|
+
var _recurring$totalAmoun, _oneTime$totalAmount;
|
|
1374
|
+
var recurring = donationTypeData.find(function (item) {
|
|
1375
|
+
return /recurring/i.test(item.type || "");
|
|
1376
|
+
}) || {};
|
|
1377
|
+
var oneTime = donationTypeData.find(function (item) {
|
|
1378
|
+
return /one.?time/i.test(item.type || "");
|
|
1379
|
+
}) || {};
|
|
1380
|
+
return {
|
|
1381
|
+
recurringTotal: Number((_recurring$totalAmoun = recurring.totalAmount) !== null && _recurring$totalAmoun !== void 0 ? _recurring$totalAmoun : 0),
|
|
1382
|
+
oneTimeTotal: Number((_oneTime$totalAmount = oneTime.totalAmount) !== null && _oneTime$totalAmount !== void 0 ? _oneTime$totalAmount : 0)
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && (donationTypeData[0].recurring !== undefined || donationTypeData[0].oneTime !== undefined || donationTypeData[0].recurringAmount !== undefined || donationTypeData[0].oneTimeAmount !== undefined)) {
|
|
1386
|
+
return {
|
|
1387
|
+
recurringTotal: donationTypeData.reduce(function (sum, item) {
|
|
1388
|
+
return sum + Number(item.recurring || item.recurringAmount || 0);
|
|
1389
|
+
}, 0),
|
|
1390
|
+
oneTimeTotal: donationTypeData.reduce(function (sum, item) {
|
|
1391
|
+
return sum + Number(item.oneTime || item.oneTimeAmount || 0);
|
|
1392
|
+
}, 0)
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
var dataObj = donationTypeData && _typeof(donationTypeData) === "object" ? donationTypeData : {};
|
|
1396
|
+
return {
|
|
1397
|
+
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),
|
|
1398
|
+
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)
|
|
1399
|
+
};
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1402
|
+
/** Mirrors PaidDonorGeographyCard row mapping from donorGeography. */
|
|
1403
|
+
var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
|
|
1404
|
+
var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
|
|
1405
|
+
return rawCountries.map(function (item) {
|
|
1406
|
+
var _item$percentage, _ref, _ref2, _item$value;
|
|
1407
|
+
return {
|
|
1408
|
+
country: item.countryName || item.country || item.name || "Unknown",
|
|
1409
|
+
percentage: typeof item.percentage === "number" ? item.percentage : Number((_item$percentage = item.percentage) !== null && _item$percentage !== void 0 ? _item$percentage : 0),
|
|
1410
|
+
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
|
|
1411
|
+
};
|
|
1412
|
+
});
|
|
1413
|
+
};
|
|
1358
1414
|
var getActiveFilterChips = function getActiveFilterChips(apiData) {
|
|
1359
1415
|
if (Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.activeFilterChips) && apiData.activeFilterChips.length) {
|
|
1360
1416
|
return apiData.activeFilterChips;
|
|
@@ -1566,7 +1622,9 @@ var buildReportData = function buildReportData() {
|
|
|
1566
1622
|
},
|
|
1567
1623
|
activeCampaigns: activeCampaigns,
|
|
1568
1624
|
donationTypeData: (apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData) || [],
|
|
1625
|
+
donationTypeTotals: parseDonationTypeTotals(apiData === null || apiData === void 0 ? void 0 : apiData.recurringBarChartData),
|
|
1569
1626
|
donorGeographyData: (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [],
|
|
1627
|
+
donorGeographyList: parseDonorGeographyList(apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography),
|
|
1570
1628
|
trafficSourceData: (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSourceData) || [],
|
|
1571
1629
|
orderBumpData: (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpDetails) || [],
|
|
1572
1630
|
upsellData: (apiData === null || apiData === void 0 ? void 0 : apiData.upSellDetails) || {},
|
|
@@ -1970,7 +2028,9 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
1970
2028
|
var _ref8$head = _ref8.head,
|
|
1971
2029
|
head = _ref8$head === void 0 ? [] : _ref8$head,
|
|
1972
2030
|
_ref8$rows = _ref8.rows,
|
|
1973
|
-
rows = _ref8$rows === void 0 ? [] : _ref8$rows
|
|
2031
|
+
rows = _ref8$rows === void 0 ? [] : _ref8$rows,
|
|
2032
|
+
_ref8$colAlign = _ref8.colAlign,
|
|
2033
|
+
colAlign = _ref8$colAlign === void 0 ? [] : _ref8$colAlign;
|
|
1974
2034
|
return /*#__PURE__*/jsxRuntime.jsxs("table", {
|
|
1975
2035
|
style: {
|
|
1976
2036
|
width: "100%",
|
|
@@ -1988,7 +2048,7 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
1988
2048
|
return /*#__PURE__*/jsxRuntime.jsx("th", {
|
|
1989
2049
|
style: {
|
|
1990
2050
|
padding: "4px 6px",
|
|
1991
|
-
textAlign: i === 0 ? "left" : "right",
|
|
2051
|
+
textAlign: colAlign[i] || (i === 0 ? "left" : "right"),
|
|
1992
2052
|
fontWeight: 700,
|
|
1993
2053
|
fontSize: 8.5,
|
|
1994
2054
|
letterSpacing: "0.3px",
|
|
@@ -2009,9 +2069,10 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
2009
2069
|
return /*#__PURE__*/jsxRuntime.jsx("td", {
|
|
2010
2070
|
style: {
|
|
2011
2071
|
padding: "4px 6px",
|
|
2012
|
-
textAlign: ci === 0 ? "left" : "right",
|
|
2072
|
+
textAlign: colAlign[ci] || (ci === 0 ? "left" : "right"),
|
|
2013
2073
|
color: "#334155",
|
|
2014
|
-
borderBottom: ri < rows.length - 1 ? "1px solid #EEF2F7" : "none"
|
|
2074
|
+
borderBottom: ri < rows.length - 1 ? "1px solid #EEF2F7" : "none",
|
|
2075
|
+
verticalAlign: "middle"
|
|
2015
2076
|
},
|
|
2016
2077
|
children: cell
|
|
2017
2078
|
}, ci);
|
|
@@ -2021,15 +2082,62 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
2021
2082
|
})]
|
|
2022
2083
|
});
|
|
2023
2084
|
};
|
|
2024
|
-
var
|
|
2025
|
-
var
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
_ref9$
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2085
|
+
var ProgressBar = function ProgressBar(_ref9) {
|
|
2086
|
+
var value = _ref9.value,
|
|
2087
|
+
_ref9$color = _ref9.color,
|
|
2088
|
+
color = _ref9$color === void 0 ? "rgb(99, 99, 230)" : _ref9$color,
|
|
2089
|
+
_ref9$height = _ref9.height,
|
|
2090
|
+
height = _ref9$height === void 0 ? 6 : _ref9$height;
|
|
2091
|
+
var pct = Math.min(100, Math.max(0, Number(value !== null && value !== void 0 ? value : 0)));
|
|
2092
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2093
|
+
style: {
|
|
2094
|
+
display: "flex",
|
|
2095
|
+
alignItems: "center",
|
|
2096
|
+
gap: 6,
|
|
2097
|
+
width: "100%"
|
|
2098
|
+
},
|
|
2099
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2100
|
+
style: {
|
|
2101
|
+
flex: 1,
|
|
2102
|
+
minWidth: 0
|
|
2103
|
+
},
|
|
2104
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2105
|
+
style: {
|
|
2106
|
+
height: height,
|
|
2107
|
+
background: "#F3F4F6",
|
|
2108
|
+
borderRadius: 4,
|
|
2109
|
+
overflow: "hidden"
|
|
2110
|
+
},
|
|
2111
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2112
|
+
style: {
|
|
2113
|
+
width: "".concat(pct, "%"),
|
|
2114
|
+
height: "100%",
|
|
2115
|
+
background: color,
|
|
2116
|
+
borderRadius: 4
|
|
2117
|
+
}
|
|
2118
|
+
})
|
|
2119
|
+
})
|
|
2120
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
2121
|
+
style: {
|
|
2122
|
+
fontSize: 9,
|
|
2123
|
+
color: "rgba(0, 0, 0, 0.4)",
|
|
2124
|
+
minWidth: 26,
|
|
2125
|
+
flexShrink: 0,
|
|
2126
|
+
textAlign: "right"
|
|
2127
|
+
},
|
|
2128
|
+
children: [pct, "%"]
|
|
2129
|
+
})]
|
|
2130
|
+
});
|
|
2131
|
+
};
|
|
2132
|
+
var KpiCard = function KpiCard(_ref0) {
|
|
2133
|
+
var title = _ref0.title,
|
|
2134
|
+
value = _ref0.value,
|
|
2135
|
+
trend = _ref0.trend,
|
|
2136
|
+
detail = _ref0.detail,
|
|
2137
|
+
_ref0$variant = _ref0.variant,
|
|
2138
|
+
variant = _ref0$variant === void 0 ? "secondary" : _ref0$variant,
|
|
2139
|
+
_ref0$trendPositiveWh = _ref0.trendPositiveWhenNegative,
|
|
2140
|
+
trendPositiveWhenNegative = _ref0$trendPositiveWh === void 0 ? false : _ref0$trendPositiveWh;
|
|
2033
2141
|
var displayTrend = withTrendArrow(trend);
|
|
2034
2142
|
var isPrimary = variant === "primary";
|
|
2035
2143
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -2080,10 +2188,10 @@ var KpiCard = function KpiCard(_ref9) {
|
|
|
2080
2188
|
})]
|
|
2081
2189
|
});
|
|
2082
2190
|
};
|
|
2083
|
-
var StatPair = function StatPair(
|
|
2084
|
-
var label =
|
|
2085
|
-
val =
|
|
2086
|
-
trend =
|
|
2191
|
+
var StatPair = function StatPair(_ref1) {
|
|
2192
|
+
var label = _ref1.label,
|
|
2193
|
+
val = _ref1.val,
|
|
2194
|
+
trend = _ref1.trend;
|
|
2087
2195
|
var displayTrend = withTrendArrow(trend);
|
|
2088
2196
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2089
2197
|
style: {
|
|
@@ -2120,12 +2228,12 @@ var StatPair = function StatPair(_ref0) {
|
|
|
2120
2228
|
})]
|
|
2121
2229
|
});
|
|
2122
2230
|
};
|
|
2123
|
-
var PageHeader = function PageHeader(
|
|
2124
|
-
var dateLabel =
|
|
2125
|
-
generatedLabel =
|
|
2126
|
-
activeFilters =
|
|
2127
|
-
page =
|
|
2128
|
-
windowLabel =
|
|
2231
|
+
var PageHeader = function PageHeader(_ref10) {
|
|
2232
|
+
var dateLabel = _ref10.dateLabel,
|
|
2233
|
+
generatedLabel = _ref10.generatedLabel,
|
|
2234
|
+
activeFilters = _ref10.activeFilters,
|
|
2235
|
+
page = _ref10.page,
|
|
2236
|
+
windowLabel = _ref10.windowLabel;
|
|
2129
2237
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2130
2238
|
style: {
|
|
2131
2239
|
padding: "22px ".concat(MX, "px 12px"),
|
|
@@ -2231,9 +2339,9 @@ var PageHeader = function PageHeader(_ref1) {
|
|
|
2231
2339
|
})]
|
|
2232
2340
|
});
|
|
2233
2341
|
};
|
|
2234
|
-
var PageFooter = function PageFooter(
|
|
2235
|
-
var generatedLabel =
|
|
2236
|
-
page =
|
|
2342
|
+
var PageFooter = function PageFooter(_ref11) {
|
|
2343
|
+
var generatedLabel = _ref11.generatedLabel,
|
|
2344
|
+
page = _ref11.page;
|
|
2237
2345
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2238
2346
|
style: {
|
|
2239
2347
|
padding: "7px ".concat(MX, "px"),
|
|
@@ -2253,16 +2361,16 @@ var PageFooter = function PageFooter(_ref10) {
|
|
|
2253
2361
|
};
|
|
2254
2362
|
|
|
2255
2363
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
2256
|
-
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (
|
|
2257
|
-
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,
|
|
2258
|
-
var
|
|
2259
|
-
apiData =
|
|
2260
|
-
|
|
2261
|
-
dateName =
|
|
2262
|
-
|
|
2263
|
-
numberOfDays =
|
|
2264
|
-
|
|
2265
|
-
activeFilters =
|
|
2364
|
+
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
2365
|
+
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;
|
|
2366
|
+
var _ref12$apiData = _ref12.apiData,
|
|
2367
|
+
apiData = _ref12$apiData === void 0 ? {} : _ref12$apiData,
|
|
2368
|
+
_ref12$dateName = _ref12.dateName,
|
|
2369
|
+
dateName = _ref12$dateName === void 0 ? "Last Period" : _ref12$dateName,
|
|
2370
|
+
_ref12$numberOfDays = _ref12.numberOfDays,
|
|
2371
|
+
numberOfDays = _ref12$numberOfDays === void 0 ? 30 : _ref12$numberOfDays,
|
|
2372
|
+
_ref12$activeFilters = _ref12.activeFilters,
|
|
2373
|
+
activeFilters = _ref12$activeFilters === void 0 ? [] : _ref12$activeFilters;
|
|
2266
2374
|
var now = new Date();
|
|
2267
2375
|
var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
|
|
2268
2376
|
var windowLabel = "".concat(numberOfDays, "-day window");
|
|
@@ -2317,7 +2425,8 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2317
2425
|
mainChart = report.mainChart,
|
|
2318
2426
|
growth = report.growth,
|
|
2319
2427
|
totalDonors = report.totalDonors,
|
|
2320
|
-
donorMix = report.donorMix
|
|
2428
|
+
donorMix = report.donorMix,
|
|
2429
|
+
activeCampaigns = report.activeCampaigns;
|
|
2321
2430
|
var overview = (apiData === null || apiData === void 0 || (_apiData$overviewStat = apiData.overviewStats) === null || _apiData$overviewStat === void 0 ? void 0 : _apiData$overviewStat.overview) || {};
|
|
2322
2431
|
var totalRaised = Number((_overview$totalRevenu = overview === null || overview === void 0 ? void 0 : overview.totalRevenue) !== null && _overview$totalRevenu !== void 0 ? _overview$totalRevenu : 240938);
|
|
2323
2432
|
var netRaised = Number((_overview$netRevenue = overview === null || overview === void 0 ? void 0 : overview.netRevenue) !== null && _overview$netRevenue !== void 0 ? _overview$netRevenue : 222300);
|
|
@@ -2335,43 +2444,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2335
2444
|
retPct = donorMix.retPct,
|
|
2336
2445
|
mixAvgGift = donorMix.avgGift,
|
|
2337
2446
|
donorMixPrev = donorMix.donorMixPrev;
|
|
2338
|
-
var
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
var oneTimeTotal = recData.length ? recData.reduce(function (s, i) {
|
|
2343
|
-
return s + Number(i.oneTime || i.oneTimeAmount || 0);
|
|
2344
|
-
}, 0) : 188001;
|
|
2345
|
-
var geoRaw = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
|
|
2346
|
-
var geoList = function () {
|
|
2347
|
-
var raw = Array.isArray(geoRaw) ? geoRaw : Array.isArray(geoRaw === null || geoRaw === void 0 ? void 0 : geoRaw.data) ? geoRaw.data : [];
|
|
2348
|
-
if (raw.length) return raw;
|
|
2349
|
-
return [{
|
|
2350
|
-
country: "United States",
|
|
2351
|
-
totalDonors: 78,
|
|
2352
|
-
percentage: 36
|
|
2353
|
-
}, {
|
|
2354
|
-
country: "United Kingdom",
|
|
2355
|
-
totalDonors: 42,
|
|
2356
|
-
percentage: 20
|
|
2357
|
-
}, {
|
|
2358
|
-
country: "Canada",
|
|
2359
|
-
totalDonors: 28,
|
|
2360
|
-
percentage: 13
|
|
2361
|
-
}, {
|
|
2362
|
-
country: "UAE",
|
|
2363
|
-
totalDonors: 24,
|
|
2364
|
-
percentage: 11
|
|
2365
|
-
}, {
|
|
2366
|
-
country: "Saudi Arabia",
|
|
2367
|
-
totalDonors: 19,
|
|
2368
|
-
percentage: 9
|
|
2369
|
-
}, {
|
|
2370
|
-
country: "Other",
|
|
2371
|
-
totalDonors: 24,
|
|
2372
|
-
percentage: 11
|
|
2373
|
-
}];
|
|
2374
|
-
}();
|
|
2447
|
+
var _report$donationTypeT = report.donationTypeTotals,
|
|
2448
|
+
recurringTotal = _report$donationTypeT.recurringTotal,
|
|
2449
|
+
oneTimeTotal = _report$donationTypeT.oneTimeTotal;
|
|
2450
|
+
var geoList = report.donorGeographyList;
|
|
2375
2451
|
var trafficItems = function (_apiData$trafficSourc) {
|
|
2376
2452
|
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 : [];
|
|
2377
2453
|
if (items.length) return items;
|
|
@@ -2441,6 +2517,9 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2441
2517
|
averageDonation: 1940,
|
|
2442
2518
|
status: "Active"
|
|
2443
2519
|
}];
|
|
2520
|
+
var campaignStatusByIndex = campaigns.map(function (c) {
|
|
2521
|
+
return c.status || "Active";
|
|
2522
|
+
});
|
|
2444
2523
|
var ob = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpDetails) || {};
|
|
2445
2524
|
var obData = ((ob === null || ob === void 0 ? void 0 : ob.chart) || []).map(function (i) {
|
|
2446
2525
|
return Number(i.revenue || 0);
|
|
@@ -2603,10 +2682,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2603
2682
|
gap: 14,
|
|
2604
2683
|
marginBottom: 6
|
|
2605
2684
|
},
|
|
2606
|
-
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (
|
|
2607
|
-
var
|
|
2608
|
-
name =
|
|
2609
|
-
color =
|
|
2685
|
+
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref13) {
|
|
2686
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
2687
|
+
name = _ref14[0],
|
|
2688
|
+
color = _ref14[1];
|
|
2610
2689
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2611
2690
|
style: {
|
|
2612
2691
|
display: "flex",
|
|
@@ -2670,11 +2749,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2670
2749
|
children: [/*#__PURE__*/jsxRuntime.jsx(Panel, {
|
|
2671
2750
|
title: "Active campaigns",
|
|
2672
2751
|
subtitle: "Live fundraisers ranked by velocity",
|
|
2673
|
-
action: "View all \u2192",
|
|
2674
2752
|
children: /*#__PURE__*/jsxRuntime.jsx(MiniTable, {
|
|
2675
2753
|
head: ["CAMPAIGN", "RAISED", "PROGRESS", "DONORS", "AVG GIFT", "STATUS"],
|
|
2676
|
-
|
|
2677
|
-
|
|
2754
|
+
colAlign: ["left", "right", "left", "right", "right", "right"],
|
|
2755
|
+
rows: activeCampaigns.map(function (c, i) {
|
|
2756
|
+
return [c.name, c.val1, /*#__PURE__*/jsxRuntime.jsx(ProgressBar, {
|
|
2757
|
+
value: c.progress
|
|
2758
|
+
}, "campaign-progress-".concat(i)), c.val3, c.val4, campaignStatusByIndex[i] || "Active"];
|
|
2678
2759
|
})
|
|
2679
2760
|
})
|
|
2680
2761
|
}), /*#__PURE__*/jsxRuntime.jsx(Panel, {
|
|
@@ -2769,7 +2850,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2769
2850
|
style: {
|
|
2770
2851
|
fontSize: 9
|
|
2771
2852
|
},
|
|
2772
|
-
children: "".concat(Number((
|
|
2853
|
+
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")
|
|
2773
2854
|
})
|
|
2774
2855
|
})]
|
|
2775
2856
|
})]
|
|
@@ -2886,13 +2967,13 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2886
2967
|
fontSize: 9,
|
|
2887
2968
|
color: "#374151"
|
|
2888
2969
|
},
|
|
2889
|
-
children: g.country
|
|
2970
|
+
children: g.country
|
|
2890
2971
|
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
2891
2972
|
style: {
|
|
2892
2973
|
fontSize: 9,
|
|
2893
2974
|
color: "#6B7280"
|
|
2894
2975
|
},
|
|
2895
|
-
children: [formatNumber(g.
|
|
2976
|
+
children: [formatNumber(g.value), " \xB7 ", formatNumber(g.percentage), "%"]
|
|
2896
2977
|
})]
|
|
2897
2978
|
}, i);
|
|
2898
2979
|
})
|
|
@@ -3025,10 +3106,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3025
3106
|
display: "flex",
|
|
3026
3107
|
gap: 12
|
|
3027
3108
|
},
|
|
3028
|
-
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 (
|
|
3029
|
-
var
|
|
3030
|
-
l =
|
|
3031
|
-
v =
|
|
3109
|
+
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) {
|
|
3110
|
+
var _ref17 = _slicedToArray(_ref16, 2),
|
|
3111
|
+
l = _ref17[0],
|
|
3112
|
+
v = _ref17[1];
|
|
3032
3113
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3033
3114
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3034
3115
|
style: {
|
|
@@ -3155,10 +3236,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3155
3236
|
display: "flex",
|
|
3156
3237
|
gap: 12
|
|
3157
3238
|
},
|
|
3158
|
-
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 (
|
|
3159
|
-
var
|
|
3160
|
-
l =
|
|
3161
|
-
v =
|
|
3239
|
+
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) {
|
|
3240
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
3241
|
+
l = _ref19[0],
|
|
3242
|
+
v = _ref19[1];
|
|
3162
3243
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3163
3244
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3164
3245
|
style: {
|
|
@@ -3301,7 +3382,8 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3301
3382
|
_ref$apiLoading = _ref.apiLoading,
|
|
3302
3383
|
apiLoading = _ref$apiLoading === void 0 ? false : _ref$apiLoading,
|
|
3303
3384
|
_ref$activeFilters = _ref.activeFilters,
|
|
3304
|
-
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters
|
|
3385
|
+
activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters,
|
|
3386
|
+
setExportLoading = _ref.setExportLoading;
|
|
3305
3387
|
var initialMetric = "Revenue";
|
|
3306
3388
|
var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
|
|
3307
3389
|
var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
|
|
@@ -3380,6 +3462,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3380
3462
|
case 6:
|
|
3381
3463
|
_context.p = 6;
|
|
3382
3464
|
setShowExportLayout(false);
|
|
3465
|
+
setExportLoading === null || setExportLoading === void 0 || setExportLoading(false);
|
|
3383
3466
|
return _context.f(6);
|
|
3384
3467
|
case 7:
|
|
3385
3468
|
return _context.a(2);
|
|
@@ -3391,7 +3474,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3391
3474
|
};
|
|
3392
3475
|
}();
|
|
3393
3476
|
doPdfExport();
|
|
3394
|
-
}, [showExportLayout, exportFiltersSnapshot]);
|
|
3477
|
+
}, [showExportLayout, exportFiltersSnapshot, setExportLoading]);
|
|
3395
3478
|
var currentData = metric === "Revenue" ? revenueData : donationsData;
|
|
3396
3479
|
var oneTimeData = (apiData === null || apiData === void 0 ? void 0 : apiData.oneTimeDonations) || [];
|
|
3397
3480
|
var oneTimeValues = oneTimeData.length > 0 ? oneTimeData.map(function (item) {
|