@ammarkhalidfarooq/dashboard-package 0.6.104 → 0.6.106

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, Dialog, DialogContent, 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, 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,7 +7,6 @@ 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';
11
10
 
12
11
  var theme = createTheme({
13
12
  cssVariables: true,
@@ -6586,7 +6585,7 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard(_ref8) {
6586
6585
  var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6587
6586
  var sx = _ref9.sx,
6588
6587
  donorGeographyData = _ref9.donorGeographyData;
6589
- var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || [];
6588
+ var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
6590
6589
  var data = rawCountries.map(function (item) {
6591
6590
  return {
6592
6591
  country: item.countryName || item.country || "Unknown",
@@ -6594,36 +6593,20 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6594
6593
  value: item.donations !== undefined ? item.donations : item.value || 0
6595
6594
  };
6596
6595
  });
6597
- return /*#__PURE__*/jsxs(Card, {
6596
+ return /*#__PURE__*/jsx(CardWrapper, {
6597
+ title: "Paid Donor Geography",
6598
+ subtitle: "Where ad-acquired donors come from",
6598
6599
  sx: _objectSpread2({
6599
- bgcolor: "#fff",
6600
- borderRadius: 4,
6601
- border: "1px solid #f0f0f0",
6602
- boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
6603
- p: 3
6600
+ width: "100%"
6604
6601
  }, sx),
6605
- children: [/*#__PURE__*/jsxs(Box, {
6602
+ children: data.length === 0 ? /*#__PURE__*/jsx(Typography, {
6606
6603
  sx: {
6607
- textAlign: "left",
6608
- marginBottom: "12px"
6604
+ fontSize: "13px",
6605
+ color: "rgba(0, 0, 0, 0.4)",
6606
+ py: 2
6609
6607
  },
6610
- children: [/*#__PURE__*/jsx(Typography, {
6611
- sx: {
6612
- fontWeight: 700,
6613
- fontSize: "18px",
6614
- color: "#000",
6615
- lineHeight: 1.15
6616
- },
6617
- children: "Paid Donor Geography"
6618
- }), /*#__PURE__*/jsx(Typography, {
6619
- sx: {
6620
- fontSize: "13px",
6621
- color: "rgba(0, 0, 0, 0.4)",
6622
- lineHeight: 1.15
6623
- },
6624
- children: "Where ad-acquired donors come from"
6625
- })]
6626
- }), data.map(function (item, index) {
6608
+ children: "No geography data for this period"
6609
+ }) : data.map(function (item, index) {
6627
6610
  return /*#__PURE__*/jsxs(Box, {
6628
6611
  sx: {
6629
6612
  display: "flex",
@@ -6668,7 +6651,7 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6668
6651
  children: [item.value, " - ", item.percentage, "%"]
6669
6652
  })]
6670
6653
  }, index);
6671
- })]
6654
+ })
6672
6655
  });
6673
6656
  };
6674
6657
 
@@ -7058,94 +7041,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7058
7041
  });
7059
7042
  };
7060
7043
 
