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