@ammarkhalidfarooq/dashboard-package 0.6.102 → 0.6.104

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, 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,
@@ -2992,7 +2993,6 @@ var P2RefundsCard = function P2RefundsCard(_ref27) {
2992
2993
  fontWeight: 700,
2993
2994
  letterSpacing: "0.5px",
2994
2995
  color: THEME.muted,
2995
- textTransform: "uppercase",
2996
2996
  marginBottom: 3
2997
2997
  },
2998
2998
  children: "Refunds"
@@ -3026,7 +3026,6 @@ var P2RefundsCard = function P2RefundsCard(_ref27) {
3026
3026
  fontWeight: 700,
3027
3027
  letterSpacing: "0.5px",
3028
3028
  color: THEME.muted,
3029
- textTransform: "uppercase",
3030
3029
  marginBottom: 3
3031
3030
  },
3032
3031
  children: "Chargebacks"
@@ -7059,9 +7058,94 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7059
7058
  });
7060
7059
  };
7061
7060
 
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
+
7062
7143
  var CARD_SX = {
7063
7144
  maxHeight: 280
7064
7145
  };
7146
+ var MODAL_CARD_SX = {
7147
+ maxHeight: "none"
7148
+ };
7065
7149
  var GRID_GAP = "6px";
7066
7150
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7067
7151
  return {
@@ -7106,6 +7190,10 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7106
7190
  _ref.dateName;
7107
7191
  var _ref$numberOfDays = _ref.numberOfDays,
7108
7192
  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];
7109
7197
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7110
7198
  var _donorMix$newDonors = donorMix.newDonors,
7111
7199
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7121,6 +7209,150 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7121
7209
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7122
7210
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7123
7211
  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
+ };
7124
7356
  var campaignsRow = exportMode ? /*#__PURE__*/jsxs(Box, {
7125
7357
  sx: {
7126
7358
  display: "grid",
@@ -7128,34 +7360,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7128
7360
  gap: GRID_GAP,
7129
7361
  alignItems: "stretch"
7130
7362
  },
7131
- children: [/*#__PURE__*/jsx(ActiveCampaignsCard, {
7132
- title: "Active Campaigns",
7133
- subtitle: "Live fundraisers ranked by velocity",
7134
- columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7135
- rows: activeCampaignsRows
7136
- }), /*#__PURE__*/jsx(DonorMixCard, {
7137
- title: "Donor Mix",
7138
- subtitle: "Acquisition vs retention",
7139
- series: [newDonors, returningDonors],
7140
- labels: ["New donors", "Returning"],
7141
- colors: ["rgb(99, 99, 230)", "#10B981"],
7142
- centerLabel: "donors",
7143
- centerValue: String(totalMix),
7144
- items: [{
7145
- label: "New donors",
7146
- val: "".concat(newDonors, " - ").concat(newPct, "%"),
7147
- color: "rgb(99, 99, 230)"
7148
- }, {
7149
- label: "Returning",
7150
- val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7151
- color: "#10B981"
7152
- }],
7153
- bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7154
- bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7155
- sx: {
7156
- width: "100%"
7157
- }
7158
- })]
7363
+ children: [/*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7159
7364
  }) : /*#__PURE__*/jsxs(Grid, {
7160
7365
  container: true,
7161
7366
  spacing: GRID_GAP,
@@ -7169,12 +7374,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7169
7374
  sx: {
7170
7375
  paddingTop: "0px !important"
7171
7376
  },
7172
- children: /*#__PURE__*/jsx(ActiveCampaignsCard, {
7173
- title: "Active Campaigns",
7174
- subtitle: "Live fundraisers ranked by velocity",
7175
- columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7176
- rows: activeCampaignsRows
7177
- })
7377
+ children: wrapCard("activeCampaigns", /*#__PURE__*/jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7178
7378
  }), /*#__PURE__*/jsx(Grid, {
7179
7379
  item: true,
7180
7380
  xs: 12,
@@ -7187,139 +7387,64 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7187
7387
  md: 0
7188
7388
  }
7189
7389
  },
7190
- children: /*#__PURE__*/jsx(DonorMixCard, {
7191
- title: "Donor Mix",
7192
- subtitle: "Acquisition vs retention",
7193
- series: [newDonors, returningDonors],
7194
- labels: ["New donors", "Returning"],
7195
- colors: ["rgb(99, 99, 230)", "#10B981"],
7196
- centerLabel: "donors",
7197
- centerValue: String(totalMix),
7198
- items: [{
7199
- label: "New Donors",
7200
- val: "".concat(newDonors, " - ").concat(newPct, "%"),
7201
- color: "rgb(99, 99, 230)"
7202
- }, {
7203
- label: "Returning",
7204
- val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7205
- color: "#10B981"
7206
- }],
7207
- bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7208
- bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7209
- sx: {
7210
- width: "100%"
7211
- }
7212
- })
7390
+ children: wrapCard("donorMix", /*#__PURE__*/jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7213
7391
  })]
7214
7392
  });