7061
- var CardDetailModal = function CardDetailModal(_ref) {
7062
- var open = _ref.open,
7063
- onClose = _ref.onClose,
7064
- children = _ref.children;
7065
- return /*#__PURE__*/jsx(Dialog, {
7066
- open: open,
7067
- onClose: onClose,
7068
- maxWidth: "lg",
7069
- fullWidth: true,
7070
- PaperProps: {
7071
- sx: {
7072
- borderRadius: 4,
7073
- maxHeight: "90vh"
7074
- }
7075
- },
7076
- children: /*#__PURE__*/jsxs(Box, {
7077
- sx: {
7078
- position: "relative"
7079
- },
7080
- children: [/*#__PURE__*/jsx(IconButton, {
7081
- "aria-label": "Close",
7082
- onClick: onClose,
7083
- sx: {
7084
- position: "absolute",
7085
- right: 12,
7086
- top: 12,
7087
- zIndex: 2,
7088
- bgcolor: "#fff",
7089
- border: "1px solid #f0f0f0",
7090
- "&:hover": {
7091
- bgcolor: "#f9f9f9"
7092
- }
7093
- },
7094
- children: /*#__PURE__*/jsx(CloseIcon, {
7095
- fontSize: "small"
7096
- })
7097
- }), /*#__PURE__*/jsx(DialogContent, {
7098
- sx: {
7099
- p: 3,
7100
- pt: 5
7101
- },
7102
- children: children
7103
- })]
7104
- })
7105
- });
7106
- };
7107
-
7108
- var ClickableCard = function ClickableCard(_ref) {
7109
- var onClick = _ref.onClick,
7110
- _ref$disabled = _ref.disabled,
7111
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
7112
- children = _ref.children,
7113
- _ref$sx = _ref.sx,
7114
- sx = _ref$sx === void 0 ? {} : _ref$sx;
7115
- return /*#__PURE__*/jsx(Box, {
7116
- onClick: disabled ? undefined : onClick,
7117
- role: disabled ? undefined : "button",
7118
- tabIndex: disabled ? undefined : 0,
7119
- onKeyDown: disabled ? undefined : function (event) {
7120
- if (event.key === "Enter" || event.key === " ") {
7121
- event.preventDefault();
7122
- onClick === null || onClick === void 0 || onClick();
7123
- }
7124
- },
7125
- sx: _objectSpread2(_objectSpread2({
7126
- height: "100%",
7127
- cursor: disabled ? "default" : "pointer",
7128
- borderRadius: 4,
7129
- transition: "box-shadow 0.2s ease, transform 0.2s ease"
7130
- }, !disabled && {
7131
- "&:hover": {
7132
- boxShadow: "0 8px 32px rgba(0,0,0,0.1)"
7133
- },
7134
- "&:focus-visible": {
7135
- outline: "2px solid #4F46E5",
7136
- outlineOffset: 2
7137
- }
7138
- }), sx),
7139
- children: children
7140
- });
7141
- };
7142
-
7143
7044
  var CARD_SX = {
7144
7045
  maxHeight: 280
7145
7046
  };
7146
- var MODAL_CARD_SX = {
7147
- maxHeight: "none"
7148
- };
7149
7047
  var GRID_GAP = "6px";
