@ammarkhalidfarooq/dashboard-package 0.6.63 → 0.6.65
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 +357 -168
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +357 -168
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1397,6 +1397,57 @@ var parseDonationTypeTotals = function parseDonationTypeTotals(donationTypeData)
|
|
|
1397
1397
|
};
|
|
1398
1398
|
};
|
|
1399
1399
|
|
|
1400
|
+
/** Weekly chart points + totals for recurring vs one-time (PDF + report). */
|
|
1401
|
+
var parseDonationTypeChartData = function parseDonationTypeChartData(donationTypeData) {
|
|
1402
|
+
var empty = {
|
|
1403
|
+
categories: [],
|
|
1404
|
+
recurring: [],
|
|
1405
|
+
oneTime: [],
|
|
1406
|
+
recurringTotal: 0,
|
|
1407
|
+
oneTimeTotal: 0
|
|
1408
|
+
};
|
|
1409
|
+
if (donationTypeData !== null && donationTypeData !== void 0 && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
1410
|
+
var _donationTypeData$tot3, _donationTypeData$tot4;
|
|
1411
|
+
return {
|
|
1412
|
+
categories: donationTypeData.data.map(function (item) {
|
|
1413
|
+
return item.label || "";
|
|
1414
|
+
}),
|
|
1415
|
+
recurring: donationTypeData.data.map(function (item) {
|
|
1416
|
+
return Number(item.recurring || 0);
|
|
1417
|
+
}),
|
|
1418
|
+
oneTime: donationTypeData.data.map(function (item) {
|
|
1419
|
+
return Number(item.oneTime || 0);
|
|
1420
|
+
}),
|
|
1421
|
+
recurringTotal: Number((_donationTypeData$tot3 = donationTypeData.totalRecurringDonations) !== null && _donationTypeData$tot3 !== void 0 ? _donationTypeData$tot3 : 0),
|
|
1422
|
+
oneTimeTotal: Number((_donationTypeData$tot4 = donationTypeData.totalOneTimeDonations) !== null && _donationTypeData$tot4 !== void 0 ? _donationTypeData$tot4 : 0)
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
1426
|
+
var totals = parseDonationTypeTotals(donationTypeData);
|
|
1427
|
+
return _objectSpread2(_objectSpread2({}, empty), totals);
|
|
1428
|
+
}
|
|
1429
|
+
if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && (donationTypeData[0].recurring !== undefined || donationTypeData[0].oneTime !== undefined || donationTypeData[0].recurringAmount !== undefined || donationTypeData[0].oneTimeAmount !== undefined)) {
|
|
1430
|
+
return {
|
|
1431
|
+
categories: donationTypeData.map(function (item) {
|
|
1432
|
+
return item.label || item.date || "";
|
|
1433
|
+
}),
|
|
1434
|
+
recurring: donationTypeData.map(function (item) {
|
|
1435
|
+
return Number(item.recurring || item.recurringAmount || 0);
|
|
1436
|
+
}),
|
|
1437
|
+
oneTime: donationTypeData.map(function (item) {
|
|
1438
|
+
return Number(item.oneTime || item.oneTimeAmount || 0);
|
|
1439
|
+
}),
|
|
1440
|
+
recurringTotal: donationTypeData.reduce(function (sum, item) {
|
|
1441
|
+
return sum + Number(item.recurring || item.recurringAmount || 0);
|
|
1442
|
+
}, 0),
|
|
1443
|
+
oneTimeTotal: donationTypeData.reduce(function (sum, item) {
|
|
1444
|
+
return sum + Number(item.oneTime || item.oneTimeAmount || 0);
|
|
1445
|
+
}, 0)
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
return _objectSpread2(_objectSpread2({}, empty), parseDonationTypeTotals(donationTypeData));
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1400
1451
|
/** Mirrors PaidDonorGeographyCard row mapping from donorGeography. */
|
|
1401
1452
|
var parseDonorGeographyList = function parseDonorGeographyList(donorGeographyData) {
|
|
1402
1453
|
var rawCountries = Array.isArray(donorGeographyData) ? donorGeographyData : (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.countries) || (donorGeographyData === null || donorGeographyData === void 0 ? void 0 : donorGeographyData.data) || [];
|
|
@@ -1662,6 +1713,12 @@ var kpiPct = function kpiPct(v) {
|
|
|
1662
1713
|
var kpiRoas = function kpiRoas(v) {
|
|
1663
1714
|
return "".concat(formatNumber(Number(v !== null && v !== void 0 ? v : 0).toFixed(2)), "\xD7");
|
|
1664
1715
|
};
|
|
1716
|
+
var d$Compact = function d$Compact(v) {
|
|
1717
|
+
var n = Number(v !== null && v !== void 0 ? v : 0);
|
|
1718
|
+
if (n >= 1000000) return "$".concat((n / 1000000).toFixed(1), "M");
|
|
1719
|
+
if (n >= 1000) return "$".concat((n / 1000).toFixed(1), "K");
|
|
1720
|
+
return d$(n);
|
|
1721
|
+
};
|
|
1665
1722
|
var pct = function pct(v) {
|
|
1666
1723
|
var dp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
1667
1724
|
return "".concat(Number(v !== null && v !== void 0 ? v : 0).toFixed(dp), "%");
|
|
@@ -2043,15 +2100,216 @@ var ProgressBar = function ProgressBar(_ref8) {
|
|
|
2043
2100
|
})]
|
|
2044
2101
|
});
|
|
2045
2102
|
};
|
|
2046
|
-
var
|
|
2047
|
-
var
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
_ref9$
|
|
2052
|
-
|
|
2053
|
-
_ref9$
|
|
2054
|
-
|
|
2103
|
+
var DonationTypeBarSvg = function DonationTypeBarSvg(_ref9) {
|
|
2104
|
+
var _ref9$categories = _ref9.categories,
|
|
2105
|
+
categories = _ref9$categories === void 0 ? [] : _ref9$categories,
|
|
2106
|
+
_ref9$recurring = _ref9.recurring,
|
|
2107
|
+
recurring = _ref9$recurring === void 0 ? [] : _ref9$recurring,
|
|
2108
|
+
_ref9$oneTime = _ref9.oneTime,
|
|
2109
|
+
oneTime = _ref9$oneTime === void 0 ? [] : _ref9$oneTime,
|
|
2110
|
+
_ref9$recurringColor = _ref9.recurringColor,
|
|
2111
|
+
recurringColor = _ref9$recurringColor === void 0 ? "#6366F1" : _ref9$recurringColor,
|
|
2112
|
+
_ref9$oneTimeColor = _ref9.oneTimeColor,
|
|
2113
|
+
oneTimeColor = _ref9$oneTimeColor === void 0 ? "#10B981" : _ref9$oneTimeColor;
|
|
2114
|
+
var width = 158;
|
|
2115
|
+
var height = 96;
|
|
2116
|
+
var padL = 30;
|
|
2117
|
+
var padR = 2;
|
|
2118
|
+
var padT = 14;
|
|
2119
|
+
var padB = 18;
|
|
2120
|
+
var chartW = width - padL - padR;
|
|
2121
|
+
var chartH = height - padT - padB;
|
|
2122
|
+
var allVals = [].concat(_toConsumableArray(recurring), _toConsumableArray(oneTime));
|
|
2123
|
+
var maxVal = Math.max.apply(Math, _toConsumableArray(allVals).concat([0])) || 1;
|
|
2124
|
+
var n = categories.length;
|
|
2125
|
+
var yTicks = [0, maxVal / 2, maxVal];
|
|
2126
|
+
if (!n) {
|
|
2127
|
+
return /*#__PURE__*/jsxs("svg", {
|
|
2128
|
+
width: "100%",
|
|
2129
|
+
height: height,
|
|
2130
|
+
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
2131
|
+
style: {
|
|
2132
|
+
display: "block"
|
|
2133
|
+
},
|
|
2134
|
+
children: [/*#__PURE__*/jsx("line", {
|
|
2135
|
+
x1: padL,
|
|
2136
|
+
y1: padT + chartH,
|
|
2137
|
+
x2: width - padR,
|
|
2138
|
+
y2: padT + chartH,
|
|
2139
|
+
stroke: "#f1f1f1"
|
|
2140
|
+
}), /*#__PURE__*/jsx("text", {
|
|
2141
|
+
x: padL - 4,
|
|
2142
|
+
y: padT + chartH + 3,
|
|
2143
|
+
textAnchor: "end",
|
|
2144
|
+
fontSize: 7,
|
|
2145
|
+
fill: "rgba(0,0,0,0.4)",
|
|
2146
|
+
children: "$0"
|
|
2147
|
+
})]
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
2150
|
+
var groupW = chartW / n;
|
|
2151
|
+
var barW = Math.min(groupW * 0.3, 12);
|
|
2152
|
+
var baseY = padT + chartH;
|
|
2153
|
+
return /*#__PURE__*/jsxs("svg", {
|
|
2154
|
+
width: "100%",
|
|
2155
|
+
height: height,
|
|
2156
|
+
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
2157
|
+
style: {
|
|
2158
|
+
display: "block"
|
|
2159
|
+
},
|
|
2160
|
+
children: [yTicks.map(function (tick, i) {
|
|
2161
|
+
var y = padT + chartH - tick / maxVal * chartH;
|
|
2162
|
+
return /*#__PURE__*/jsxs("g", {
|
|
2163
|
+
children: [/*#__PURE__*/jsx("line", {
|
|
2164
|
+
x1: padL,
|
|
2165
|
+
y1: y,
|
|
2166
|
+
x2: width - padR,
|
|
2167
|
+
y2: y,
|
|
2168
|
+
stroke: "#f1f1f1",
|
|
2169
|
+
strokeDasharray: "4"
|
|
2170
|
+
}), /*#__PURE__*/jsx("text", {
|
|
2171
|
+
x: padL - 4,
|
|
2172
|
+
y: y + 3,
|
|
2173
|
+
textAnchor: "end",
|
|
2174
|
+
fontSize: 7,
|
|
2175
|
+
fill: "rgba(0,0,0,0.4)",
|
|
2176
|
+
children: d$Compact(tick)
|
|
2177
|
+
})]
|
|
2178
|
+
}, "y-".concat(i));
|
|
2179
|
+
}), categories.map(function (cat, i) {
|
|
2180
|
+
var groupX = padL + i * groupW + groupW / 2;
|
|
2181
|
+
var rVal = recurring[i] || 0;
|
|
2182
|
+
var oVal = oneTime[i] || 0;
|
|
2183
|
+
var rH = rVal / maxVal * chartH;
|
|
2184
|
+
var oH = oVal / maxVal * chartH;
|
|
2185
|
+
var rX = groupX - barW - 1;
|
|
2186
|
+
var oX = groupX + 1;
|
|
2187
|
+
return /*#__PURE__*/jsxs("g", {
|
|
2188
|
+
children: [rVal > 0 && /*#__PURE__*/jsxs(Fragment, {
|
|
2189
|
+
children: [/*#__PURE__*/jsx("rect", {
|
|
2190
|
+
x: rX,
|
|
2191
|
+
y: baseY - rH,
|
|
2192
|
+
width: barW,
|
|
2193
|
+
height: Math.max(rH, 1),
|
|
2194
|
+
fill: recurringColor,
|
|
2195
|
+
rx: 2
|
|
2196
|
+
}), /*#__PURE__*/jsx("text", {
|
|
2197
|
+
x: rX + barW / 2,
|
|
2198
|
+
y: baseY - rH - 3,
|
|
2199
|
+
textAnchor: "middle",
|
|
2200
|
+
fontSize: 6.5,
|
|
2201
|
+
fontWeight: 600,
|
|
2202
|
+
fill: "#111827",
|
|
2203
|
+
children: d$Compact(rVal)
|
|
2204
|
+
})]
|
|
2205
|
+
}), oVal > 0 && /*#__PURE__*/jsxs(Fragment, {
|
|
2206
|
+
children: [/*#__PURE__*/jsx("rect", {
|
|
2207
|
+
x: oX,
|
|
2208
|
+
y: baseY - oH,
|
|
2209
|
+
width: barW,
|
|
2210
|
+
height: Math.max(oH, 1),
|
|
2211
|
+
fill: oneTimeColor,
|
|
2212
|
+
rx: 2
|
|
2213
|
+
}), /*#__PURE__*/jsx("text", {
|
|
2214
|
+
x: oX + barW / 2,
|
|
2215
|
+
y: baseY - oH - 3,
|
|
2216
|
+
textAnchor: "middle",
|
|
2217
|
+
fontSize: 6.5,
|
|
2218
|
+
fontWeight: 600,
|
|
2219
|
+
fill: "#111827",
|
|
2220
|
+
children: d$Compact(oVal)
|
|
2221
|
+
})]
|
|
2222
|
+
}), /*#__PURE__*/jsx("text", {
|
|
2223
|
+
x: groupX,
|
|
2224
|
+
y: height - 4,
|
|
2225
|
+
textAnchor: "middle",
|
|
2226
|
+
fontSize: 7.5,
|
|
2227
|
+
fill: "rgba(0,0,0,0.4)",
|
|
2228
|
+
children: cat
|
|
2229
|
+
})]
|
|
2230
|
+
}, "bar-".concat(i));
|
|
2231
|
+
})]
|
|
2232
|
+
});
|
|
2233
|
+
};
|
|
2234
|
+
var DonationTypePanel = function DonationTypePanel(_ref0) {
|
|
2235
|
+
var donationTypeData = _ref0.donationTypeData,
|
|
2236
|
+
_ref0$recurringColor = _ref0.recurringColor,
|
|
2237
|
+
recurringColor = _ref0$recurringColor === void 0 ? "#6366F1" : _ref0$recurringColor,
|
|
2238
|
+
_ref0$oneTimeColor = _ref0.oneTimeColor,
|
|
2239
|
+
oneTimeColor = _ref0$oneTimeColor === void 0 ? "#10B981" : _ref0$oneTimeColor;
|
|
2240
|
+
var _parseDonationTypeCha = parseDonationTypeChartData(donationTypeData),
|
|
2241
|
+
categories = _parseDonationTypeCha.categories,
|
|
2242
|
+
recurring = _parseDonationTypeCha.recurring,
|
|
2243
|
+
oneTime = _parseDonationTypeCha.oneTime,
|
|
2244
|
+
recurringTotal = _parseDonationTypeCha.recurringTotal,
|
|
2245
|
+
oneTimeTotal = _parseDonationTypeCha.oneTimeTotal;
|
|
2246
|
+
return /*#__PURE__*/jsxs(Panel, {
|
|
2247
|
+
title: "Recurring vs one-time",
|
|
2248
|
+
subtitle: "Donation type \xB7 weekly",
|
|
2249
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
2250
|
+
style: {
|
|
2251
|
+
display: "flex",
|
|
2252
|
+
flexWrap: "wrap",
|
|
2253
|
+
gap: "6px 10px",
|
|
2254
|
+
marginBottom: 4
|
|
2255
|
+
},
|
|
2256
|
+
children: [{
|
|
2257
|
+
label: "Recurring",
|
|
2258
|
+
total: recurringTotal,
|
|
2259
|
+
color: recurringColor
|
|
2260
|
+
}, {
|
|
2261
|
+
label: "One-time",
|
|
2262
|
+
total: oneTimeTotal,
|
|
2263
|
+
color: oneTimeColor
|
|
2264
|
+
}].map(function (item) {
|
|
2265
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2266
|
+
style: {
|
|
2267
|
+
display: "flex",
|
|
2268
|
+
alignItems: "center",
|
|
2269
|
+
gap: 4
|
|
2270
|
+
},
|
|
2271
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
2272
|
+
style: {
|
|
2273
|
+
width: 6,
|
|
2274
|
+
height: 6,
|
|
2275
|
+
borderRadius: "50%",
|
|
2276
|
+
background: item.color,
|
|
2277
|
+
flexShrink: 0
|
|
2278
|
+
}
|
|
2279
|
+
}), /*#__PURE__*/jsx("span", {
|
|
2280
|
+
style: {
|
|
2281
|
+
fontSize: 9.5,
|
|
2282
|
+
color: "#374151"
|
|
2283
|
+
},
|
|
2284
|
+
children: item.label
|
|
2285
|
+
}), /*#__PURE__*/jsx("span", {
|
|
2286
|
+
style: {
|
|
2287
|
+
fontSize: 9.5,
|
|
2288
|
+
fontWeight: 700,
|
|
2289
|
+
color: "#111827"
|
|
2290
|
+
},
|
|
2291
|
+
children: d$(item.total)
|
|
2292
|
+
})]
|
|
2293
|
+
}, item.label);
|
|
2294
|
+
})
|
|
2295
|
+
}), /*#__PURE__*/jsx(DonationTypeBarSvg, {
|
|
2296
|
+
categories: categories,
|
|
2297
|
+
recurring: recurring,
|
|
2298
|
+
oneTime: oneTime,
|
|
2299
|
+
recurringColor: recurringColor,
|
|
2300
|
+
oneTimeColor: oneTimeColor
|
|
2301
|
+
})]
|
|
2302
|
+
});
|
|
2303
|
+
};
|
|
2304
|
+
var KpiCard = function KpiCard(_ref1) {
|
|
2305
|
+
var title = _ref1.title,
|
|
2306
|
+
value = _ref1.value,
|
|
2307
|
+
trend = _ref1.trend,
|
|
2308
|
+
detail = _ref1.detail,
|
|
2309
|
+
_ref1$variant = _ref1.variant,
|
|
2310
|
+
variant = _ref1$variant === void 0 ? "secondary" : _ref1$variant,
|
|
2311
|
+
_ref1$trendPositiveWh = _ref1.trendPositiveWhenNegative,
|
|
2312
|
+
trendPositiveWhenNegative = _ref1$trendPositiveWh === void 0 ? false : _ref1$trendPositiveWh;
|
|
2055
2313
|
var displayTrend = withTrendArrow(trend);
|
|
2056
2314
|
var isPrimary = variant === "primary";
|
|
2057
2315
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -2102,10 +2360,10 @@ var KpiCard = function KpiCard(_ref9) {
|
|
|
2102
2360
|
})]
|
|
2103
2361
|
});
|
|
2104
2362
|
};
|
|
2105
|
-
var StatPair = function StatPair(
|
|
2106
|
-
var label =
|
|
2107
|
-
val =
|
|
2108
|
-
trend =
|
|
2363
|
+
var StatPair = function StatPair(_ref10) {
|
|
2364
|
+
var label = _ref10.label,
|
|
2365
|
+
val = _ref10.val,
|
|
2366
|
+
trend = _ref10.trend;
|
|
2109
2367
|
var displayTrend = withTrendArrow(trend);
|
|
2110
2368
|
return /*#__PURE__*/jsxs("div", {
|
|
2111
2369
|
style: {
|
|
@@ -2142,12 +2400,12 @@ var StatPair = function StatPair(_ref0) {
|
|
|
2142
2400
|
})]
|
|
2143
2401
|
});
|
|
2144
2402
|
};
|
|
2145
|
-
var PageHeader = function PageHeader(
|
|
2146
|
-
var dateLabel =
|
|
2147
|
-
generatedLabel =
|
|
2148
|
-
activeFilters =
|
|
2149
|
-
page =
|
|
2150
|
-
windowLabel =
|
|
2403
|
+
var PageHeader = function PageHeader(_ref11) {
|
|
2404
|
+
var dateLabel = _ref11.dateLabel,
|
|
2405
|
+
generatedLabel = _ref11.generatedLabel,
|
|
2406
|
+
activeFilters = _ref11.activeFilters,
|
|
2407
|
+
page = _ref11.page,
|
|
2408
|
+
windowLabel = _ref11.windowLabel;
|
|
2151
2409
|
return /*#__PURE__*/jsxs("div", {
|
|
2152
2410
|
style: {
|
|
2153
2411
|
padding: "22px ".concat(MX, "px 12px"),
|
|
@@ -2253,9 +2511,9 @@ var PageHeader = function PageHeader(_ref1) {
|
|
|
2253
2511
|
})]
|
|
2254
2512
|
});
|
|
2255
2513
|
};
|
|
2256
|
-
var PageFooter = function PageFooter(
|
|
2257
|
-
var generatedLabel =
|
|
2258
|
-
page =
|
|
2514
|
+
var PageFooter = function PageFooter(_ref12) {
|
|
2515
|
+
var generatedLabel = _ref12.generatedLabel,
|
|
2516
|
+
page = _ref12.page;
|
|
2259
2517
|
return /*#__PURE__*/jsx("div", {
|
|
2260
2518
|
style: {
|
|
2261
2519
|
padding: "7px ".concat(MX, "px"),
|
|
@@ -2275,16 +2533,16 @@ var PageFooter = function PageFooter(_ref10) {
|
|
|
2275
2533
|
};
|
|
2276
2534
|
|
|
2277
2535
|
// ─── Main component ───────────────────────────────────────────────────────────
|
|
2278
|
-
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (
|
|
2279
|
-
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3, _mainChart$stacked,
|
|
2280
|
-
var
|
|
2281
|
-
apiData =
|
|
2282
|
-
|
|
2283
|
-
dateName =
|
|
2284
|
-
|
|
2285
|
-
numberOfDays =
|
|
2286
|
-
|
|
2287
|
-
activeFilters =
|
|
2536
|
+
var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref13, ref) {
|
|
2537
|
+
var _apiData$overviewStat, _overview$totalRevenu, _overview$netRevenue, _overview$overallAVGD, _overview$conversionR, _apiData$totalVisits, _refundsRaw$refundRat, _refundsRaw$chargebac, _apiData$trafficSourc2, _metricByTitle$NetRa, _metricByTitle$Total, _metricByTitle$Total2, _metricByTitle$Total3, _metricByTitle$AvgDo, _metricByTitle$AvgDo2, _apiData$medianGift, _apiData$topDecileGif, _apiData$roasCard, _metricByTitle$ROAS, _apiData$roasCardPrev, _metricByTitle$ROAS2, _apiData$adSpend, _apiData$attributedRe, _metricByTitle$Conver, _metricByTitle$Conver2, _metricByTitle$Refund, _metricByTitle$Refund2, _refundsRaw$refundCou, _metricByTitle$Refund3, _mainChart$stacked, _ref16, _refundsRaw$refundRat2, _ob$growthPercentage, _ob$peakDay, _refCard$growthPercen;
|
|
2538
|
+
var _ref13$apiData = _ref13.apiData,
|
|
2539
|
+
apiData = _ref13$apiData === void 0 ? {} : _ref13$apiData,
|
|
2540
|
+
_ref13$dateName = _ref13.dateName,
|
|
2541
|
+
dateName = _ref13$dateName === void 0 ? "Last Period" : _ref13$dateName,
|
|
2542
|
+
_ref13$numberOfDays = _ref13.numberOfDays,
|
|
2543
|
+
numberOfDays = _ref13$numberOfDays === void 0 ? 30 : _ref13$numberOfDays,
|
|
2544
|
+
_ref13$activeFilters = _ref13.activeFilters,
|
|
2545
|
+
activeFilters = _ref13$activeFilters === void 0 ? [] : _ref13$activeFilters;
|
|
2288
2546
|
var now = new Date();
|
|
2289
2547
|
var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
|
|
2290
2548
|
var windowLabel = "".concat(numberOfDays, "-day window");
|
|
@@ -2358,9 +2616,6 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2358
2616
|
retPct = donorMix.retPct,
|
|
2359
2617
|
mixAvgGift = donorMix.avgGift,
|
|
2360
2618
|
donorMixPrev = donorMix.donorMixPrev;
|
|
2361
|
-
var _report$donationTypeT = report.donationTypeTotals,
|
|
2362
|
-
recurringTotal = _report$donationTypeT.recurringTotal,
|
|
2363
|
-
oneTimeTotal = _report$donationTypeT.oneTimeTotal;
|
|
2364
2619
|
var geoList = report.donorGeographyList;
|
|
2365
2620
|
var trafficItems = function (_apiData$trafficSourc) {
|
|
2366
2621
|
var items = Array.isArray(apiData === null || apiData === void 0 || (_apiData$trafficSourc = apiData.trafficSourceData) === null || _apiData$trafficSourc === void 0 ? void 0 : _apiData$trafficSourc.data) ? apiData.trafficSourceData.data : [];
|
|
@@ -2596,10 +2851,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2596
2851
|
gap: 14,
|
|
2597
2852
|
marginBottom: 6
|
|
2598
2853
|
},
|
|
2599
|
-
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (
|
|
2600
|
-
var
|
|
2601
|
-
name =
|
|
2602
|
-
color =
|
|
2854
|
+
children: [["Email", C.cyan], ["Organic", C.emerald], ["Paid Ads", C.indigo]].map(function (_ref14) {
|
|
2855
|
+
var _ref15 = _slicedToArray(_ref14, 2),
|
|
2856
|
+
name = _ref15[0],
|
|
2857
|
+
color = _ref15[1];
|
|
2603
2858
|
return /*#__PURE__*/jsxs("div", {
|
|
2604
2859
|
style: {
|
|
2605
2860
|
display: "flex",
|
|
@@ -2775,7 +3030,7 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2775
3030
|
style: {
|
|
2776
3031
|
fontSize: 9
|
|
2777
3032
|
},
|
|
2778
|
-
children: "".concat(Number((
|
|
3033
|
+
children: "".concat(Number((_ref16 = donorMixPrev !== null && donorMixPrev !== void 0 ? donorMixPrev : growth === null || growth === void 0 ? void 0 : growth.overallAVGDonations) !== null && _ref16 !== void 0 ? _ref16 : 0).toFixed(2), "% vs pp")
|
|
2779
3034
|
})
|
|
2780
3035
|
})]
|
|
2781
3036
|
})]
|
|
@@ -2787,95 +3042,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2787
3042
|
gridTemplateColumns: "repeat(4, 1fr)",
|
|
2788
3043
|
gap: 8
|
|
2789
3044
|
},
|
|
2790
|
-
children: [/*#__PURE__*/jsx(
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
var tot = recurringTotal + oneTimeTotal || 1;
|
|
2795
|
-
var rPct = recurringTotal / tot * 100;
|
|
2796
|
-
var oPct = oneTimeTotal / tot * 100;
|
|
2797
|
-
return /*#__PURE__*/jsxs("div", {
|
|
2798
|
-
style: {
|
|
2799
|
-
display: "flex",
|
|
2800
|
-
flexDirection: "column",
|
|
2801
|
-
gap: 9,
|
|
2802
|
-
marginTop: 4
|
|
2803
|
-
},
|
|
2804
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2805
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2806
|
-
style: {
|
|
2807
|
-
display: "flex",
|
|
2808
|
-
justifyContent: "space-between",
|
|
2809
|
-
marginBottom: 3
|
|
2810
|
-
},
|
|
2811
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
2812
|
-
style: {
|
|
2813
|
-
fontSize: 9.5,
|
|
2814
|
-
color: "#374151"
|
|
2815
|
-
},
|
|
2816
|
-
children: "Recurring"
|
|
2817
|
-
}), /*#__PURE__*/jsx("span", {
|
|
2818
|
-
style: {
|
|
2819
|
-
fontSize: 9.5,
|
|
2820
|
-
fontWeight: 700,
|
|
2821
|
-
color: "#111827"
|
|
2822
|
-
},
|
|
2823
|
-
children: d$(recurringTotal)
|
|
2824
|
-
})]
|
|
2825
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2826
|
-
style: {
|
|
2827
|
-
height: 9,
|
|
2828
|
-
background: "#EEF2FF",
|
|
2829
|
-
borderRadius: 3
|
|
2830
|
-
},
|
|
2831
|
-
children: /*#__PURE__*/jsx("div", {
|
|
2832
|
-
style: {
|
|
2833
|
-
width: "".concat(rPct, "%"),
|
|
2834
|
-
height: "100%",
|
|
2835
|
-
background: C.indigo,
|
|
2836
|
-
borderRadius: 3
|
|
2837
|
-
}
|
|
2838
|
-
})
|
|
2839
|
-
})]
|
|
2840
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
2841
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2842
|
-
style: {
|
|
2843
|
-
display: "flex",
|
|
2844
|
-
justifyContent: "space-between",
|
|
2845
|
-
marginBottom: 3
|
|
2846
|
-
},
|
|
2847
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
2848
|
-
style: {
|
|
2849
|
-
fontSize: 9.5,
|
|
2850
|
-
color: "#374151"
|
|
2851
|
-
},
|
|
2852
|
-
children: "One-time"
|
|
2853
|
-
}), /*#__PURE__*/jsx("span", {
|
|
2854
|
-
style: {
|
|
2855
|
-
fontSize: 9.5,
|
|
2856
|
-
fontWeight: 700,
|
|
2857
|
-
color: "#111827"
|
|
2858
|
-
},
|
|
2859
|
-
children: d$(oneTimeTotal)
|
|
2860
|
-
})]
|
|
2861
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2862
|
-
style: {
|
|
2863
|
-
height: 9,
|
|
2864
|
-
background: "#EEF2FF",
|
|
2865
|
-
borderRadius: 3
|
|
2866
|
-
},
|
|
2867
|
-
children: /*#__PURE__*/jsx("div", {
|
|
2868
|
-
style: {
|
|
2869
|
-
width: "".concat(oPct, "%"),
|
|
2870
|
-
height: "100%",
|
|
2871
|
-
background: "#C7D2FE",
|
|
2872
|
-
borderRadius: 3
|
|
2873
|
-
}
|
|
2874
|
-
})
|
|
2875
|
-
})]
|
|
2876
|
-
})]
|
|
2877
|
-
});
|
|
2878
|
-
}()
|
|
3045
|
+
children: [/*#__PURE__*/jsx(DonationTypePanel, {
|
|
3046
|
+
donationTypeData: report.donationTypeData,
|
|
3047
|
+
recurringColor: C.indigo,
|
|
3048
|
+
oneTimeColor: C.emerald
|
|
2879
3049
|
}), /*#__PURE__*/jsx(Panel, {
|
|
2880
3050
|
title: "Donor geography",
|
|
2881
3051
|
subtitle: "Top countries \xB7 ".concat(formatNumber(totalDonors), " total"),
|
|
@@ -3031,10 +3201,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3031
3201
|
display: "flex",
|
|
3032
3202
|
gap: 12
|
|
3033
3203
|
},
|
|
3034
|
-
children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (
|
|
3035
|
-
var
|
|
3036
|
-
l =
|
|
3037
|
-
v =
|
|
3204
|
+
children: [["Avg/day", d$((ob === null || ob === void 0 ? void 0 : ob.averagePerDay) || 0)], ["Peak day", d$((ob === null || ob === void 0 || (_ob$peakDay = ob.peakDay) === null || _ob$peakDay === void 0 ? void 0 : _ob$peakDay.amount) || 0)], ["Orders", formatNumber((ob === null || ob === void 0 ? void 0 : ob.totalOrders) || 0)]].map(function (_ref17) {
|
|
3205
|
+
var _ref18 = _slicedToArray(_ref17, 2),
|
|
3206
|
+
l = _ref18[0],
|
|
3207
|
+
v = _ref18[1];
|
|
3038
3208
|
return /*#__PURE__*/jsxs("div", {
|
|
3039
3209
|
children: [/*#__PURE__*/jsx("div", {
|
|
3040
3210
|
style: {
|
|
@@ -3161,10 +3331,10 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
3161
3331
|
display: "flex",
|
|
3162
3332
|
gap: 12
|
|
3163
3333
|
},
|
|
3164
|
-
children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (
|
|
3165
|
-
var
|
|
3166
|
-
l =
|
|
3167
|
-
v =
|
|
3334
|
+
children: [["Referrers", formatNumber((refCard === null || refCard === void 0 ? void 0 : refCard.totalReferrers) || 0)], ["Avg gift", d$((refCard === null || refCard === void 0 ? void 0 : refCard.averageGift) || 0)], ["Conv. rate", pct((refCard === null || refCard === void 0 ? void 0 : refCard.conversionRate) || 0, 1)]].map(function (_ref19) {
|
|
3335
|
+
var _ref20 = _slicedToArray(_ref19, 2),
|
|
3336
|
+
l = _ref20[0],
|
|
3337
|
+
v = _ref20[1];
|
|
3168
3338
|
return /*#__PURE__*/jsxs("div", {
|
|
3169
3339
|
children: [/*#__PURE__*/jsx("div", {
|
|
3170
3340
|
style: {
|
|
@@ -4782,7 +4952,12 @@ var MetricDonutCard = function MetricDonutCard(_ref2) {
|
|
|
4782
4952
|
|
|
4783
4953
|
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
4784
4954
|
var sx = _ref.sx,
|
|
4785
|
-
donationTypeData = _ref.donationTypeData
|
|
4955
|
+
donationTypeData = _ref.donationTypeData,
|
|
4956
|
+
_ref$exportMode = _ref.exportMode,
|
|
4957
|
+
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode,
|
|
4958
|
+
_ref$subtitle = _ref.subtitle,
|
|
4959
|
+
subtitle = _ref$subtitle === void 0 ? "Donation type" : _ref$subtitle,
|
|
4960
|
+
chartHeight = _ref.chartHeight;
|
|
4786
4961
|
var recurringColor = "rgb(99, 99, 230)";
|
|
4787
4962
|
var oneTimeColor = "#10B981";
|
|
4788
4963
|
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
@@ -4842,10 +5017,21 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4842
5017
|
}
|
|
4843
5018
|
} else {
|
|
4844
5019
|
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
4845
|
-
// Object format or
|
|
4846
|
-
var dataObj = donationTypeData
|
|
5020
|
+
// Object format, empty array, or missing data
|
|
5021
|
+
var dataObj = donationTypeData && _typeof(donationTypeData) === "object" && !Array.isArray(donationTypeData) ? donationTypeData : {};
|
|
4847
5022
|
categories = dataObj.categories || [];
|
|
4848
|
-
|
|
5023
|
+
var rawSeries = dataObj.series || [];
|
|
5024
|
+
if (rawSeries.length && categories.length) {
|
|
5025
|
+
series = rawSeries;
|
|
5026
|
+
} else {
|
|
5027
|
+
series = [{
|
|
5028
|
+
name: "Recurring",
|
|
5029
|
+
data: []
|
|
5030
|
+
}, {
|
|
5031
|
+
name: "One-time",
|
|
5032
|
+
data: []
|
|
5033
|
+
}];
|
|
5034
|
+
}
|
|
4849
5035
|
summaries = [{
|
|
4850
5036
|
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary = dataObj.summary) === null || _dataObj$summary === void 0 || (_dataObj$summary = _dataObj$summary.recurring) === null || _dataObj$summary === void 0 ? void 0 : _dataObj$summary.label) || "Recurring",
|
|
4851
5037
|
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
@@ -4858,6 +5044,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4858
5044
|
title = "Recurring vs one-time";
|
|
4859
5045
|
isDistributed = false;
|
|
4860
5046
|
}
|
|
5047
|
+
var resolvedChartHeight = chartHeight !== null && chartHeight !== void 0 ? chartHeight : exportMode ? 110 : 170;
|
|
4861
5048
|
var chartOptions = {
|
|
4862
5049
|
chart: {
|
|
4863
5050
|
type: "bar",
|
|
@@ -4872,8 +5059,8 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4872
5059
|
plotOptions: {
|
|
4873
5060
|
bar: {
|
|
4874
5061
|
horizontal: false,
|
|
4875
|
-
columnWidth: "75%",
|
|
4876
|
-
borderRadius: 4,
|
|
5062
|
+
columnWidth: exportMode ? "68%" : "75%",
|
|
5063
|
+
borderRadius: exportMode ? 3 : 4,
|
|
4877
5064
|
distributed: isDistributed,
|
|
4878
5065
|
dataLabels: {
|
|
4879
5066
|
position: "top"
|
|
@@ -4885,9 +5072,9 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4885
5072
|
formatter: function formatter(val) {
|
|
4886
5073
|
return "$".concat(formatNumber(val));
|
|
4887
5074
|
},
|
|
4888
|
-
offsetY: -20,
|
|
5075
|
+
offsetY: exportMode ? -16 : -20,
|
|
4889
5076
|
style: {
|
|
4890
|
-
fontSize: "9px",
|
|
5077
|
+
fontSize: exportMode ? "7px" : "9px",
|
|
4891
5078
|
fontWeight: 600,
|
|
4892
5079
|
colors: ["#000"]
|
|
4893
5080
|
}
|
|
@@ -4908,20 +5095,20 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4908
5095
|
labels: {
|
|
4909
5096
|
style: {
|
|
4910
5097
|
colors: "rgba(0, 0, 0, 0.4)",
|
|
4911
|
-
fontSize: "11px"
|
|
5098
|
+
fontSize: exportMode ? "8px" : "11px"
|
|
4912
5099
|
}
|
|
4913
5100
|
}
|
|
4914
5101
|
},
|
|
4915
5102
|
yaxis: {
|
|
4916
5103
|
min: 0,
|
|
4917
|
-
tickAmount: 4,
|
|
5104
|
+
tickAmount: exportMode ? 3 : 4,
|
|
4918
5105
|
labels: {
|
|
4919
5106
|
formatter: function formatter(val) {
|
|
4920
5107
|
return "$".concat(formatNumber(val));
|
|
4921
5108
|
},
|
|
4922
5109
|
style: {
|
|
4923
5110
|
colors: "rgba(0, 0, 0, 0.4)",
|
|
4924
|
-
fontSize: "10px"
|
|
5111
|
+
fontSize: exportMode ? "8px" : "10px"
|
|
4925
5112
|
}
|
|
4926
5113
|
}
|
|
4927
5114
|
},
|
|
@@ -4956,10 +5143,12 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4956
5143
|
return /*#__PURE__*/jsxs(Card, {
|
|
4957
5144
|
sx: _objectSpread2({
|
|
4958
5145
|
bgcolor: "#fff",
|
|
4959
|
-
borderRadius: 4,
|
|
4960
|
-
border: "1px solid #f0f0f0",
|
|
4961
|
-
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
4962
|
-
p: 3
|
|
5146
|
+
borderRadius: exportMode ? 2 : 4,
|
|
5147
|
+
border: exportMode ? "1px solid #DDE3EA" : "1px solid #f0f0f0",
|
|
5148
|
+
boxShadow: exportMode ? "0 1px 0 rgba(15,23,42,0.03)" : "0 4px 24px rgba(0,0,0,0.06)",
|
|
5149
|
+
p: exportMode ? 1.5 : 3,
|
|
5150
|
+
height: exportMode ? "100%" : "auto",
|
|
5151
|
+
boxSizing: "border-box"
|
|
4963
5152
|
}, sx),
|
|
4964
5153
|
children: [/*#__PURE__*/jsxs(Box, {
|
|
4965
5154
|
sx: {
|
|
@@ -4973,24 +5162,24 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
4973
5162
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
4974
5163
|
sx: {
|
|
4975
5164
|
fontWeight: 700,
|
|
4976
|
-
fontSize: "18px",
|
|
5165
|
+
fontSize: exportMode ? "12px" : "18px",
|
|
4977
5166
|
color: "#000",
|
|
4978
5167
|
lineHeight: 1.15
|
|
4979
5168
|
},
|
|
4980
5169
|
children: title
|
|
4981
5170
|
}), /*#__PURE__*/jsx(Typography, {
|
|
4982
5171
|
sx: {
|
|
4983
|
-
fontSize: "13px",
|
|
4984
|
-
color: "rgba(0, 0, 0, 0.4)",
|
|
5172
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
5173
|
+
color: exportMode ? "#94A3B8" : "rgba(0, 0, 0, 0.4)",
|
|
4985
5174
|
lineHeight: 1.15
|
|
4986
5175
|
},
|
|
4987
|
-
children:
|
|
5176
|
+
children: subtitle
|
|
4988
5177
|
})]
|
|
4989
5178
|
}), /*#__PURE__*/jsx(Box, {
|
|
4990
5179
|
sx: {
|
|
4991
5180
|
display: "flex",
|
|
4992
|
-
gap: 1.5,
|
|
4993
|
-
mt: 0.5,
|
|
5181
|
+
gap: exportMode ? 1 : 1.5,
|
|
5182
|
+
mt: exportMode ? 0.75 : 0.5,
|
|
4994
5183
|
flexWrap: "wrap"
|
|
4995
5184
|
},
|
|
4996
5185
|
children: summaries.map(function (item, index) {
|
|
@@ -5002,22 +5191,22 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5002
5191
|
},
|
|
5003
5192
|
children: [/*#__PURE__*/jsx(Box, {
|
|
5004
5193
|
sx: {
|
|
5005
|
-
width: 8,
|
|
5006
|
-
height: 8,
|
|
5194
|
+
width: exportMode ? 6 : 8,
|
|
5195
|
+
height: exportMode ? 6 : 8,
|
|
5007
5196
|
bgcolor: item.color,
|
|
5008
5197
|
borderRadius: "50%"
|
|
5009
5198
|
}
|
|
5010
5199
|
}), /*#__PURE__*/jsx(Typography, {
|
|
5011
5200
|
sx: {
|
|
5012
|
-
fontSize: "13px",
|
|
5013
|
-
color: "rgba(0, 0, 0, 0.5)",
|
|
5201
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
5202
|
+
color: exportMode ? "#374151" : "rgba(0, 0, 0, 0.5)",
|
|
5014
5203
|
fontWeight: 500
|
|
5015
5204
|
},
|
|
5016
5205
|
children: item.label
|
|
5017
5206
|
}), /*#__PURE__*/jsxs(Typography, {
|
|
5018
5207
|
sx: {
|
|
5019
|
-
fontSize: "13px",
|
|
5020
|
-
fontWeight: 600,
|
|
5208
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
5209
|
+
fontWeight: exportMode ? 700 : 600,
|
|
5021
5210
|
color: "#000"
|
|
5022
5211
|
},
|
|
5023
5212
|
children: ["$", formatNumber(item.total || 0)]
|
|
@@ -5027,10 +5216,10 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
|
5027
5216
|
})]
|
|
5028
5217
|
}), /*#__PURE__*/jsx(Box, {
|
|
5029
5218
|
sx: {
|
|
5030
|
-
height:
|
|
5031
|
-
width: "calc(100% + 48px)",
|
|
5032
|
-
ml: -3,
|
|
5033
|
-
mr: -3
|
|
5219
|
+
height: resolvedChartHeight,
|
|
5220
|
+
width: exportMode ? "calc(100% + 24px)" : "calc(100% + 48px)",
|
|
5221
|
+
ml: exportMode ? -1.5 : -3,
|
|
5222
|
+
mr: exportMode ? -1.5 : -3
|
|
5034
5223
|
},
|
|
5035
5224
|
children: /*#__PURE__*/jsx(ReactApexChart, {
|
|
5036
5225
|
options: chartOptions,
|