@ammarkhalidfarooq/dashboard-package 0.3.39 → 0.4.0

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
@@ -798,19 +798,17 @@ var CardWrapper = function CardWrapper(_ref) {
798
798
  children = _ref.children,
799
799
  sx = _ref.sx;
800
800
  return /*#__PURE__*/jsxRuntime.jsx(material.Card, {
801
- sx: _objectSpread2({
802
- width: "100%",
801
+ sx: _objectSpread2(_objectSpread2({
802
+ // width: "100%",
803
803
  display: "flex",
804
804
  flexDirection: "column",
805
805
  boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
806
806
  borderRadius: 4,
807
- border: "1px solid #f0f0f0",
807
+ border: "1px solid #f0f0f0"
808
+ }, sx), {}, {
808
809
  height: "100%"
809
- }, sx),
810
+ }),
810
811
  children: /*#__PURE__*/jsxRuntime.jsxs(material.CardContent, {
811
- sx: {
812
- p: 3
813
- },
814
812
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
815
813
  variant: "subtitle2",
816
814
  sx: {
@@ -2069,29 +2067,29 @@ var OrganicSection = function OrganicSection(_ref) {
2069
2067
  xs: 12,
2070
2068
  md: 6,
2071
2069
  children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
2072
- title: "Spend allocation",
2073
- subtitle: "Where $80.3K went this month",
2070
+ title: "Source breakdown",
2071
+ subtitle: "Where organic visitors come from",
2074
2072
  series: [40.8, 35.1, 14.2, 3.3],
2075
2073
  labels: ["Meta Ads", "Google Ads", "TikTok", "Snapchat"],
2076
- colors: ["#4267B2", "#4285F4", "#06510bff", "#FFFC00"],
2074
+ colors: ["#4267B2", "#4285F4", "#06510bff", "#f2b61dff"],
2077
2075
  centerLabel: "total spend",
2078
2076
  centerValue: "$8.3K",
2079
2077
  items: [{
2080
- label: "Meta Ads",
2078
+ label: "Google Search",
2081
2079
  val: "40.8%",
2082
2080
  color: "#4267B2"
2083
2081
  }, {
2084
- label: "Google Ads",
2082
+ label: "Direct",
2085
2083
  val: "35.1%",
2086
2084
  color: "#4285F4"
2087
2085
  }, {
2088
- label: "TikTok",
2086
+ label: "Bing / Other",
2089
2087
  val: "14.2%",
2090
2088
  color: "#06510bff"
2091
2089
  }, {
2092
- label: "Snapchat",
2090
+ label: "Referalls",
2093
2091
  val: "3.3%",
2094
- color: "#FFFC00"
2092
+ color: "#f2b61dff"
2095
2093
  }],
2096
2094
  showBottomSummary: false,
2097
2095
  sx: {
@@ -2108,19 +2106,217 @@ var OrganicSection = function OrganicSection(_ref) {
2108
2106
  xs: 12,
2109
2107
  md: 6,
2110
2108
  children: /*#__PURE__*/jsxRuntime.jsx(GeographyCard, {
2111
- subtitle: "Organic traffic source locations"
2109
+ subtitle: "Top countries by organic traffic"
2112
2110
  })
2113
2111
  })]
2114
2112
  })]
2115
2113
  });
2116
2114
  };
2117
2115
 
