@ammarkhalidfarooq/dashboard-package 0.4.42 → 0.4.44

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
@@ -5147,6 +5147,70 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5147
5147
  });
5148
5148
  };
5149
5149
 
5150
+ var MetricCard = function MetricCard(_ref) {
5151
+ var title = _ref.title,
5152
+ value = _ref.value,
5153
+ caption = _ref.caption,
5154
+ icon = _ref.icon,
5155
+ active = _ref.active,
5156
+ warning = _ref.warning,
5157
+ error = _ref.error,
5158
+ onClick = _ref.onClick;
5159
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
5160
+ sx: {
5161
+ bgcolor: "#fff",
5162
+ border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
5163
+ borderRadius: "16px",
5164
+ p: {
5165
+ xs: 1.75,
5166
+ md: 2
5167
+ },
5168
+ minHeight: 108,
5169
+ boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
5170
+ },
5171
+ onClick: onClick,
5172
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
5173
+ direction: "row",
5174
+ justifyContent: "space-between",
5175
+ alignItems: "center",
5176
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5177
+ sx: {
5178
+ color: active ? "#818CF8" : "#999EAA",
5179
+ fontSize: 13,
5180
+ fontWeight: 500,
5181
+ letterSpacing: 0
5182
+ },
5183
+ children: title
5184
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
5185
+ sx: {
5186
+ width: 42,
5187
+ height: 42,
5188
+ bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
5189
+ color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
5190
+ },
5191
+ children: icon
5192
+ })]
5193
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5194
+ sx: {
5195
+ mt: 0.3,
5196
+ fontSize: 22,
5197
+ fontWeight: 700,
5198
+ color: active ? "#4F46E5" : "#050509",
5199
+ lineHeight: 1.15
5200
+ },
5201
+ children: value
5202
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5203
+ sx: {
5204
+ mt: 1.05,
5205
+ fontSize: 12,
5206
+ fontWeight: 500,
5207
+ color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
5208
+ },
5209
+ children: caption
5210
+ })]
5211
+ });
5212
+ };
5213
+
5150
5214
  var OverallSection = function OverallSection(_ref) {
5151
5215
  var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
5152
5216
  var _ref$apiData = _ref.apiData,
@@ -5209,37 +5273,55 @@ var OverallSection = function OverallSection(_ref) {
5209
5273
  value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5210
5274
  subValue: "".concat(Number((_apiData$totalRaisedP = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev) !== null && _apiData$totalRaisedP !== void 0 ? _apiData$totalRaisedP : 0).toFixed(2), "% vs ").concat(dateName || "last month"),
5211
5275
  label: "Total Raised",
5212
- icon: iconsMaterial.PaidOutlined
5276
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5277
+ money: true,
5278
+ error: false,
5279
+ warning: false
5213
5280
  },
5214
5281
  "Net Raised": {
5215
5282
  value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5216
5283
  subValue: "".concat(Number((_apiData$netRaisedPre = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedPrev) !== null && _apiData$netRaisedPre !== void 0 ? _apiData$netRaisedPre : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "previous period"),
5217
5284
  label: "Net Raised",
5218
- icon: iconsMaterial.FavoriteOutlined
5285
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.FavoriteOutlined, {}),
5286
+ money: true,
5287
+ error: false,
5288
+ warning: false
5219
5289
  },
5220
5290
  "Total Donors": {
5221
5291
  value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsCard) || "215",
5222
5292
  subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsPrev, " new") || "31 new",
5223
5293
  label: "Total Donors",
5224
- icon: iconsMaterial.PeopleAltOutlined
5294
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PeopleAltOutlined, {}),
5295
+ money: false,
5296
+ error: false,
5297
+ warning: false
5225
5298
  },