7215
7393
  var middleCards = /*#__PURE__*/jsxs(Fragment, {
7216
- children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
7394
+ children: [wrapCard("donationType", /*#__PURE__*/jsx(DonationTypeBarChart, {
7217
7395
  sx: CARD_SX,
7218
7396
  donationTypeData: donationTypeData
7219
- }), /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7397
+ })), wrapCard("donorGeography", /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7220
7398
  sx: CARD_SX,
7221
7399
  donorGeographyData: donorGeographyData
7222
- }), /*#__PURE__*/jsx(RefundsChargebacksCard, {
7400
+ })), wrapCard("refundsChargebacks", /*#__PURE__*/jsx(RefundsChargebacksCard, {
7223
7401
  sx: CARD_SX,
7224
7402
  refundsChargebacksData: refundsChargebacksData,
7225
7403
  numberOfDays: numberOfDays
7226
- }), /*#__PURE__*/jsx(TrafficSourceCard, {
7404
+ })), wrapCard("trafficSource", /*#__PURE__*/jsx(TrafficSourceCard, {
7227
7405
  sx: CARD_SX,
7228
7406
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7229
7407
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7230
7408
  numberOfDays: numberOfDays
7231
- })]
7409
+ }))]
7232
7410
  });
7233
7411
  var bottomCards = /*#__PURE__*/jsxs(Fragment, {
7234
- children: [/*#__PURE__*/jsx(MetricSparklineCard, {
7235
- title: "Order Bump",
7236
- subtitle: "Revenue trend - last ".concat(daysLabel),
7237
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7238
- 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"),
7239
- chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7240
- return {
7241
- label: item.label,
7242
- value: item.revenue
7243
- };
7244
- })) || [],
7245
- isAmount: true,
7246
- footerMetrics: [{
7247
- label: "Avg / Day",
7248
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7249
- }, {
7250
- label: "Orders",
7251
- value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7252
- }, {
7253
- label: "Peak Day",
7254
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7255
- subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7256
- }],
7257
- sx: CARD_SX,
7258
- bottomSection: true
7259
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7260
- title: "Upsell",
7261
- subtitle: "Acceptance & raised",
7262
- acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7263
- acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7264
- 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), "%"),
7265
- raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7266
- 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), "%"),
7412
+ children: [wrapCard("orderBump", /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7267
7413
  sx: CARD_SX
7268
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7269
- title: "Downsell",
7270
- subtitle: "Acceptance & raised",
7271
- acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7272
- acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7273
- 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), "%"),
7274
- raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7275
- 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), "%"),
7414
+ }))), wrapCard("upsell", /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7276
7415
  sx: CARD_SX
7277
- }), /*#__PURE__*/jsx(MetricSparklineCard, {
7278
- title: "Referrals",
7279
- subtitle: "Revenue trend - last ".concat(daysLabel),
7280
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7281
- 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"),
7282
- chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7283
- return {
7284
- label: item.date,
7285
- value: item.revenue
7286
- };
7287
- })) || [],
7288
- isAmount: true,
7289
- footerMetrics: [{
7290
- label: "Referrers",
7291
- value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7292
- }, {
7293
- label: "Avg gift",
7294
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7295
- }, {
7296
- label: "Conv. rate",
7297
- value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7298
- }],
7299
- sx: CARD_SX,
7300
- bottomSection: true
7301
- })]
7302
- });
7303
- if (section === "campaigns") return /*#__PURE__*/jsx(Box, {
7304
- children: campaignsRow
7305
- });
7306
- if (section === "middle") return /*#__PURE__*/jsx(Box, {
7307
- sx: fourColGridSx$1(exportMode),
7308
- children: middleCards
7309
- });
7310
- if (section === "bottom") return /*#__PURE__*/jsx(Box, {
7311
- sx: fourColGridSx$1(exportMode),
7312
- children: bottomCards
7416
+ }))), wrapCard("downsell", /*#__PURE__*/jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7417
+ sx: CARD_SX
7418
+ }))), wrapCard("referrals", /*#__PURE__*/jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7419
+ sx: CARD_SX
7420
+ })))]
7313
7421
  });
7314
- return /*#__PURE__*/jsxs(Box, {
7315
- children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7422
+ var content = /*#__PURE__*/jsxs(Fragment, {
7423
+ children: [section === "campaigns" && /*#__PURE__*/jsx(Box, {
7424
+ children: campaignsRow
7425
+ }), section === "middle" && /*#__PURE__*/jsx(Box, {
7316
7426
  sx: fourColGridSx$1(exportMode),
7317
7427
  children: middleCards
7318
- }), /*#__PURE__*/jsx(Box, {
7428
+ }), section === "bottom" && /*#__PURE__*/jsx(Box, {
7319
7429
  sx: fourColGridSx$1(exportMode),
7320
7430
  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
7321
7445
  })]
7322
7446
  });
7447
+ return content;
7323
7448
  };
7324
7449
 
7325
7450
  var ReportDetailsSection = function ReportDetailsSection(_ref) {