2116
+ var EmailTrendCard = function EmailTrendCard(_ref) {
2117
+ var title = _ref.title,
2118
+ subtitle = _ref.subtitle,
2119
+ value = _ref.value,
2120
+ trend = _ref.trend,
2121
+ series = _ref.series,
2122
+ colors = _ref.colors,
2123
+ _ref$yAxisMax = _ref.yAxisMax,
2124
+ yAxisMax = _ref$yAxisMax === void 0 ? 60 : _ref$yAxisMax,
2125
+ _ref$yAxisTickAmount = _ref.yAxisTickAmount,
2126
+ yAxisTickAmount = _ref$yAxisTickAmount === void 0 ? 3 : _ref$yAxisTickAmount,
2127
+ _ref$yAxisFormatter = _ref.yAxisFormatter,
2128
+ yAxisFormatter = _ref$yAxisFormatter === void 0 ? function (val) {
2129
+ return "".concat(val, "%");
2130
+ } : _ref$yAxisFormatter;
2131
+ var chartOptions = {
2132
+ chart: {
2133
+ type: "area",
2134
+ toolbar: {
2135
+ show: false
2136
+ },
2137
+ sparkline: {
2138
+ enabled: false
2139
+ },
2140
+ fontFamily: "Inter, sans-serif"
2141
+ },
2142
+ stroke: {
2143
+ curve: "smooth",
2144
+ width: 2,
2145
+ dashArray: series.map(function (s) {
2146
+ return s.dashed ? 5 : 0;
2147
+ })
2148
+ },
2149
+ fill: {
2150
+ type: "gradient",
2151
+ gradient: {
2152
+ shadeIntensity: 1,
2153
+ opacityFrom: 0.3,
2154
+ opacityTo: 0.8,
2155
+ stops: [0, 90, 100]
2156
+ }
2157
+ },
2158
+ colors: colors,
2159
+ xaxis: {
2160
+ categories: ["Apr 5", "Apr 12", "Apr 19", "Apr 26", "May 4"],
2161
+ labels: {
2162
+ show: true,
2163
+ style: {
2164
+ colors: 'rgba(0, 0, 0, 0.3)',
2165
+ fontSize: '10px'
2166
+ },
2167
+ offsetY: -5
2168
+ },
2169
+ axisBorder: {
2170
+ show: false
2171
+ },
2172
+ axisTicks: {
2173
+ show: false
2174
+ },
2175
+ position: 'bottom'
2176
+ },
2177
+ yaxis: {
2178
+ max: yAxisMax,
2179
+ tickAmount: yAxisTickAmount,
2180
+ labels: {
2181
+ show: true,
2182
+ style: {
2183
+ colors: 'rgba(0, 0, 0, 0.3)',
2184
+ fontSize: '10px'
2185
+ },
2186
+ formatter: yAxisFormatter
2187
+ }
2188
+ },
2189
+ grid: {
2190
+ show: true,
2191
+ borderColor: "rgba(0, 0, 0, 0.05)",
2192
+ strokeDashArray: 0,
2193
+ xaxis: {
2194
+ lines: {
2195
+ show: false
2196
+ }
2197
+ },
2198
+ yaxis: {
2199
+ lines: {
2200
+ show: true
2201
+ }
2202
+ },
2203
+ padding: {
2204
+ left: 10,
2205
+ right: 10,
2206
+ bottom: 0
2207
+ }
2208
+ },
2209
+ dataLabels: {
2210
+ enabled: false
2211
+ },
2212
+ legend: {
2213
+ show: series.length > 1,
2214
+ position: 'bottom',
2215
+ horizontalAlign: 'left',
2216
+ fontSize: '11px',
2217
+ fontFamily: 'Inter, sans-serif',
2218
+ offsetY: -5,
2219
+ markers: {
2220
+ width: 8,
2221
+ height: 8,
2222
+ radius: 12
2223
+ },
2224
+ itemMargin: {
2225
+ horizontal: 10,
2226
+ vertical: 0
2227
+ }
2228
+ },
2229
+ tooltip: {
2230
+ theme: 'light'
2231
+ }
2232
+ };
2233
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
2234
+ sx: {
2235
+ p: 3,
2236
+ borderRadius: 4,
2237
+ border: "1px solid #f0f0f0",
2238
+ boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
2239
+ bgcolor: "#fff",
2240
+ height: "100%",
2241
+ display: "flex",
2242
+ flexDirection: "column"
2243
+ },
2244
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
2245
+ sx: {
2246
+ mb: 1,
2247
+ textAlign: 'left'
2248
+ },
2249
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
2250
+ sx: {
2251
+ fontWeight: 700,
2252
+ fontSize: "18px",
2253
+ color: "#000"
2254
+ },
2255
+ children: title
2256
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
2257
+ sx: {
2258
+ fontSize: "12px",
2259
+ color: "rgba(0, 0, 0, 0.4)",
2260
+ fontWeight: 500
2261
+ },
2262
+ children: subtitle
2263
+ })]
2264
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
2265
+ sx: {
2266
+ display: "flex",
2267
+ alignItems: "center",
2268
+ gap: 1.5,
2269
+ mb: 1
2270
+ },
2271
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
2272
+ sx: {
2273
+ fontSize: "28px",
2274
+ fontWeight: 700,
2275
+ color: "#000"
2276
+ },
2277
+ children: value
2278
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
2279
+ sx: {
2280
+ bgcolor: "#ebfcf4",
2281
+ color: "#10b981",
2282
+ px: 1,
2283
+ py: 0.4,
2284
+ borderRadius: "100px",
2285
+ fontSize: "12px",
2286
+ fontWeight: 700,
2287
+ display: "flex",
2288
+ alignItems: "center",
2289
+ gap: 0.3
2290
+ },
2291
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
2292
+ style: {
2293
+ fontSize: '10px'
2294
+ },
2295
+ children: "\u25B2"
2296
+ }), " ", trend]
2297
+ })]
2298
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
2299
+ sx: {
2300
+ flexGrow: 1,
2301
+ height: 150,
2302
+ ml: -2,
2303
+ mr: -1
2304
+ },
2305
+ children: /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
2306
+ options: chartOptions,
2307
+ series: series,
2308
+ type: "area",
2309
+ height: "100%"
2310
+ })
2311
+ })]
2312
+ });
2313
+ };
2314
+
2118
2315
  var EmailSection = function EmailSection() {
2119
2316
  var _useState = React.useState("Total raised"),
2120
2317
  _useState2 = _slicedToArray(_useState, 2),
2121
2318
  activeMetric = _useState2[0],
2122
2319
  setActiveMetric = _useState2[1];
2123
- var categories = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
2124
2320
  var metricInfo = {
2125
2321
  "Total raised": {
2126
2322
  value: "$48,920",
@@ -2183,14 +2379,6 @@ var EmailSection = function EmailSection() {
2183
2379
  data: [28, 32, 29, 34, 30, 30, 30.35]
2184
2380
  }
2185
2381
  };
2186
- var selectedInfo = metricInfo[activeMetric];
2187
- var mainChart = {
2188
- label: activeMetric,
2189
- value: selectedInfo.value,
2190
- trend: selectedInfo.subValue,
2191
- data: selectedInfo.data,
2192
- categories: categories
2193
- };
2194
2382
  var renderCard = function renderCard(title) {
2195
2383
  return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
2196
2384
  title: title,
@@ -2203,12 +2391,8 @@ var EmailSection = function EmailSection() {
2203
2391
  isActive: activeMetric === title,
2204
2392
  sx: {
2205
2393
  flex: 1
2206
- // border:
2207
- // activeMetric === title
2208
- // ? "2px solid rgb(99, 99, 230)"
2209
- // : "2px solid #f0f0f0",
2210
2394
  }
2211
- });
2395
+ }, title);
2212
2396
  };
