@ammarkhalidfarooq/dashboard-package 0.6.105 → 0.6.107

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
@@ -1,5 +1,5 @@
1
1
  import React, { Suspense, lazy, useState, useRef, useEffect, useMemo } from 'react';
2
- import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, Stack, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Skeleton } from '@mui/material';
2
+ import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, Stack, Dialog, DialogTitle, DialogContent, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Skeleton } from '@mui/material';
3
3
  import { MoreHoriz, TrendingDown, TrendingUp, MoreVert, Check, InfoOutlined, Settings, PeopleAltOutlined, PaidOutlined, PersonOutlined, IndeterminateCheckBoxOutlined, FavoriteOutlined, SearchOutlined, HighlightOff, Email } from '@mui/icons-material';
4
4
  import { createTheme, useTheme } from '@mui/material/styles';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -7,6 +7,7 @@ import Grid$1 from '@mui/material/Grid';
7
7
  import Box$1 from '@mui/material/Box';
8
8
  import Typography$1 from '@mui/material/Typography';
9
9
  import ReactApexChart from 'react-apexcharts';
10
+ import CloseIcon from '@mui/icons-material/Close';
10
11
 
11
12
  var theme = createTheme({
12
13
  cssVariables: true,
@@ -6593,36 +6594,13 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6593
6594
  value: item.donations !== undefined ? item.donations : item.value || 0
6594
6595
  };
6595
6596
  });
6596
- return /*#__PURE__*/jsxs(Card, {
6597
+ return /*#__PURE__*/jsx(CardWrapper, {
6598
+ title: "Paid Donor Geography",
6599
+ subtitle: "Where ad-acquired donors come from",
6597
6600
  sx: _objectSpread2({
6598
- bgcolor: "#fff",
6599
- borderRadius: 4,
6600
- border: "1px solid #f0f0f0",
6601
- boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
6602
- p: 3
6601
+ width: "100%"
6603
6602
  }, sx),
6604
- children: [/*#__PURE__*/jsxs(Box, {
6605
- sx: {
6606
- textAlign: "left",
6607
- marginBottom: "12px"
6608
- },
6609
- children: [/*#__PURE__*/jsx(Typography, {
6610
- sx: {
6611
- fontWeight: 700,
6612
- fontSize: "18px",
6613
- color: "#000",
6614
- lineHeight: 1.15
6615
- },
6616
- children: "Paid Donor Geography"
6617
- }), /*#__PURE__*/jsx(Typography, {
6618
- sx: {
6619
- fontSize: "13px",
6620
- color: "rgba(0, 0, 0, 0.4)",
6621
- lineHeight: 1.15
6622
- },
6623
- children: "Where ad-acquired donors come from"
6624
- })]
6625
- }), data.length === 0 ? /*#__PURE__*/jsx(Typography, {
6603
+ children: data.length === 0 ? /*#__PURE__*/jsx(Typography, {
6626
6604
  sx: {
6627
6605
  fontSize: "13px",
6628
6606
  color: "rgba(0, 0, 0, 0.4)",
@@ -6674,7 +6652,7 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6674
6652
  children: [item.value, " - ", item.percentage, "%"]
6675
6653
  })]
6676
6654
  }, index);
6677
- })]
6655
+ })
6678
6656
  });
6679
6657
  };
6680
6658
 
@@ -7064,6 +7042,154 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7064
7042
  });
7065
7043
  };
7066
7044
 
