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