@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.cjs.js CHANGED
@@ -9,6 +9,7 @@ var Grid = require('@mui/material/Grid');
9
9
  var Box = require('@mui/material/Box');
10
10
  var Typography = require('@mui/material/Typography');
11
11
  var ReactApexChart = require('react-apexcharts');
12
+ var CloseIcon = require('@mui/icons-material/Close');
12
13
 
13
14
  var theme = styles.createTheme({
14
15
  cssVariables: true,
@@ -2994,7 +2995,6 @@ var P2RefundsCard = function P2RefundsCard(_ref27) {
2994
2995
  fontWeight: 700,
2995
2996
  letterSpacing: "0.5px",
2996
2997
  color: THEME.muted,
2997
- textTransform: "uppercase",
2998
2998
  marginBottom: 3
2999
2999
  },
3000
3000
  children: "Refunds"
@@ -3028,7 +3028,6 @@ var P2RefundsCard = function P2RefundsCard(_ref27) {
3028
3028
  fontWeight: 700,
3029
3029
  letterSpacing: "0.5px",
3030
3030
  color: THEME.muted,
3031
- textTransform: "uppercase",
3032
3031
  marginBottom: 3
3033
3032
  },
3034
3033
  children: "Chargebacks"
@@ -7061,9 +7060,94 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7061
7060
  });
7062
7061
  };
7063
7062
 
7063
+ var CardDetailModal = function CardDetailModal(_ref) {
7064
+ var open = _ref.open,
7065
+ onClose = _ref.onClose,
7066
+ children = _ref.children;
7067
+ return /*#__PURE__*/jsxRuntime.jsx(material.Dialog, {
7068
+ open: open,
7069
+ onClose: onClose,
7070
+ maxWidth: "lg",
7071
+ fullWidth: true,
7072
+ PaperProps: {
7073
+ sx: {
7074
+ borderRadius: 4,
7075
+ maxHeight: "90vh"
7076
+ }
7077
+ },
7078
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7079
+ sx: {
7080
+ position: "relative"
7081
+ },
7082
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
7083
+ "aria-label": "Close",
7084
+ onClick: onClose,
7085
+ sx: {
7086
+ position: "absolute",
7087
+ right: 12,
7088
+ top: 12,
7089
+ zIndex: 2,
7090
+ bgcolor: "#fff",
7091
+ border: "1px solid #f0f0f0",
7092
+ "&:hover": {
7093
+ bgcolor: "#f9f9f9"
7094
+ }
7095
+ },
7096
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {
7097
+ fontSize: "small"
7098
+ })
7099
+ }), /*#__PURE__*/jsxRuntime.jsx(material.DialogContent, {
7100
+ sx: {
7101
+ p: 3,
7102
+ pt: 5
7103
+ },
7104
+ children: children
7105
+ })]
7106
+ })
7107
+ });
7108
+ };
7109
+
7110
+ var ClickableCard = function ClickableCard(_ref) {
7111
+ var onClick = _ref.onClick,
7112
+ _ref$disabled = _ref.disabled,
7113
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
7114
+ children = _ref.children,
7115
+ _ref$sx = _ref.sx,
7116
+ sx = _ref$sx === void 0 ? {} : _ref$sx;
7117
+ return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7118
+ onClick: disabled ? undefined : onClick,
7119
+ role: disabled ? undefined : "button",
7120
+ tabIndex: disabled ? undefined : 0,
7121
+ onKeyDown: disabled ? undefined : function (event) {
7122
+ if (event.key === "Enter" || event.key === " ") {
7123
+ event.preventDefault();
7124
+ onClick === null || onClick === void 0 || onClick();
7125
+ }
7126
+ },
7127
+ sx: _objectSpread2(_objectSpread2({
7128
+ height: "100%",
7129
+ cursor: disabled ? "default" : "pointer",
7130
+ borderRadius: 4,
7131
+ transition: "box-shadow 0.2s ease, transform 0.2s ease"
7132
+ }, !disabled && {
7133
+ "&:hover": {
7134
+ boxShadow: "0 8px 32px rgba(0,0,0,0.1)"
7135
+ },
7136
+ "&:focus-visible": {
7137
+ outline: "2px solid #4F46E5",
7138
+ outlineOffset: 2
7139
+ }
7140
+ }), sx),
7141
+ children: children
7142
+ });
7143
+ };
7144
+
7064
7145
  var CARD_SX = {
7065
7146
  maxHeight: 280
7066
7147
  };