7150
7048
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7151
7049
  return {
@@ -7190,10 +7088,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7190
7088
  _ref.dateName;
7191
7089
  var _ref$numberOfDays = _ref.numberOfDays,
7192
7090
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7193
- var _useState = useState(null),
7194
- _useState2 = _slicedToArray(_useState, 2),
7195
- openModalKey = _useState2[0],
7196
- setOpenModalKey = _useState2[1];
7197
7091
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7198
7092
  var _donorMix$newDonors = donorMix.newDonors,
7199
7093
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7209,150 +7103,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7209
7103
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7210
7104
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7211
7105
  donorMixPrev = _donorMix$donorMixPre === void 0 ? 0 : _donorMix$donorMixPre;
7212
- var activeCampaignsProps = {
7213
- title: "Active Campaigns",
7214
- subtitle: "Live fundraisers ranked by velocity",
7215
- columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7216
- rows: activeCampaignsRows
7217
- };
7218
- var donorMixProps = {
7219
- title: "Donor Mix",
7220
- subtitle: "Acquisition vs retention",
7221
- series: [newDonors, returningDonors],
7222
- labels: ["New donors", "Returning"],
7223
- colors: ["rgb(99, 99, 230)", "#10B981"],
7224
- centerLabel: "donors",
7225
- centerValue: String(totalMix),
7226
- items: [{
7227
- label: "New Donors",
7228
- val: "".concat(newDonors, " - ").concat(newPct, "%"),
7229
- color: "rgb(99, 99, 230)"
7230
- }, {
7231
- label: "Returning",
7232
- val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7233
- color: "#10B981"
7234
- }],
7235
- bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7236
- bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7237
- sx: {
7238
- width: "100%"
7239
- }
7240
- };
7241
- var orderBumpProps = {
7242
- title: "Order Bump",
7243
- subtitle: "Revenue trend - last ".concat(daysLabel),
7244
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7245
- trend: "".concat((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) || 0).toFixed(1), "% vs pp"),
7246
- chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7247
- return {
7248
- label: item.label,
7249
- value: item.revenue
7250
- };
7251
- })) || [],
7252
- isAmount: true,
7253
- footerMetrics: [{
7254
- label: "Avg / Day",
7255
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7256
- }, {
7257
- label: "Orders",
7258
- value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7259
- }, {
7260
- label: "Peak Day",
7261
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7262
- subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7263
- }],
7264
- bottomSection: true
7265
- };
7266
- var upsellProps = {
7267
- title: "Upsell",
7268
- subtitle: "Acceptance & raised",
7269
- acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7270
- acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7271
- acceptanceTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
7272
- raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7273
- 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
- };
7275
- var downsellProps = {
7276
- title: "Downsell",
7277
- subtitle: "Acceptance & raised",
7278
- acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7279
- acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7280
- acceptanceTrend: "".concat((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
7281
- raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7282
- 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
- };
7284
- var referralProps = {
7285
- title: "Referrals",
7286
- subtitle: "Revenue trend - last ".concat(daysLabel),
7287
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7288
- trend: "".concat((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) || 0).toFixed(1), "% vs pp"),
7289
- chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7290
- return {
7291
- label: item.date,
7292
- value: item.revenue
7293
- };
7294
- })) || [],
7295
- isAmount: true,
7296
- footerMetrics: [{
7297
- label: "Referrers",
7298
- value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7299
- }, {
7300
- label: "Avg gift",
7301
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7302
- }, {
7303
- label: "Conv. rate",
7304
- value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7305
- }],
7306
- bottomSection: true
7307
- };
7308
- var modalContentByKey = {
7309
- activeCampaigns: /*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2(_objectSpread2({}, activeCampaignsProps), {}, {
7310
- sx: MODAL_CARD_SX
7311
- })),
7312
- donorMix: /*#__PURE__*/jsx(DonorMixCard, _objectSpread2(_objectSpread2({}, donorMixProps), {}, {
7313
- sx: MODAL_CARD_SX
7314
- })),
7315
- donationType: /*#__PURE__*/jsx(DonationTypeBarChart, {
7316
- sx: MODAL_CARD_SX,
7317
- donationTypeData: donationTypeData
7318
- }),
7319
- donorGeography: /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7320
- sx: MODAL_CARD_SX,
7321
- donorGeographyData: donorGeographyData
7322
- }),
7323
- refundsChargebacks: /*#__PURE__*/jsx(RefundsChargebacksCard, {
7324
- sx: MODAL_CARD_SX,
7325
- refundsChargebacksData: refundsChargebacksData,
7326
- numberOfDays: numberOfDays
7327
- }),
7328
- trafficSource: /*#__PURE__*/jsx(TrafficSourceCard, {
7329
- sx: MODAL_CARD_SX,
7330
- trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7331
- total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7332
- numberOfDays: numberOfDays
7333
- }),
7334
- orderBump: /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7335
- sx: MODAL_CARD_SX
7336
- })),
7337
- upsell: /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7338
- sx: MODAL_CARD_SX
7339
- })),
7340
- downsell: /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7341
- sx: MODAL_CARD_SX
7342
- })),
7343
- referrals: /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7344
- sx: MODAL_CARD_SX
7345
- }))
7346
- };
7347
- var wrapCard = function wrapCard(modalKey, card) {
7348
- if (exportMode) return card;
7349
- return /*#__PURE__*/jsx(ClickableCard, {
7350
- onClick: function onClick() {
7351
- return setOpenModalKey(modalKey);
7352
- },
7353
- children: card
7354
- });
7355
- };
7356
7106
  var campaignsRow = exportMode ? /*#__PURE__*/jsxs(Box, {
7357
7107
  sx: {
7358
7108
  display: "grid",
@@ -7360,7 +7110,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7360
7110
  gap: GRID_GAP,
7361
7111
  alignItems: "stretch"
7362
7112
  },
7363
- children: [/*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7113
+ children: [/*#__PURE__*/jsx(ActiveCampaignsCard, {
7114
+ title: "Active Campaigns",
7115
+ subtitle: "Live fundraisers ranked by velocity",
7116
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7117
+ rows: activeCampaignsRows
7118
+ }), /*#__PURE__*/jsx(DonorMixCard, {
7119
+ title: "Donor Mix",
7120
+ subtitle: "Acquisition vs retention",
7121
+ series: [newDonors, returningDonors],
7122
+ labels: ["New donors", "Returning"],
7123
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7124
+ centerLabel: "donors",
7125
+ centerValue: String(totalMix),
7126
+ items: [{
7127
+ label: "New donors",
7128
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7129
+ color: "rgb(99, 99, 230)"
7130
+ }, {
7131
+ label: "Returning",
7132
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7133
+ color: "#10B981"
7134
+ }],
7135
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7136
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7137
+ sx: {
7138
+ width: "100%"
7139
+ }
7140
+ })]
7364
7141
  }) : /*#__PURE__*/jsxs(Grid, {
7365
7142
  container: true,
7366
7143
  spacing: GRID_GAP,
@@ -7374,7 +7151,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7374
7151
  sx: {
7375
7152
  paddingTop: "0px !important"
7376
7153
  },
7377
- children: wrapCard("activeCampaigns", /*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7154
+ children: /*#__PURE__*/jsx(ActiveCampaignsCard, {
7155
+ title: "Active Campaigns",
7156
+ subtitle: "Live fundraisers ranked by velocity",
7157
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7158
+ rows: activeCampaignsRows
7159
+ })
7378
7160
  }), /*#__PURE__*/jsx(Grid, {
7379
7161
  item: true,
7380
7162
  xs: 12,
@@ -7387,64 +7169,139 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7387
7169
  md: 0
7388
7170
  }
7389
7171
  },
7390
- children: wrapCard("donorMix", /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7172
+ children: /*#__PURE__*/jsx(DonorMixCard, {
7173
+ title: "Donor Mix",
7174
+ subtitle: "Acquisition vs retention",
7175
+ series: [newDonors, returningDonors],
7176
+ labels: ["New donors", "Returning"],
7177
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7178
+ centerLabel: "donors",
7179
+ centerValue: String(totalMix),
7180
+ items: [{
7181
+ label: "New Donors",
7182
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7183
+ color: "rgb(99, 99, 230)"
7184
+ }, {
7185
+ label: "Returning",
7186
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7187
+ color: "#10B981"
7188
+ }],
7189
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7190
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7191
+ sx: {
7192
+ width: "100%"
7193
+ }
7194
+ })
7391
7195
  })]