5226
5299
  "Avg donation": {
5227
5300
  value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5228
5301
  subValue: "".concat(Number((_apiData$averageDonat2 = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat2 !== void 0 ? _apiData$averageDonat2 : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
5229
5302
  label: "Average Donation Amount",
5230
- icon: iconsMaterial.PaidOutlined
5303
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5304
+ money: true,
5305
+ error: false,
5306
+ warning: false
5231
5307
  },
5232
5308
  "ROAS": {
5233
5309
  value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5234
5310
  subValue: "".concat(Number((_apiData$roasCardPrev = apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) !== null && _apiData$roasCardPrev !== void 0 ? _apiData$roasCardPrev : 0).toFixed(2), "x vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
5235
5311
  label: "ROAS",
5236
- icon: iconsMaterial.TrendingUp
5312
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
5313
+ money: false,
5314
+ error: false,
5315
+ warning: false
5237
5316
  },
5238
5317
  "Conversion": {
5239
5318
  value: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionCard) || "1.7%",
5240
5319
  subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionSub) || "215 / 12.4K",
5241
5320
  label: "Conversion Rate",
5242
- icon: iconsMaterial.Adjust
5321
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Adjust, {}),
5322
+ money: false,
5323
+ error: false,
5324
+ warning: false
5243
5325
  }
5244
5326
  };
5245
5327
  var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
@@ -5248,22 +5330,39 @@ var OverallSection = function OverallSection(_ref) {
5248
5330
  var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
5249
5331
  var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
5250
5332
  var renderCard = function renderCard(title) {
5251
- return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5333
+ return /*#__PURE__*/jsxRuntime.jsx(MetricCard
5334
+ // key={title}
5335
+ , {
5252
5336
  title: title,
5253
- value: metricInfo[title].value,
5254
- subValue: metricInfo[title].subValue,
5337
+ value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
5338
+ caption: metricInfo[title].subValue,
5255
5339
  icon: metricInfo[title].icon,
5340
+ error: metricInfo[title].error,
5341
+ active: activeMetric === title,
5256
5342
  onClick: function onClick() {
5257
5343
  return setActiveMetric(title);
5258
5344
  },
5259
- isActive: activeMetric === title,
5260
- sx: {
5261
- // border:
5262
- // activeMetric === title
5263
- // ? "1px solid rgb(99, 99, 230)"
5264
- // : "2px solid #f0f0f0",
5265
- }
5266
- }, title);
5345
+ sx: metricInfo[title].error ? {
5346
+ border: "2px solid #ef4444",
5347
+ bgcolor: "#fffafa"
5348
+ } : {}
5349
+ })
5350
+ // <DisplayCard
5351
+ // key={title}
5352
+ // title={title}
5353
+ // value={metricInfo[title].value}
5354
+ // subValue={metricInfo[title].subValue}
5355
+ // icon={metricInfo[title].icon}
5356
+ // onClick={() => setActiveMetric(title)}
5357
+ // isActive={activeMetric === title}
5358
+ // sx={{
5359
+ // // border:
5360
+ // // activeMetric === title
5361
+ // // ? "1px solid rgb(99, 99, 230)"
5362
+ // // : "2px solid #f0f0f0",
5363
+ // }}
5364
+ // />
5365
+ ;
5267
5366
  };
5268
5367
  var extendedCharts = getExtendedCharts();
5269
5368
  var selectedInfo = metricInfo[activeMetric];