2213
2397
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2214
2398
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
@@ -2227,20 +2411,72 @@ var EmailSection = function EmailSection() {
2227
2411
  flexWrap: "wrap"
2228
2412
  },
2229
2413
  children: ["Open rate", "Clicks", "Unique Clicks", "Bounce rate", "Revenue per Click"].map(renderCard)
2230
- }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
2414
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
2231
2415
  container: true,
2232
2416
  spacing: 3,
2233
2417
  sx: {
2234
- mt: 1
2418
+ mt: 1,
2419
+ mb: 8
2235
2420
  },
2236
- children: /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
2237
- item: mainChart,
2238
- index: 0,
2239
- md: 12,
2240
- type: "area",
2241
- isPrimary: true,
2242
- isPremium: true
2243
- })
2421
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Grid, {
2422
+ item: true,
2423
+ xs: 12,
2424
+ md: 4,
2425
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
2426
+ title: "Open rate trend",
2427
+ subtitle: "Daily \xB7 30 days",
2428
+ value: "42.3%",
2429
+ trend: "2.1pp",
2430
+ series: [{
2431
+ name: 'Open Rate',
2432
+ data: [38, 42, 41, 43, 42.3]
2433
+ }],
2434
+ colors: ['rgb(99, 99, 230)'],
2435
+ yAxisMax: 53,
2436
+ yAxisTickAmount: 3
2437
+ })
2438
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
2439
+ item: true,
2440
+ xs: 12,
2441
+ md: 4,
2442
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
2443
+ title: "Clicks trend",
2444
+ subtitle: "Total + unique \xB7 30 days",
2445
+ value: "1,612",
2446
+ trend: "14%",
2447
+ series: [{
2448
+ name: 'Total clicks',
2449
+ data: [56, 112, 80, 150, 112]
2450
+ }, {
2451
+ name: 'Unique clicks',
2452
+ data: [30, 70, 45, 100, 75],
2453
+ dashed: true
2454
+ }],
2455
+ colors: ['#10B981', '#10B981'],
2456
+ yAxisMax: 168,
2457
+ yAxisTickAmount: 3,
2458
+ yAxisFormatter: function yAxisFormatter(val) {
2459
+ return val;
2460
+ }
2461
+ })
2462
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
2463
+ item: true,
2464
+ xs: 12,
2465
+ md: 4,
2466
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailTrendCard, {
2467
+ title: "Bounce rate trend",
2468
+ subtitle: "Daily \xB7 lower is better",
2469
+ value: "1.8%",
2470
+ trend: "0.3pp",
2471
+ series: [{
2472
+ name: 'Bounce Rate',
2473
+ data: [2.2, 1.9, 2.0, 1.7, 1.8]
2474
+ }],
2475
+ colors: ['#f2994a'],
2476
+ yAxisMax: 2.5,
2477
+ yAxisTickAmount: 3
2478
+ })
2479
+ })]
2244
2480
  }), /*#__PURE__*/jsxRuntime.jsxs(material.Grid, {
2245
2481
  container: true,
2246
2482
  spacing: 3,
@@ -4254,24 +4490,43 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
4254
4490
  },
4255
4491
  children: row.val4
4256
4492
  }), columns.length > 5 && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
