@ammarkhalidfarooq/dashboard-package 0.3.37 → 0.3.39

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
@@ -5429,7 +5429,7 @@ function formatNumber(num) {
5429
5429
  }
5430
5430
 
5431
5431
  var OverallSection = function OverallSection(_ref) {
5432
- var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2;
5432
+ var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev;
5433
5433
  var _ref$apiData = _ref.apiData,
5434
5434
  apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
5435
5435
  primaryCharts = _ref.primaryCharts,
@@ -5506,8 +5506,8 @@ var OverallSection = function OverallSection(_ref) {
5506
5506
  icon: iconsMaterial.PaidOutlined
5507
5507
  },
5508
5508
  "ROAS": {
5509
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) || "3.0x",
5510
- subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.roasTrend) || "0.4x vs last month",
5509
+ value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5510
+ 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"),
5511
5511
  label: "ROAS",
5512
5512
  icon: iconsMaterial.TrendingUp
5513
5513
  },
@@ -5518,6 +5518,7 @@ var OverallSection = function OverallSection(_ref) {
5518
5518
  icon: iconsMaterial.Adjust
5519
5519
  }
5520
5520
  };
5521
+ var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
5521
5522
  var renderCard = function renderCard(title) {
5522
5523
  return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5523
5524
  title: title,
@@ -5856,64 +5857,19 @@ var OverallSection = function OverallSection(_ref) {
5856
5857
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"
5857
5858
  // "Status",
5858
5859
  ],
5859
- rows: [{
5860
- id: "OS",
5861
- name: "Orphan sponsorship Yemen",
5862
- val1: "$78,400",
5863
- type: "progress",
5864
- progress: 78,
5865
- val3: "82",
5866
- val4: "$956"
5867
- // status: "Active",
5868
- // statusColor: "#22C55E",
5869
- // statusBg: "#DCFCE7",
5870
- }, {
5871
- id: "EF",
5872
- name: "Emergency food — Gaza",
5873
- val1: "$62,100",
5874
- type: "progress",
5875
- progress: 83,
5876
- val3: "61",
5877
- val4: "$1,018"
5878
- // status: "Active",
5879
- // statusColor: "#22C55E",
5880
- // statusBg: "#DCFCE7",
5881
- }, {
5882
- id: "MB",
5883
- name: "Masjid build — Somalia",
5884
- val1: "$38,200",
5885
- type: "progress",
5886
- progress: 48,
5887
- val3: "34",
5888
- val4: "$1,124"
5889
- // status: "Slow",
5890
- // statusColor: "#B45309",
5891
- // statusBg: "#FEF3C7",
5892
- // progressColor: "#F59E0B",
5893
- }, {
5894
- id: "WW",
5895
- name: "Water wells — Pakistan",
5896
- val1: "$29,800",
5897
- type: "progress",
5898
- progress: 99,
5899
- val3: "28",
5900
- val4: "$1,064"
5901
- // status: "Closing",
5902
- // statusColor: "#6366F1",
5903
- // statusBg: "#EEF2FF",
5904
- // progressColor: "#10B981",
5905
- }, {
5906
- id: "RP",
5907
- name: "Ramadan packs — Egypt",
5908
- val1: "$19,400",
5909
- type: "progress",
5910
- progress: 78,
5911
- val3: "10",
5912
- val4: "$1,940"
5913
- // status: "Active",
5914
- // statusColor: "#22C55E",
5915
- // statusBg: "#DCFCE7",
5916
- }]
5860
+ rows: activeCampaignsData.map(function (campaign) {
5861
+ return {
5862
+ id: campaign.campaignName ? campaign.campaignName.split(" ").filter(Boolean).map(function (word) {
5863
+ return word[0];
5864
+ }).join("").toUpperCase().slice(0, 2) : "??",
5865
+ name: campaign.campaignName || "Untitled Campaign",
5866
+ val1: "$".concat(formatNumber(campaign.raisedAmount || 0)),
5867
+ type: "progress",
5868
+ progress: Math.round((campaign.raisedAmount || 0) / (campaign.totalAmount || 1) * 100),
5869
+ val3: formatNumber(campaign.donors || 0),
5870
+ val4: "$".concat(formatNumber(campaign.avgGift || 0))
5871
+ };
5872
+ })
5917
5873
  })
5918
5874
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
5919
5875
  item: true,