@ammarkhalidfarooq/dashboard-package 0.6.104 → 0.6.106

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,7 +9,6 @@ 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');
13
12
 
14
13
  var theme = styles.createTheme({
15
14
  cssVariables: true,
@@ -6588,7 +6587,7 @@ var TopPerformingCampaignsCard = function TopPerformingCampaignsCard(_ref8) {
6588
6587
  var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6589
6588
  var sx = _ref9.sx,
6590
6589
  donorGeographyData = _ref9.donorGeographyData;
6591
- var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || [];
6590
+ var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
6592
6591
  var data = rawCountries.map(function (item) {
6593
6592
  return {
6594
6593
  country: item.countryName || item.country || "Unknown",
@@ -6596,36 +6595,20 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6596
6595
  value: item.donations !== undefined ? item.donations : item.value || 0
6597
6596
  };
6598
6597
  });
6599
- return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
6598
+ return /*#__PURE__*/jsxRuntime.jsx(CardWrapper, {
6599
+ title: "Paid Donor Geography",
6600
+ subtitle: "Where ad-acquired donors come from",
6600
6601
  sx: _objectSpread2({
6601
- bgcolor: "#fff",
6602
- borderRadius: 4,
6603
- border: "1px solid #f0f0f0",
6604
- boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
6605
- p: 3
6602
+ width: "100%"
6606
6603
  }, sx),
6607
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
6604
+ children: data.length === 0 ? /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
6608
6605
  sx: {
6609
- textAlign: "left",
6610
- marginBottom: "12px"
6606
+ fontSize: "13px",
6607
+ color: "rgba(0, 0, 0, 0.4)",
6608
+ py: 2
6611
6609
  },
6612
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
6613
- sx: {
6614
- fontWeight: 700,
6615
- fontSize: "18px",
6616
- color: "#000",
6617
- lineHeight: 1.15
6618
- },
6619
- children: "Paid Donor Geography"
6620
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
6621
- sx: {
6622
- fontSize: "13px",
6623
- color: "rgba(0, 0, 0, 0.4)",
6624
- lineHeight: 1.15
6625
- },
6626
- children: "Where ad-acquired donors come from"
6627
- })]
6628
- }), data.map(function (item, index) {
6610
+ children: "No geography data for this period"
6611
+ }) : data.map(function (item, index) {
6629
6612
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
6630
6613
  sx: {
6631
6614
  display: "flex",
@@ -6670,7 +6653,7 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6670
6653
  children: [item.value, " - ", item.percentage, "%"]
6671
6654
  })]
6672
6655
  }, index);
6673
- })]
6656
+ })
6674
6657
  });
6675
6658
  };
6676
6659
 
@@ -7060,94 +7043,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7060
7043
  });
7061
7044
  };
7062
7045
 
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
-
7145
7046
  var CARD_SX = {
7146
7047
  maxHeight: 280
7147
7048
  };
7148
- var MODAL_CARD_SX = {
7149
- maxHeight: "none"
7150
- };
7151
7049
  var GRID_GAP = "6px";
7152
7050
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7153
7051
  return {
@@ -7192,10 +7090,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7192
7090
  _ref.dateName;
7193
7091
  var _ref$numberOfDays = _ref.numberOfDays,
7194
7092
  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];
7199
7093
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7200
7094
  var _donorMix$newDonors = donorMix.newDonors,
7201
7095
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7211,150 +7105,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7211
7105
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7212
7106
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7213
7107
  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
- };
7358
7108
  var campaignsRow = exportMode ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7359
7109
  sx: {
7360
7110
  display: "grid",
@@ -7362,7 +7112,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7362
7112
  gap: GRID_GAP,
7363
7113
  alignItems: "stretch"
7364
7114
  },
7365
- children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7115
+ children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7116
+ title: "Active Campaigns",
7117
+ subtitle: "Live fundraisers ranked by velocity",
7118
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7119
+ rows: activeCampaignsRows
7120
+ }), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7121
+ title: "Donor Mix",
7122
+ subtitle: "Acquisition vs retention",
7123
+ series: [newDonors, returningDonors],
7124
+ labels: ["New donors", "Returning"],
7125
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7126
+ centerLabel: "donors",
7127
+ centerValue: String(totalMix),
7128
+ items: [{
7129
+ label: "New donors",
7130
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7131
+ color: "rgb(99, 99, 230)"
7132
+ }, {
7133
+ label: "Returning",
7134
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7135
+ color: "#10B981"
7136
+ }],
7137
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7138
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7139
+ sx: {
7140
+ width: "100%"
7141
+ }
7142
+ })]
7366
7143
  }) : /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
