@ammarkhalidfarooq/dashboard-package 0.4.10 → 0.4.12

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
@@ -4756,6 +4756,18 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4756
4756
  chartColor = _ref$chartColor === void 0 ? "rgb(99, 99, 230)" : _ref$chartColor,
4757
4757
  _ref$footerMetrics = _ref.footerMetrics,
4758
4758
  footerMetrics = _ref$footerMetrics === void 0 ? [] : _ref$footerMetrics;
4759
+ // Extract values for chart series
4760
+ var series = [{
4761
+ name: title,
4762
+ data: chartData.map(function (item) {
4763
+ return item.value;
4764
+ })
4765
+ }];
4766
+
4767
+ // Extract labels for x-axis
4768
+ var categories = chartData.map(function (item) {
4769
+ return item.label;
4770
+ });
4759
4771
  var chartOptions = {
4760
4772
  chart: {
4761
4773
  type: "area",
@@ -4764,6 +4776,15 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4764
4776
  },
4765
4777
  animations: {
4766
4778
  enabled: true
4779
+ },
4780
+ toolbar: {
4781
+ show: false
4782
+ }
4783
+ },
4784
+ xaxis: {
4785
+ categories: categories,
4786
+ labels: {
4787
+ show: false
4767
4788
  }
4768
4789
  },
4769
4790
  stroke: {
@@ -4784,17 +4805,21 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4784
4805
  enabled: true,
4785
4806
  theme: "light",
4786
4807
  x: {
4787
- show: false
4808
+ show: true,
4809
+ formatter: function formatter(_, _ref2) {
4810
+ var dataPointIndex = _ref2.dataPointIndex;
4811
+ return categories[dataPointIndex];
4812
+ }
4788
4813
  },
4789
4814
  y: {
4790
4815
  formatter: function formatter(val) {
4791
4816
  if (title !== null && title !== void 0 && title.toLowerCase().includes("revenue")) {
4792
- return "$".concat(val.toLocaleString());
4817
+ return "$".concat(Number(val).toLocaleString());
4793
4818
  }
4794
4819
  if (title !== null && title !== void 0 && title.toLowerCase().includes("rate") || title !== null && title !== void 0 && title.toLowerCase().includes("bounce")) {
4795
4820
  return "".concat(val, "%");
4796
4821
  }
4797
- return val.toLocaleString();
4822
+ return Number(val).toLocaleString();
4798
4823
  }
4799
4824
  },
4800
4825
  marker: {
@@ -4802,10 +4827,6 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4802
4827
  }
4803
4828
  }
4804
4829
  };
4805
- var series = [{
4806
- name: title,
4807
- data: chartData
4808
- }];
4809
4830
  return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
4810
4831
  sx: {
4811
4832
  p: 3,
@@ -4813,7 +4834,6 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4813
4834
  border: "1px solid #f0f0f0",
4814
4835
  boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
4815
4836
  bgcolor: "#fff",
4816
- // height: "100%",
4817
4837
  display: "flex",
4818
4838
  flexDirection: "column"
4819
4839
  },
@@ -4882,26 +4902,25 @@ var MetricSparklineCard = function MetricSparklineCard(_ref) {
4882
4902
  fontSize: "10px",
4883
4903
  color: "rgba(0, 0, 0, 0.3)"
4884
4904
  },
4885
- children: "Apr 5"
4905
+ children: categories[0]
4886
4906
  }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4887
4907
  sx: {
4888
4908
  fontSize: "10px",
4889
4909
  color: "rgba(0, 0, 0, 0.3)"
4890
4910
  },
4891
- children: "Apr 17"
4911
+ children: categories[Math.floor(categories.length / 2)]
4892
4912
  }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4893
4913
  sx: {
4894
4914
  fontSize: "10px",
4895
4915
  color: "rgba(0, 0, 0, 0.3)"
4896
4916
  },
4897
- children: "May 4"
4917
+ children: categories[categories.length - 1]
4898
4918
  })]
4899
4919
  })]
4900
4920
  }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
4901
4921
  sx: {
4902
4922
  mt: "auto",
4903
4923
  pt: 3,
4904
- // borderTop: "1px solid #f0f0f0",
4905
4924
  display: "flex",
4906
4925
  justifyContent: "space-between"
4907
4926
  },
@@ -5660,7 +5679,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5660
5679
  };
5661
5680
 
5662
5681
  var OverallSection = function OverallSection(_ref) {
5663
- var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev;
5682
+ var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
5664
5683
  var _ref$apiData = _ref.apiData,
5665
5684
  apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
5666
5685
  primaryCharts = _ref.primaryCharts,
@@ -5675,6 +5694,7 @@ var OverallSection = function OverallSection(_ref) {
5675
5694
  var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationTypeData) || [];
5676
5695
  var donorGeographyData = (apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography) || [];
5677
5696
  var trafficSourceData = (apiData === null || apiData === void 0 ? void 0 : apiData.trafficSource) || [];
5697
+ var orderBumpData = (apiData === null || apiData === void 0 ? void 0 : apiData.orderBumpData) || [];
5678
5698
  var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
5679
5699
  var getExtendedCharts = function getExtendedCharts() {
5680
5700
  var charts = _toConsumableArray(allCharts);
@@ -6201,19 +6221,10 @@ var OverallSection = function OverallSection(_ref) {
6201
6221
  children: /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
6202
6222
  title: "Order Bump",
6203
6223
  subtitle: "Revenue trend \xB7 last 30 days",
6204
- value: "$19.2K",
6205
- trend: "\u25B2 8.7% vs last month",
6206
- chartData: [1200, 1500, 1300, 1800, 1600, 2100, 1920],
6207
- footerMetrics: [{
6208
- label: "Avg/day",
6209
- value: "$640"
6210
- }, {
6211
- label: "Peak day",
6212
- value: "$1.4K"
6213
- }, {
6214
- label: "Orders",
6215
- value: "84"
6216
- }]
6224
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalValue) || "$0")),
6225
+ trend: "\u25B2 ".concat(orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$prevTr = orderBumpData.prevTrend) === null || _orderBumpData$prevTr === void 0 ? void 0 : _orderBumpData$prevTr.toFixed(1), "% vs last month"),
6226
+ chartData: orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.orderBumpMetrics,
6227
+ footerMetrics: orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.footerMetrics
6217
6228
  })
6218
6229
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
6219
6230
  item: true,