7045
+ var BORDER$1 = "1px solid #e0e0e0";
7046
+ var headerCellSx$1 = {
7047
+ fontWeight: 700,
7048
+ fontSize: "0.78rem",
7049
+ color: "#111",
7050
+ bgcolor: "#f3f3f3",
7051
+ borderBottom: BORDER$1,
7052
+ borderRight: BORDER$1,
7053
+ py: "12px",
7054
+ px: "16px",
7055
+ lineHeight: 1.4,
7056
+ textAlign: "left",
7057
+ "&:last-child": {
7058
+ borderRight: 0
7059
+ }
7060
+ };
7061
+ var cellSx$1 = {
7062
+ fontSize: "0.85rem",
7063
+ color: "#333",
7064
+ borderBottom: BORDER$1,
7065
+ borderRight: BORDER$1,
7066
+ py: "12px",
7067
+ px: "16px",
7068
+ verticalAlign: "middle",
7069
+ textAlign: "left",
7070
+ "&:last-child": {
7071
+ borderRight: 0
7072
+ }
7073
+ };
7074
+ var MOCK_ROWS = [{
7075
+ date: "Jun 1, 2026",
7076
+ campaignName: "Ramadan 2024 - Global Feed",
7077
+ raised: "$4,520.00"
7078
+ }, {
7079
+ date: "Jun 2, 2026",
7080
+ campaignName: "Water for Life - East Africa",
7081
+ raised: "$1,280.00"
7082
+ }, {
7083
+ date: "Jun 3, 2026",
7084
+ campaignName: "Orphan Care - Palestine",
7085
+ raised: "$2,850.00"
7086
+ }, {
7087
+ date: "Jun 4, 2026",
7088
+ campaignName: "Emergency Relief - Yemen",
7089
+ raised: "$1,540.00"
7090
+ }, {
7091
+ date: "Jun 5, 2026",
7092
+ campaignName: "Education Fund - Syria",
7093
+ raised: "$980.00"
7094
+ }, {
7095
+ date: "Jun 6, 2026",
7096
+ campaignName: "Medical Aid - Gaza",
7097
+ raised: "$3,120.00"
7098
+ }, {
7099
+ date: "Jun 7, 2026",
7100
+ campaignName: "Food Security - Sudan",
7101
+ raised: "$760.00"
7102
+ }];
7103
+ var OverallDetailModal = function OverallDetailModal(_ref) {
7104
+ var open = _ref.open,
7105
+ title = _ref.title,
7106
+ onClose = _ref.onClose;
7107
+ return /*#__PURE__*/jsxs(Dialog, {
7108
+ open: open,
7109
+ onClose: onClose,
7110
+ maxWidth: "md",
7111
+ fullWidth: true,
7112
+ children: [/*#__PURE__*/jsxs(DialogTitle, {
7113
+ sx: {
7114
+ display: "flex",
7115
+ alignItems: "center",
7116
+ justifyContent: "space-between",
7117
+ pr: 1,
7118
+ pb: 1
7119
+ },
7120
+ children: [/*#__PURE__*/jsxs(Box, {
7121
+ children: [/*#__PURE__*/jsx(Typography, {
7122
+ sx: {
7123
+ fontWeight: 700,
7124
+ fontSize: "18px",
7125
+ color: "#000"
7126
+ },
7127
+ children: title
7128
+ }), /*#__PURE__*/jsx(Typography, {
7129
+ sx: {
7130
+ fontSize: "13px",
7131
+ color: "rgba(0, 0, 0, 0.45)",
7132
+ mt: 0.25
7133
+ },
7134
+ children: "Campaign breakdown"
7135
+ })]
7136
+ }), /*#__PURE__*/jsx(IconButton, {
7137
+ "aria-label": "Close",
7138
+ onClick: onClose,
7139
+ size: "small",
7140
+ children: /*#__PURE__*/jsx(CloseIcon, {})
7141
+ })]
7142
+ }), /*#__PURE__*/jsx(DialogContent, {
7143
+ sx: {
7144
+ pt: 0
7145
+ },
7146
+ children: /*#__PURE__*/jsx(TableContainer, {
7147
+ sx: {
7148
+ border: BORDER$1,
7149
+ borderRadius: "12px",
7150
+ overflow: "hidden"
7151
+ },
7152
+ children: /*#__PURE__*/jsxs(Table, {
7153
+ children: [/*#__PURE__*/jsx(TableHead, {
7154
+ children: /*#__PURE__*/jsxs(TableRow, {
7155
+ children: [/*#__PURE__*/jsx(TableCell, {
7156
+ sx: headerCellSx$1,
7157
+ children: "Date"
7158
+ }), /*#__PURE__*/jsx(TableCell, {
7159
+ sx: headerCellSx$1,
7160
+ children: "Campaign Name"
7161
+ }), /*#__PURE__*/jsx(TableCell, {
7162
+ sx: _objectSpread2(_objectSpread2({}, headerCellSx$1), {}, {
7163
+ textAlign: "right"
7164
+ }),
7165
+ children: "Raised"
7166
+ })]
7167
+ })
7168
+ }), /*#__PURE__*/jsx(TableBody, {
7169
+ children: MOCK_ROWS.map(function (row) {
7170
+ return /*#__PURE__*/jsxs(TableRow, {
7171
+ children: [/*#__PURE__*/jsx(TableCell, {
7172
+ sx: cellSx$1,
7173
+ children: row.date
7174
+ }), /*#__PURE__*/jsx(TableCell, {
7175
+ sx: cellSx$1,
7176
+ children: row.campaignName
7177
+ }), /*#__PURE__*/jsx(TableCell, {
7178
+ sx: _objectSpread2(_objectSpread2({}, cellSx$1), {}, {
7179
+ textAlign: "right",
7180
+ fontWeight: 600
7181
+ }),
7182
+ children: row.raised
7183
+ })]
7184
+ }, "".concat(row.date, "-").concat(row.campaignName));
7185
+ })
7186
+ })]
7187
+ })
7188
+ })
7189
+ })]
7190
+ });
7191
+ };
7192
+
7067
7193
  var CARD_SX = {
7068
7194
  maxHeight: 280
7069
7195
  };
