@ammarkhalidfarooq/dashboard-package 0.2.6 → 0.2.8

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