@ammarkhalidfarooq/dashboard-package 0.6.104 → 0.6.105

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",
@@ -6623,7 +6622,14 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6623
6622
  },
6624
6623
  children: "Where ad-acquired donors come from"
6625
6624
  })]
6626
- }), data.map(function (item, index) {
6625
+ }), data.length === 0 ? /*#__PURE__*/jsx(Typography, {
6626
+ sx: {
6627
+ fontSize: "13px",
6628
+ color: "rgba(0, 0, 0, 0.4)",
6629
+ py: 2
6630
+ },
6631
+ children: "No geography data for this period"
6632
+ }) : data.map(function (item, index) {
6627
6633
  return /*#__PURE__*/jsxs(Box, {
6628
6634
  sx: {
6629
6635
  display: "flex",
@@ -7058,94 +7064,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7058
7064
  });
7059
7065
  };
7060
7066
 
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
7067
  var CARD_SX = {
7144
7068
  maxHeight: 280
7145
7069
  };
7146
- var MODAL_CARD_SX = {
7147
- maxHeight: "none"
7148
- };
7149
7070
  var GRID_GAP = "6px";
7150
7071
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7151
7072
  return {
@@ -7190,10 +7111,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7190
7111
  _ref.dateName;
7191
7112
  var _ref$numberOfDays = _ref.numberOfDays,
7192
7113
  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
7114
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7198
7115
  var _donorMix$newDonors = donorMix.newDonors,
7199
7116
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7209,150 +7126,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7209
7126
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7210
7127
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7211
7128
  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
7129
  var campaignsRow = exportMode ? /*#__PURE__*/jsxs(Box, {
7357
7130
  sx: {
7358
7131
  display: "grid",
@@ -7360,7 +7133,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7360
7133
  gap: GRID_GAP,
7361
7134
  alignItems: "stretch"
7362
7135
  },
7363
- children: [/*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7136
+ children: [/*#__PURE__*/jsx(ActiveCampaignsCard, {
7137
+ title: "Active Campaigns",
7138
+ subtitle: "Live fundraisers ranked by velocity",
7139
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7140
+ rows: activeCampaignsRows
7141
+ }), /*#__PURE__*/jsx(DonorMixCard, {
7142
+ title: "Donor Mix",
7143
+ subtitle: "Acquisition vs retention",
7144
+ series: [newDonors, returningDonors],
7145
+ labels: ["New donors", "Returning"],
7146
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7147
+ centerLabel: "donors",
7148
+ centerValue: String(totalMix),
7149
+ items: [{
7150
+ label: "New donors",
7151
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7152
+ color: "rgb(99, 99, 230)"
7153
+ }, {
7154
+ label: "Returning",
7155
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7156
+ color: "#10B981"
7157
+ }],
7158
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7159
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7160
+ sx: {
7161
+ width: "100%"
7162
+ }
7163
+ })]
7364
7164
  }) : /*#__PURE__*/jsxs(Grid, {
7365
7165
  container: true,
7366
7166
  spacing: GRID_GAP,
@@ -7374,7 +7174,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7374
7174
  sx: {
7375
7175
  paddingTop: "0px !important"
7376
7176
  },
7377
- children: wrapCard("activeCampaigns", /*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7177
+ children: /*#__PURE__*/jsx(ActiveCampaignsCard, {
7178
+ title: "Active Campaigns",
7179
+ subtitle: "Live fundraisers ranked by velocity",
7180
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7181
+ rows: activeCampaignsRows
7182
+ })
7378
7183
  }), /*#__PURE__*/jsx(Grid, {
7379
7184
  item: true,
7380
7185
  xs: 12,
@@ -7387,64 +7192,139 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7387
7192
  md: 0
7388
7193
  }
7389
7194
  },
7390
- children: wrapCard("donorMix", /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7195
+ children: /*#__PURE__*/jsx(DonorMixCard, {
7196
+ title: "Donor Mix",
7197
+ subtitle: "Acquisition vs retention",
7198
+ series: [newDonors, returningDonors],
7199
+ labels: ["New donors", "Returning"],
7200
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7201
+ centerLabel: "donors",
7202
+ centerValue: String(totalMix),
7203
+ items: [{
7204
+ label: "New Donors",
7205
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7206
+ color: "rgb(99, 99, 230)"
7207
+ }, {
7208
+ label: "Returning",
7209
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7210
+ color: "#10B981"
7211
+ }],
7212
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7213
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7214
+ sx: {
7215
+ width: "100%"
7216
+ }
7217
+ })
7391
7218
  })]
7392
7219
  });
7393
7220
  var middleCards = /*#__PURE__*/jsxs(Fragment, {
7394
- children: [wrapCard("donationType", /*#__PURE__*/jsx(DonationTypeBarChart, {
7221
+ children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
7395
7222
  sx: CARD_SX,
7396
7223
  donationTypeData: donationTypeData
7397
- })), wrapCard("donorGeography", /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7224
+ }), /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7398
7225
  sx: CARD_SX,
7399
7226
  donorGeographyData: donorGeographyData
7400
- })), wrapCard("refundsChargebacks", /*#__PURE__*/jsx(RefundsChargebacksCard, {
7227
+ }), /*#__PURE__*/jsx(RefundsChargebacksCard, {
7401
7228
  sx: CARD_SX,
7402
7229
  refundsChargebacksData: refundsChargebacksData,
7403
7230
  numberOfDays: numberOfDays
7404
- })), wrapCard("trafficSource", /*#__PURE__*/jsx(TrafficSourceCard, {
7231
+ }), /*#__PURE__*/jsx(TrafficSourceCard, {
7405
7232
  sx: CARD_SX,
7406
7233
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7407
7234
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7408
7235
  numberOfDays: numberOfDays
7409
- }))]
7236
+ })]
7410
7237
  });