7392
7196
  });
7393
7197
  var middleCards = /*#__PURE__*/jsxs(Fragment, {
7394
- children: [wrapCard("donationType", /*#__PURE__*/jsx(DonationTypeBarChart, {
7198
+ children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
7395
7199
  sx: CARD_SX,
7396
7200
  donationTypeData: donationTypeData
7397
- })), wrapCard("donorGeography", /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7201
+ }), /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7398
7202
  sx: CARD_SX,
7399
7203
  donorGeographyData: donorGeographyData
7400
- })), wrapCard("refundsChargebacks", /*#__PURE__*/jsx(RefundsChargebacksCard, {
7204
+ }), /*#__PURE__*/jsx(RefundsChargebacksCard, {
7401
7205
  sx: CARD_SX,
7402
7206
  refundsChargebacksData: refundsChargebacksData,
7403
7207
  numberOfDays: numberOfDays
7404
- })), wrapCard("trafficSource", /*#__PURE__*/jsx(TrafficSourceCard, {
7208
+ }), /*#__PURE__*/jsx(TrafficSourceCard, {
7405
7209
  sx: CARD_SX,
7406
7210
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7407
7211
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7408
7212
  numberOfDays: numberOfDays
7409
- }))]
7213
+ })]
7410
7214
  });
7411
7215
  var bottomCards = /*#__PURE__*/jsxs(Fragment, {
7412
- children: [wrapCard("orderBump", /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7413
- sx: CARD_SX
7414
- }))), wrapCard("upsell", /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7415
- sx: CARD_SX
7416
- }))), wrapCard("downsell", /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7216
+ children: [/*#__PURE__*/jsx(MetricSparklineCard, {
7217
+ title: "Order Bump",
7218
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7219
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7220
+ trend: "".concat((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) >= 0 ? "" : "▼", " ").concat(Math.abs((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.growthPercentage) || 0).toFixed(1), "% vs pp"),
7221
+ chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7222
+ return {
7223
+ label: item.label,
7224
+ value: item.revenue
7225
+ };
7226
+ })) || [],
7227
+ isAmount: true,
7228
+ footerMetrics: [{
7229
+ label: "Avg / Day",
7230
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7231
+ }, {
7232
+ label: "Orders",
7233
+ value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7234
+ }, {
7235
+ label: "Peak Day",
7236
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7237
+ subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7238
+ }],
7239
+ sx: CARD_SX,
7240
+ bottomSection: true
7241
+ }), /*#__PURE__*/jsx(MetricDonutCard, {
7242
+ title: "Upsell",
7243
+ subtitle: "Acceptance & raised",
7244
+ acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7245
+ acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7246
+ acceptanceTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
7247
+ raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7248
+ 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), "%"),
7417
7249
  sx: CARD_SX