7148
+ var MODAL_CARD_SX = {
7149
+ maxHeight: "none"
7150
+ };
7067
7151
  var GRID_GAP = "6px";
7068
7152
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7069
7153
  return {
@@ -7108,6 +7192,10 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7108
7192
  _ref.dateName;
7109
7193
  var _ref$numberOfDays = _ref.numberOfDays,
7110
7194
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7195
+ var _useState = React.useState(null),
7196
+ _useState2 = _slicedToArray(_useState, 2),
7197
+ openModalKey = _useState2[0],
7198
+ setOpenModalKey = _useState2[1];
7111
7199
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7112
7200
  var _donorMix$newDonors = donorMix.newDonors,
7113
7201
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7123,6 +7211,150 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7123
7211
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7124
7212
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7125
7213
  donorMixPrev = _donorMix$donorMixPre === void 0 ? 0 : _donorMix$donorMixPre;
7214
+ var activeCampaignsProps = {
7215
+ title: "Active Campaigns",
7216
+ subtitle: "Live fundraisers ranked by velocity",
7217
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7218
+ rows: activeCampaignsRows
7219
+ };
7220
+ var donorMixProps = {
7221
+ title: "Donor Mix",
7222
+ subtitle: "Acquisition vs retention",
7223
+ series: [newDonors, returningDonors],
7224
+ labels: ["New donors", "Returning"],
7225
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7226
+ centerLabel: "donors",
7227
+ centerValue: String(totalMix),
7228
+ items: [{
7229
+ label: "New Donors",
7230
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7231
+ color: "rgb(99, 99, 230)"
7232
+ }, {
7233
+ label: "Returning",
7234
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7235
+ color: "#10B981"
7236
+ }],
7237
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7238
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7239
+ sx: {
7240
+ width: "100%"
7241
+ }
7242
+ };
7243
+ var orderBumpProps = {
7244
+ title: "Order Bump",
7245
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7246
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7247
+ 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"),
7248
+ chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7249
+ return {
7250
+ label: item.label,
7251
+ value: item.revenue
7252
+ };
7253
+ })) || [],
7254
+ isAmount: true,
7255
+ footerMetrics: [{
7256
+ label: "Avg / Day",
7257
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7258
+ }, {
7259
+ label: "Orders",
7260
+ value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7261
+ }, {
7262
+ label: "Peak Day",
7263
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7264
+ subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7265
+ }],
7266
+ bottomSection: true
7267
+ };
7268
+ var upsellProps = {
7269
+ title: "Upsell",
7270
+ subtitle: "Acceptance & raised",
7271
+ acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7272
+ acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7273
+ 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), "%"),
7274
+ raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7275
+ 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), "%")
7276
+ };
7277
+ var downsellProps = {
7278
+ title: "Downsell",
7279
+ subtitle: "Acceptance & raised",
7280
+ acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7281
+ acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7282
+ 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), "%"),
7283
+ raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7284
+ 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), "%")
7285
+ };
7286
+ var referralProps = {
7287
+ title: "Referrals",
7288
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7289
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7290
+ 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"),
7291
+ chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7292
+ return {
7293
+ label: item.date,
7294
+ value: item.revenue
7295
+ };
7296
+ })) || [],
7297
+ isAmount: true,
7298
+ footerMetrics: [{
7299
+ label: "Referrers",
7300
+ value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7301
+ }, {
7302
+ label: "Avg gift",
7303
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7304
+ }, {
7305
+ label: "Conv. rate",
7306
+ value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7307
+ }],
7308
+ bottomSection: true
7309
+ };
7310
+ var modalContentByKey = {
7311
+ activeCampaigns: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2(_objectSpread2({}, activeCampaignsProps), {}, {
7312
+ sx: MODAL_CARD_SX
7313
+ })),
7314
+ donorMix: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2(_objectSpread2({}, donorMixProps), {}, {
7315
+ sx: MODAL_CARD_SX
7316
+ })),
7317
+ donationType: /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7318
+ sx: MODAL_CARD_SX,
7319
+ donationTypeData: donationTypeData
7320
+ }),
7321
+ donorGeography: /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7322
+ sx: MODAL_CARD_SX,
7323
+ donorGeographyData: donorGeographyData
7324
+ }),
7325
+ refundsChargebacks: /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7326
+ sx: MODAL_CARD_SX,
7327
+ refundsChargebacksData: refundsChargebacksData,
7328
+ numberOfDays: numberOfDays
7329
+ }),
7330
+ trafficSource: /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7331
+ sx: MODAL_CARD_SX,
7332
+ trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7333
+ total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7334
+ numberOfDays: numberOfDays
7335
+ }),
7336
+ orderBump: /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7337
+ sx: MODAL_CARD_SX
7338
+ })),
7339
+ upsell: /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7340
+ sx: MODAL_CARD_SX
7341
+ })),
7342
+ downsell: /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7343
+ sx: MODAL_CARD_SX
7344
+ })),
7345
+ referrals: /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7346
+ sx: MODAL_CARD_SX
7347
+ }))
7348
+ };
7349
+ var wrapCard = function wrapCard(modalKey, card) {
7350
+ if (exportMode) return card;
7351
+ return /*#__PURE__*/jsxRuntime.jsx(ClickableCard, {
7352
+ onClick: function onClick() {
7353
+ return setOpenModalKey(modalKey);
7354
+ },
7355
+ children: card
7356
+ });
7357
+ };
7126
7358
  var campaignsRow = exportMode ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7127
