@ammarkhalidfarooq/dashboard-package 0.1.2 → 0.1.5
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 +90 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +90 -40
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -89,6 +89,15 @@ function _toPropertyKey(t) {
|
|
|
89
89
|
var i = _toPrimitive(t, "string");
|
|
90
90
|
return "symbol" == typeof i ? i : i + "";
|
|
91
91
|
}
|
|
92
|
+
function _typeof(o) {
|
|
93
|
+
"@babel/helpers - typeof";
|
|
94
|
+
|
|
95
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
96
|
+
return typeof o;
|
|
97
|
+
} : function (o) {
|
|
98
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
99
|
+
}, _typeof(o);
|
|
100
|
+
}
|
|
92
101
|
function _unsupportedIterableToArray(r, a) {
|
|
93
102
|
if (r) {
|
|
94
103
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -367,12 +376,18 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
367
376
|
if (isRadial) {
|
|
368
377
|
var _series$;
|
|
369
378
|
// For donut/pie, series must be a simple array of numbers
|
|
370
|
-
|
|
379
|
+
var processedData = Array.isArray(data) ? data.map(function (v) {
|
|
380
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
381
|
+
}) : [];
|
|
382
|
+
chartSeries = processedData.length > 0 ? processedData : (series === null || series === void 0 || (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.data) || [];
|
|
371
383
|
} else {
|
|
372
384
|
// For bar/line/area, series must be an array of objects [{ name: '', data: [] }]
|
|
385
|
+
var _processedData = Array.isArray(data) ? data.map(function (v) {
|
|
386
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
387
|
+
}) : [];
|
|
373
388
|
chartSeries = Array.isArray(series) ? series : [{
|
|
374
389
|
name: metric || "Value",
|
|
375
|
-
data:
|
|
390
|
+
data: _processedData
|
|
376
391
|
}];
|
|
377
392
|
}
|
|
378
393
|
return /*#__PURE__*/jsx(ReactApexChart, {
|
|
@@ -446,14 +461,14 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
446
461
|
color: "#000000",
|
|
447
462
|
mb: 0.5
|
|
448
463
|
},
|
|
449
|
-
children: item.value
|
|
464
|
+
children: _typeof(item.value) === 'object' && item.value !== null ? item.value.value !== undefined ? item.value.value : JSON.stringify(item.value) : item.value
|
|
450
465
|
}), item.subValue && /*#__PURE__*/jsx(Typography, {
|
|
451
466
|
variant: "subtitle2",
|
|
452
467
|
sx: {
|
|
453
468
|
color: "#000000",
|
|
454
469
|
fontWeight: 600
|
|
455
470
|
},
|
|
456
|
-
children: item.subValue
|
|
471
|
+
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
457
472
|
})]
|
|
458
473
|
}), /*#__PURE__*/jsxs(Box, {
|
|
459
474
|
sx: {
|
|
@@ -554,7 +569,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
554
569
|
_ref$donationsData = _ref.donationsData,
|
|
555
570
|
donationsData = _ref$donationsData === void 0 ? [15, 22, 18, 30, 25, 35, 42, 45, 28] : _ref$donationsData,
|
|
556
571
|
_ref$categories = _ref.categories,
|
|
557
|
-
categories = _ref$categories === void 0 ? ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"] : _ref$categories
|
|
572
|
+
categories = _ref$categories === void 0 ? ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"] : _ref$categories,
|
|
573
|
+
_ref$apiData = _ref.apiData,
|
|
574
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData;
|
|
558
575
|
var _React$useState = React.useState(initialMetric),
|
|
559
576
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
560
577
|
metric = _React$useState2[0];
|
|
@@ -619,7 +636,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
619
636
|
},
|
|
620
637
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
621
638
|
}),
|
|
622
|
-
children: /*#__PURE__*/jsx(NewOverview$1, {
|
|
639
|
+
children: /*#__PURE__*/jsx(NewOverview$1, {
|
|
640
|
+
apiData: apiData
|
|
641
|
+
})
|
|
623
642
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
624
643
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
625
644
|
sx: {
|
|
@@ -628,7 +647,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
628
647
|
},
|
|
629
648
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
630
649
|
}),
|
|
631
|
-
children: /*#__PURE__*/jsx(PerformanceSection$1, {
|
|
650
|
+
children: /*#__PURE__*/jsx(PerformanceSection$1, {
|
|
651
|
+
apiData: apiData
|
|
652
|
+
})
|
|
632
653
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
633
654
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
634
655
|
sx: {
|
|
@@ -637,7 +658,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
637
658
|
},
|
|
638
659
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
639
660
|
}),
|
|
640
|
-
children: /*#__PURE__*/jsx(RecurringPlans$1, {
|
|
661
|
+
children: /*#__PURE__*/jsx(RecurringPlans$1, {
|
|
662
|
+
apiData: apiData
|
|
663
|
+
})
|
|
641
664
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
642
665
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
643
666
|
sx: {
|
|
@@ -646,7 +669,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
646
669
|
},
|
|
647
670
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
648
671
|
}),
|
|
649
|
-
children: /*#__PURE__*/jsx(RecurringRevenueSection$1, {
|
|
672
|
+
children: /*#__PURE__*/jsx(RecurringRevenueSection$1, {
|
|
673
|
+
apiData: apiData
|
|
674
|
+
})
|
|
650
675
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
651
676
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
652
677
|
sx: {
|
|
@@ -655,7 +680,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
655
680
|
},
|
|
656
681
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
657
682
|
}),
|
|
658
|
-
children: /*#__PURE__*/jsx(DonorBehavior$1, {
|
|
683
|
+
children: /*#__PURE__*/jsx(DonorBehavior$1, {
|
|
684
|
+
apiData: apiData
|
|
685
|
+
})
|
|
659
686
|
}), /*#__PURE__*/jsx(Suspense, {
|
|
660
687
|
fallback: /*#__PURE__*/jsx(Box, {
|
|
661
688
|
sx: {
|
|
@@ -664,7 +691,9 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
664
691
|
},
|
|
665
692
|
children: /*#__PURE__*/jsx(CircularProgress, {})
|
|
666
693
|
}),
|
|
667
|
-
children: /*#__PURE__*/jsx(UpdateEmails$1, {
|
|
694
|
+
children: /*#__PURE__*/jsx(UpdateEmails$1, {
|
|
695
|
+
apiData: apiData
|
|
696
|
+
})
|
|
668
697
|
})]
|
|
669
698
|
});
|
|
670
699
|
};
|
|
@@ -707,13 +736,15 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
707
736
|
fontSize: '22px',
|
|
708
737
|
fontWeight: '500'
|
|
709
738
|
},
|
|
710
|
-
children: value
|
|
739
|
+
children: _typeof(value) === 'object' && value !== null ? value.value !== undefined ? value.value : JSON.stringify(value) : value
|
|
711
740
|
})]
|
|
712
741
|
})
|
|
713
742
|
});
|
|
714
743
|
};
|
|
715
744
|
|
|
716
|
-
var OrganicSection = function OrganicSection() {
|
|
745
|
+
var OrganicSection = function OrganicSection(_ref) {
|
|
746
|
+
var _ref$apiData = _ref.apiData,
|
|
747
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData;
|
|
717
748
|
var categories = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
718
749
|
var dailyPerformance = {
|
|
719
750
|
label: "Search Visibility",
|
|
@@ -745,37 +776,37 @@ var OrganicSection = function OrganicSection() {
|
|
|
745
776
|
},
|
|
746
777
|
children: [/*#__PURE__*/jsx(DisplayCard, {
|
|
747
778
|
title: "Organic Users",
|
|
748
|
-
value: "$9,200",
|
|
779
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.organicUsers) || "$9,200",
|
|
749
780
|
sx: {
|
|
750
781
|
flex: 1
|
|
751
782
|
}
|
|
752
783
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
753
784
|
title: "Search Clicks",
|
|
754
|
-
value: "$9,200",
|
|
785
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.searchClicks) || "$9,200",
|
|
755
786
|
sx: {
|
|
756
787
|
flex: 1
|
|
757
788
|
}
|
|
758
789
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
759
790
|
title: "Donations",
|
|
760
|
-
value: "$9,200",
|
|
791
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.donations) || "$9,200",
|
|
761
792
|
sx: {
|
|
762
793
|
flex: 1
|
|
763
794
|
}
|
|
764
795
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
765
796
|
title: "Converstion Rate",
|
|
766
|
-
value: "$9,200",
|
|
797
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionRate) || "$9,200",
|
|
767
798
|
sx: {
|
|
768
799
|
flex: 1
|
|
769
800
|
}
|
|
770
801
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
771
802
|
title: "Revenue Raised",
|
|
772
|
-
value: "3.0",
|
|
803
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.revenueRaised) || "3.0",
|
|
773
804
|
sx: {
|
|
774
805
|
flex: 1
|
|
775
806
|
}
|
|
776
807
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
777
808
|
title: "Avg Donation",
|
|
778
|
-
value: "215",
|
|
809
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.avgDonation) || "215",
|
|
779
810
|
sx: {
|
|
780
811
|
flex: 1
|
|
781
812
|
}
|
|
@@ -816,11 +847,13 @@ var OverallSection$2 = /*#__PURE__*/lazy(function () {
|
|
|
816
847
|
var PaidSection$2 = /*#__PURE__*/lazy(function () {
|
|
817
848
|
return Promise.resolve().then(function () { return PaidSection$1; });
|
|
818
849
|
});
|
|
819
|
-
var NewOverview = function NewOverview() {
|
|
850
|
+
var NewOverview = function NewOverview(_ref) {
|
|
851
|
+
var _ref$apiData = _ref.apiData,
|
|
852
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData;
|
|
820
853
|
var initialMetric = "Revenue";
|
|
821
|
-
var revenueData = [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
|
|
822
|
-
var donationsData = [15, 22, 18, 30, 25, 35, 42, 45, 28];
|
|
823
|
-
var categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
|
|
854
|
+
var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
|
|
855
|
+
var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
|
|
856
|
+
var categories = (apiData === null || apiData === void 0 ? void 0 : apiData.categories) || ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
|
|
824
857
|
var _useState = useState(initialMetric),
|
|
825
858
|
_useState2 = _slicedToArray(_useState, 2),
|
|
826
859
|
metric = _useState2[0];
|
|
@@ -830,10 +863,20 @@ var NewOverview = function NewOverview() {
|
|
|
830
863
|
activeSection = _useState4[0],
|
|
831
864
|
setActiveSection = _useState4[1];
|
|
832
865
|
var currentData = metric === "Revenue" ? revenueData : donationsData;
|
|
866
|
+
var oneTimeData = (apiData === null || apiData === void 0 ? void 0 : apiData.oneTimeDonations) || [];
|
|
867
|
+
var oneTimeValues = oneTimeData.length > 0 ? oneTimeData.map(function (item) {
|
|
868
|
+
return item.value;
|
|
869
|
+
}) : currentData;
|
|
870
|
+
var oneTimeCategories = oneTimeData.length > 0 ? oneTimeData.map(function (item) {
|
|
871
|
+
return item.date;
|
|
872
|
+
}) : categories;
|
|
873
|
+
var oneTimeTotal = oneTimeData.length > 0 ? oneTimeValues.reduce(function (sum, val) {
|
|
874
|
+
return sum + val;
|
|
875
|
+
}, 0) : 7100;
|
|
833
876
|
var primaryCharts = [{
|
|
834
877
|
label: "Total Revenue",
|
|
835
|
-
value: "$9,200.00",
|
|
836
|
-
subValue: "Total Donations: 215
|
|
878
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) || "$9,200.00",
|
|
879
|
+
subValue: "Total Donations: ".concat((apiData === null || apiData === void 0 ? void 0 : apiData.totalDonations) || 215),
|
|
837
880
|
data: currentData,
|
|
838
881
|
categories: categories,
|
|
839
882
|
showSelector: true
|
|
@@ -844,9 +887,9 @@ var NewOverview = function NewOverview() {
|
|
|
844
887
|
categories: categories.slice(-7)
|
|
845
888
|
}, {
|
|
846
889
|
label: "One-time donations",
|
|
847
|
-
value: "$7,100.00",
|
|
848
|
-
data:
|
|
849
|
-
categories:
|
|
890
|
+
value: apiData !== null && apiData !== void 0 && apiData.oneTimeDonations ? "$".concat(oneTimeTotal.toLocaleString()) : "$7,100.00",
|
|
891
|
+
data: oneTimeValues,
|
|
892
|
+
categories: oneTimeCategories
|
|
850
893
|
}];
|
|
851
894
|
var secondaryCharts = [{
|
|
852
895
|
label: "New vs Returning Donors",
|
|
@@ -995,15 +1038,20 @@ var NewOverview = function NewOverview() {
|
|
|
995
1038
|
})
|
|
996
1039
|
}),
|
|
997
1040
|
children: [activeSection === "Overall" && /*#__PURE__*/jsx(OverallSection$2, {
|
|
1041
|
+
apiData: apiData,
|
|
998
1042
|
primaryCharts: primaryCharts,
|
|
999
1043
|
secondaryCharts: secondaryCharts,
|
|
1000
1044
|
tertiaryCharts: tertiaryCharts,
|
|
1001
1045
|
quaternaryCharts: quaternaryCharts
|
|
1002
|
-
}), activeSection === "Paid" && /*#__PURE__*/jsx(PaidSection$2, {
|
|
1046
|
+
}), activeSection === "Paid" && /*#__PURE__*/jsx(PaidSection$2, {
|
|
1047
|
+
apiData: apiData
|
|
1048
|
+
}), activeSection === "Organic" && /*#__PURE__*/jsx(Box, {
|
|
1003
1049
|
sx: {
|
|
1004
1050
|
p: 2
|
|
1005
1051
|
},
|
|
1006
|
-
children: /*#__PURE__*/jsx(OrganicSection, {
|
|
1052
|
+
children: /*#__PURE__*/jsx(OrganicSection, {
|
|
1053
|
+
apiData: apiData
|
|
1054
|
+
})
|
|
1007
1055
|
}), activeSection === "Email" && /*#__PURE__*/jsx(Box, {
|
|
1008
1056
|
sx: {
|
|
1009
1057
|
p: 2
|
|
@@ -5145,7 +5193,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5145
5193
|
});
|
|
5146
5194
|
|
|
5147
5195
|
var OverallSection = function OverallSection(_ref) {
|
|
5148
|
-
var
|
|
5196
|
+
var _ref$apiData = _ref.apiData,
|
|
5197
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
5198
|
+
primaryCharts = _ref.primaryCharts,
|
|
5149
5199
|
secondaryCharts = _ref.secondaryCharts,
|
|
5150
5200
|
tertiaryCharts = _ref.tertiaryCharts,
|
|
5151
5201
|
quaternaryCharts = _ref.quaternaryCharts;
|
|
@@ -5158,31 +5208,31 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5158
5208
|
},
|
|
5159
5209
|
children: [/*#__PURE__*/jsx(DisplayCard, {
|
|
5160
5210
|
title: "Total Raised",
|
|
5161
|
-
value: "$9,200",
|
|
5211
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised) || "$9,200",
|
|
5162
5212
|
sx: {
|
|
5163
5213
|
flex: 1
|
|
5164
5214
|
}
|
|
5165
5215
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
5166
5216
|
title: "Net Raised",
|
|
5167
|
-
value: "$9,200",
|
|
5217
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.netRaised) || "$9,200",
|
|
5168
5218
|
sx: {
|
|
5169
5219
|
flex: 1
|
|
5170
5220
|
}
|
|
5171
5221
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
5172
5222
|
title: "Total Spent",
|
|
5173
|
-
value: "$9,200",
|
|
5223
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalSpent) || "$9,200",
|
|
5174
5224
|
sx: {
|
|
5175
5225
|
flex: 1
|
|
5176
5226
|
}
|
|
5177
5227
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
5178
5228
|
title: "Total ROAS",
|
|
5179
|
-
value: "3.0",
|
|
5229
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRoas) || "3.0",
|
|
5180
5230
|
sx: {
|
|
5181
5231
|
flex: 1
|
|
5182
5232
|
}
|
|
5183
5233
|
}), /*#__PURE__*/jsx(DisplayCard, {
|
|
5184
5234
|
title: "Total Donors",
|
|
5185
|
-
value: "215",
|
|
5235
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "215",
|
|
5186
5236
|
sx: {
|
|
5187
5237
|
flex: 1
|
|
5188
5238
|
}
|
|
@@ -5197,7 +5247,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5197
5247
|
return /*#__PURE__*/jsx(RenderChartCard, {
|
|
5198
5248
|
item: item,
|
|
5199
5249
|
index: index
|
|
5200
|
-
});
|
|
5250
|
+
}, "primary-".concat(index));
|
|
5201
5251
|
})
|
|
5202
5252
|
}), /*#__PURE__*/jsx(Grid, {
|
|
5203
5253
|
container: true,
|
|
@@ -5209,7 +5259,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5209
5259
|
return /*#__PURE__*/jsx(RenderChartCard, {
|
|
5210
5260
|
item: item,
|
|
5211
5261
|
index: index
|
|
5212
|
-
});
|
|
5262
|
+
}, "secondary-".concat(index));
|
|
5213
5263
|
})
|
|
5214
5264
|
}), /*#__PURE__*/jsx(Grid, {
|
|
5215
5265
|
container: true,
|
|
@@ -5221,7 +5271,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5221
5271
|
return /*#__PURE__*/jsx(RenderChartCard, {
|
|
5222
5272
|
item: item,
|
|
5223
5273
|
index: index
|
|
5224
|
-
});
|
|
5274
|
+
}, "tertiary-".concat(index));
|
|
5225
5275
|
})
|
|
5226
5276
|
}), /*#__PURE__*/jsx(Grid, {
|
|
5227
5277
|
container: true,
|
|
@@ -5233,7 +5283,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5233
5283
|
return /*#__PURE__*/jsx(RenderChartCard, {
|
|
5234
5284
|
item: item,
|
|
5235
5285
|
index: index
|
|
5236
|
-
});
|
|
5286
|
+
}, "quaternary-".concat(index));
|
|
5237
5287
|
})
|
|
5238
5288
|
})]
|
|
5239
5289
|
});
|