@@ -5829,65 +5928,100 @@ var PaidSection = function PaidSection() {
5829
5928
  var categories = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
5830
5929
  var metricInfo = {
5831
5930
  "Total Spent": {
5832
- value: "$80,313",
5931
+ value: "$".concat(formatNumber(80313)),
5833
5932
  subValue: "12% vs last month",
5834
5933
  chartLabel: "Daily Spend",
5835
5934
  data: [800, 950, 700, 1100, 900, 1200, 1300],
5836
- icon: iconsMaterial.IndeterminateCheckBoxOutlined
5935
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.IndeterminateCheckBoxOutlined, {}),
5936
+ money: true,
5937
+ error: false,
5938
+ warning: false
5837
5939
  },
5838
5940
  "Revinue Raised": {
5839
- value: "$240,398",
5941
+ value: "$".concat(formatNumber(240398)),
5840
5942
  subValue: "12% vs last month",
5841
5943
  chartLabel: "Daily Revenue",
5842
5944
  data: [3200, 4100, 2800, 5600, 4200, 6100, 7500],
5843
- icon: iconsMaterial.PaidOutlined
5945
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5946
+ money: true,
5947
+ error: false,
5948
+ warning: false
5844
5949
  },
5845
5950
  ROAS: {
5846
5951
  value: "3.0",
5847
5952
  subValue: "12% vs last month",
5848
5953
  chartLabel: "ROAS Trend",
5849
5954
  data: [2.5, 3.1, 2.8, 4.2, 3.8, 4.5, 5.2],
5850
- icon: iconsMaterial.TrendingUp
5955
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
5956
+ money: false,
5957
+ error: false,
5958
+ warning: false
5851
5959
  },
5852
5960
  "Cost per donor": {
5853
- value: "$373",
5961
+ value: "$".concat(formatNumber(373)),
5854
5962
  subValue: "12% vs last month",
5855
5963
  chartLabel: "CPA Trend",
5856
5964
  data: [350, 380, 360, 410, 390, 370, 373],
5857
- icon: iconsMaterial.PersonOutlined
5965
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PersonOutlined, {}),
5966
+ money: true,
5967
+ error: false,
5968
+ warning: false
5858
5969
  },
5859
5970
  "Conversion rate": {
5860
5971
  value: "3.1%",
5861
5972
  subValue: "12% vs last month",
5862
5973
  chartLabel: "Conversion Rate",
5863
5974
  data: [2.8, 3.0, 2.9, 3.4, 3.2, 3.1, 3.1],
5864
- icon: iconsMaterial.Adjust
5975
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Adjust, {}),
5976
+ money: false,
5977
+ error: false,
5978
+ warning: false
5865
5979
  },
5866
5980
  "Avg donation": {
5867
- value: "$130.58",
5981
+ value: "$".concat(formatNumber(130.58)),
5868
5982
  subValue: "12% vs last month",
5869
5983
  chartLabel: "Average Donation",
5870
5984
  data: [120, 135, 125, 140, 130, 128, 130.58],
5871
- icon: iconsMaterial.PaidOutlined
5985
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5986
+ money: true,
5987
+ error: false,
5988
+ warning: false
5872
5989
  }
5873
5990
  };
5874
5991
  var renderCard = function renderCard(title) {
5875
- return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5992
+ return /*#__PURE__*/jsxRuntime.jsx(MetricCard
5993
+ // key={title}
5994
+ , {
5876
5995
  title: title,
5877
- value: metricInfo[title].value,
5878
- subValue: metricInfo[title].subValue,
5996
+ value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
5997
+ caption: metricInfo[title].subValue,
5879
5998
  icon: metricInfo[title].icon,
5999
+ error: metricInfo[title].error,
6000
+ active: activeMetric === title,
5880
6001
  onClick: function onClick() {
5881
6002
  return setActiveMetric(title);
5882
6003
  },
5883
- isActive: activeMetric === title,
5884
- sx: {
5885
- // border:
5886
- // activeMetric === title
5887
- // ? "2px solid rgb(99, 99, 230)"
5888
- // : "2px solid #f0f0f0",
5889
- }
5890
- }, title);
6004
+ sx: metricInfo[title].error ? {
6005
+ border: "2px solid #ef4444",
6006
+ bgcolor: "#fffafa"
6007
+ } : {}
6008
+ })
6009
+ // <DisplayCard
6010
+ // key={title}
6011
+ // title={title}
6012
+ // value={metricInfo[title].value}
6013
+ // subValue={metricInfo[title].subValue}
6014
+ // icon={metricInfo[title].icon}
6015
+ // onClick={() => setActiveMetric(title)}
6016
+ // isActive={activeMetric === title}
6017
+ // sx={{
6018
+ // // border:
6019
+ // // activeMetric === title
6020
+ // // ? "2px solid rgb(99, 99, 230)"
6021
+ // // : "2px solid #f0f0f0",
6022
+ // }}
6023
+ // />
6024
+ ;
5891
6025
  };
5892
6026
  var selectedInfo = metricInfo[activeMetric];
5893
6027
  var mainChart = {