7418
- }))), wrapCard("referrals", /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7250
+ }), /*#__PURE__*/jsx(MetricDonutCard, {
7251
+ title: "Downsell",
7252
+ subtitle: "Acceptance & raised",
7253
+ acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7254
+ acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7255
+ acceptanceTrend: "".concat((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceGrowth) || 0).toFixed(1), "%"),
7256
+ raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7257
+ 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), "%"),
7419
7258
  sx: CARD_SX
7420
- })))]
7259
+ }), /*#__PURE__*/jsx(MetricSparklineCard, {
7260
+ title: "Referrals",
7261
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7262
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7263
+ trend: "".concat((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) >= 0 ? "▲" : "▼", " ").concat(Math.abs((referralData === null || referralData === void 0 ? void 0 : referralData.growthPercentage) || 0).toFixed(1), "% vs pp"),
7264
+ chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7265
+ return {
7266
+ label: item.date,
7267
+ value: item.revenue
7268
+ };
7269
+ })) || [],
7270
+ isAmount: true,
7271
+ footerMetrics: [{
7272
+ label: "Referrers",
7273
+ value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7274
+ }, {
7275
+ label: "Avg gift",
7276
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7277
+ }, {
7278
+ label: "Conv. rate",
7279
+ value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7280
+ }],
7281
+ sx: CARD_SX,
7282
+ bottomSection: true
7283
+ })]
7284
+ });
7285
+ if (section === "campaigns") return /*#__PURE__*/jsx(Box, {
7286
+ children: campaignsRow
7287
+ });
7288
+ if (section === "middle") return /*#__PURE__*/jsx(Box, {
7289
+ sx: fourColGridSx$1(exportMode),
7290
+ children: middleCards
7421
7291
  });