7367
7144
  container: true,
7368
7145
  spacing: GRID_GAP,
@@ -7376,7 +7153,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7376
7153
  sx: {
7377
7154
  paddingTop: "0px !important"
7378
7155
  },
7379
- children: wrapCard("activeCampaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7156
+ children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7157
+ title: "Active Campaigns",
7158
+ subtitle: "Live fundraisers ranked by velocity",
7159
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7160
+ rows: activeCampaignsRows
7161
+ })
7380
7162
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7381
7163
  item: true,
7382
7164
  xs: 12,
@@ -7389,64 +7171,139 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7389
7171
  md: 0
7390
7172
  }
7391
7173
  },
7392
- children: wrapCard("donorMix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7174
+ children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7175
+ title: "Donor Mix",
7176
+ subtitle: "Acquisition vs retention",
7177
+ series: [newDonors, returningDonors],
7178
+ labels: ["New donors", "Returning"],
7179
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7180
+ centerLabel: "donors",
7181
+ centerValue: String(totalMix),
7182
+ items: [{
7183
+ label: "New Donors",
7184
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7185
+ color: "rgb(99, 99, 230)"
7186
+ }, {
7187
+ label: "Returning",
7188
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7189
+ color: "#10B981"
7190
+ }],
7191
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7192
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7193
+ sx: {
7194
+ width: "100%"
7195
+ }
7196
+ })
7393
7197
  })]
7394
7198
  });
7395
7199
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7396
- children: [wrapCard("donationType", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7200
+ children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7397
7201
  sx: CARD_SX,
7398
7202
  donationTypeData: donationTypeData
7399
- })), wrapCard("donorGeography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7203
+ }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7400
7204
  sx: CARD_SX,
7401
7205
  donorGeographyData: donorGeographyData
7402
- })), wrapCard("refundsChargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7206
+ }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7403
7207
  sx: CARD_SX,
7404
7208
  refundsChargebacksData: refundsChargebacksData,
7405
7209
  numberOfDays: numberOfDays
7406
- })), wrapCard("trafficSource", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7210
+ }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7407
7211
  sx: CARD_SX,
7408
7212
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7409
7213
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7410
7214
  numberOfDays: numberOfDays
7411
- }))]
7215
+ })]
7412
7216
  });
7413
7217
  var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7414
- children: [wrapCard("orderBump", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, orderBumpProps), {}, {
7415
- sx: CARD_SX
7416
- }))), wrapCard("upsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, upsellProps), {}, {
7417
- sx: CARD_SX
7418
- }))), wrapCard("downsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, _objectSpread2(_objectSpread2({}, downsellProps), {}, {
7218
+ children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7219
+ title: "Order Bump",
7220
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7221
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
7222
+ 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"),
7223
+ chartData: (orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$chart = orderBumpData.chart) === null || _orderBumpData$chart === void 0 ? void 0 : _orderBumpData$chart.map(function (item) {
7224
+ return {
7225
+ label: item.label,
7226
+ value: item.revenue
7227
+ };
7228
+ })) || [],
7229
+ isAmount: true,
7230
+ footerMetrics: [{
7231
+ label: "Avg / Day",
7232
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.averagePerDay) || 0))
7233
+ }, {
7234
+ label: "Orders",
7235
+ value: formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalOrders) || 0)
7236
+ }, {
7237
+ label: "Peak Day",
7238
+ value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa = orderBumpData.peakDay) === null || _orderBumpData$peakDa === void 0 ? void 0 : _orderBumpData$peakDa.amount) || 0)),
7239
+ subValue: orderBumpData === null || orderBumpData === void 0 || (_orderBumpData$peakDa2 = orderBumpData.peakDay) === null || _orderBumpData$peakDa2 === void 0 ? void 0 : _orderBumpData$peakDa2.date
7240
+ }],
7241
+ sx: CARD_SX,
7242
+ bottomSection: true
7243
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7244
+ title: "Upsell",
7245
+ subtitle: "Acceptance & raised",
7246
+ acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
7247
+ acceptanceVal: "".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0), "%"),
7248
+ 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), "%"),
7249
+ raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7250
+ 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), "%"),
7419
7251
  sx: CARD_SX
7420
- }))), wrapCard("referrals", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7252
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7253
+ title: "Downsell",
7254
+ subtitle: "Acceptance & raised",
7255
+ acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
7256
+ acceptanceVal: "".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0), "%"),
7257
+ 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), "%"),
7258
+ raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7259
+ 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), "%"),
7421
7260
  sx: CARD_SX
