@ammarkhalidfarooq/dashboard-package 0.2.6 → 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 CHANGED
@@ -1822,6 +1822,46 @@ var PerformanceSection = function PerformanceSection(_ref) {
1822
1822
  var revPerVisTotal = revPerVisData.length > 0 ? revPerVisValues.reduce(function (sum, val) {
1823
1823
  return sum + val;
1824
1824
  }, 0) / revPerVisValues.length : 5.12;
1825
+ var totalVisData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.totalVisits) ? performanceData.totalVisits : [];
1826
+ var totalVisValues = totalVisData.length > 0 ? totalVisData.map(function (item) {
1827
+ return item.value;
1828
+ }) : visitorsData;
1829
+ var totalVisCategories = totalVisData.length > 0 ? totalVisData.map(function (item) {
1830
+ return item.date;
1831
+ }) : categories;
1832
+ var totalVisTotal = totalVisData.length > 0 ? totalVisValues.reduce(function (sum, val) {
1833
+ return sum + val;
1834
+ }, 0) : 1200;
1835
+ var upSellData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.upSellRaisedAmount) ? performanceData.upSellRaisedAmount : [];
1836
+ var upSellValues = upSellData.length > 0 ? upSellData.map(function (item) {
1837
+ return item.value;
1838
+ }) : revenueData;
1839
+ var upSellCategories = upSellData.length > 0 ? upSellData.map(function (item) {
1840
+ return item.date;
1841
+ }) : categories;
1842
+ var upSellTotal = upSellData.length > 0 ? upSellValues.reduce(function (sum, val) {
1843
+ return sum + val;
1844
+ }, 0) : 11050;
1845
+ var downSellData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.downSellRaisedAmount) ? performanceData.downSellRaisedAmount : [];
1846
+ var downSellValues = downSellData.length > 0 ? downSellData.map(function (item) {
1847
+ return item.value;
1848
+ }) : revenueData;
1849
+ var downSellCategories = downSellData.length > 0 ? downSellData.map(function (item) {
1850
+ return item.date;
1851
+ }) : categories;
1852
+ var downSellTotal = downSellData.length > 0 ? downSellValues.reduce(function (sum, val) {
1853
+ return sum + val;
1854
+ }, 0) : 1200;
1855
+ var abandonedData = Array.isArray(performanceData === null || performanceData === void 0 ? void 0 : performanceData.abandonedDonationRecoveryCount) ? performanceData.abandonedDonationRecoveryCount : [];
1856
+ var abandonedValues = abandonedData.length > 0 ? abandonedData.map(function (item) {
1857
+ return item.value;
1858
+ }) : visitorsData;
1859
+ var abandonedCategories = abandonedData.length > 0 ? abandonedData.map(function (item) {
1860
+ return item.date;
1861
+ }) : categories;
1862
+ var abandonedTotal = abandonedData.length > 0 ? abandonedValues.reduce(function (sum, val) {
1863
+ return sum + val;
1864
+ }, 0) : 14;
1825
1865
  var primaryCharts = [{
1826
1866
  label: 'Revenue per Visitor',
1827
1867
  value: performanceData !== null && performanceData !== void 0 && performanceData.revenuePerVisitor ? "$".concat(revPerVisTotal.toFixed(2)) : '$5.12',
@@ -1829,9 +1869,9 @@ var PerformanceSection = function PerformanceSection(_ref) {
1829
1869
  categories: revPerVisCategories
1830
1870
  }, {
1831
1871
  label: 'Visitors',
1832
- value: '1200',
1833
- data: visitorsData,
1834
- categories: categories
1872
+ value: performanceData !== null && performanceData !== void 0 && performanceData.totalVisits ? totalVisTotal.toLocaleString() : '1200',
1873
+ data: totalVisValues,
1874
+ categories: totalVisCategories
1835
1875
  }];
1836
1876
  var secondaryCharts = [{
1837
1877
  label: 'Upsell Acceptance Rate',
@@ -1840,9 +1880,9 @@ var PerformanceSection = function PerformanceSection(_ref) {
1840
1880
  categories: categories
1841
1881
  }, {
1842
1882
  label: 'Upsell Raised Amount',
1843
- value: '$1,1050',
1844
- data: revenueData,
1845
- categories: categories
1883
+ value: performanceData !== null && performanceData !== void 0 && performanceData.upSellRaisedAmount ? "$".concat(upSellTotal.toLocaleString()) : '$1,1050',
1884
+ data: upSellValues,
1885
+ categories: upSellCategories
1846
1886
  }];
1847
1887
  var tertiaryCharts = [{
1848
1888
  label: 'Downsell Acceptance Rate',
@@ -1851,15 +1891,15 @@ var PerformanceSection = function PerformanceSection(_ref) {
1851
1891
  categories: categories
1852
1892
  }, {
1853
1893
  label: 'Downsell Raised Amount',
1854
- value: '$1,200',
1855
- data: revenueData,
1856
- categories: categories
1894
+ value: performanceData !== null && performanceData !== void 0 && performanceData.downSellRaisedAmount ? "$".concat(downSellTotal.toLocaleString()) : '$1,200',
1895
+ data: downSellValues,
1896
+ categories: downSellCategories
1857
1897
  }];
1858
1898
  var quaternaryCharts = [{
1859
1899
  label: 'Abandoned Donation Recovery',
1860
- value: '14',
1861
- data: visitorsData,
1862
- categories: categories
1900
+ value: performanceData !== null && performanceData !== void 0 && performanceData.abandonedDonationRecoveryCount ? abandonedTotal.toLocaleString() : '14',
1901
+ data: abandonedValues,
1902
+ categories: abandonedCategories
1863
1903
  }];
1864
1904
  return /*#__PURE__*/jsxRuntime.jsxs(Box, {
1865
1905
  sx: {