4257
- children: row.type === "trend" ? /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
4493
+ children: row.type === "trend" ? /*#__PURE__*/jsxRuntime.jsx(material.Box, {
4258
4494
  sx: {
4259
4495
  display: "flex",
4260
4496
  alignItems: "center",
4261
- gap: 0.5,
4262
- color: row.trendType === "up" ? "#22C55E" : "#EF4444",
4263
- fontSize: "12px",
4264
- fontWeight: 600
4497
+ gap: 0.5
4265
4498
  },
4266
- children: [row.trendType === "up" ? /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {
4267
- sx: {
4268
- fontSize: "14px"
4269
- }
4270
- }) : /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingDown, {
4271
- sx: {
4272
- fontSize: "14px"
4273
- }
4274
- }), row.trendLabel]
4499
+ children: row.trendType === "up" ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
4500
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4501
+ sx: {
4502
+ fontSize: "14px",
4503
+ color: "#22C55E"
4504
+ },
4505
+ children: "\u25B2"
4506
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4507
+ sx: {
4508
+ fontSize: "12px",
4509
+ color: "#22C55E",
4510
+ fontWeight: 700
4511
+ },
4512
+ children: row.trendLabel
4513
+ })]
4514
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
4515
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4516
+ sx: {
4517
+ fontSize: "14px",
4518
+ color: "#EF4444"
4519
+ },
4520
+ children: "\u25BC"
4521
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
4522
+ sx: {
4523
+ fontSize: "12px",
4524
+ color: "#EF4444",
4525
+ fontWeight: 700
4526
+ },
4527
+ children: row.trendLabel
4528
+ })]
4529
+ })
4275
4530
  }) : /*#__PURE__*/jsxRuntime.jsx(material.Box, {
4276
4531
  sx: {
4277
4532
  display: "inline-block",
@@ -4912,8 +5167,26 @@ var MetricDonutCard = function MetricDonutCard(_ref) {
4912
5167
  });
4913
5168
  };
4914
5169
 
5170
+ function formatNumber(num) {
5171
+ if (num >= 1000000000) {
5172
+ return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
5173
+ }
5174
+ if (num >= 1000000) {
5175
+ return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
5176
+ }
5177
+ if (num >= 1000) {
5178
+ return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
5179
+ }
5180
+ return (num !== null && num !== void 0 ? num : 0).toString();
5181
+ }
5182
+
4915
5183
  var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
4916
- var sx = _ref.sx;
5184
+ var _donationTypeData$sum, _donationTypeData$sum2, _donationTypeData$sum3, _donationTypeData$sum4, _donationTypeData$sum5, _donationTypeData$sum6;
5185
+ var sx = _ref.sx,
5186
+ _ref$donationTypeData = _ref.donationTypeData,
5187
+ donationTypeData = _ref$donationTypeData === void 0 ? [] : _ref$donationTypeData;
5188
+ var recurringColor = (donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum = donationTypeData.summary) === null || _donationTypeData$sum === void 0 || (_donationTypeData$sum = _donationTypeData$sum.recurring) === null || _donationTypeData$sum === void 0 ? void 0 : _donationTypeData$sum.color) || "rgb(99, 99, 230)";
5189
+ var oneTimeColor = (donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum2 = donationTypeData.summary) === null || _donationTypeData$sum2 === void 0 || (_donationTypeData$sum2 = _donationTypeData$sum2.oneTime) === null || _donationTypeData$sum2 === void 0 ? void 0 : _donationTypeData$sum2.color) || "#10B981";
4917
5190
  var chartOptions = {
4918
5191
  chart: {
4919
5192
  type: "bar",
@@ -4938,7 +5211,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
4938
5211
  dataLabels: {
4939
5212
  enabled: true,
4940
5213
  formatter: function formatter(val) {
4941
- return "$".concat(val, "K");
5214
+ return "$".concat(formatNumber(val));
4942
5215
  },
4943
5216
  offsetY: -22,
4944
5217
  style: {
@@ -4953,7 +5226,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
4953
5226
  colors: ["transparent"]
4954
5227
  },
4955
5228
  xaxis: {
4956
- categories: ["Wk 1", "Wk 2", "Wk 3", "May 3-4"],
5229
+ categories: (donationTypeData === null || donationTypeData === void 0 ? void 0 : donationTypeData.categories) || [],
4957
5230
  axisBorder: {
4958
5231
  show: false
4959
5232
  },
@@ -4973,7 +5246,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
4973
5246
  tickAmount: 3,
4974
5247
  labels: {
4975
5248
  formatter: function formatter(val) {
4976
- return val === 40 ? "" : "$".concat(val, "K");
5249
+ return "$".concat(formatNumber(val));
4977
5250
  },
4978
5251
  style: {
4979
5252
  colors: "rgba(0, 0, 0, 0.4)",
@@ -4984,7 +5257,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
4984
5257
  fill: {
4985
5258
  opacity: 1
4986
5259
  },
4987
- colors: ["rgb(99, 99, 230)", "#10B981"],
5260
+ colors: [recurringColor, oneTimeColor],
4988
5261
  grid: {
4989
5262
  borderColor: "#f1f1f1",
4990
5263
  strokeDashArray: 4,
@@ -5004,18 +5277,12 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5004
5277
  tooltip: {
5005
5278
  y: {
5006
5279
  formatter: function formatter(val) {
5007
- return "$".concat(val, "K");
5280
+ return "$".concat(formatNumber(val));
5008
5281
  }
5009
5282
  }
5010
5283
  }
5011
5284
  };
5012
- var series = [{
5013
- name: "Recurring",
5014
- data: [9.2, 11.8, 13.4, 4.9]
5015
- }, {
5016
- name: "One-time",
5017
- data: [32.4, 41.2, 46.8, 14.3]
5018
- }];
5285
+ var series = (donationTypeData === null || donationTypeData === void 0 ? void 0 : donationTypeData.series) || [];
5019
5286
  return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
5020
5287
  sx: _objectSpread2({
5021
5288
  bgcolor: "#fff",
@@ -5075,14 +5342,14 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5075
5342
  color: "rgba(0, 0, 0, 0.5)",
5076
5343
  fontWeight: 500
5077
5344
  },
5078
- children: "Recurring"
5079
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5345
+ children: donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum3 = donationTypeData.summary) === null || _donationTypeData$sum3 === void 0 || (_donationTypeData$sum3 = _donationTypeData$sum3.recurring) === null || _donationTypeData$sum3 === void 0 ? void 0 : _donationTypeData$sum3.label
5346
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
5080
5347
  sx: {
5081
5348
  fontSize: "13px",
5082
5349
  fontWeight: 600,
5083
5350
  color: "#000"
5084
5351
  },
5085
- children: "$54,937"
5352
+ children: ["$", formatNumber((donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum4 = donationTypeData.summary) === null || _donationTypeData$sum4 === void 0 || (_donationTypeData$sum4 = _donationTypeData$sum4.recurring) === null || _donationTypeData$sum4 === void 0 ? void 0 : _donationTypeData$sum4.total) || 0)]
5086
5353
  })]
5087
5354
  }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
5088
5355
  sx: {
@@ -5103,14 +5370,14 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
5103
5370
  color: "rgba(0, 0, 0, 0.5)",
5104
5371
  fontWeight: 500
5105
5372
  },
5106
- children: "One-time"
5107
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5373
+ children: donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum5 = donationTypeData.summary) === null || _donationTypeData$sum5 === void 0 || (_donationTypeData$sum5 = _donationTypeData$sum5.oneTime) === null || _donationTypeData$sum5 === void 0 ? void 0 : _donationTypeData$sum5.label
5374
+ }), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
5108
5375
  sx: {
5109
5376
  fontSize: "13px",
5110
5377
  fontWeight: 600,
5111
5378
  color: "#000"
5112
5379
  },