7359
  sx: {
7128
7360
  display: "grid",
@@ -7130,34 +7362,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7130
7362
  gap: GRID_GAP,
7131
7363
  alignItems: "stretch"
7132
7364
  },
7133
- children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7134
- title: "Active Campaigns",
7135
- subtitle: "Live fundraisers ranked by velocity",
7136
- columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7137
- rows: activeCampaignsRows
7138
- }), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7139
- title: "Donor Mix",
7140
- subtitle: "Acquisition vs retention",
7141
- series: [newDonors, returningDonors],
7142
- labels: ["New donors", "Returning"],
7143
- colors: ["rgb(99, 99, 230)", "#10B981"],
7144
- centerLabel: "donors",
7145
- centerValue: String(totalMix),
7146
- items: [{
7147
- label: "New donors",
7148
- val: "".concat(newDonors, " - ").concat(newPct, "%"),
7149
- color: "rgb(99, 99, 230)"
7150
- }, {
7151
- label: "Returning",
7152
- val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7153
- color: "#10B981"
7154
- }],
7155
- bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7156
- bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7157
- sx: {
7158
- width: "100%"
7159
- }
7160
- })]
7365
+ children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7161
7366
  }) : /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
7162
7367
  container: true,
7163
7368
  spacing: GRID_GAP,
@@ -7171,12 +7376,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7171
7376
  sx: {
7172
7377
  paddingTop: "0px !important"
7173
7378
  },
7174
- children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7175
- title: "Active Campaigns",
7176
- subtitle: "Live fundraisers ranked by velocity",
7177
- columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7178
- rows: activeCampaignsRows
7179
- })
7379
+ children: wrapCard("activeCampaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7180
7380
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7181
7381
  item: true,
7182
7382
  xs: 12,
@@ -7189,139 +7389,64 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7189
7389
  md: 0
7190
7390
  }
7191
7391
  },
7192
- children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7193
- title: "Donor Mix",
7194
- subtitle: "Acquisition vs retention",
7195
- series: [newDonors, returningDonors],
7196
- labels: ["New donors", "Returning"],
7197
- colors: ["rgb(99, 99, 230)", "#10B981"],
7198
- centerLabel: "donors",
7199
- centerValue: String(totalMix),
7200
- items: [{
7201
- label: "New Donors",
7202
- val: "".concat(newDonors, " - ").concat(newPct, "%"),
7203
- color: "rgb(99, 99, 230)"
7204
- }, {
7205
- label: "Returning",
7206
- val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7207
- color: "#10B981"
7208
- }],
7209
- bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7210
- bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7211
- sx: {
7212
- width: "100%"
7213
- }
7214
- })
7392
+ children: wrapCard("donorMix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7215
7393
  })]
7216
7394
  });