7422
- var content = /*#__PURE__*/jsxs(Fragment, {
7423
- children: [section === "campaigns" && /*#__PURE__*/jsx(Box, {
7424
- children: campaignsRow
7425
- }), section === "middle" && /*#__PURE__*/jsx(Box, {
7292
+ if (section === "bottom") return /*#__PURE__*/jsx(Box, {
7293
+ sx: fourColGridSx$1(exportMode),
7294
+ children: bottomCards
7295
+ });
7296
+ return /*#__PURE__*/jsxs(Box, {
7297
+ children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7426
7298
  sx: fourColGridSx$1(exportMode),
7427
7299
  children: middleCards
7428
- }), section === "bottom" && /*#__PURE__*/jsx(Box, {
7300
+ }), /*#__PURE__*/jsx(Box, {
7429
7301
  sx: fourColGridSx$1(exportMode),
7430
7302
  children: bottomCards
7431
- }), section === "all" && /*#__PURE__*/jsxs(Box, {
7432
- children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7433
- sx: fourColGridSx$1(exportMode),
7434
- children: middleCards
7435
- }), /*#__PURE__*/jsx(Box, {
7436
- sx: fourColGridSx$1(exportMode),
7437
- children: bottomCards
7438
- })]
7439
- }), !exportMode && /*#__PURE__*/jsx(CardDetailModal, {
7440
- open: Boolean(openModalKey),
7441
- onClose: function onClose() {
7442
- return setOpenModalKey(null);
7443
- },
7444
- children: openModalKey ? modalContentByKey[openModalKey] : null
7445
7303
  })]
7446
7304
  });
7447
- return content;
7448
7305
  };
7449
7306
 
7450
7307
  var ReportDetailsSection = function ReportDetailsSection(_ref) {
@@ -18631,6 +18488,12 @@ var PaidSection = function PaidSection(_ref) {
18631
18488
  };
18632
18489
  });
18633
18490
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns, hasPaidOverview]);
18491
+ var donorGeographyData = useMemo(function () {
18492
+ var geography = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
18493
+ if (!hasPaidOverview) return [];
18494
+ var rawCountries = Array.isArray(geography) ? geography : (geography === null || geography === void 0 ? void 0 : geography.countries) || (geography === null || geography === void 0 ? void 0 : geography.data) || [];
18495
+ return Array.isArray(rawCountries) ? rawCountries : [];
18496
+ }, [apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography, hasPaidOverview]);
18634
18497
  var renderCard = function renderCard(title) {
18635
18498
  return /*#__PURE__*/jsx(MetricCard$1, {
18636
18499
  title: title,
@@ -18836,17 +18699,24 @@ var PaidSection = function PaidSection(_ref) {
18836
18699
  container: true,
18837
18700
  spacing: 3,
18838
18701
  sx: {
18839
- mt: "6px"
18702
+ mt: "6px",
18703
+ alignItems: "stretch"
18840
18704
  },
18841
18705
  children: [/*#__PURE__*/jsx(Grid, {
18842
18706
  item: true,
18843
18707
  xs: 12,
18844
18708
  md: 6,
18845
18709
  sx: {
18846
- paddingTop: "0px !important"
18710
+ paddingTop: "0px !important",
18711
+ display: "flex"
18847
18712
  },
18848
- children: /*#__PURE__*/jsx(TopPerformingCampaignsCard, {
18849
- data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18713
+ children: /*#__PURE__*/jsx(Box, {
18714
+ sx: {
18715
+ width: "100%"
18716
+ },
18717
+ children: /*#__PURE__*/jsx(TopPerformingCampaignsCard, {
18718
+ data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18719
+ })
18850
18720
  })
18851
18721
  }), /*#__PURE__*/jsx(Grid, {
18852
18722
  item: true,
@@ -18861,10 +18731,11 @@ var PaidSection = function PaidSection(_ref) {
18861
18731
  marginTop: {
18862
18732
  xs: "6px",
18863
18733
  md: "0px"
18864
- }
18734
+ },
18735
+ display: "flex"
18865
18736
  },
18866
18737
  children: /*#__PURE__*/jsx(PaidDonorGeographyCard, {
18867
- donorGeographyData: apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography
18738
+ donorGeographyData: donorGeographyData
18868
18739
  })
18869
18740
  })]
18870
18741
  })]