@ammarkhalidfarooq/dashboard-package 0.2.5 → 0.2.7
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 +72 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +72 -17
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -571,7 +571,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
571
571
|
_ref$categories = _ref.categories,
|
|
572
572
|
categories = _ref$categories === void 0 ? ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"] : _ref$categories,
|
|
573
573
|
_ref$apiData = _ref.apiData,
|
|
574
|
-
apiData = _ref$apiData === void 0 ? {} : _ref$apiData
|
|
574
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
575
|
+
_ref$performanceData = _ref.performanceData,
|
|
576
|
+
performanceData = _ref$performanceData === void 0 ? {} : _ref$performanceData;
|
|
575
577
|
var _React$useState = React.useState(initialMetric),
|
|
576
578
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
577
579
|
metric = _React$useState2[0];
|
|
@@ -648,7 +650,8 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
648
650
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
649
651
|
}),
|
|
650
652
|
children: /*#__PURE__*/jsx(PerformanceSection$1, {
|
|
651
|
-
apiData: apiData
|
|
653
|
+
apiData: apiData,
|
|
654
|
+
performanceData: performanceData
|
|
652
655
|
})
|
|
653
656
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
654
657
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
@@ -1802,19 +1805,71 @@ var index$5 = /*#__PURE__*/Object.freeze({
|
|
|
1802
1805
|
|
|
1803
1806
|
var PerformanceSection = function PerformanceSection(_ref) {
|
|
1804
1807
|
_ref.title;
|
|
1808
|
+
var _ref$performanceData = _ref.performanceData,
|
|
1809
|
+
performanceData = _ref$performanceData === void 0 ? {} : _ref$performanceData;
|
|
1805
1810
|
var revenueData = [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
|
|
1806
1811
|
var visitorsData = [100, 200, 150, 250, 300, 275, 325, 350, 280];
|
|
1807
1812
|
var categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'];
|
|
1813
|
+
var revPerVisData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.revenuePerVisitor) ? performanceData.revenuePerVisitor : [];
|
|
1814
|
+
var revPerVisValues = revPerVisData.length > 0 ? revPerVisData.map(function (item) {
|
|
1815
|
+
return item.value;
|
|
1816
|
+
}) : revenueData;
|
|
1817
|
+
var revPerVisCategories = revPerVisData.length > 0 ? revPerVisData.map(function (item) {
|
|
1818
|
+
return item.date;
|
|
1819
|
+
}) : categories;
|
|
1820
|
+
var revPerVisTotal = revPerVisData.length > 0 ? revPerVisValues.reduce(function (sum, val) {
|
|
1821
|
+
return sum + val;
|
|
1822
|
+
}, 0) / revPerVisValues.length : 5.12;
|
|
1823
|
+
var totalVisData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.totalVisits) ? performanceData.totalVisits : [];
|
|
1824
|
+
var totalVisValues = totalVisData.length > 0 ? totalVisData.map(function (item) {
|
|
1825
|
+
return item.value;
|
|
1826
|
+
}) : visitorsData;
|
|
1827
|
+
var totalVisCategories = totalVisData.length > 0 ? totalVisData.map(function (item) {
|
|
1828
|
+
return item.date;
|
|
1829
|
+
}) : categories;
|
|
1830
|
+
var totalVisTotal = totalVisData.length > 0 ? totalVisValues.reduce(function (sum, val) {
|
|
1831
|
+
return sum + val;
|
|
1832
|
+
}, 0) : 1200;
|
|
1833
|
+
var upSellData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.upSellRaisedAmount) ? performanceData.upSellRaisedAmount : [];
|
|
1834
|
+
var upSellValues = upSellData.length > 0 ? upSellData.map(function (item) {
|
|
1835
|
+
return item.value;
|
|
1836
|
+
}) : revenueData;
|
|
1837
|
+
var upSellCategories = upSellData.length > 0 ? upSellData.map(function (item) {
|
|
1838
|
+
return item.date;
|
|
1839
|
+
}) : categories;
|
|
1840
|
+
var upSellTotal = upSellData.length > 0 ? upSellValues.reduce(function (sum, val) {
|
|
1841
|
+
return sum + val;
|
|
1842
|
+
}, 0) : 11050;
|
|
1843
|
+
var downSellData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.downSellRaisedAmount) ? performanceData.downSellRaisedAmount : [];
|
|
1844
|
+
var downSellValues = downSellData.length > 0 ? downSellData.map(function (item) {
|
|
1845
|
+
return item.value;
|
|
1846
|
+
}) : revenueData;
|
|
1847
|
+
var downSellCategories = downSellData.length > 0 ? downSellData.map(function (item) {
|
|
1848
|
+
return item.date;
|
|
1849
|
+
}) : categories;
|
|
1850
|
+
var downSellTotal = downSellData.length > 0 ? downSellValues.reduce(function (sum, val) {
|
|
1851
|
+
return sum + val;
|
|
1852
|
+
}, 0) : 1200;
|
|
1853
|
+
var abandonedData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.abandonedDonationRecoveryCount) ? performanceData.abandonedDonationRecoveryCount : [];
|
|
1854
|
+
var abandonedValues = abandonedData.length > 0 ? abandonedData.map(function (item) {
|
|
1855
|
+
return item.value;
|
|
1856
|
+
}) : visitorsData;
|
|
1857
|
+
var abandonedCategories = abandonedData.length > 0 ? abandonedData.map(function (item) {
|
|
1858
|
+
return item.date;
|
|
1859
|
+
}) : categories;
|
|
1860
|
+
var abandonedTotal = abandonedData.length > 0 ? abandonedValues.reduce(function (sum, val) {
|
|
1861
|
+
return sum + val;
|
|
1862
|
+
}, 0) : 14;
|
|
1808
1863
|
var primaryCharts = [{
|
|
1809
1864
|
label: 'Revenue per Visitor',
|
|
1810
|
-
value: '$5.12',
|
|
1811
|
-
data:
|
|
1812
|
-
categories:
|
|
1865
|
+
value: performanceData !== null && performanceData !== void 0 && performanceData.revenuePerVisitor ? "$".concat(revPerVisTotal.toFixed(2)) : '$5.12',
|
|
1866
|
+
data: revPerVisValues,
|
|
1867
|
+
categories: revPerVisCategories
|
|
1813
1868
|
}, {
|
|
1814
1869
|
label: 'Visitors',
|
|
1815
|
-
value: '1200',
|
|
1816
|
-
data:
|
|
1817
|
-
categories:
|
|
1870
|
+
value: performanceData !== null && performanceData !== void 0 && performanceData.totalVisits ? totalVisTotal.toLocaleString() : '1200',
|
|
1871
|
+
data: totalVisValues,
|
|
1872
|
+
categories: totalVisCategories
|
|
1818
1873
|
}];
|
|
1819
1874
|
var secondaryCharts = [{
|
|
1820
1875
|
label: 'Upsell Acceptance Rate',
|
|
@@ -1823,9 +1878,9 @@ var PerformanceSection = function PerformanceSection(_ref) {
|
|
|
1823
1878
|
categories: categories
|
|
1824
1879
|
}, {
|
|
1825
1880
|
label: 'Upsell Raised Amount',
|
|
1826
|
-
value: '$1,1050',
|
|
1827
|
-
data:
|
|
1828
|
-
categories:
|
|
1881
|
+
value: performanceData !== null && performanceData !== void 0 && performanceData.upSellRaisedAmount ? "$".concat(upSellTotal.toLocaleString()) : '$1,1050',
|
|
1882
|
+
data: upSellValues,
|
|
1883
|
+
categories: upSellCategories
|
|
1829
1884
|
}];
|
|
1830
1885
|
var tertiaryCharts = [{
|
|
1831
1886
|
label: 'Downsell Acceptance Rate',
|
|
@@ -1834,15 +1889,15 @@ var PerformanceSection = function PerformanceSection(_ref) {
|
|
|
1834
1889
|
categories: categories
|
|
1835
1890
|
}, {
|
|
1836
1891
|
label: 'Downsell Raised Amount',
|
|
1837
|
-
value: '$1,200',
|
|
1838
|
-
data:
|
|
1839
|
-
categories:
|
|
1892
|
+
value: performanceData !== null && performanceData !== void 0 && performanceData.downSellRaisedAmount ? "$".concat(downSellTotal.toLocaleString()) : '$1,200',
|
|
1893
|
+
data: downSellValues,
|
|
1894
|
+
categories: downSellCategories
|
|
1840
1895
|
}];
|
|
1841
1896
|
var quaternaryCharts = [{
|
|
1842
1897
|
label: 'Abandoned Donation Recovery',
|
|
1843
|
-
value: '14',
|
|
1844
|
-
data:
|
|
1845
|
-
categories:
|
|
1898
|
+
value: performanceData !== null && performanceData !== void 0 && performanceData.abandonedDonationRecoveryCount ? abandonedTotal.toLocaleString() : '14',
|
|
1899
|
+
data: abandonedValues,
|
|
1900
|
+
categories: abandonedCategories
|
|
1846
1901
|
}];
|
|
1847
1902
|
return /*#__PURE__*/jsxs(Box$1, {
|
|
1848
1903
|
sx: {
|