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