@ammarkhalidfarooq/dashboard-package 0.6.104 → 0.6.105

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",
@@ -6625,7 +6624,14 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref9) {
6625
6624
  },
6626
6625
  children: "Where ad-acquired donors come from"
6627
6626
  })]
6628
- }), data.map(function (item, index) {
6627
+ }), data.length === 0 ? /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
6628
+ sx: {
6629
+ fontSize: "13px",
6630
+ color: "rgba(0, 0, 0, 0.4)",
6631
+ py: 2
6632
+ },
6633
+ children: "No geography data for this period"
6634
+ }) : data.map(function (item, index) {
6629
6635
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
6630
6636
  sx: {
6631
6637
  display: "flex",
@@ -7060,94 +7066,9 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7060
7066
  });
7061
7067
  };
7062
7068
 
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
7069
  var CARD_SX = {
7146
7070
  maxHeight: 280
7147
7071
  };
7148
- var MODAL_CARD_SX = {
7149
- maxHeight: "none"
7150
- };
7151
7072
  var GRID_GAP = "6px";
7152
7073
  var fourColGridSx$1 = function fourColGridSx(exportMode) {
7153
7074
  return {
@@ -7192,10 +7113,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7192
7113
  _ref.dateName;
7193
7114
  var _ref$numberOfDays = _ref.numberOfDays,
7194
7115
  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
7116
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7200
7117
  var _donorMix$newDonors = donorMix.newDonors,
7201
7118
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
@@ -7211,150 +7128,6 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7211
7128
  avgGift = _donorMix$avgGift === void 0 ? 0 : _donorMix$avgGift,
7212
7129
  _donorMix$donorMixPre = donorMix.donorMixPrev,
7213
7130
  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
7131
  var campaignsRow = exportMode ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7359
7132
  sx: {
7360
7133
  display: "grid",
@@ -7362,7 +7135,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7362
7135
  gap: GRID_GAP,
7363
7136
  alignItems: "stretch"
7364
7137
  },
7365
- children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps))]
7138
+ children: [/*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7139
+ title: "Active Campaigns",
7140
+ subtitle: "Live fundraisers ranked by velocity",
7141
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7142
+ rows: activeCampaignsRows
7143
+ }), /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7144
+ title: "Donor Mix",
7145
+ subtitle: "Acquisition vs retention",
7146
+ series: [newDonors, returningDonors],
7147
+ labels: ["New donors", "Returning"],
7148
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7149
+ centerLabel: "donors",
7150
+ centerValue: String(totalMix),
7151
+ items: [{
7152
+ label: "New donors",
7153
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7154
+ color: "rgb(99, 99, 230)"
7155
+ }, {
7156
+ label: "Returning",
7157
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7158
+ color: "#10B981"
7159
+ }],
7160
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7161
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7162
+ sx: {
7163
+ width: "100%"
7164
+ }
7165
+ })]
7366
7166
  }) : /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
7367
7167
  container: true,
7368
7168
  spacing: GRID_GAP,
@@ -7376,7 +7176,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7376
7176
  sx: {
7377
7177
  paddingTop: "0px !important"
7378
7178
  },
7379
- children: wrapCard("activeCampaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, _objectSpread2({}, activeCampaignsProps)))
7179
+ children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7180
+ title: "Active Campaigns",
7181
+ subtitle: "Live fundraisers ranked by velocity",
7182
+ columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7183
+ rows: activeCampaignsRows
7184
+ })
7380
7185
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7381
7186
  item: true,
7382
7187
  xs: 12,
@@ -7389,64 +7194,139 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7389
7194
  md: 0
7390
7195
  }
7391
7196
  },
7392
- children: wrapCard("donorMix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, _objectSpread2({}, donorMixProps)))
7197
+ children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7198
+ title: "Donor Mix",
7199
+ subtitle: "Acquisition vs retention",
7200
+ series: [newDonors, returningDonors],
7201
+ labels: ["New donors", "Returning"],
7202
+ colors: ["rgb(99, 99, 230)", "#10B981"],
7203
+ centerLabel: "donors",
7204
+ centerValue: String(totalMix),
7205
+ items: [{
7206
+ label: "New Donors",
7207
+ val: "".concat(newDonors, " - ").concat(newPct, "%"),
7208
+ color: "rgb(99, 99, 230)"
7209
+ }, {
7210
+ label: "Returning",
7211
+ val: "".concat(returningDonors, " - ").concat(retPct, "%"),
7212
+ color: "#10B981"
7213
+ }],
7214
+ bottomSummaryValue: "$".concat(formatNumber(avgGift)),
7215
+ bottomSummaryTrend: "".concat(donorMixPrev, "% vs pp"),
7216
+ sx: {
7217
+ width: "100%"
7218
+ }
7219
+ })
7393
7220
  })]
7394
7221
  });
7395
7222
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7396
- children: [wrapCard("donationType", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7223
+ children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7397
7224
  sx: CARD_SX,
7398
7225
  donationTypeData: donationTypeData
7399
- })), wrapCard("donorGeography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7226
+ }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7400
7227
  sx: CARD_SX,
7401
7228
  donorGeographyData: donorGeographyData
7402
- })), wrapCard("refundsChargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7229
+ }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7403
7230
  sx: CARD_SX,
7404
7231
  refundsChargebacksData: refundsChargebacksData,
7405
7232
  numberOfDays: numberOfDays
7406
- })), wrapCard("trafficSource", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7233
+ }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7407
7234
  sx: CARD_SX,
7408
7235
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7409
7236
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7410
7237
  numberOfDays: numberOfDays
7411
- }))]
7238
+ })]
7412
7239
  });
7413
7240
  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), {}, {
7241
+ children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
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
+ sx: CARD_SX,
7265
+ bottomSection: true
7266
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
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), "%"),
7419
7274
  sx: CARD_SX
7420
- }))), wrapCard("referrals", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, _objectSpread2(_objectSpread2({}, referralProps), {}, {
7275
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
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), "%"),
7421
7283
  sx: CARD_SX
7422
- })))]
7284
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
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
+ sx: CARD_SX,
7307
+ bottomSection: true
7308
+ })]
7309
+ });
7310
+ if (section === "campaigns") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7311
+ children: campaignsRow
7312
+ });
7313
+ if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7314
+ sx: fourColGridSx$1(exportMode),
7315
+ children: middleCards
7423
7316
  });
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, {
7317
+ if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7318
+ sx: fourColGridSx$1(exportMode),
7319
+ children: bottomCards
7320
+ });
7321
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7322
+ children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7428
7323
  sx: fourColGridSx$1(exportMode),
7429
7324
  children: middleCards
7430
- }), section === "bottom" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7325
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7431
7326
  sx: fourColGridSx$1(exportMode),
7432
7327
  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
7328
  })]
7448
7329
  });
7449
- return content;
7450
7330
  };
7451
7331
 
7452
7332
  var ReportDetailsSection = function ReportDetailsSection(_ref) {
@@ -18633,6 +18513,12 @@ var PaidSection = function PaidSection(_ref) {
18633
18513
  };
18634
18514
  });
18635
18515
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaigns, hasPaidOverview]);
18516
+ var donorGeographyData = React.useMemo(function () {
18517
+ var geography = apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography;
18518
+ if (!hasPaidOverview) return [];
18519
+ var rawCountries = Array.isArray(geography) ? geography : (geography === null || geography === void 0 ? void 0 : geography.countries) || (geography === null || geography === void 0 ? void 0 : geography.data) || [];
18520
+ return Array.isArray(rawCountries) ? rawCountries : [];
18521
+ }, [apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography, hasPaidOverview]);
18636
18522
  var renderCard = function renderCard(title) {
18637
18523
  return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1, {
18638
18524
  title: title,
@@ -18866,7 +18752,7 @@ var PaidSection = function PaidSection(_ref) {
18866
18752
  }
18867
18753
  },
18868
18754
  children: /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
18869
- donorGeographyData: apiData === null || apiData === void 0 ? void 0 : apiData.donorGeography
18755
+ donorGeographyData: donorGeographyData
18870
18756
  })
18871
18757
  })]
18872
18758
  })]