@@ -7111,7 +7237,30 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7111
7237
  _ref.dateName;
7112
7238
  var _ref$numberOfDays = _ref.numberOfDays,
7113
7239
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7240
+ var _useState = useState(null),
7241
+ _useState2 = _slicedToArray(_useState, 2),
7242
+ modalTitle = _useState2[0],
7243
+ setModalTitle = _useState2[1];
7114
7244
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7245
+ var openDetailModal = function openDetailModal(title) {
7246
+ if (!exportMode) {
7247
+ setModalTitle(title);
7248
+ }
7249
+ };
7250
+ var closeDetailModal = function closeDetailModal() {
7251
+ return setModalTitle(null);
7252
+ };
7253
+ var withCardClick = function withCardClick(title, card) {
7254
+ return exportMode ? card : /*#__PURE__*/jsx(Box, {
7255
+ onClick: function onClick() {
7256
+ return openDetailModal(title);
7257
+ },
7258
+ sx: {
7259
+ height: "100%"
7260
+ },
7261
+ children: card
7262
+ });
7263
+ };
7115
7264
  var _donorMix$newDonors = donorMix.newDonors,
7116
7265
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
7117
7266
  _donorMix$returningDo = donorMix.returningDonors,
@@ -7174,12 +7323,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7174
7323
  sx: {
7175
7324
  paddingTop: "0px !important"
7176
7325
  },
7177
- children: /*#__PURE__*/jsx(ActiveCampaignsCard, {
7326
+ children: withCardClick("Active Campaigns", /*#__PURE__*/jsx(ActiveCampaignsCard, {
7178
7327
  title: "Active Campaigns",
7179
7328
  subtitle: "Live fundraisers ranked by velocity",
7180
7329
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7181
7330
  rows: activeCampaignsRows
7182
- })
7331
+ }))
7183
7332
  }), /*#__PURE__*/jsx(Grid, {
7184
7333
  item: true,
7185
7334
  xs: 12,
@@ -7192,7 +7341,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7192
7341
  md: 0
7193
7342
  }
7194
7343
  },
7195
- children: /*#__PURE__*/jsx(DonorMixCard, {
7344
+ children: withCardClick("Donor Mix", /*#__PURE__*/jsx(DonorMixCard, {
7196
7345
  title: "Donor Mix",
7197
7346
  subtitle: "Acquisition vs retention",
7198
7347
  series: [newDonors, returningDonors],
@@ -7214,29 +7363,29 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7214
7363
  sx: {
7215
7364
  width: "100%"
7216
7365
  }
7217
- })
7366
+ }))
7218
7367
  })]
7219
7368
  });
7220
7369
  var middleCards = /*#__PURE__*/jsxs(Fragment, {
7221
- children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
7370
+ children: [withCardClick("Donation Type", /*#__PURE__*/jsx(DonationTypeBarChart, {
7222
7371
  sx: CARD_SX,
7223
7372
  donationTypeData: donationTypeData
7224
- }), /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7373
+ })), withCardClick("Paid Donor Geography", /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7225
7374
  sx: CARD_SX,
7226
7375
  donorGeographyData: donorGeographyData
7227
- }), /*#__PURE__*/jsx(RefundsChargebacksCard, {
7376
+ })), withCardClick("Refunds & Chargebacks", /*#__PURE__*/jsx(RefundsChargebacksCard, {
7228
7377
  sx: CARD_SX,
7229
7378
  refundsChargebacksData: refundsChargebacksData,
7230
7379
  numberOfDays: numberOfDays
7231
- }), /*#__PURE__*/jsx(TrafficSourceCard, {
7380
+ })), withCardClick("Traffic Source", /*#__PURE__*/jsx(TrafficSourceCard, {
7232
7381
  sx: CARD_SX,
7233
7382
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7234
7383
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7235
7384
  numberOfDays: numberOfDays
7236
- })]
7385
+ }))]
7237
7386
  });