7411
7238
  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), {}, {
7239
+ children: [/*#__PURE__*/jsx(MetricSparklineCard, {
7240
+ title: "Order Bump",
7241
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7242
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7243
+ 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"),
7244
+ chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7245
+ return {
7246
+ label: item.label,
7247
+ value: item.revenue
7248
+ };
7249
+ })) || [],
7250
+ isAmount: true,
7251
+ footerMetrics: [{
7252
+ label: "Avg / Day",
7253
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7254
+ }, {
7255
+ label: "Orders",
7256
+ value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7257
+ }, {
7258
+ label: "Peak Day",
7259
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7260
+ subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7261
+ }],
7262
+ sx: CARD_SX,
7263
+ bottomSection: true
7264
+ }), /*#__PURE__*/jsx(MetricDonutCard, {
7265
+ title: "Upsell",
7266
+ subtitle: "Acceptance & raised",
7267
+ acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7268
+ acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7269
+ 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), "%"),
7270
+ raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7271
+ 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
7272
  sx: CARD_SX
7418
- }))), wrapCard("referrals", /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7273
+ }), /*#__PURE__*/jsx(MetricDonutCard, {
7274
+ title: "Downsell",
7275
+ subtitle: "Acceptance & raised",
7276
+ acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7277
+ acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7278
+ 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), "%"),
7279
+ raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7280
+ 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
7281
  sx: CARD_SX
7420
- })))]
7282
+ }), /*#__PURE__*/jsx(MetricSparklineCard, {
7283
+ title: "Referrals",
7284
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7285
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7286
+ 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"),
7287
+ chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7288
+ return {
7289
+ label: item.date,
7290
+ value: item.revenue
7291
+ };
7292
+ })) || [],
7293
+ isAmount: true,
7294
+ footerMetrics: [{
7295
+ label: "Referrers",
7296
+ value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7297
+ }, {
7298
+ label: "Avg gift",
7299
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7300
+ }, {
7301
+ label: "Conv. rate",
7302
+ value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7303
+ }],
7304
+ sx: CARD_SX,
7305
+ bottomSection: true
7306
+ })]
7307
+ });
7308
+ if (section === "campaigns") return /*#__PURE__*/jsx(Box, {
7309
+ children: campaignsRow
7310
+ });
7311
+ if (section === "middle") return /*#__PURE__*/jsx(Box, {
7312
+ sx: fourColGridSx$1(exportMode),
7313
+ children: middleCards
7421
7314
  });
7422
- var content = /*#__PURE__*/jsxs(Fragment, {
7423
- children: [section === "campaigns" && /*#__PURE__*/jsx(Box, {
7424
- children: campaignsRow
7425
- }), section === "middle" && /*#__PURE__*/jsx(Box, {
7315
+ if (section === "bottom") return /*#__PURE__*/jsx(Box, {
7316
+ sx: fourColGridSx$1(exportMode),
7317
+ children: bottomCards
7318
+ });
7319
+ return /*#__PURE__*/jsxs(Box, {
7320
+ children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7426
7321
  sx: fourColGridSx$1(exportMode),
7427
7322
  children: middleCards
7428
- }), section === "bottom" && /*#__PURE__*/jsx(Box, {
7323
+ }), /*#__PURE__*/jsx(Box, {
7429
7324
  sx: fourColGridSx$1(exportMode),
7430
7325
  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
7326
  })]
7446
7327
  });
7447
- return content;
7448
7328
  };
7449
7329
 
7450
7330
  var ReportDetailsSection = function ReportDetailsSection(_ref) {
@@ -18631,6 +18511,12 @@ var PaidSection = function PaidSection(_ref) {
18631
18511
  };
18632
18512
  });
18633
18513
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns, hasPaidOverview]);
18514
+ var donorGeographyData = useMemo(function () {
18515
+ var geography = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
18516
+ if (!hasPaidOverview) return [];
18517
+ var rawCountries = Array.isArray(geography) ? geography : (geography === null || geography === void 0 ? void 0 : geography.countries) || (geography === null || geography === void 0 ? void 0 : geography.data) || [];
18518
+ return Array.isArray(rawCountries) ? rawCountries : [];
18519
+ }, [apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography, hasPaidOverview]);
18634
18520
  var renderCard = function renderCard(title) {
18635
18521
  return /*#__PURE__*/jsx(MetricCard$1, {
18636
18522
  title: title,
@@ -18864,7 +18750,7 @@ var PaidSection = function PaidSection(_ref) {
18864
18750
  }
18865
18751
  },
18866
18752
  children: /*#__PURE__*/jsx(PaidDonorGeographyCard, {
18867
- donorGeographyData: apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography
18753
+ donorGeographyData: donorGeographyData
18868
18754
  })
18869
18755
  })]
18870
18756
  })]