@ammarkhalidfarooq/dashboard-package 0.4.42 → 0.4.43
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 +116 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +117 -18
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
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(
|
|
5333
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard
|
|
5334
|
+
// key={title}
|
|
5335
|
+
, {
|
|
5252
5336
|
title: title,
|
|
5253
|
-
value: metricInfo[title].value,
|
|
5254
|
-
|
|
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
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
}
|
|
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];
|