7217
7395
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7218
- children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7396
+ children: [wrapCard("donationType", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7219
7397
  sx: CARD_SX,
7220
7398
  donationTypeData: donationTypeData
7221
- }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7399
+ })), wrapCard("donorGeography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7222
7400
  sx: CARD_SX,
7223
7401
  donorGeographyData: donorGeographyData
7224
- }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7402
+ })), wrapCard("refundsChargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7225
7403
  sx: CARD_SX,
7226
7404
  refundsChargebacksData: refundsChargebacksData,
7227
7405
  numberOfDays: numberOfDays
7228
- }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7406
+ })), wrapCard("trafficSource", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7229
7407
  sx: CARD_SX,
7230
7408
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7231
7409
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7232
7410
  numberOfDays: numberOfDays
7233
- })]
7411
+ }))]
7234
7412
  });
7235
7413
  var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7236
- children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7237
- title: "Order Bump",
7238
- subtitle: "Revenue trend - last ".concat(daysLabel),
7239
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7240
- 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"),
7241
- chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7242
- return {
7243
- label: item.label,
7244
- value: item.revenue
7245
- };
7246
- })) || [],
7247
- isAmount: true,
7248
- footerMetrics: [{
7249
- label: "Avg / Day",
7250
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7251
- }, {
7252
- label: "Orders",
7253
- value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7254
- }, {
7255
- label: "Peak Day",
7256
- value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7257
- subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7258
- }],
7259
- sx: CARD_SX,
7260
- bottomSection: true
7261
- }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7262
- title: "Upsell",
7263
- subtitle: "Acceptance & raised",
7264
- acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7265
- acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7266
- 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), "%"),
7267
- raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7268
- 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), "%"),
7414
+ children: [wrapCard("orderBump", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7269
7415
  sx: CARD_SX
7270
- }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7271
- title: "Downsell",
7272
- subtitle: "Acceptance & raised",
7273
- acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7274
- acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7275
- 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), "%"),
7276
- raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7277
- 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), "%"),
7416
+ }))), wrapCard("upsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7278
7417
  sx: CARD_SX
7279
- }), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7280
- title: "Referrals",
7281
- subtitle: "Revenue trend - last ".concat(daysLabel),
7282
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7283
- 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"),
7284
- chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7285
- return {
7286
- label: item.date,
7287
- value: item.revenue
7288
- };
7289
- })) || [],
7290
- isAmount: true,
7291
- footerMetrics: [{
7292
- label: "Referrers",
7293
- value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7294
- }, {
7295
- label: "Avg gift",
7296
- value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7297
- }, {
7298
- label: "Conv. rate",
7299
- value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7300
- }],
7301
- sx: CARD_SX,
7302
- bottomSection: true
7303
- })]
7304
- });
7305
- if (section === "campaigns") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7306
- children: campaignsRow
7307
- });
7308
- if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7309
- sx: fourColGridSx$1(exportMode),
7310
- children: middleCards
7311
- });
7312
- if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7313
- sx: fourColGridSx$1(exportMode),
7314
- children: bottomCards
7418
+ }))), wrapCard("downsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7419
+ sx: CARD_SX
7420
+ }))), wrapCard("referrals", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7421
+ sx: CARD_SX
7422
+ })))]
7315
7423
  });
7316
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7317
- children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7424
+ var content = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7425
+ children: [section === "campaigns" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7426
+ children: campaignsRow
7427
+ }), section === "middle" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7318
7428
  sx: fourColGridSx$1(exportMode),
7319
7429
  children: middleCards
7320
- }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7430
+ }), section === "bottom" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7321
7431
  sx: fourColGridSx$1(exportMode),
7322
7432
  children: bottomCards
7433
+ }), section === "all" && /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7434
+ children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7435
+ sx: fourColGridSx$1(exportMode),
7436
+ children: middleCards
7437
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7438
+ sx: fourColGridSx$1(exportMode),
7439
+ children: bottomCards
7440
+ })]
7441
+ }), !exportMode && /*#__PURE__*/jsxRuntime.jsx(CardDetailModal, {
7442
+ open: Boolean(openModalKey),
7443
+ onClose: function onClose() {
7444
+ return setOpenModalKey(null);
7445
+ },
7446
+ children: openModalKey ? modalContentByKey[openModalKey] : null
7323
7447
  })]
7324
7448
  });
7449
+ return content;
7325
7450
  };
7326
7451
 
7327
7452
  var ReportDetailsSection = function ReportDetailsSection(_ref) {