@ammarkhalidfarooq/dashboard-package 0.1.5 → 0.1.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.es.js CHANGED
@@ -873,18 +873,38 @@ var NewOverview = function NewOverview(_ref) {
873
873
  var oneTimeTotal = oneTimeData.length > 0 ? oneTimeValues.reduce(function (sum, val) {
874
874
  return sum + val;
875
875
  }, 0) : 7100;
876
+ var firstInstData = (apiData === null || apiData === void 0 ? void 0 : apiData.firstInstallmentRevenue) || [];
877
+ var firstInstValues = firstInstData.length > 0 ? firstInstData.map(function (item) {
878
+ return item.value;
879
+ }) : currentData.slice(-7);
880
+ var firstInstCategories = firstInstData.length > 0 ? firstInstData.map(function (item) {
881
+ return item.date;
882
+ }) : categories.slice(-7);
883
+ var firstInstTotal = firstInstData.length > 0 ? firstInstValues.reduce(function (sum, val) {
884
+ return sum + val;
885
+ }, 0) : 510;
886
+ var totalRevData = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) ? apiData.totalRevenue : [];
887
+ var totalRevValues = totalRevData.length > 0 ? totalRevData.map(function (item) {
888
+ return item.value;
889
+ }) : currentData;
890
+ var totalRevCategories = totalRevData.length > 0 ? totalRevData.map(function (item) {
891
+ return item.date;
892
+ }) : categories;
893
+ var totalRevTotal = totalRevData.length > 0 ? totalRevValues.reduce(function (sum, val) {
894
+ return sum + val;
895
+ }, 0) : 9200;
876
896
  var primaryCharts = [{
877
897
  label: "Total Revenue",
878
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) || "$9,200.00",
898
+ value: totalRevData.length > 0 ? "$".concat(totalRevTotal.toLocaleString()) : typeof (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) === 'string' ? apiData.totalRevenue : "$9,200.00",
879
899
  subValue: "Total Donations: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalDonations) || 215),
880
- data: currentData,
881
- categories: categories,
900
+ data: totalRevValues,
901
+ categories: totalRevCategories,
882
902
  showSelector: true
883
903
  }, {
884
904
  label: "First installments",
885
- value: "$510.00",
886
- data: currentData.slice(-7),
887
- categories: categories.slice(-7)
905
+ value: apiData !== null && apiData !== void 0 && apiData.firstInstallmentRevenue ? "$".concat(firstInstTotal.toLocaleString()) : "$510.00",
906
+ data: firstInstValues,
907
+ categories: firstInstCategories
888
908
  }, {
889
909
  label: "One-time donations",
890
910
  value: apiData !== null && apiData !== void 0 && apiData.oneTimeDonations ? "$".concat(oneTimeTotal.toLocaleString()) : "$7,100.00",