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