7238
7387
  var bottomCards = /*#__PURE__*/jsxs(Fragment, {
7239
- children: [/*#__PURE__*/jsx(MetricSparklineCard, {
7388
+ children: [withCardClick("Order Bump", /*#__PURE__*/jsx(MetricSparklineCard, {
7240
7389
  title: "Order Bump",
7241
7390
  subtitle: "Revenue trend - last ".concat(daysLabel),
7242
7391
  value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
@@ -7261,7 +7410,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7261
7410
  }],
7262
7411
  sx: CARD_SX,
7263
7412
  bottomSection: true
7264
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7413
+ })), withCardClick("Upsell", /*#__PURE__*/jsx(MetricDonutCard, {
7265
7414
  title: "Upsell",
7266
7415
  subtitle: "Acceptance & raised",
7267
7416
  acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
@@ -7270,7 +7419,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7270
7419
  raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7271
7420
  raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
7272
7421
  sx: CARD_SX
7273
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7422
+ })), withCardClick("Downsell", /*#__PURE__*/jsx(MetricDonutCard, {
7274
7423
  title: "Downsell",
7275
7424
  subtitle: "Acceptance & raised",
7276
7425
  acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
@@ -7279,7 +7428,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7279
7428
  raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7280
7429
  raisedTrend: "".concat((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0).toFixed(1), "%"),
7281
7430
  sx: CARD_SX
7282
- }), /*#__PURE__*/jsx(MetricSparklineCard, {
7431
+ })), withCardClick("Referrals", /*#__PURE__*/jsx(MetricSparklineCard, {
7283
7432
  title: "Referrals",
7284
7433
  subtitle: "Revenue trend - last ".concat(daysLabel),
7285
7434
  value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
@@ -7303,19 +7452,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7303
7452
  }],
7304
7453
  sx: CARD_SX,
7305
7454
  bottomSection: true
7306
- })]
7307
- });
7308
- if (section === "campaigns") return /*#__PURE__*/jsx(Box, {
7309
- children: campaignsRow
7455
+ }))]
7310
7456
  });
7311
- if (section === "middle") return /*#__PURE__*/jsx(Box, {
7312
- sx: fourColGridSx$1(exportMode),
7313
- children: middleCards
7314
- });
7315
- if (section === "bottom") return /*#__PURE__*/jsx(Box, {
7316
- sx: fourColGridSx$1(exportMode),
7317
- children: bottomCards
7457
+ var detailModal = /*#__PURE__*/jsx(OverallDetailModal, {
7458
+ open: Boolean(modalTitle),
7459
+ title: modalTitle || "",
7460
+ onClose: closeDetailModal
7318
7461
  });
7462
+ if (section === "campaigns") {
7463
+ return /*#__PURE__*/jsxs(Box, {
7464
+ children: [campaignsRow, detailModal]
7465
+ });
7466
+ }
7467
+ if (section === "middle") {
7468
+ return /*#__PURE__*/jsxs(Box, {
7469
+ children: [/*#__PURE__*/jsx(Box, {
7470
+ sx: fourColGridSx$1(exportMode),
7471
+ children: middleCards
7472
+ }), detailModal]
7473
+ });
7474
+ }
7475
+ if (section === "bottom") {
7476
+ return /*#__PURE__*/jsxs(Box, {
7477
+ children: [/*#__PURE__*/jsx(Box, {
7478
+ sx: fourColGridSx$1(exportMode),
7479
+ children: bottomCards
7480
+ }), detailModal]
7481
+ });
7482
+ }
7319
7483
  return /*#__PURE__*/jsxs(Box, {
7320
7484
  children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7321
7485
  sx: fourColGridSx$1(exportMode),
@@ -7323,7 +7487,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7323
7487
  }), /*#__PURE__*/jsx(Box, {
7324
7488
  sx: fourColGridSx$1(exportMode),
7325
7489
  children: bottomCards
7326
- })]
7490
+ }), detailModal]
7327
7491
  });
7328
7492
  };
7329
7493
 
@@ -18722,17 +18886,24 @@ var PaidSection = function PaidSection(_ref) {
18722
18886
  container: true,
18723
18887
  spacing: 3,
18724
18888
  sx: {
18725
- mt: "6px"
18889
+ mt: "6px",
18890
+ alignItems: "stretch"
18726
18891
  },
18727
18892
  children: [/*#__PURE__*/jsx(Grid, {
18728
18893
  item: true,
18729
18894
  xs: 12,
18730
18895
  md: 6,
18731
18896
  sx: {
18732
- paddingTop: "0px !important"
18897
+ paddingTop: "0px !important",
18898
+ display: "flex"
18733
18899
  },
18734
- children: /*#__PURE__*/jsx(TopPerformingCampaignsCard, {
18735
- data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18900
+ children: /*#__PURE__*/jsx(Box, {
18901
+ sx: {
18902
+ width: "100%"
18903
+ },
18904
+ children: /*#__PURE__*/jsx(TopPerformingCampaignsCard, {
18905
+ data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18906
+ })
18736
18907
  })
18737
18908
  }), /*#__PURE__*/jsx(Grid, {
18738
18909
  item: true,
@@ -18747,7 +18918,8 @@ var PaidSection = function PaidSection(_ref) {
18747
18918
  marginTop: {
18748
18919
  xs: "6px",
18749
18920
  md: "0px"
18750
- }
18921
+ },
18922
+ display: "flex"
18751
18923
  },
18752
18924
  children: /*#__PURE__*/jsx(PaidDonorGeographyCard, {
18753
18925
  donorGeographyData: donorGeographyData