7422
- })))]
7261
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7262
+ title: "Referrals",
7263
+ subtitle: "Revenue trend - last ".concat(daysLabel),
7264
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
7265
+ 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"),
7266
+ chartData: (referralData === null || referralData === void 0 || (_referralData$chartDa = referralData.chartData) === null || _referralData$chartDa === void 0 ? void 0 : _referralData$chartDa.map(function (item) {
7267
+ return {
7268
+ label: item.date,
7269
+ value: item.revenue
7270
+ };
7271
+ })) || [],
7272
+ isAmount: true,
7273
+ footerMetrics: [{
7274
+ label: "Referrers",
7275
+ value: formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalReferrers) || 0)
7276
+ }, {
7277
+ label: "Avg gift",
7278
+ value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.averageGift) || 0))
7279
+ }, {
7280
+ label: "Conv. rate",
7281
+ value: "".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.conversionRate) || 0), "%")
7282
+ }],
7283
+ sx: CARD_SX,
7284
+ bottomSection: true
7285
+ })]
7286
+ });
7287
+ if (section === "campaigns") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7288
+ children: campaignsRow
7289
+ });
7290
+ if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7291
+ sx: fourColGridSx$1(exportMode),
7292
+ children: middleCards
7423
7293
  });
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, {
7294
+ if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7295
+ sx: fourColGridSx$1(exportMode),
7296
+ children: bottomCards
7297
+ });
7298
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7299
+ children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7428
7300
  sx: fourColGridSx$1(exportMode),
7429
7301
  children: middleCards
7430
- }), section === "bottom" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7302
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7431
7303
  sx: fourColGridSx$1(exportMode),
7432
7304
  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
7447
7305
  })]
7448
7306
  });
7449
- return content;
7450
7307
  };
7451
7308
 
7452
7309
  var ReportDetailsSection = function ReportDetailsSection(_ref) {
@@ -18633,6 +18490,12 @@ var PaidSection = function PaidSection(_ref) {
18633
18490
  };
18634
18491
  });
18635
18492
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns, hasPaidOverview]);
18493
+ var donorGeographyData = React.useMemo(function () {
18494
+ var geography = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
18495
+ if (!hasPaidOverview) return [];
18496
+ var rawCountries = Array.isArray(geography) ? geography : (geography === null || geography === void 0 ? void 0 : geography.countries) || (geography === null || geography === void 0 ? void 0 : geography.data) || [];
18497
+ return Array.isArray(rawCountries) ? rawCountries : [];
18498
+ }, [apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography, hasPaidOverview]);
18636
18499
  var renderCard = function renderCard(title) {
18637
18500
  return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1, {
18638
18501
  title: title,
@@ -18838,17 +18701,24 @@ var PaidSection = function PaidSection(_ref) {
18838
18701
  container: true,
18839
18702
  spacing: 3,
18840
18703
  sx: {
18841
- mt: "6px"
18704
+ mt: "6px",
18705
+ alignItems: "stretch"
18842
18706
  },
18843
18707
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Grid, {
18844
18708
  item: true,
18845
18709
  xs: 12,
18846
18710
  md: 6,
18847
18711
  sx: {
18848
- paddingTop: "0px !important"
18712
+ paddingTop: "0px !important",
18713
+ display: "flex"
18849
18714
  },
18850
- children: /*#__PURE__*/jsxRuntime.jsx(TopPerformingCampaignsCard, {
18851
- data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18715
+ children: /*#__PURE__*/jsxRuntime.jsx(material.Box, {
18716
+ sx: {
18717
+ width: "100%"
18718
+ },
18719
+ children: /*#__PURE__*/jsxRuntime.jsx(TopPerformingCampaignsCard, {
18720
+ data: topCampaignsData !== null && topCampaignsData !== void 0 ? topCampaignsData : hasPaidOverview ? [] : null
18721
+ })
18852
18722
  })
18853
18723
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
18854
18724
  item: true,
@@ -18863,10 +18733,11 @@ var PaidSection = function PaidSection(_ref) {
18863
18733
  marginTop: {
18864
18734
  xs: "6px",
18865
18735
  md: "0px"
18866
- }
18736
+ },
18737
+ display: "flex"
18867
18738
  },
18868
18739
  children: /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
18869
- donorGeographyData: apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography
18740
+ donorGeographyData: donorGeographyData
18870
18741
  })
18871
18742
  })]
18872
18743
  })]