5113
- children: "$188,001"
5380
+ children: ["$", formatNumber((donationTypeData === null || donationTypeData === void 0 || (_donationTypeData$sum6 = donationTypeData.summary) === null || _donationTypeData$sum6 === void 0 || (_donationTypeData$sum6 = _donationTypeData$sum6.oneTime) === null || _donationTypeData$sum6 === void 0 ? void 0 : _donationTypeData$sum6.total) || 0)]
5114
5381
  })]
5115
5382
  })]
5116
5383
  })]
@@ -5244,7 +5511,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5244
5511
  return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
5245
5512
  sx: _objectSpread2({
5246
5513
  bgcolor: "#fff",
5247
- borderRadius: "24px",
5514
+ borderRadius: 4,
5248
5515
  border: "1px solid #f0f0f0",
5249
5516
  boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
5250
5517
  p: 3,
@@ -5403,7 +5670,8 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5403
5670
  }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
5404
5671
  sx: {
5405
5672
  height: 160,
5406
- width: "100%"
5673
+ width: "100%",
5674
+ flexShrink: 0
5407
5675
  },
5408
5676
  children: /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
5409
5677
  options: chartOptions,
@@ -5415,19 +5683,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5415
5683
  });
5416
5684
  };
5417
5685
 
5418
- function formatNumber(num) {
5419
- if (num >= 1000000000) {
5420
- return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
5421
- }
5422
- if (num >= 1000000) {
5423
- return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
5424
- }
5425
- if (num >= 1000) {
5426
- return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
5427
- }
5428
- return (num !== null && num !== void 0 ? num : 0).toString();
5429
- }
5430
-
5431
5686
  var OverallSection = function OverallSection(_ref) {
5432
5687
  var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev;
5433
5688
  var _ref$apiData = _ref.apiData,
@@ -5441,6 +5696,7 @@ var OverallSection = function OverallSection(_ref) {
5441
5696
  _useState2 = _slicedToArray(_useState, 2),
5442
5697
  activeMetric = _useState2[0],
5443
5698
  setActiveMetric = _useState2[1];
5699
+ var donationTypeData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationType) || [];
5444
5700
  var allCharts = [].concat(_toConsumableArray(primaryCharts), _toConsumableArray(secondaryCharts), _toConsumableArray(tertiaryCharts), _toConsumableArray(quaternaryCharts));
5445
5701
  var getExtendedCharts = function getExtendedCharts() {
5446
5702
  var charts = _toConsumableArray(allCharts);
@@ -5519,6 +5775,10 @@ var OverallSection = function OverallSection(_ref) {
5519
5775
  }
5520
5776
  };
5521
5777
  var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
5778
+ var donorMix = (apiData === null || apiData === void 0 ? void 0 : apiData.donorMix) || {};
5779
+ var totalDonorsMix = (donorMix.newDonors || 0) + (donorMix.returningDonors || 0);
5780
+ var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
5781
+ var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
5522
5782
  var renderCard = function renderCard(title) {
5523
5783
  return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5524
5784
  title: title,
@@ -5881,22 +6141,22 @@ var OverallSection = function OverallSection(_ref) {
5881
6141
  children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
5882
6142
  title: "Donor mix",
5883
6143
  subtitle: "Acquisition vs retention",
5884
- series: [68, 32],
6144
+ series: [donorMix.newDonors || 0, donorMix.returningDonors || 0],
5885
6145
  labels: ["New donors", "Returning"],
5886
6146
  colors: ["rgb(99, 99, 230)", "#10B981"],
5887
6147
  centerLabel: "donors",
5888
- centerValue: "215",
6148
+ centerValue: totalDonorsMix.toString(),
5889
6149
  items: [{
5890
6150
  label: "New donors",
5891
- val: "146 · 68%",
6151
+ val: "".concat(donorMix.newDonors || 0, " \xB7 ").concat(newDonorsPerc, "%"),
5892
6152
  color: "rgb(99, 99, 230)"
5893
6153
  }, {
5894
6154
  label: "Returning",
5895
- val: "69 · 32%",
6155
+ val: "".concat(donorMix.returningDonors || 0, " \xB7 ").concat(returningDonorsPerc, "%"),
5896
6156
  color: "#10B981"
5897
6157
  }],
5898
- bottomSummaryValue: "$130.58",
5899
- bottomSummaryTrend: "8.4% vs last month",
6158
+ bottomSummaryValue: "$".concat(donorMix.avgGift || 0),
6159
+ bottomSummaryTrend: "".concat(donorMix.donorMixPrev || 0, "% vs ").concat(dateName || "last month"),
5900
6160
  sx: {
5901
6161
  width: "100%"
5902
6162
  }
@@ -5906,7 +6166,8 @@ var OverallSection = function OverallSection(_ref) {
5906
6166
  container: true,
5907
6167
  spacing: 3,
5908
6168
  sx: {
5909
- mt: 2
6169
+ mt: 2,
6170
+ alignItems: "stretch"
5910
6171
  },
5911
6172
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Grid, {
5912
6173
  item: true,
@@ -5914,8 +6175,9 @@ var OverallSection = function OverallSection(_ref) {
5914
6175
  md: 3,
5915
6176
  children: /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
5916
6177
  sx: {
5917
- minHeight: 330
5918
- }
6178
+ height: 330
6179
+ },
6180
+ donationTypeData: donationTypeData
5919
6181
  })
5920
6182
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
5921
6183
  item: true,
@@ -5923,7 +6185,7 @@ var OverallSection = function OverallSection(_ref) {
5923
6185
  md: 3,
5924
6186
  children: /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
5925
6187
  sx: {
5926
- minHeight: 330
6188
+ height: 330
5927
6189
  }
5928
6190
  })
5929
6191
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
@@ -5932,7 +6194,7 @@ var OverallSection = function OverallSection(_ref) {
5932
6194
  md: 3,
5933
6195
  children: /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
5934
6196
  sx: {
5935
- minHeight: 330
6197
+ height: 330
5936
6198
  }
5937
6199
  })
5938
6200
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
@@ -5941,7 +6203,7 @@ var OverallSection = function OverallSection(_ref) {
5941
6203
  md: 3,
5942
6204
  children: /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
5943
6205
  sx: {
5944
- minHeight: 330
6206
+ height: 330
5945
6207
  }
5946
6208
  })
5947
6209
  })]
@@ -5949,8 +6211,7 @@ var OverallSection = function OverallSection(_ref) {
5949
6211
  container: true,
5950
6212
  spacing: 3,
5951
6213
  sx: {
5952
- mt: 1,
5953
- mb: 2
6214
+ mt: 1
5954
6215
  },
5955
6216
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Grid, {
5956
6217
  item: true,