@ammarkhalidfarooq/dashboard-package 0.4.41 → 0.4.43
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 +118 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +119 -23
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Suspense, lazy, useState, useEffect } from 'react';
|
|
2
|
-
import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Avatar } from '@mui/material';
|
|
2
|
+
import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Avatar, Stack } from '@mui/material';
|
|
3
3
|
import { MoreHoriz, MoreVert, Check, InfoOutlined, Settings, TrendingUp, Adjust, PaidOutlined, PeopleAltOutlined, FavoriteOutlined, PersonOutlined, IndeterminateCheckBoxOutlined, SearchOutlined, HighlightOff, NearMe, Email, NotInterested } from '@mui/icons-material';
|
|
4
4
|
import { createTheme, useTheme } from '@mui/material/styles';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -3734,8 +3734,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3734
3734
|
plotOptions: {
|
|
3735
3735
|
bar: {
|
|
3736
3736
|
horizontal: false,
|
|
3737
|
-
columnWidth: "
|
|
3738
|
-
barGap: "10%",
|
|
3737
|
+
columnWidth: "70%",
|
|
3739
3738
|
borderRadius: 4,
|
|
3740
3739
|
dataLabels: {
|
|
3741
3740
|
position: "top"
|
|
@@ -3743,7 +3742,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3743
3742
|
}
|
|
3744
3743
|
},
|
|
3745
3744
|
dataLabels: {
|
|
3746
|
-
enabled:
|
|
3745
|
+
enabled: true,
|
|
3747
3746
|
formatter: function formatter(val) {
|
|
3748
3747
|
return "$".concat(formatNumber(val));
|
|
3749
3748
|
},
|
|
@@ -3808,8 +3807,6 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
3808
3807
|
show: false
|
|
3809
3808
|
},
|
|
3810
3809
|
tooltip: {
|
|
3811
|
-
shared: true,
|
|
3812
|
-
intersect: false,
|
|
3813
3810
|
y: {
|
|
3814
3811
|
formatter: function formatter(val) {
|
|
3815
3812
|
return "$".concat(formatNumber(val));
|
|
@@ -5148,6 +5145,70 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5148
5145
|
});
|
|
5149
5146
|
};
|
|
5150
5147
|
|
|
5148
|
+
var MetricCard = function MetricCard(_ref) {
|
|
5149
|
+
var title = _ref.title,
|
|
5150
|
+
value = _ref.value,
|
|
5151
|
+
caption = _ref.caption,
|
|
5152
|
+
icon = _ref.icon,
|
|
5153
|
+
active = _ref.active,
|
|
5154
|
+
warning = _ref.warning,
|
|
5155
|
+
error = _ref.error,
|
|
5156
|
+
onClick = _ref.onClick;
|
|
5157
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
5158
|
+
sx: {
|
|
5159
|
+
bgcolor: "#fff",
|
|
5160
|
+
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
5161
|
+
borderRadius: "16px",
|
|
5162
|
+
p: {
|
|
5163
|
+
xs: 1.75,
|
|
5164
|
+
md: 2
|
|
5165
|
+
},
|
|
5166
|
+
minHeight: 108,
|
|
5167
|
+
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
5168
|
+
},
|
|
5169
|
+
onClick: onClick,
|
|
5170
|
+
children: [/*#__PURE__*/jsxs(Stack, {
|
|
5171
|
+
direction: "row",
|
|
5172
|
+
justifyContent: "space-between",
|
|
5173
|
+
alignItems: "center",
|
|
5174
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
5175
|
+
sx: {
|
|
5176
|
+
color: active ? "#818CF8" : "#999EAA",
|
|
5177
|
+
fontSize: 13,
|
|
5178
|
+
fontWeight: 500,
|
|
5179
|
+
letterSpacing: 0
|
|
5180
|
+
},
|
|
5181
|
+
children: title
|
|
5182
|
+
}), /*#__PURE__*/jsx(Avatar, {
|
|
5183
|
+
sx: {
|
|
5184
|
+
width: 42,
|
|
5185
|
+
height: 42,
|
|
5186
|
+
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
5187
|
+
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
5188
|
+
},
|
|
5189
|
+
children: icon
|
|
5190
|
+
})]
|
|
5191
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
5192
|
+
sx: {
|
|
5193
|
+
mt: 0.3,
|
|
5194
|
+
fontSize: 22,
|
|
5195
|
+
fontWeight: 700,
|
|
5196
|
+
color: active ? "#4F46E5" : "#050509",
|
|
5197
|
+
lineHeight: 1.15
|
|
5198
|
+
},
|
|
5199
|
+
children: value
|
|
5200
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
5201
|
+
sx: {
|
|
5202
|
+
mt: 1.05,
|
|
5203
|
+
fontSize: 12,
|
|
5204
|
+
fontWeight: 500,
|
|
5205
|
+
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
5206
|
+
},
|
|
5207
|
+
children: caption
|
|
5208
|
+
})]
|
|
5209
|
+
});
|
|
5210
|
+
};
|
|
5211
|
+
|
|
5151
5212
|
var OverallSection = function OverallSection(_ref) {
|
|
5152
5213
|
var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
|
|
5153
5214
|
var _ref$apiData = _ref.apiData,
|
|
@@ -5210,37 +5271,55 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5210
5271
|
value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
|
|
5211
5272
|
subValue: "".concat(Number((_apiData$totalRaisedP = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev) !== null && _apiData$totalRaisedP !== void 0 ? _apiData$totalRaisedP : 0).toFixed(2), "% vs ").concat(dateName || "last month"),
|
|
5212
5273
|
label: "Total Raised",
|
|
5213
|
-
icon: PaidOutlined
|
|
5274
|
+
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
5275
|
+
money: true,
|
|
5276
|
+
error: false,
|
|
5277
|
+
warning: false
|
|
5214
5278
|
},
|
|
5215
5279
|
"Net Raised": {
|
|
5216
5280
|
value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
|
|
5217
5281
|
subValue: "".concat(Number((_apiData$netRaisedPre = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedPrev) !== null && _apiData$netRaisedPre !== void 0 ? _apiData$netRaisedPre : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "previous period"),
|
|
5218
5282
|
label: "Net Raised",
|
|
5219
|
-
icon: FavoriteOutlined
|
|
5283
|
+
icon: /*#__PURE__*/jsx(FavoriteOutlined, {}),
|
|
5284
|
+
money: true,
|
|
5285
|
+
error: false,
|
|
5286
|
+
warning: false
|
|
5220
5287
|
},
|
|
5221
5288
|
"Total Donors": {
|
|
5222
5289
|
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsCard) || "215",
|
|
5223
5290
|
subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsPrev, " new") || "31 new",
|
|
5224
5291
|
label: "Total Donors",
|
|
5225
|
-
icon: PeopleAltOutlined
|
|
5292
|
+
icon: /*#__PURE__*/jsx(PeopleAltOutlined, {}),
|
|
5293
|
+
money: false,
|
|
5294
|
+
error: false,
|
|
5295
|
+
warning: false
|
|
5226
5296
|
},
|
|
5227
5297
|
"Avg donation": {
|
|
5228
5298
|
value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
|
|
5229
5299
|
subValue: "".concat(Number((_apiData$averageDonat2 = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat2 !== void 0 ? _apiData$averageDonat2 : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5230
5300
|
label: "Average Donation Amount",
|
|
5231
|
-
icon: PaidOutlined
|
|
5301
|
+
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
5302
|
+
money: true,
|
|
5303
|
+
error: false,
|
|
5304
|
+
warning: false
|
|
5232
5305
|
},
|
|
5233
5306
|
"ROAS": {
|
|
5234
5307
|
value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
|
|
5235
5308
|
subValue: "".concat(Number((_apiData$roasCardPrev = apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) !== null && _apiData$roasCardPrev !== void 0 ? _apiData$roasCardPrev : 0).toFixed(2), "x vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5236
5309
|
label: "ROAS",
|
|
5237
|
-
icon: TrendingUp
|
|
5310
|
+
icon: /*#__PURE__*/jsx(TrendingUp, {}),
|
|
5311
|
+
money: false,
|
|
5312
|
+
error: false,
|
|
5313
|
+
warning: false
|
|
5238
5314
|
},
|
|
5239
5315
|
"Conversion": {
|
|
5240
5316
|
value: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionCard) || "1.7%",
|
|
5241
5317
|
subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionSub) || "215 / 12.4K",
|
|
5242
5318
|
label: "Conversion Rate",
|
|
5243
|
-
icon: Adjust
|
|
5319
|
+
icon: /*#__PURE__*/jsx(Adjust, {}),
|
|
5320
|
+
money: false,
|
|
5321
|
+
error: false,
|
|
5322
|
+
warning: false
|
|
5244
5323
|
}
|
|
5245
5324
|
};
|
|
5246
5325
|
var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
|
|
@@ -5249,22 +5328,39 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5249
5328
|
var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
|
|
5250
5329
|
var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
|
|
5251
5330
|
var renderCard = function renderCard(title) {
|
|
5252
|
-
return /*#__PURE__*/jsx(
|
|
5331
|
+
return /*#__PURE__*/jsx(MetricCard
|
|
5332
|
+
// key={title}
|
|
5333
|
+
, {
|
|
5253
5334
|
title: title,
|
|
5254
|
-
value: metricInfo[title].value,
|
|
5255
|
-
|
|
5335
|
+
value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
|
|
5336
|
+
caption: metricInfo[title].subValue,
|
|
5256
5337
|
icon: metricInfo[title].icon,
|
|
5338
|
+
error: metricInfo[title].error,
|
|
5339
|
+
active: activeMetric === title,
|
|
5257
5340
|
onClick: function onClick() {
|
|
5258
5341
|
return setActiveMetric(title);
|
|
5259
5342
|
},
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
}
|
|
5343
|
+
sx: metricInfo[title].error ? {
|
|
5344
|
+
border: "2px solid #ef4444",
|
|
5345
|
+
bgcolor: "#fffafa"
|
|
5346
|
+
} : {}
|
|
5347
|
+
})
|
|
5348
|
+
// <DisplayCard
|
|
5349
|
+
// key={title}
|
|
5350
|
+
// title={title}
|
|
5351
|
+
// value={metricInfo[title].value}
|
|
5352
|
+
// subValue={metricInfo[title].subValue}
|
|
5353
|
+
// icon={metricInfo[title].icon}
|
|
5354
|
+
// onClick={() => setActiveMetric(title)}
|
|
5355
|
+
// isActive={activeMetric === title}
|
|
5356
|
+
// sx={{
|
|
5357
|
+
// // border:
|
|
5358
|
+
// // activeMetric === title
|
|
5359
|
+
// // ? "1px solid rgb(99, 99, 230)"
|
|
5360
|
+
// // : "2px solid #f0f0f0",
|
|
5361
|
+
// }}
|
|
5362
|
+
// />
|
|
5363
|
+
;
|
|
5268
5364
|
};
|
|
5269
5365
|
var extendedCharts = getExtendedCharts();
|
|
5270
5366
|
var selectedInfo = metricInfo[activeMetric];
|