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