@ammarkhalidfarooq/dashboard-package 0.6.62 → 0.6.64
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 +412 -559
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +412 -559
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1327,6 +1327,287 @@ var MetricCard$1 = function MetricCard(_ref) {
|
|
|
1327
1327
|
});
|
|
1328
1328
|
};
|
|
1329
1329
|
|
|
1330
|
+
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
1331
|
+
var sx = _ref.sx,
|
|
1332
|
+
donationTypeData = _ref.donationTypeData,
|
|
1333
|
+
_ref$exportMode = _ref.exportMode,
|
|
1334
|
+
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode,
|
|
1335
|
+
_ref$subtitle = _ref.subtitle,
|
|
1336
|
+
subtitle = _ref$subtitle === void 0 ? "Donation type" : _ref$subtitle,
|
|
1337
|
+
chartHeight = _ref.chartHeight;
|
|
1338
|
+
var recurringColor = "rgb(99, 99, 230)";
|
|
1339
|
+
var oneTimeColor = "#10B981";
|
|
1340
|
+
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
1341
|
+
var categories = [];
|
|
1342
|
+
var series = [];
|
|
1343
|
+
var summaries = [];
|
|
1344
|
+
var title = "Donation Type";
|
|
1345
|
+
var isDistributed = false;
|
|
1346
|
+
if (donationTypeData && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
1347
|
+
// Time series recurring vs one-time format
|
|
1348
|
+
categories = donationTypeData.data.map(function (item) {
|
|
1349
|
+
return item.label || "";
|
|
1350
|
+
});
|
|
1351
|
+
series = [{
|
|
1352
|
+
name: "Recurring",
|
|
1353
|
+
data: donationTypeData.data.map(function (item) {
|
|
1354
|
+
return item.recurring || 0;
|
|
1355
|
+
})
|
|
1356
|
+
}, {
|
|
1357
|
+
name: "One-time",
|
|
1358
|
+
data: donationTypeData.data.map(function (item) {
|
|
1359
|
+
return item.oneTime || 0;
|
|
1360
|
+
})
|
|
1361
|
+
}];
|
|
1362
|
+
summaries = [{
|
|
1363
|
+
label: "Recurring",
|
|
1364
|
+
total: donationTypeData.totalRecurringDonations || 0,
|
|
1365
|
+
color: recurringColor
|
|
1366
|
+
}, {
|
|
1367
|
+
label: "One-time",
|
|
1368
|
+
total: donationTypeData.totalOneTimeDonations || 0,
|
|
1369
|
+
color: oneTimeColor
|
|
1370
|
+
}];
|
|
1371
|
+
title = "Recurring vs One-time";
|
|
1372
|
+
isDistributed = false;
|
|
1373
|
+
} else if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
1374
|
+
// New array format
|
|
1375
|
+
categories = donationTypeData.map(function (item) {
|
|
1376
|
+
return item.type || "";
|
|
1377
|
+
});
|
|
1378
|
+
series = [{
|
|
1379
|
+
name: "Amount",
|
|
1380
|
+
data: donationTypeData.map(function (item) {
|
|
1381
|
+
return item.totalAmount || 0;
|
|
1382
|
+
})
|
|
1383
|
+
}];
|
|
1384
|
+
summaries = donationTypeData.map(function (item, index) {
|
|
1385
|
+
return {
|
|
1386
|
+
label: item.type || "",
|
|
1387
|
+
total: item.totalAmount || 0,
|
|
1388
|
+
color: colors[index % colors.length]
|
|
1389
|
+
};
|
|
1390
|
+
});
|
|
1391
|
+
isDistributed = true;
|
|
1392
|
+
if (donationTypeData.length === 2) {
|
|
1393
|
+
title = "".concat(donationTypeData[0].type, " vs ").concat(donationTypeData[1].type);
|
|
1394
|
+
}
|
|
1395
|
+
} else {
|
|
1396
|
+
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
1397
|
+
// Object format, empty array, or missing data
|
|
1398
|
+
var dataObj = donationTypeData && _typeof(donationTypeData) === "object" && !Array.isArray(donationTypeData) ? donationTypeData : {};
|
|
1399
|
+
categories = dataObj.categories || [];
|
|
1400
|
+
var rawSeries = dataObj.series || [];
|
|
1401
|
+
if (rawSeries.length && categories.length) {
|
|
1402
|
+
series = rawSeries;
|
|
1403
|
+
} else {
|
|
1404
|
+
series = [{
|
|
1405
|
+
name: "Recurring",
|
|
1406
|
+
data: []
|
|
1407
|
+
}, {
|
|
1408
|
+
name: "One-time",
|
|
1409
|
+
data: []
|
|
1410
|
+
}];
|
|
1411
|
+
}
|
|
1412
|
+
summaries = [{
|
|
1413
|
+
label: (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.label) || "Recurring",
|
|
1414
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
1415
|
+
color: recurringColor
|
|
1416
|
+
}, {
|
|
1417
|
+
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary3 = dataObj.summary) === null || _dataObj$summary3 === void 0 || (_dataObj$summary3 = _dataObj$summary3.oneTime) === null || _dataObj$summary3 === void 0 ? void 0 : _dataObj$summary3.label) || "One-time",
|
|
1418
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary4 = dataObj.summary) === null || _dataObj$summary4 === void 0 || (_dataObj$summary4 = _dataObj$summary4.oneTime) === null || _dataObj$summary4 === void 0 ? void 0 : _dataObj$summary4.total) || 0,
|
|
1419
|
+
color: oneTimeColor
|
|
1420
|
+
}];
|
|
1421
|
+
title = "Recurring vs one-time";
|
|
1422
|
+
isDistributed = false;
|
|
1423
|
+
}
|
|
1424
|
+
var resolvedChartHeight = chartHeight !== null && chartHeight !== void 0 ? chartHeight : exportMode ? 110 : 170;
|
|
1425
|
+
var chartOptions = {
|
|
1426
|
+
chart: {
|
|
1427
|
+
type: "bar",
|
|
1428
|
+
toolbar: {
|
|
1429
|
+
show: false
|
|
1430
|
+
},
|
|
1431
|
+
zoom: {
|
|
1432
|
+
enabled: false
|
|
1433
|
+
},
|
|
1434
|
+
fontFamily: "Inter, sans-serif"
|
|
1435
|
+
},
|
|
1436
|
+
plotOptions: {
|
|
1437
|
+
bar: {
|
|
1438
|
+
horizontal: false,
|
|
1439
|
+
columnWidth: exportMode ? "68%" : "75%",
|
|
1440
|
+
borderRadius: exportMode ? 3 : 4,
|
|
1441
|
+
distributed: isDistributed,
|
|
1442
|
+
dataLabels: {
|
|
1443
|
+
position: "top"
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
dataLabels: {
|
|
1448
|
+
enabled: true,
|
|
1449
|
+
formatter: function formatter(val) {
|
|
1450
|
+
return "$".concat(formatNumber(val));
|
|
1451
|
+
},
|
|
1452
|
+
offsetY: exportMode ? -16 : -20,
|
|
1453
|
+
style: {
|
|
1454
|
+
fontSize: exportMode ? "7px" : "9px",
|
|
1455
|
+
fontWeight: 600,
|
|
1456
|
+
colors: ["#000"]
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
stroke: {
|
|
1460
|
+
show: true,
|
|
1461
|
+
width: 2,
|
|
1462
|
+
colors: ["transparent"]
|
|
1463
|
+
},
|
|
1464
|
+
xaxis: {
|
|
1465
|
+
categories: categories,
|
|
1466
|
+
axisBorder: {
|
|
1467
|
+
show: false
|
|
1468
|
+
},
|
|
1469
|
+
axisTicks: {
|
|
1470
|
+
show: false
|
|
1471
|
+
},
|
|
1472
|
+
labels: {
|
|
1473
|
+
style: {
|
|
1474
|
+
colors: "rgba(0, 0, 0, 0.4)",
|
|
1475
|
+
fontSize: exportMode ? "8px" : "11px"
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
yaxis: {
|
|
1480
|
+
min: 0,
|
|
1481
|
+
tickAmount: exportMode ? 3 : 4,
|
|
1482
|
+
labels: {
|
|
1483
|
+
formatter: function formatter(val) {
|
|
1484
|
+
return "$".concat(formatNumber(val));
|
|
1485
|
+
},
|
|
1486
|
+
style: {
|
|
1487
|
+
colors: "rgba(0, 0, 0, 0.4)",
|
|
1488
|
+
fontSize: exportMode ? "8px" : "10px"
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
fill: {
|
|
1493
|
+
opacity: 1
|
|
1494
|
+
},
|
|
1495
|
+
colors: colors,
|
|
1496
|
+
grid: {
|
|
1497
|
+
borderColor: "#f1f1f1",
|
|
1498
|
+
strokeDashArray: 4,
|
|
1499
|
+
padding: {
|
|
1500
|
+
left: 0,
|
|
1501
|
+
right: 0
|
|
1502
|
+
},
|
|
1503
|
+
yaxis: {
|
|
1504
|
+
lines: {
|
|
1505
|
+
show: true
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
legend: {
|
|
1510
|
+
show: false
|
|
1511
|
+
},
|
|
1512
|
+
tooltip: {
|
|
1513
|
+
y: {
|
|
1514
|
+
formatter: function formatter(val) {
|
|
1515
|
+
return "$".concat(formatNumber(val));
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
return /*#__PURE__*/jsxs(Card, {
|
|
1521
|
+
sx: _objectSpread2({
|
|
1522
|
+
bgcolor: "#fff",
|
|
1523
|
+
borderRadius: exportMode ? 2 : 4,
|
|
1524
|
+
border: exportMode ? "1px solid #DDE3EA" : "1px solid #f0f0f0",
|
|
1525
|
+
boxShadow: exportMode ? "0 1px 0 rgba(15,23,42,0.03)" : "0 4px 24px rgba(0,0,0,0.06)",
|
|
1526
|
+
p: exportMode ? 1.5 : 3,
|
|
1527
|
+
height: exportMode ? "100%" : "auto",
|
|
1528
|
+
boxSizing: "border-box"
|
|
1529
|
+
}, sx),
|
|
1530
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
1531
|
+
sx: {
|
|
1532
|
+
display: "flex",
|
|
1533
|
+
flexDirection: "column"
|
|
1534
|
+
},
|
|
1535
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
1536
|
+
sx: {
|
|
1537
|
+
textAlign: "left"
|
|
1538
|
+
},
|
|
1539
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1540
|
+
sx: {
|
|
1541
|
+
fontWeight: 700,
|
|
1542
|
+
fontSize: exportMode ? "12px" : "18px",
|
|
1543
|
+
color: "#000",
|
|
1544
|
+
lineHeight: 1.15
|
|
1545
|
+
},
|
|
1546
|
+
children: title
|
|
1547
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1548
|
+
sx: {
|
|
1549
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1550
|
+
color: exportMode ? "#94A3B8" : "rgba(0, 0, 0, 0.4)",
|
|
1551
|
+
lineHeight: 1.15
|
|
1552
|
+
},
|
|
1553
|
+
children: subtitle
|
|
1554
|
+
})]
|
|
1555
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
1556
|
+
sx: {
|
|
1557
|
+
display: "flex",
|
|
1558
|
+
gap: exportMode ? 1 : 1.5,
|
|
1559
|
+
mt: exportMode ? 0.75 : 0.5,
|
|
1560
|
+
flexWrap: "wrap"
|
|
1561
|
+
},
|
|
1562
|
+
children: summaries.map(function (item, index) {
|
|
1563
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
1564
|
+
sx: {
|
|
1565
|
+
display: "flex",
|
|
1566
|
+
alignItems: "center",
|
|
1567
|
+
gap: 0.5
|
|
1568
|
+
},
|
|
1569
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
1570
|
+
sx: {
|
|
1571
|
+
width: exportMode ? 6 : 8,
|
|
1572
|
+
height: exportMode ? 6 : 8,
|
|
1573
|
+
bgcolor: item.color,
|
|
1574
|
+
borderRadius: "50%"
|
|
1575
|
+
}
|
|
1576
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1577
|
+
sx: {
|
|
1578
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1579
|
+
color: exportMode ? "#374151" : "rgba(0, 0, 0, 0.5)",
|
|
1580
|
+
fontWeight: 500
|
|
1581
|
+
},
|
|
1582
|
+
children: item.label
|
|
1583
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
1584
|
+
sx: {
|
|
1585
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1586
|
+
fontWeight: exportMode ? 700 : 600,
|
|
1587
|
+
color: "#000"
|
|
1588
|
+
},
|
|
1589
|
+
children: ["$", formatNumber(item.total || 0)]
|
|
1590
|
+
})]
|
|
1591
|
+
}, item.label || index);
|
|
1592
|
+
})
|
|
1593
|
+
})]
|
|
1594
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
1595
|
+
sx: {
|
|
1596
|
+
height: resolvedChartHeight,
|
|
1597
|
+
width: exportMode ? "calc(100% + 24px)" : "calc(100% + 48px)",
|
|
1598
|
+
ml: exportMode ? -1.5 : -3,
|
|
1599
|
+
mr: exportMode ? -1.5 : -3
|
|
1600
|
+
},
|
|
1601
|
+
children: /*#__PURE__*/jsx(ReactApexChart, {
|
|
1602
|
+
options: chartOptions,
|
|
1603
|
+
series: series,
|
|
1604
|
+
type: "bar",
|
|
1605
|
+
height: "100%"
|
|
1606
|
+
})
|
|
1607
|
+
})]
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1330
1611
|
var PURPLE = "#6363E6";
|
|
1331
1612
|
var REPORT_COLORS = {
|
|
1332
1613
|
purple: PURPLE};
|
|
@@ -1635,7 +1916,6 @@ var buildReportData = function buildReportData() {
|
|
|
1635
1916
|
var W = 794;
|
|
1636
1917
|
var MIN_H = 1123;
|
|
1637
1918
|
var MX = 32; // horizontal margin
|
|
1638
|
-
var CW = W - MX * 2; // 730 px usable width
|
|
1639
1919
|
var THEME = {
|
|
1640
1920
|
pageBg: "#F8FAFC",
|
|
1641
1921
|
panelBg: "#FFFFFF",
|
|
@@ -1805,120 +2085,14 @@ var Sparkline = function Sparkline(_ref3) {
|
|
|
1805
2085
|
});
|
|
1806
2086
|
};
|
|
1807
2087
|
|
|
1808
|
-
// ─── SVG multi-series line chart ──────────────────────────────────────────────
|
|
1809
|
-
var LineChart = function LineChart(_ref4) {
|
|
1810
|
-
var _ref4$series = _ref4.series,
|
|
1811
|
-
series = _ref4$series === void 0 ? [] : _ref4$series,
|
|
1812
|
-
_ref4$categories = _ref4.categories,
|
|
1813
|
-
categories = _ref4$categories === void 0 ? [] : _ref4$categories,
|
|
1814
|
-
_ref4$width = _ref4.width,
|
|
1815
|
-
width = _ref4$width === void 0 ? CW : _ref4$width,
|
|
1816
|
-
_ref4$height = _ref4.height,
|
|
1817
|
-
height = _ref4$height === void 0 ? 180 : _ref4$height;
|
|
1818
|
-
var allVals = series.flatMap(function (s) {
|
|
1819
|
-
return s.data || [];
|
|
1820
|
-
});
|
|
1821
|
-
if (!allVals.length) {
|
|
1822
|
-
return /*#__PURE__*/jsx("div", {
|
|
1823
|
-
style: {
|
|
1824
|
-
height: height,
|
|
1825
|
-
background: THEME.tableAltBg,
|
|
1826
|
-
borderRadius: 6
|
|
1827
|
-
}
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
var COLORS = ["#6366F1", "#10B981", "#06B6D4"];
|
|
1831
|
-
var seriesColor = function seriesColor(name) {
|
|
1832
|
-
if (/email/i.test(name)) return COLORS[2];
|
|
1833
|
-
if (/organic/i.test(name)) return COLORS[1];
|
|
1834
|
-
return COLORS[0];
|
|
1835
|
-
};
|
|
1836
|
-
var PL = 46,
|
|
1837
|
-
PR = 8,
|
|
1838
|
-
PT = 8,
|
|
1839
|
-
PB = 22;
|
|
1840
|
-
var IW = width - PL - PR;
|
|
1841
|
-
var IH = height - PT - PB;
|
|
1842
|
-
var max = Math.max.apply(Math, _toConsumableArray(allVals).concat([0]));
|
|
1843
|
-
var min = 0;
|
|
1844
|
-
var range = max - min || 1;
|
|
1845
|
-
var xp = function xp(i, n) {
|
|
1846
|
-
return PL + i / Math.max(n - 1, 1) * IW;
|
|
1847
|
-
};
|
|
1848
|
-
var yp = function yp(v) {
|
|
1849
|
-
return PT + IH - (v - min) / range * IH;
|
|
1850
|
-
};
|
|
1851
|
-
var yTicks = [0, 0.25, 0.5, 0.75, 1].map(function (t) {
|
|
1852
|
-
return min + t * range;
|
|
1853
|
-
});
|
|
1854
|
-
var step = Math.max(1, Math.floor(categories.length / 6));
|
|
1855
|
-
var shownCats = categories.filter(function (_, i) {
|
|
1856
|
-
return i % step === 0 || i === categories.length - 1;
|
|
1857
|
-
});
|
|
1858
|
-
return /*#__PURE__*/jsxs("svg", {
|
|
1859
|
-
width: width,
|
|
1860
|
-
height: height,
|
|
1861
|
-
style: {
|
|
1862
|
-
display: "block"
|
|
1863
|
-
},
|
|
1864
|
-
children: [yTicks.map(function (v, i) {
|
|
1865
|
-
var y = yp(v);
|
|
1866
|
-
var label = v >= 10000 ? "$".concat((v / 1000).toFixed(0), "K") : v >= 1000 ? "$".concat((v / 1000).toFixed(1), "K") : "$".concat(v.toFixed(0));
|
|
1867
|
-
return /*#__PURE__*/jsxs("g", {
|
|
1868
|
-
children: [/*#__PURE__*/jsx("line", {
|
|
1869
|
-
x1: PL,
|
|
1870
|
-
y1: y,
|
|
1871
|
-
x2: width - PR,
|
|
1872
|
-
y2: y,
|
|
1873
|
-
stroke: "#E5EAF1",
|
|
1874
|
-
strokeWidth: 1
|
|
1875
|
-
}), /*#__PURE__*/jsx("text", {
|
|
1876
|
-
x: PL - 4,
|
|
1877
|
-
y: y + 3.5,
|
|
1878
|
-
textAnchor: "end",
|
|
1879
|
-
fontSize: 9,
|
|
1880
|
-
fill: THEME.muted,
|
|
1881
|
-
children: label
|
|
1882
|
-
})]
|
|
1883
|
-
}, i);
|
|
1884
|
-
}), series.map(function (s, si) {
|
|
1885
|
-
var data = s.data || [];
|
|
1886
|
-
if (!data.length) return null;
|
|
1887
|
-
var points = data.map(function (v, i) {
|
|
1888
|
-
return [xp(i, data.length), yp(v)];
|
|
1889
|
-
});
|
|
1890
|
-
var pathD = buildSmoothPath(points);
|
|
1891
|
-
return /*#__PURE__*/jsx("path", {
|
|
1892
|
-
d: pathD,
|
|
1893
|
-
fill: "none",
|
|
1894
|
-
stroke: seriesColor(s.name),
|
|
1895
|
-
strokeWidth: 2,
|
|
1896
|
-
strokeLinecap: "round",
|
|
1897
|
-
strokeLinejoin: "round"
|
|
1898
|
-
}, si);
|
|
1899
|
-
}), shownCats.map(function (label, i) {
|
|
1900
|
-
var origIdx = categories.indexOf(label);
|
|
1901
|
-
var x = xp(origIdx < 0 ? i * step : origIdx, categories.length);
|
|
1902
|
-
return /*#__PURE__*/jsx("text", {
|
|
1903
|
-
x: x,
|
|
1904
|
-
y: height - 5,
|
|
1905
|
-
textAnchor: "middle",
|
|
1906
|
-
fontSize: 9,
|
|
1907
|
-
fill: THEME.muted,
|
|
1908
|
-
children: label
|
|
1909
|
-
}, i);
|
|
1910
|
-
})]
|
|
1911
|
-
});
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
2088
|
// ─── SVG donut ────────────────────────────────────────────────────────────────
|
|
1915
|
-
var Donut = function Donut(
|
|
1916
|
-
var
|
|
1917
|
-
segments =
|
|
1918
|
-
|
|
1919
|
-
size =
|
|
1920
|
-
centerVal =
|
|
1921
|
-
centerLabel =
|
|
2089
|
+
var Donut = function Donut(_ref4) {
|
|
2090
|
+
var _ref4$segments = _ref4.segments,
|
|
2091
|
+
segments = _ref4$segments === void 0 ? [] : _ref4$segments,
|
|
2092
|
+
_ref4$size = _ref4.size,
|
|
2093
|
+
size = _ref4$size === void 0 ? 88 : _ref4$size,
|
|
2094
|
+
centerVal = _ref4.centerVal,
|
|
2095
|
+
centerLabel = _ref4.centerLabel;
|
|
1922
2096
|
var total = segments.reduce(function (s, g) {
|
|
1923
2097
|
return s + (g.value || 0);
|
|
1924
2098
|
}, 0) || 1;
|
|
@@ -1976,11 +2150,11 @@ var Donut = function Donut(_ref5) {
|
|
|
1976
2150
|
};
|
|
1977
2151
|
|
|
1978
2152
|
// ─── Shared primitives ────────────────────────────────────────────────────────
|
|
1979
|
-
var Divider = function Divider(
|
|
1980
|
-
var
|
|
1981
|
-
mt =
|
|
1982
|
-
|
|
1983
|
-
mb =
|
|
2153
|
+
var Divider = function Divider(_ref5) {
|
|
2154
|
+
var _ref5$mt = _ref5.mt,
|
|
2155
|
+
mt = _ref5$mt === void 0 ? 0 : _ref5$mt,
|
|
2156
|
+
_ref5$mb = _ref5.mb,
|
|
2157
|
+
mb = _ref5$mb === void 0 ? 0 : _ref5$mb;
|
|
1984
2158
|
return /*#__PURE__*/jsx("div", {
|
|
1985
2159
|
style: {
|
|
1986
2160
|
borderTop: "1px solid #E5EAF1",
|
|
@@ -1989,13 +2163,13 @@ var Divider = function Divider(_ref6) {
|
|
|
1989
2163
|
}
|
|
1990
2164
|
});
|
|
1991
2165
|
};
|
|
1992
|
-
var Panel = function Panel(
|
|
1993
|
-
var children =
|
|
1994
|
-
title =
|
|
1995
|
-
subtitle =
|
|
1996
|
-
action =
|
|
1997
|
-
|
|
1998
|
-
style =
|
|
2166
|
+
var Panel = function Panel(_ref6) {
|
|
2167
|
+
var children = _ref6.children,
|
|
2168
|
+
title = _ref6.title,
|
|
2169
|
+
subtitle = _ref6.subtitle,
|
|
2170
|
+
action = _ref6.action,
|
|
2171
|
+
_ref6$style = _ref6.style,
|
|
2172
|
+
style = _ref6$style === void 0 ? {} : _ref6$style;
|
|
1999
2173
|
return /*#__PURE__*/jsxs("div", {
|
|
2000
2174
|
style: _objectSpread2({
|
|
2001
2175
|
border: "1px solid ".concat(THEME.panelBorder),
|
|
@@ -2044,13 +2218,13 @@ var Panel = function Panel(_ref7) {
|
|
|
2044
2218
|
}), children]
|
|
2045
2219
|
});
|
|
2046
2220
|
};
|
|
2047
|
-
var MiniTable = function MiniTable(
|
|
2048
|
-
var
|
|
2049
|
-
head =
|
|
2050
|
-
|
|
2051
|
-
rows =
|
|
2052
|
-
|
|
2053
|
-
colAlign =
|
|
2221
|
+
var MiniTable = function MiniTable(_ref7) {
|
|
2222
|
+
var _ref7$head = _ref7.head,
|
|
2223
|
+
head = _ref7$head === void 0 ? [] : _ref7$head,
|
|
2224
|
+
_ref7$rows = _ref7.rows,
|
|
2225
|
+
rows = _ref7$rows === void 0 ? [] : _ref7$rows,
|
|
2226
|
+
_ref7$colAlign = _ref7.colAlign,
|
|
2227
|
+
colAlign = _ref7$colAlign === void 0 ? [] : _ref7$colAlign;
|
|
2054
2228
|
return /*#__PURE__*/jsxs("table", {
|
|
2055
2229
|
style: {
|
|
2056
2230
|
width: "100%",
|
|
@@ -2102,12 +2276,12 @@ var MiniTable = function MiniTable(_ref8) {
|
|
|
2102
2276
|
})]
|
|
2103
2277
|
});
|
|
2104
2278
|
};
|
|
2105
|
-
var ProgressBar = function ProgressBar(
|
|
2106
|
-
var value =
|
|
2107
|
-
|
|
2108
|
-
color =
|
|
2109
|
-
|
|
2110
|
-
height =
|
|
2279
|
+
var ProgressBar = function ProgressBar(_ref8) {
|
|
2280
|
+
var value = _ref8.value,
|
|
2281
|
+
_ref8$color = _ref8.color,
|
|
2282
|
+
color = _ref8$color === void 0 ? "rgb(99, 99, 230)" : _ref8$color,
|
|
2283
|
+
_ref8$height = _ref8.height,
|
|
2284
|
+
height = _ref8$height === void 0 ? 6 : _ref8$height;
|
|
2111
2285
|
var pct = Math.max(0, Number(value !== null && value !== void 0 ? value : 0));
|
|
2112
2286
|
var barWidth = Math.min(100, pct);
|
|
2113
2287
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -2150,15 +2324,15 @@ var ProgressBar = function ProgressBar(_ref9) {
|
|
|
2150
2324
|
})]
|
|
2151
2325
|
});
|
|
2152
2326
|
};
|
|
2153
|
-
var KpiCard = function KpiCard(
|
|
2154
|
-
var title =
|
|
2155
|
-
value =
|
|
2156
|
-
trend =
|
|
2157
|
-
detail =
|
|
2158
|
-
|
|
2159
|
-
variant =
|
|
2160
|
-
|
|
2161
|
-
trendPositiveWhenNegative =
|
|
2327
|
+
var KpiCard = function KpiCard(_ref9) {
|
|
2328
|
+
var title = _ref9.title,
|
|
2329
|
+
value = _ref9.value,
|
|
2330
|
+
trend = _ref9.trend,
|
|
2331
|
+
detail = _ref9.detail,
|
|
2332
|
+
_ref9$variant = _ref9.variant,
|
|
2333
|
+
variant = _ref9$variant === void 0 ? "secondary" : _ref9$variant,
|
|
2334
|
+
_ref9$trendPositiveWh = _ref9.trendPositiveWhenNegative,
|
|
2335
|
+
trendPositiveWhenNegative = _ref9$trendPositiveWh === void 0 ? false : _ref9$trendPositiveWh;
|
|
2162
2336
|
var displayTrend = withTrendArrow(trend);
|
|
2163
2337
|
var isPrimary = variant === "primary";
|
|
2164
2338
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -2209,10 +2383,10 @@ var KpiCard = function KpiCard(_ref0) {
|
|
|
2209
2383
|
})]
|
|
2210
2384
|
});
|
|
2211
2385
|
};
|
|
2212
|
-
var StatPair = function StatPair(
|
|
2213
|
-
var label =
|
|
2214
|
-
val =
|
|
2215
|
-
trend =
|
|
2386
|
+
var StatPair = function StatPair(_ref0) {
|
|
2387
|
+
var label = _ref0.label,
|
|
2388
|
+
val = _ref0.val,
|
|
2389
|
+
trend = _ref0.trend;
|
|
2216
2390
|
var displayTrend = withTrendArrow(trend);
|
|
2217
2391
|
return /*#__PURE__*/jsxs("div", {
|
|
2218
2392
|
style: {
|
|
@@ -2249,12 +2423,12 @@ var StatPair = function StatPair(_ref1) {
|
|
|
2249
2423
|
})]
|
|
2250
2424
|
});
|
|
2251
2425
|
};
|
|
2252
|
-
var PageHeader = function PageHeader(
|
|
2253
|
-
var dateLabel =
|
|
2254
|
-
generatedLabel =
|
|
2255
|
-
activeFilters =
|
|
2256
|
-
page =
|
|
2257
|
-
windowLabel =
|
|
2426
|
+
var PageHeader = function PageHeader(_ref1) {
|
|
2427
|
+
var dateLabel = _ref1.dateLabel,
|
|
2428
|
+
generatedLabel = _ref1.generatedLabel,
|
|
2429
|
+
activeFilters = _ref1.activeFilters,
|
|
2430
|
+
page = _ref1.page,
|
|
2431
|
+
windowLabel = _ref1.windowLabel;
|
|
2258
2432
|
return /*#__PURE__*/jsxs("div", {
|
|
2259
2433
|
style: {
|
|
2260
2434
|
padding: "22px ".concat(MX, "px 12px"),
|
|
@@ -2360,9 +2534,9 @@ var PageHeader = function PageHeader(_ref10) {
|
|
|
2360
2534
|
})]
|
|
2361
2535
|
});
|
|
2362
2536
|
};
|
|
2363
|
-
var PageFooter = function PageFooter(
|
|
2364
|
-
var generatedLabel =
|
|
2365
|
-
page =
|
|
2537
|
+
var PageFooter = function PageFooter(_ref10) {
|
|
2538
|
+
var generatedLabel = _ref10.generatedLabel,
|
|
2539
|
+
page = _ref10.page;
|
|
2366
2540
|
return /*#__PURE__*/jsx("div", {
|
|
2367
2541
|
style: {
|
|
2368
2542
|
padding: "7px ".concat(MX, "px"),
|
|
@@ -2382,16 +2556,16 @@ var PageFooter = function PageFooter(_ref11) {
|
|
|
2382
2556
|
};
|
|
2383
2557
|
|
|
2384
2558
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
2385
|
-
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (
|
|
2386
|
-
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,
|
|
2387
|
-
var
|
|
2388
|
-
apiData =
|
|
2389
|
-
|
|
2390
|
-
dateName =
|
|
2391
|
-
|
|
2392
|
-
numberOfDays =
|
|
2393
|
-
|
|
2394
|
-
activeFilters =
|
|
2559
|
+
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
2560
|
+
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, _mainChart$stacked, _ref14, _refundsRaw$refundRat2, _ob$growthPercentage, _ob$peakDay, _refCard$growthPercen;
|
|
2561
|
+
var _ref11$apiData = _ref11.apiData,
|
|
2562
|
+
apiData = _ref11$apiData === void 0 ? {} : _ref11$apiData,
|
|
2563
|
+
_ref11$dateName = _ref11.dateName,
|
|
2564
|
+
dateName = _ref11$dateName === void 0 ? "Last Period" : _ref11$dateName,
|
|
2565
|
+
_ref11$numberOfDays = _ref11.numberOfDays,
|
|
2566
|
+
numberOfDays = _ref11$numberOfDays === void 0 ? 30 : _ref11$numberOfDays,
|
|
2567
|
+
_ref11$activeFilters = _ref11.activeFilters,
|
|
2568
|
+
activeFilters = _ref11$activeFilters === void 0 ? [] : _ref11$activeFilters;
|
|
2395
2569
|
var now = new Date();
|
|
2396
2570
|
var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
|
|
2397
2571
|
var windowLabel = "".concat(numberOfDays, "-day window");
|
|
@@ -2465,9 +2639,6 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
2465
2639
|
retPct = donorMix.retPct,
|
|
2466
2640
|
mixAvgGift = donorMix.avgGift,
|
|
2467
2641
|
donorMixPrev = donorMix.donorMixPrev;
|
|
2468
|
-
var _report$donationTypeT = report.donationTypeTotals,
|
|
2469
|
-
recurringTotal = _report$donationTypeT.recurringTotal,
|
|
2470
|
-
oneTimeTotal = _report$donationTypeT.oneTimeTotal;
|
|
2471
2642
|
var geoList = report.donorGeographyList;
|
|
2472
2643
|
var trafficItems = function (_apiData$trafficSourc) {
|
|
2473
2644
|
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 : [];
|
|
@@ -2703,10 +2874,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
2703
2874
|
gap: 14,
|
|
2704
2875
|
marginBottom: 6
|
|
2705
2876
|
},
|
|
2706
|
-
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (
|
|
2707
|
-
var
|
|
2708
|
-
name =
|
|
2709
|
-
color =
|
|
2877
|
+
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref12) {
|
|
2878
|
+
var _ref13 = _slicedToArray(_ref12, 2),
|
|
2879
|
+
name = _ref13[0],
|
|
2880
|
+
color = _ref13[1];
|
|
2710
2881
|
return /*#__PURE__*/jsxs("div", {
|
|
2711
2882
|
style: {
|
|
2712
2883
|
display: "flex",
|
|
@@ -2729,11 +2900,22 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
2729
2900
|
})]
|
|
2730
2901
|
}, name);
|
|
2731
2902
|
})
|
|
2732
|
-
}), /*#__PURE__*/jsx(
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2903
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2904
|
+
style: {
|
|
2905
|
+
width: "100%",
|
|
2906
|
+
minHeight: 300
|
|
2907
|
+
},
|
|
2908
|
+
children: /*#__PURE__*/jsx(RevenueChart, {
|
|
2909
|
+
id: "pdf-total-revenue-trend",
|
|
2910
|
+
metric: "Revenue",
|
|
2911
|
+
series: revSeries,
|
|
2912
|
+
categories: revCats,
|
|
2913
|
+
height: 300,
|
|
2914
|
+
stacked: (_mainChart$stacked = mainChart.stacked) !== null && _mainChart$stacked !== void 0 ? _mainChart$stacked : true,
|
|
2915
|
+
type: "area",
|
|
2916
|
+
colors: mainChart.colors || ["#6366F1", "#10B981", "#06B6D4"],
|
|
2917
|
+
showLegend: false
|
|
2918
|
+
})
|
|
2737
2919
|
})]
|
|
2738
2920
|
})]
|
|
2739
2921
|
}), /*#__PURE__*/jsx(PageFooter, {
|
|
@@ -2871,7 +3053,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
2871
3053
|
style: {
|
|
2872
3054
|
fontSize: 9
|
|
2873
3055
|
},
|
|
2874
|
-
children: "".concat(Number((
|
|
3056
|
+
children: "".concat(Number((_ref14 = donorMixPrev !== null && donorMixPrev !== void 0 ? donorMixPrev : growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _ref14 !== void 0 ? _ref14 : 0).toFixed(2), "% vs pp")
|
|
2875
3057
|
})
|
|
2876
3058
|
})]
|
|
2877
3059
|
})]
|
|
@@ -2883,95 +3065,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
2883
3065
|
gridTemplateColumns: "repeat(4, 1fr)",
|
|
2884
3066
|
gap: 8
|
|
2885
3067
|
},
|
|
2886
|
-
children: [/*#__PURE__*/jsx(
|
|
2887
|
-
|
|
3068
|
+
children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
|
|
3069
|
+
exportMode: true,
|
|
2888
3070
|
subtitle: "Donation type \xB7 weekly",
|
|
2889
|
-
|
|
2890
|
-
var tot = recurringTotal + oneTimeTotal || 1;
|
|
2891
|
-
var rPct = recurringTotal / tot * 100;
|
|
2892
|
-
var oPct = oneTimeTotal / tot * 100;
|
|
2893
|
-
return /*#__PURE__*/jsxs("div", {
|
|
2894
|
-
style: {
|
|
2895
|
-
display: "flex",
|
|
2896
|
-
flexDirection: "column",
|
|
2897
|
-
gap: 9,
|
|
2898
|
-
marginTop: 4
|
|
2899
|
-
},
|
|
2900
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2901
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2902
|
-
style: {
|
|
2903
|
-
display: "flex",
|
|
2904
|
-
justifyContent: "space-between",
|
|
2905
|
-
marginBottom: 3
|
|
2906
|
-
},
|
|
2907
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
2908
|
-
style: {
|
|
2909
|
-
fontSize: 9.5,
|
|
2910
|
-
color: "#374151"
|
|
2911
|
-
},
|
|
2912
|
-
children: "Recurring"
|
|
2913
|
-
}), /*#__PURE__*/jsx("span", {
|
|
2914
|
-
style: {
|
|
2915
|
-
fontSize: 9.5,
|
|
2916
|
-
fontWeight: 700,
|
|
2917
|
-
color: "#111827"
|
|
2918
|
-
},
|
|
2919
|
-
children: d$(recurringTotal)
|
|
2920
|
-
})]
|
|
2921
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2922
|
-
style: {
|
|
2923
|
-
height: 9,
|
|
2924
|
-
background: "#EEF2FF",
|
|
2925
|
-
borderRadius: 3
|
|
2926
|
-
},
|
|
2927
|
-
children: /*#__PURE__*/jsx("div", {
|
|
2928
|
-
style: {
|
|
2929
|
-
width: "".concat(rPct, "%"),
|
|
2930
|
-
height: "100%",
|
|
2931
|
-
background: C.indigo,
|
|
2932
|
-
borderRadius: 3
|
|
2933
|
-
}
|
|
2934
|
-
})
|
|
2935
|
-
})]
|
|
2936
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
2937
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2938
|
-
style: {
|
|
2939
|
-
display: "flex",
|
|
2940
|
-
justifyContent: "space-between",
|
|
2941
|
-
marginBottom: 3
|
|
2942
|
-
},
|
|
2943
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
2944
|
-
style: {
|
|
2945
|
-
fontSize: 9.5,
|
|
2946
|
-
color: "#374151"
|
|
2947
|
-
},
|
|
2948
|
-
children: "One-time"
|
|
2949
|
-
}), /*#__PURE__*/jsx("span", {
|
|
2950
|
-
style: {
|
|
2951
|
-
fontSize: 9.5,
|
|
2952
|
-
fontWeight: 700,
|
|
2953
|
-
color: "#111827"
|
|
2954
|
-
},
|
|
2955
|
-
children: d$(oneTimeTotal)
|
|
2956
|
-
})]
|
|
2957
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2958
|
-
style: {
|
|
2959
|
-
height: 9,
|
|
2960
|
-
background: "#EEF2FF",
|
|
2961
|
-
borderRadius: 3
|
|
2962
|
-
},
|
|
2963
|
-
children: /*#__PURE__*/jsx("div", {
|
|
2964
|
-
style: {
|
|
2965
|
-
width: "".concat(oPct, "%"),
|
|
2966
|
-
height: "100%",
|
|
2967
|
-
background: "#C7D2FE",
|
|
2968
|
-
borderRadius: 3
|
|
2969
|
-
}
|
|
2970
|
-
})
|
|
2971
|
-
})]
|
|
2972
|
-
})]
|
|
2973
|
-
});
|
|
2974
|
-
}()
|
|
3071
|
+
donationTypeData: report.donationTypeData
|
|
2975
3072
|
}), /*#__PURE__*/jsx(Panel, {
|
|
2976
3073
|
title: "Donor geography",
|
|
2977
3074
|
subtitle: "Top countries \xB7 ".concat(formatNumber(totalDonors), " total"),
|
|
@@ -3127,10 +3224,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
3127
3224
|
display: "flex",
|
|
3128
3225
|
gap: 12
|
|
3129
3226
|
},
|
|
3130
|
-
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 (
|
|
3131
|
-
var
|
|
3132
|
-
l =
|
|
3133
|
-
v =
|
|
3227
|
+
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 (_ref15) {
|
|
3228
|
+
var _ref16 = _slicedToArray(_ref15, 2),
|
|
3229
|
+
l = _ref16[0],
|
|
3230
|
+
v = _ref16[1];
|
|
3134
3231
|
return /*#__PURE__*/jsxs("div", {
|
|
3135
3232
|
children: [/*#__PURE__*/jsx("div", {
|
|
3136
3233
|
style: {
|
|
@@ -3257,10 +3354,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref12, ref) {
|
|
|
3257
3354
|
display: "flex",
|
|
3258
3355
|
gap: 12
|
|
3259
3356
|
},
|
|
3260
|
-
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 (
|
|
3261
|
-
var
|
|
3262
|
-
l =
|
|
3263
|
-
v =
|
|
3357
|
+
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 (_ref17) {
|
|
3358
|
+
var _ref18 = _slicedToArray(_ref17, 2),
|
|
3359
|
+
l = _ref18[0],
|
|
3360
|
+
v = _ref18[1];
|
|
3264
3361
|
return /*#__PURE__*/jsxs("div", {
|
|
3265
3362
|
children: [/*#__PURE__*/jsx("div", {
|
|
3266
3363
|
style: {
|
|
@@ -3446,7 +3543,7 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3446
3543
|
if (!showExportLayout) return;
|
|
3447
3544
|
var doPdfExport = /*#__PURE__*/function () {
|
|
3448
3545
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
3449
|
-
var container, safeDate, _t;
|
|
3546
|
+
var container, waitForCharts, safeDate, _t;
|
|
3450
3547
|
return _regenerator().w(function (_context) {
|
|
3451
3548
|
while (1) switch (_context.p = _context.n) {
|
|
3452
3549
|
case 0:
|
|
@@ -3458,37 +3555,55 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
3458
3555
|
});
|
|
3459
3556
|
});
|
|
3460
3557
|
case 1:
|
|
3461
|
-
_context.n = 2;
|
|
3462
|
-
return new Promise(function (r) {
|
|
3463
|
-
return setTimeout(r, 400);
|
|
3464
|
-
});
|
|
3465
|
-
case 2:
|
|
3466
3558
|
container = exportLayoutRef.current;
|
|
3467
3559
|
if (container) {
|
|
3468
|
-
_context.n =
|
|
3560
|
+
_context.n = 2;
|
|
3469
3561
|
break;
|
|
3470
3562
|
}
|
|
3471
3563
|
return _context.a(2);
|
|
3564
|
+
case 2:
|
|
3565
|
+
waitForCharts = function waitForCharts(root) {
|
|
3566
|
+
var timeoutMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4000;
|
|
3567
|
+
return new Promise(function (resolve) {
|
|
3568
|
+
var started = Date.now();
|
|
3569
|
+
var _check = function check() {
|
|
3570
|
+
var chartSvg = root.querySelector(".apexcharts-svg");
|
|
3571
|
+
if (chartSvg || Date.now() - started >= timeoutMs) {
|
|
3572
|
+
resolve();
|
|
3573
|
+
return;
|
|
3574
|
+
}
|
|
3575
|
+
requestAnimationFrame(_check);
|
|
3576
|
+
};
|
|
3577
|
+
_check();
|
|
3578
|
+
});
|
|
3579
|
+
};
|
|
3580
|
+
_context.n = 3;
|
|
3581
|
+
return waitForCharts(container);
|
|
3472
3582
|
case 3:
|
|
3473
|
-
safeDate = new Date().toISOString().slice(0, 10);
|
|
3474
3583
|
_context.n = 4;
|
|
3584
|
+
return new Promise(function (r) {
|
|
3585
|
+
return setTimeout(r, 300);
|
|
3586
|
+
});
|
|
3587
|
+
case 4:
|
|
3588
|
+
safeDate = new Date().toISOString().slice(0, 10);
|
|
3589
|
+
_context.n = 5;
|
|
3475
3590
|
return exportReportPdf(container, "DashboardOverview_report_".concat(safeDate, ".pdf"));
|
|
3476
|
-
case 4:
|
|
3477
|
-
_context.n = 6;
|
|
3478
|
-
break;
|
|
3479
3591
|
case 5:
|
|
3480
|
-
_context.
|
|
3481
|
-
|
|
3482
|
-
console.error("Failed to export overall dashboard PDF:", _t);
|
|
3592
|
+
_context.n = 7;
|
|
3593
|
+
break;
|
|
3483
3594
|
case 6:
|
|
3484
3595
|
_context.p = 6;
|
|
3596
|
+
_t = _context.v;
|
|
3597
|
+
console.error("Failed to export overall dashboard PDF:", _t);
|
|
3598
|
+
case 7:
|
|
3599
|
+
_context.p = 7;
|
|
3485
3600
|
setShowExportLayout(false);
|
|
3486
3601
|
setExportLoading === null || setExportLoading === void 0 || setExportLoading(false);
|
|
3487
|
-
return _context.f(
|
|
3488
|
-
case
|
|
3602
|
+
return _context.f(7);
|
|
3603
|
+
case 8:
|
|
3489
3604
|
return _context.a(2);
|
|
3490
3605
|
}
|
|
3491
|
-
}, _callee, null, [[0,
|
|
3606
|
+
}, _callee, null, [[0, 6, 7, 8]]);
|
|
3492
3607
|
}));
|
|
3493
3608
|
return function doPdfExport() {
|
|
3494
3609
|
return _ref2.apply(this, arguments);
|
|
@@ -4858,268 +4973,6 @@ var MetricDonutCard = function MetricDonutCard(_ref2) {
|
|
|
4858
4973
|
});
|
|
4859
4974
|
};
|
|
4860
4975
|
|
|
4861
|
-
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
4862
|
-
var sx = _ref.sx,
|
|
4863
|
-
donationTypeData = _ref.donationTypeData;
|
|
4864
|
-
var recurringColor = "rgb(99, 99, 230)";
|
|
4865
|
-
var oneTimeColor = "#10B981";
|
|
4866
|
-
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
4867
|
-
var categories = [];
|
|
4868
|
-
var series = [];
|
|
4869
|
-
var summaries = [];
|
|
4870
|
-
var title = "Donation Type";
|
|
4871
|
-
var isDistributed = false;
|
|
4872
|
-
if (donationTypeData && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
4873
|
-
// Time series recurring vs one-time format
|
|
4874
|
-
categories = donationTypeData.data.map(function (item) {
|
|
4875
|
-
return item.label || "";
|
|
4876
|
-
});
|
|
4877
|
-
series = [{
|
|
4878
|
-
name: "Recurring",
|
|
4879
|
-
data: donationTypeData.data.map(function (item) {
|
|
4880
|
-
return item.recurring || 0;
|
|
4881
|
-
})
|
|
4882
|
-
}, {
|
|
4883
|
-
name: "One-time",
|
|
4884
|
-
data: donationTypeData.data.map(function (item) {
|
|
4885
|
-
return item.oneTime || 0;
|
|
4886
|
-
})
|
|
4887
|
-
}];
|
|
4888
|
-
summaries = [{
|
|
4889
|
-
label: "Recurring",
|
|
4890
|
-
total: donationTypeData.totalRecurringDonations || 0,
|
|
4891
|
-
color: recurringColor
|
|
4892
|
-
}, {
|
|
4893
|
-
label: "One-time",
|
|
4894
|
-
total: donationTypeData.totalOneTimeDonations || 0,
|
|
4895
|
-
color: oneTimeColor
|
|
4896
|
-
}];
|
|
4897
|
-
title = "Recurring vs One-time";
|
|
4898
|
-
isDistributed = false;
|
|
4899
|
-
} else if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
4900
|
-
// New array format
|
|
4901
|
-
categories = donationTypeData.map(function (item) {
|
|
4902
|
-
return item.type || "";
|
|
4903
|
-
});
|
|
4904
|
-
series = [{
|
|
4905
|
-
name: "Amount",
|
|
4906
|
-
data: donationTypeData.map(function (item) {
|
|
4907
|
-
return item.totalAmount || 0;
|
|
4908
|
-
})
|
|
4909
|
-
}];
|
|
4910
|
-
summaries = donationTypeData.map(function (item, index) {
|
|
4911
|
-
return {
|
|
4912
|
-
label: item.type || "",
|
|
4913
|
-
total: item.totalAmount || 0,
|
|
4914
|
-
color: colors[index % colors.length]
|
|
4915
|
-
};
|
|
4916
|
-
});
|
|
4917
|
-
isDistributed = true;
|
|
4918
|
-
if (donationTypeData.length === 2) {
|
|
4919
|
-
title = "".concat(donationTypeData[0].type, " vs ").concat(donationTypeData[1].type);
|
|
4920
|
-
}
|
|
4921
|
-
} else {
|
|
4922
|
-
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
4923
|
-
// Object format or simple series array
|
|
4924
|
-
var dataObj = donationTypeData || {};
|
|
4925
|
-
categories = dataObj.categories || [];
|
|
4926
|
-
series = Array.isArray(donationTypeData) ? donationTypeData : dataObj.series || [];
|
|
4927
|
-
summaries = [{
|
|
4928
|
-
label: (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.label) || "Recurring",
|
|
4929
|
-
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
4930
|
-
color: recurringColor
|
|
4931
|
-
}, {
|
|
4932
|
-
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary3 = dataObj.summary) === null || _dataObj$summary3 === void 0 || (_dataObj$summary3 = _dataObj$summary3.oneTime) === null || _dataObj$summary3 === void 0 ? void 0 : _dataObj$summary3.label) || "One-time",
|
|
4933
|
-
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary4 = dataObj.summary) === null || _dataObj$summary4 === void 0 || (_dataObj$summary4 = _dataObj$summary4.oneTime) === null || _dataObj$summary4 === void 0 ? void 0 : _dataObj$summary4.total) || 0,
|
|
4934
|
-
color: oneTimeColor
|
|
4935
|
-
}];
|
|
4936
|
-
title = "Recurring vs one-time";
|
|
4937
|
-
isDistributed = false;
|
|
4938
|
-
}
|
|
4939
|
-
var chartOptions = {
|
|
4940
|
-
chart: {
|
|
4941
|
-
type: "bar",
|
|
4942
|
-
toolbar: {
|
|
4943
|
-
show: false
|
|
4944
|
-
},
|
|
4945
|
-
zoom: {
|
|
4946
|
-
enabled: false
|
|
4947
|
-
},
|
|
4948
|
-
fontFamily: "Inter, sans-serif"
|
|
4949
|
-
},
|
|
4950
|
-
plotOptions: {
|
|
4951
|
-
bar: {
|
|
4952
|
-
horizontal: false,
|
|
4953
|
-
columnWidth: "75%",
|
|
4954
|
-
borderRadius: 4,
|
|
4955
|
-
distributed: isDistributed,
|
|
4956
|
-
dataLabels: {
|
|
4957
|
-
position: "top"
|
|
4958
|
-
}
|
|
4959
|
-
}
|
|
4960
|
-
},
|
|
4961
|
-
dataLabels: {
|
|
4962
|
-
enabled: true,
|
|
4963
|
-
formatter: function formatter(val) {
|
|
4964
|
-
return "$".concat(formatNumber(val));
|
|
4965
|
-
},
|
|
4966
|
-
offsetY: -20,
|
|
4967
|
-
style: {
|
|
4968
|
-
fontSize: "9px",
|
|
4969
|
-
fontWeight: 600,
|
|
4970
|
-
colors: ["#000"]
|
|
4971
|
-
}
|
|
4972
|
-
},
|
|
4973
|
-
stroke: {
|
|
4974
|
-
show: true,
|
|
4975
|
-
width: 2,
|
|
4976
|
-
colors: ["transparent"]
|
|
4977
|
-
},
|
|
4978
|
-
xaxis: {
|
|
4979
|
-
categories: categories,
|
|
4980
|
-
axisBorder: {
|
|
4981
|
-
show: false
|
|
4982
|
-
},
|
|
4983
|
-
axisTicks: {
|
|
4984
|
-
show: false
|
|
4985
|
-
},
|
|
4986
|
-
labels: {
|
|
4987
|
-
style: {
|
|
4988
|
-
colors: "rgba(0, 0, 0, 0.4)",
|
|
4989
|
-
fontSize: "11px"
|
|
4990
|
-
}
|
|
4991
|
-
}
|
|
4992
|
-
},
|
|
4993
|
-
yaxis: {
|
|
4994
|
-
min: 0,
|
|
4995
|
-
tickAmount: 4,
|
|
4996
|
-
labels: {
|
|
4997
|
-
formatter: function formatter(val) {
|
|
4998
|
-
return "$".concat(formatNumber(val));
|
|
4999
|
-
},
|
|
5000
|
-
style: {
|
|
5001
|
-
colors: "rgba(0, 0, 0, 0.4)",
|
|
5002
|
-
fontSize: "10px"
|
|
5003
|
-
}
|
|
5004
|
-
}
|
|
5005
|
-
},
|
|
5006
|
-
fill: {
|
|
5007
|
-
opacity: 1
|
|
5008
|
-
},
|
|
5009
|
-
colors: colors,
|
|
5010
|
-
grid: {
|
|
5011
|
-
borderColor: "#f1f1f1",
|
|
5012
|
-
strokeDashArray: 4,
|
|
5013
|
-
padding: {
|
|
5014
|
-
left: 0,
|
|
5015
|
-
right: 0
|
|
5016
|
-
},
|
|
5017
|
-
yaxis: {
|
|
5018
|
-
lines: {
|
|
5019
|
-
show: true
|
|
5020
|
-
}
|
|
5021
|
-
}
|
|
5022
|
-
},
|
|
5023
|
-
legend: {
|
|
5024
|
-
show: false
|
|
5025
|
-
},
|
|
5026
|
-
tooltip: {
|
|
5027
|
-
y: {
|
|
5028
|
-
formatter: function formatter(val) {
|
|
5029
|
-
return "$".concat(formatNumber(val));
|
|
5030
|
-
}
|
|
5031
|
-
}
|
|
5032
|
-
}
|
|
5033
|
-
};
|
|
5034
|
-
return /*#__PURE__*/jsxs(Card, {
|
|
5035
|
-
sx: _objectSpread2({
|
|
5036
|
-
bgcolor: "#fff",
|
|
5037
|
-
borderRadius: 4,
|
|
5038
|
-
border: "1px solid #f0f0f0",
|
|
5039
|
-
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
5040
|
-
p: 3
|
|
5041
|
-
}, sx),
|
|
5042
|
-
children: [/*#__PURE__*/jsxs(Box, {
|
|
5043
|
-
sx: {
|
|
5044
|
-
display: "flex",
|
|
5045
|
-
flexDirection: "column"
|
|
5046
|
-
},
|
|
5047
|
-
children: [/*#__PURE__*/jsxs(Box, {
|
|
5048
|
-
sx: {
|
|
5049
|
-
textAlign: "left"
|
|
5050
|
-
},
|
|
5051
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
5052
|
-
sx: {
|
|
5053
|
-
fontWeight: 700,
|
|
5054
|
-
fontSize: "18px",
|
|
5055
|
-
color: "#000",
|
|
5056
|
-
lineHeight: 1.15
|
|
5057
|
-
},
|
|
5058
|
-
children: title
|
|
5059
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
5060
|
-
sx: {
|
|
5061
|
-
fontSize: "13px",
|
|
5062
|
-
color: "rgba(0, 0, 0, 0.4)",
|
|
5063
|
-
lineHeight: 1.15
|
|
5064
|
-
},
|
|
5065
|
-
children: "Donation type"
|
|
5066
|
-
})]
|
|
5067
|
-
}), /*#__PURE__*/jsx(Box, {
|
|
5068
|
-
sx: {
|
|
5069
|
-
display: "flex",
|
|
5070
|
-
gap: 1.5,
|
|
5071
|
-
mt: 0.5,
|
|
5072
|
-
flexWrap: "wrap"
|
|
5073
|
-
},
|
|
5074
|
-
children: summaries.map(function (item, index) {
|
|
5075
|
-
return /*#__PURE__*/jsxs(Box, {
|
|
5076
|
-
sx: {
|
|
5077
|
-
display: "flex",
|
|
5078
|
-
alignItems: "center",
|
|
5079
|
-
gap: 0.5
|
|
5080
|
-
},
|
|
5081
|
-
children: [/*#__PURE__*/jsx(Box, {
|
|
5082
|
-
sx: {
|
|
5083
|
-
width: 8,
|
|
5084
|
-
height: 8,
|
|
5085
|
-
bgcolor: item.color,
|
|
5086
|
-
borderRadius: "50%"
|
|
5087
|
-
}
|
|
5088
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
5089
|
-
sx: {
|
|
5090
|
-
fontSize: "13px",
|
|
5091
|
-
color: "rgba(0, 0, 0, 0.5)",
|
|
5092
|
-
fontWeight: 500
|
|
5093
|
-
},
|
|
5094
|
-
children: item.label
|
|
5095
|
-
}), /*#__PURE__*/jsxs(Typography, {
|
|
5096
|
-
sx: {
|
|
5097
|
-
fontSize: "13px",
|
|
5098
|
-
fontWeight: 600,
|
|
5099
|
-
color: "#000"
|
|
5100
|
-
},
|
|
5101
|
-
children: ["$", formatNumber(item.total || 0)]
|
|
5102
|
-
})]
|
|
5103
|
-
}, item.label || index);
|
|
5104
|
-
})
|
|
5105
|
-
})]
|
|
5106
|
-
}), /*#__PURE__*/jsx(Box, {
|
|
5107
|
-
sx: {
|
|
5108
|
-
height: 170,
|
|
5109
|
-
width: "calc(100% + 48px)",
|
|
5110
|
-
ml: -3,
|
|
5111
|
-
mr: -3
|
|
5112
|
-
},
|
|
5113
|
-
children: /*#__PURE__*/jsx(ReactApexChart, {
|
|
5114
|
-
options: chartOptions,
|
|
5115
|
-
series: series,
|
|
5116
|
-
type: "bar",
|
|
5117
|
-
height: "100%"
|
|
5118
|
-
})
|
|
5119
|
-
})]
|
|
5120
|
-
});
|
|
5121
|
-
};
|
|
5122
|
-
|
|
5123
4976
|
var CardWrapper = function CardWrapper(_ref) {
|
|
5124
4977
|
var title = _ref.title,
|
|
5125
4978
|
subtitle = _ref.subtitle,
|