@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.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,
@@ -7059,9 +7060,94 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7059
7060
  });
7060
7061
  };
7061
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
+
7062
7145
  var CARD_SX = {
7063
7146
  maxHeight: 280
7064
7147
  };
7148
+ var MODAL_CARD_SX = {
7149
+ maxHeight: "none"
7150
+ };
7065
7151
  var GRID_GAP = "6px";
7066
7152
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7067
7153
  return {
@@ -7106,6 +7192,10 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7106
7192
  _ref.dateName;
7107
7193
  var _ref$numberOfDays = _ref.numberOfDays,
7108
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];
7109
7199
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7110
7200
  var _donorMix$newDonors = donorMix.newDonors,
7111
7201
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7121,6 +7211,150 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7121
7211
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7122
7212
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7123
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
+ };
7124
7358
  var campaignsRow = exportMode ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7125
7359
  sx: {
7126
7360
  display: "grid",
@@ -7128,34 +7362,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7128
7362
  gap: GRID_GAP,
7129
7363
  alignItems: "stretch"
7130
7364
  },
7131
- children: [/*#__PURE__*/jsxRuntime.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__*/jsxRuntime.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
- })]
7365
+ children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7159
7366
  }) : /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
7160
7367
  container: true,
7161
7368
  spacing: GRID_GAP,
@@ -7169,12 +7376,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7169
7376
  sx: {
7170
7377
  paddingTop: "0px !important"
7171
7378
  },
7172
- children: /*#__PURE__*/jsxRuntime.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
- })
7379
+ children: wrapCard("activeCampaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7178
7380
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7179
7381
  item: true,
7180
7382
  xs: 12,
@@ -7187,139 +7389,64 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7187
7389
  md: 0
7188
7390
  }
7189
7391
  },
7190
- children: /*#__PURE__*/jsxRuntime.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
- })
7392
+ children: wrapCard("donorMix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7213
7393
  })]
7214
7394
  });
7215
7395
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7216
- children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7396
+ children: [wrapCard("donationType", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7217
7397
  sx: CARD_SX,
7218
7398
  donationTypeData: donationTypeData
7219
- }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7399
+ })), wrapCard("donorGeography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7220
7400
  sx: CARD_SX,
7221
7401
  donorGeographyData: donorGeographyData
7222
- }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7402
+ })), wrapCard("refundsChargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7223
7403
  sx: CARD_SX,
7224
7404
  refundsChargebacksData: refundsChargebacksData,
7225
7405
  numberOfDays: numberOfDays
7226
- }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7406
+ })), wrapCard("trafficSource", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7227
7407
  sx: CARD_SX,
7228
7408
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7229
7409
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7230
7410
  numberOfDays: numberOfDays
7231
- })]
7411
+ }))]
7232
7412
  });
7233
7413
  var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7234
- children: [/*#__PURE__*/jsxRuntime.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__*/jsxRuntime.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), "%"),
7414
+ children: [wrapCard("orderBump", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7267
7415
  sx: CARD_SX
7268
- }), /*#__PURE__*/jsxRuntime.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), "%"),
7416
+ }))), wrapCard("upsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7276
7417
  sx: CARD_SX
7277
- }), /*#__PURE__*/jsxRuntime.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__*/jsxRuntime.jsx(material.Box, {
7304
- children: campaignsRow
7305
- });
7306
- if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7307
- sx: fourColGridSx$1(exportMode),
7308
- children: middleCards
7309
- });
7310
- if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7311
- sx: fourColGridSx$1(exportMode),
7312
- 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
+ })))]
7313
7423
  });
7314
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7315
- 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, {
7316
7428
  sx: fourColGridSx$1(exportMode),
7317
7429
  children: middleCards
7318
- }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7430
+ }), section === "bottom" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7319
7431
  sx: fourColGridSx$1(exportMode),
7320
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
7321
7447
  })]
7322
7448
  });
7449
+ return content;
7323
7450
  };
7324
7451
 
7325
7452
  var ReportDetailsSection = function ReportDetailsSection(_ref) {