@agilo/medusa-analytics-plugin 1.2.1 → 1.3.2
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/README.md +5 -1
- package/package.json +39 -39
- package/.medusa/server/src/admin/index.js +0 -2098
- package/.medusa/server/src/admin/index.mjs +0 -2080
- package/.medusa/server/src/api/admin/agilo-analytics/customers/route.js +0 -178
- package/.medusa/server/src/api/admin/agilo-analytics/orders/route.js +0 -177
- package/.medusa/server/src/api/admin/agilo-analytics/products/route.js +0 -106
- package/.medusa/server/src/utils/orders.js +0 -184
|
@@ -1,2098 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const adminSdk = require("@medusajs/admin-sdk");
|
|
5
|
-
const ui = require("@medusajs/ui");
|
|
6
|
-
const icons = require("@medusajs/icons");
|
|
7
|
-
const lucideReact = require("lucide-react");
|
|
8
|
-
const dateFns = require("date-fns");
|
|
9
|
-
const reactAriaComponents = require("react-aria-components");
|
|
10
|
-
const reactRouterDom = require("react-router-dom");
|
|
11
|
-
const recharts = require("recharts");
|
|
12
|
-
const Medusa = require("@medusajs/js-sdk");
|
|
13
|
-
const clsx = require("clsx");
|
|
14
|
-
const tailwindMerge = require("tailwind-merge");
|
|
15
|
-
const reactQuery = require("@tanstack/react-query");
|
|
16
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule) return e;
|
|
19
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
20
|
-
if (e) {
|
|
21
|
-
for (const k in e) {
|
|
22
|
-
if (k !== "default") {
|
|
23
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: () => e[k]
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
n.default = e;
|
|
32
|
-
return Object.freeze(n);
|
|
33
|
-
}
|
|
34
|
-
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
35
|
-
const Medusa__default = /* @__PURE__ */ _interopDefault(Medusa);
|
|
36
|
-
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
|
|
37
|
-
return amount - numerator * Math.floor(amount / numerator);
|
|
38
|
-
}
|
|
39
|
-
const $3b62074eb05584b2$var$EPOCH = 1721426;
|
|
40
|
-
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
|
|
41
|
-
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
|
|
42
|
-
let y1 = year - 1;
|
|
43
|
-
let monthOffset = -2;
|
|
44
|
-
if (month <= 2) monthOffset = 0;
|
|
45
|
-
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
|
|
46
|
-
return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
|
|
47
|
-
}
|
|
48
|
-
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
|
|
49
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
50
|
-
}
|
|
51
|
-
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
|
|
52
|
-
return era === "BC" ? 1 - year : year;
|
|
53
|
-
}
|
|
54
|
-
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
|
|
55
|
-
let era = "AD";
|
|
56
|
-
if (year <= 0) {
|
|
57
|
-
era = "BC";
|
|
58
|
-
year = 1 - year;
|
|
59
|
-
}
|
|
60
|
-
return [
|
|
61
|
-
era,
|
|
62
|
-
year
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
const $3b62074eb05584b2$var$daysInMonth = {
|
|
66
|
-
standard: [
|
|
67
|
-
31,
|
|
68
|
-
28,
|
|
69
|
-
31,
|
|
70
|
-
30,
|
|
71
|
-
31,
|
|
72
|
-
30,
|
|
73
|
-
31,
|
|
74
|
-
31,
|
|
75
|
-
30,
|
|
76
|
-
31,
|
|
77
|
-
30,
|
|
78
|
-
31
|
|
79
|
-
],
|
|
80
|
-
leapyear: [
|
|
81
|
-
31,
|
|
82
|
-
29,
|
|
83
|
-
31,
|
|
84
|
-
30,
|
|
85
|
-
31,
|
|
86
|
-
30,
|
|
87
|
-
31,
|
|
88
|
-
31,
|
|
89
|
-
30,
|
|
90
|
-
31,
|
|
91
|
-
30,
|
|
92
|
-
31
|
|
93
|
-
]
|
|
94
|
-
};
|
|
95
|
-
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
96
|
-
fromJulianDay(jd) {
|
|
97
|
-
let jd0 = jd;
|
|
98
|
-
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
|
|
99
|
-
let quadricent = Math.floor(depoch / 146097);
|
|
100
|
-
let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
|
|
101
|
-
let cent = Math.floor(dqc / 36524);
|
|
102
|
-
let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
|
|
103
|
-
let quad = Math.floor(dcent / 1461);
|
|
104
|
-
let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
|
|
105
|
-
let yindex = Math.floor(dquad / 365);
|
|
106
|
-
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
107
|
-
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
|
|
108
|
-
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
|
|
109
|
-
let leapAdj = 2;
|
|
110
|
-
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
|
|
111
|
-
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
|
|
112
|
-
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
113
|
-
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
|
|
114
|
-
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
|
|
115
|
-
}
|
|
116
|
-
toJulianDay(date) {
|
|
117
|
-
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
|
|
118
|
-
}
|
|
119
|
-
getDaysInMonth(date) {
|
|
120
|
-
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
|
|
121
|
-
}
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
123
|
-
getMonthsInYear(date) {
|
|
124
|
-
return 12;
|
|
125
|
-
}
|
|
126
|
-
getDaysInYear(date) {
|
|
127
|
-
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
128
|
-
}
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
130
|
-
getYearsInEra(date) {
|
|
131
|
-
return 9999;
|
|
132
|
-
}
|
|
133
|
-
getEras() {
|
|
134
|
-
return [
|
|
135
|
-
"BC",
|
|
136
|
-
"AD"
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
isInverseEra(date) {
|
|
140
|
-
return date.era === "BC";
|
|
141
|
-
}
|
|
142
|
-
balanceDate(date) {
|
|
143
|
-
if (date.year <= 0) {
|
|
144
|
-
date.era = date.era === "BC" ? "AD" : "BC";
|
|
145
|
-
date.year = 1 - date.year;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
constructor() {
|
|
149
|
-
this.identifier = "gregory";
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a, b) {
|
|
153
|
-
var _a_isEqual, _b_isEqual;
|
|
154
|
-
var _a_isEqual1, _ref;
|
|
155
|
-
return (_ref = (_a_isEqual1 = (_a_isEqual = a.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a)) !== null && _ref !== void 0 ? _ref : a.identifier === b.identifier;
|
|
156
|
-
}
|
|
157
|
-
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
|
|
158
|
-
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
159
|
-
}
|
|
160
|
-
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
|
|
161
|
-
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
|
|
162
|
-
}
|
|
163
|
-
function $14e0f24ef4ac5c92$var$timeToMs(a) {
|
|
164
|
-
return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
|
|
165
|
-
}
|
|
166
|
-
let $14e0f24ef4ac5c92$var$localTimeZone = null;
|
|
167
|
-
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
|
|
168
|
-
if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
169
|
-
return $14e0f24ef4ac5c92$var$localTimeZone;
|
|
170
|
-
}
|
|
171
|
-
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
|
|
172
|
-
date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
|
|
173
|
-
let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date.era, date.year);
|
|
174
|
-
return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
175
|
-
}
|
|
176
|
-
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
|
|
177
|
-
let date = /* @__PURE__ */ new Date();
|
|
178
|
-
date.setUTCHours(hour, minute, second, millisecond);
|
|
179
|
-
date.setUTCFullYear(year, month - 1, day);
|
|
180
|
-
return date.getTime();
|
|
181
|
-
}
|
|
182
|
-
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
|
|
183
|
-
if (timeZone === "UTC") return 0;
|
|
184
|
-
if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2()) return new Date(ms).getTimezoneOffset() * -6e4;
|
|
185
|
-
let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
|
|
186
|
-
let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
187
|
-
return utc - Math.floor(ms / 1e3) * 1e3;
|
|
188
|
-
}
|
|
189
|
-
const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
|
|
190
|
-
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
|
|
191
|
-
let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
|
|
192
|
-
if (!formatter) {
|
|
193
|
-
formatter = new Intl.DateTimeFormat("en-US", {
|
|
194
|
-
timeZone,
|
|
195
|
-
hour12: false,
|
|
196
|
-
era: "short",
|
|
197
|
-
year: "numeric",
|
|
198
|
-
month: "numeric",
|
|
199
|
-
day: "numeric",
|
|
200
|
-
hour: "numeric",
|
|
201
|
-
minute: "numeric",
|
|
202
|
-
second: "numeric"
|
|
203
|
-
});
|
|
204
|
-
$11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
|
|
205
|
-
}
|
|
206
|
-
let parts = formatter.formatToParts(new Date(ms));
|
|
207
|
-
let namedParts = {};
|
|
208
|
-
for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value;
|
|
209
|
-
return {
|
|
210
|
-
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
|
|
211
|
-
year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
|
|
212
|
-
month: +namedParts.month,
|
|
213
|
-
day: +namedParts.day,
|
|
214
|
-
hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
|
|
215
|
-
minute: +namedParts.minute,
|
|
216
|
-
second: +namedParts.second
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
|
|
220
|
-
function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
221
|
-
let found = earlier === later ? [
|
|
222
|
-
earlier
|
|
223
|
-
] : [
|
|
224
|
-
earlier,
|
|
225
|
-
later
|
|
226
|
-
];
|
|
227
|
-
return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
|
|
228
|
-
}
|
|
229
|
-
function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
|
|
230
|
-
let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
|
|
231
|
-
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
|
|
232
|
-
}
|
|
233
|
-
function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
|
|
234
|
-
let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
|
|
235
|
-
if (timeZone === "UTC") return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
236
|
-
if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
|
|
237
|
-
dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
|
|
238
|
-
let date2 = /* @__PURE__ */ new Date();
|
|
239
|
-
let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
|
|
240
|
-
date2.setFullYear(year, dateTime.month - 1, dateTime.day);
|
|
241
|
-
date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
242
|
-
return date2.getTime();
|
|
243
|
-
}
|
|
244
|
-
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
245
|
-
let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
246
|
-
let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
247
|
-
let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
248
|
-
if (valid.length === 1) return valid[0];
|
|
249
|
-
if (valid.length > 1) switch (disambiguation) {
|
|
250
|
-
case "compatible":
|
|
251
|
-
case "earlier":
|
|
252
|
-
return valid[0];
|
|
253
|
-
case "later":
|
|
254
|
-
return valid[valid.length - 1];
|
|
255
|
-
case "reject":
|
|
256
|
-
throw new RangeError("Multiple possible absolute times found");
|
|
257
|
-
}
|
|
258
|
-
switch (disambiguation) {
|
|
259
|
-
case "earlier":
|
|
260
|
-
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
261
|
-
case "compatible":
|
|
262
|
-
case "later":
|
|
263
|
-
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
264
|
-
case "reject":
|
|
265
|
-
throw new RangeError("No such absolute time found");
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
|
|
269
|
-
return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
|
|
270
|
-
}
|
|
271
|
-
function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
|
|
272
|
-
let hour = 0, minute = 0, second = 0, millisecond = 0;
|
|
273
|
-
if ("timeZone" in date) ({ hour, minute, second, millisecond } = date);
|
|
274
|
-
else if ("hour" in date && !time) return date;
|
|
275
|
-
if (time) ({ hour, minute, second, millisecond } = time);
|
|
276
|
-
return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
277
|
-
}
|
|
278
|
-
function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
|
|
279
|
-
if ($14e0f24ef4ac5c92$export$dbc69fd56b53d5e(date.calendar, calendar)) return date;
|
|
280
|
-
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
281
|
-
let copy = date.copy();
|
|
282
|
-
copy.calendar = calendar;
|
|
283
|
-
copy.era = calendarDate.era;
|
|
284
|
-
copy.year = calendarDate.year;
|
|
285
|
-
copy.month = calendarDate.month;
|
|
286
|
-
copy.day = calendarDate.day;
|
|
287
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(copy);
|
|
288
|
-
return copy;
|
|
289
|
-
}
|
|
290
|
-
function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
|
|
291
|
-
let mutableDate = date.copy();
|
|
292
|
-
let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
|
|
293
|
-
$735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
|
|
294
|
-
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
|
|
295
|
-
mutableDate.month += duration.months || 0;
|
|
296
|
-
$735220c2d4774dd3$var$balanceYearMonth(mutableDate);
|
|
297
|
-
$735220c2d4774dd3$var$constrainMonthDay(mutableDate);
|
|
298
|
-
mutableDate.day += (duration.weeks || 0) * 7;
|
|
299
|
-
mutableDate.day += duration.days || 0;
|
|
300
|
-
mutableDate.day += days;
|
|
301
|
-
$735220c2d4774dd3$var$balanceDay(mutableDate);
|
|
302
|
-
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
|
|
303
|
-
if (mutableDate.year < 1) {
|
|
304
|
-
mutableDate.year = 1;
|
|
305
|
-
mutableDate.month = 1;
|
|
306
|
-
mutableDate.day = 1;
|
|
307
|
-
}
|
|
308
|
-
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
|
|
309
|
-
if (mutableDate.year > maxYear) {
|
|
310
|
-
var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
|
|
311
|
-
let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
|
|
312
|
-
mutableDate.year = maxYear;
|
|
313
|
-
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
314
|
-
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
315
|
-
}
|
|
316
|
-
if (mutableDate.month < 1) {
|
|
317
|
-
mutableDate.month = 1;
|
|
318
|
-
mutableDate.day = 1;
|
|
319
|
-
}
|
|
320
|
-
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
321
|
-
if (mutableDate.month > maxMonth) {
|
|
322
|
-
mutableDate.month = maxMonth;
|
|
323
|
-
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
324
|
-
}
|
|
325
|
-
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
|
|
326
|
-
return mutableDate;
|
|
327
|
-
}
|
|
328
|
-
function $735220c2d4774dd3$var$addYears(date, years) {
|
|
329
|
-
var _date_calendar_isInverseEra, _date_calendar;
|
|
330
|
-
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
|
|
331
|
-
date.year += years;
|
|
332
|
-
}
|
|
333
|
-
function $735220c2d4774dd3$var$balanceYearMonth(date) {
|
|
334
|
-
while (date.month < 1) {
|
|
335
|
-
$735220c2d4774dd3$var$addYears(date, -1);
|
|
336
|
-
date.month += date.calendar.getMonthsInYear(date);
|
|
337
|
-
}
|
|
338
|
-
let monthsInYear = 0;
|
|
339
|
-
while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
|
|
340
|
-
date.month -= monthsInYear;
|
|
341
|
-
$735220c2d4774dd3$var$addYears(date, 1);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function $735220c2d4774dd3$var$balanceDay(date) {
|
|
345
|
-
while (date.day < 1) {
|
|
346
|
-
date.month--;
|
|
347
|
-
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
348
|
-
date.day += date.calendar.getDaysInMonth(date);
|
|
349
|
-
}
|
|
350
|
-
while (date.day > date.calendar.getDaysInMonth(date)) {
|
|
351
|
-
date.day -= date.calendar.getDaysInMonth(date);
|
|
352
|
-
date.month++;
|
|
353
|
-
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function $735220c2d4774dd3$var$constrainMonthDay(date) {
|
|
357
|
-
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
|
|
358
|
-
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
|
|
359
|
-
}
|
|
360
|
-
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
|
|
361
|
-
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
|
|
362
|
-
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
|
|
363
|
-
$735220c2d4774dd3$var$constrainMonthDay(date);
|
|
364
|
-
}
|
|
365
|
-
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
|
|
366
|
-
let inverseDuration = {};
|
|
367
|
-
for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
|
|
368
|
-
return inverseDuration;
|
|
369
|
-
}
|
|
370
|
-
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
|
|
371
|
-
return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
|
|
372
|
-
}
|
|
373
|
-
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
|
|
374
|
-
let mutableDate = date.copy();
|
|
375
|
-
if (fields.era != null) mutableDate.era = fields.era;
|
|
376
|
-
if (fields.year != null) mutableDate.year = fields.year;
|
|
377
|
-
if (fields.month != null) mutableDate.month = fields.month;
|
|
378
|
-
if (fields.day != null) mutableDate.day = fields.day;
|
|
379
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
|
|
380
|
-
return mutableDate;
|
|
381
|
-
}
|
|
382
|
-
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
|
|
383
|
-
let mutableValue = value.copy();
|
|
384
|
-
if (fields.hour != null) mutableValue.hour = fields.hour;
|
|
385
|
-
if (fields.minute != null) mutableValue.minute = fields.minute;
|
|
386
|
-
if (fields.second != null) mutableValue.second = fields.second;
|
|
387
|
-
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
|
|
388
|
-
$735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
|
|
389
|
-
return mutableValue;
|
|
390
|
-
}
|
|
391
|
-
function $735220c2d4774dd3$var$balanceTime(time) {
|
|
392
|
-
time.second += Math.floor(time.millisecond / 1e3);
|
|
393
|
-
time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
|
|
394
|
-
time.minute += Math.floor(time.second / 60);
|
|
395
|
-
time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
|
|
396
|
-
time.hour += Math.floor(time.minute / 60);
|
|
397
|
-
time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
|
|
398
|
-
let days = Math.floor(time.hour / 24);
|
|
399
|
-
time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
|
|
400
|
-
return days;
|
|
401
|
-
}
|
|
402
|
-
function $735220c2d4774dd3$export$7555de1e070510cb(time) {
|
|
403
|
-
time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
|
|
404
|
-
time.second = Math.max(0, Math.min(time.second, 59));
|
|
405
|
-
time.minute = Math.max(0, Math.min(time.minute, 59));
|
|
406
|
-
time.hour = Math.max(0, Math.min(time.hour, 23));
|
|
407
|
-
}
|
|
408
|
-
function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
|
|
409
|
-
let result = a % b;
|
|
410
|
-
if (result < 0) result += b;
|
|
411
|
-
return result;
|
|
412
|
-
}
|
|
413
|
-
function $735220c2d4774dd3$var$addTimeFields(time, duration) {
|
|
414
|
-
time.hour += duration.hours || 0;
|
|
415
|
-
time.minute += duration.minutes || 0;
|
|
416
|
-
time.second += duration.seconds || 0;
|
|
417
|
-
time.millisecond += duration.milliseconds || 0;
|
|
418
|
-
return $735220c2d4774dd3$var$balanceTime(time);
|
|
419
|
-
}
|
|
420
|
-
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
|
|
421
|
-
let mutable = value.copy();
|
|
422
|
-
switch (field) {
|
|
423
|
-
case "era": {
|
|
424
|
-
let eras = value.calendar.getEras();
|
|
425
|
-
let eraIndex = eras.indexOf(value.era);
|
|
426
|
-
if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
|
|
427
|
-
eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
|
|
428
|
-
mutable.era = eras[eraIndex];
|
|
429
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
case "year":
|
|
433
|
-
var _mutable_calendar_isInverseEra, _mutable_calendar;
|
|
434
|
-
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
|
|
435
|
-
mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
|
|
436
|
-
if (mutable.year === -Infinity) mutable.year = 1;
|
|
437
|
-
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
|
|
438
|
-
break;
|
|
439
|
-
case "month":
|
|
440
|
-
mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
|
|
441
|
-
break;
|
|
442
|
-
case "day":
|
|
443
|
-
mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
|
|
444
|
-
break;
|
|
445
|
-
default:
|
|
446
|
-
throw new Error("Unsupported field " + field);
|
|
447
|
-
}
|
|
448
|
-
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
|
|
449
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
450
|
-
return mutable;
|
|
451
|
-
}
|
|
452
|
-
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
|
|
453
|
-
let mutable = value.copy();
|
|
454
|
-
switch (field) {
|
|
455
|
-
case "hour": {
|
|
456
|
-
let hours = value.hour;
|
|
457
|
-
let min = 0;
|
|
458
|
-
let max = 23;
|
|
459
|
-
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
|
|
460
|
-
let isPM = hours >= 12;
|
|
461
|
-
min = isPM ? 12 : 0;
|
|
462
|
-
max = isPM ? 23 : 11;
|
|
463
|
-
}
|
|
464
|
-
mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
|
|
465
|
-
break;
|
|
466
|
-
}
|
|
467
|
-
case "minute":
|
|
468
|
-
mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
469
|
-
break;
|
|
470
|
-
case "second":
|
|
471
|
-
mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
472
|
-
break;
|
|
473
|
-
case "millisecond":
|
|
474
|
-
mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
|
|
475
|
-
break;
|
|
476
|
-
default:
|
|
477
|
-
throw new Error("Unsupported field " + field);
|
|
478
|
-
}
|
|
479
|
-
return mutable;
|
|
480
|
-
}
|
|
481
|
-
function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
|
|
482
|
-
if (round) {
|
|
483
|
-
value += Math.sign(amount);
|
|
484
|
-
if (value < min) value = max;
|
|
485
|
-
let div = Math.abs(amount);
|
|
486
|
-
if (amount > 0) value = Math.ceil(value / div) * div;
|
|
487
|
-
else value = Math.floor(value / div) * div;
|
|
488
|
-
if (value > max) value = min;
|
|
489
|
-
} else {
|
|
490
|
-
value += amount;
|
|
491
|
-
if (value < min) value = max - (min - value - 1);
|
|
492
|
-
else if (value > max) value = min + (value - max - 1);
|
|
493
|
-
}
|
|
494
|
-
return value;
|
|
495
|
-
}
|
|
496
|
-
function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
|
|
497
|
-
return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`;
|
|
498
|
-
}
|
|
499
|
-
function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
|
|
500
|
-
let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
|
|
501
|
-
let year;
|
|
502
|
-
if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
|
|
503
|
-
else year = String(gregorianDate.year).padStart(4, "0");
|
|
504
|
-
return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
|
|
505
|
-
}
|
|
506
|
-
function $fae977aafc393c5c$export$4223de14708adc63(date) {
|
|
507
|
-
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
|
|
508
|
-
}
|
|
509
|
-
function _check_private_redeclaration(obj, privateCollection) {
|
|
510
|
-
if (privateCollection.has(obj)) {
|
|
511
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function _class_private_field_init(obj, privateMap, value) {
|
|
515
|
-
_check_private_redeclaration(obj, privateMap);
|
|
516
|
-
privateMap.set(obj, value);
|
|
517
|
-
}
|
|
518
|
-
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
|
|
519
|
-
let calendar = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
|
|
520
|
-
let era;
|
|
521
|
-
if (typeof args[0] === "string") era = args.shift();
|
|
522
|
-
else {
|
|
523
|
-
let eras = calendar.getEras();
|
|
524
|
-
era = eras[eras.length - 1];
|
|
525
|
-
}
|
|
526
|
-
let year = args.shift();
|
|
527
|
-
let month = args.shift();
|
|
528
|
-
let day = args.shift();
|
|
529
|
-
return [
|
|
530
|
-
calendar,
|
|
531
|
-
era,
|
|
532
|
-
year,
|
|
533
|
-
month,
|
|
534
|
-
day
|
|
535
|
-
];
|
|
536
|
-
}
|
|
537
|
-
var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
|
|
538
|
-
class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
|
|
539
|
-
/** Returns a copy of this date. */
|
|
540
|
-
copy() {
|
|
541
|
-
if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
|
|
542
|
-
else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
|
|
543
|
-
}
|
|
544
|
-
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
545
|
-
add(duration) {
|
|
546
|
-
return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
|
|
547
|
-
}
|
|
548
|
-
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
549
|
-
subtract(duration) {
|
|
550
|
-
return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
|
|
551
|
-
}
|
|
552
|
-
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
553
|
-
set(fields) {
|
|
554
|
-
return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
558
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
559
|
-
*/
|
|
560
|
-
cycle(field, amount, options) {
|
|
561
|
-
return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
|
|
562
|
-
}
|
|
563
|
-
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
564
|
-
toDate(timeZone) {
|
|
565
|
-
return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
|
|
566
|
-
}
|
|
567
|
-
/** Converts the date to an ISO 8601 formatted string. */
|
|
568
|
-
toString() {
|
|
569
|
-
return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
|
|
570
|
-
}
|
|
571
|
-
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
572
|
-
compare(b) {
|
|
573
|
-
return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
|
|
574
|
-
}
|
|
575
|
-
constructor(...args) {
|
|
576
|
-
_class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
|
|
577
|
-
writable: true,
|
|
578
|
-
value: void 0
|
|
579
|
-
});
|
|
580
|
-
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
581
|
-
this.calendar = calendar;
|
|
582
|
-
this.era = era;
|
|
583
|
-
this.year = year;
|
|
584
|
-
this.month = month;
|
|
585
|
-
this.day = day;
|
|
586
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(this);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
|
|
590
|
-
class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
|
|
591
|
-
/** Returns a copy of this date. */
|
|
592
|
-
copy() {
|
|
593
|
-
if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
594
|
-
else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
595
|
-
}
|
|
596
|
-
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
597
|
-
add(duration) {
|
|
598
|
-
return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
|
|
599
|
-
}
|
|
600
|
-
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
601
|
-
subtract(duration) {
|
|
602
|
-
return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
|
|
603
|
-
}
|
|
604
|
-
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
605
|
-
set(fields) {
|
|
606
|
-
return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
610
|
-
* When the resulting value reaches the limits of the field, it wraps around.
|
|
611
|
-
*/
|
|
612
|
-
cycle(field, amount, options) {
|
|
613
|
-
switch (field) {
|
|
614
|
-
case "era":
|
|
615
|
-
case "year":
|
|
616
|
-
case "month":
|
|
617
|
-
case "day":
|
|
618
|
-
return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
|
|
619
|
-
default:
|
|
620
|
-
return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
624
|
-
toDate(timeZone, disambiguation) {
|
|
625
|
-
return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
|
|
626
|
-
}
|
|
627
|
-
/** Converts the date to an ISO 8601 formatted string. */
|
|
628
|
-
toString() {
|
|
629
|
-
return $fae977aafc393c5c$export$4223de14708adc63(this);
|
|
630
|
-
}
|
|
631
|
-
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
632
|
-
compare(b) {
|
|
633
|
-
let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
|
|
634
|
-
if (res === 0) return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b));
|
|
635
|
-
return res;
|
|
636
|
-
}
|
|
637
|
-
constructor(...args) {
|
|
638
|
-
_class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
|
|
639
|
-
writable: true,
|
|
640
|
-
value: void 0
|
|
641
|
-
});
|
|
642
|
-
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
643
|
-
this.calendar = calendar;
|
|
644
|
-
this.era = era;
|
|
645
|
-
this.year = year;
|
|
646
|
-
this.month = month;
|
|
647
|
-
this.day = day;
|
|
648
|
-
this.hour = args.shift() || 0;
|
|
649
|
-
this.minute = args.shift() || 0;
|
|
650
|
-
this.second = args.shift() || 0;
|
|
651
|
-
this.millisecond = args.shift() || 0;
|
|
652
|
-
$735220c2d4774dd3$export$c4e2ecac49351ef2(this);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
const useDarkMode = () => {
|
|
656
|
-
const [isDark, setIsDark] = React.useState(false);
|
|
657
|
-
React.useEffect(() => {
|
|
658
|
-
const checkDarkMode = () => {
|
|
659
|
-
setIsDark(document.documentElement.classList.contains("dark"));
|
|
660
|
-
};
|
|
661
|
-
checkDarkMode();
|
|
662
|
-
const observer = new MutationObserver(checkDarkMode);
|
|
663
|
-
observer.observe(document.documentElement, {
|
|
664
|
-
attributes: true,
|
|
665
|
-
attributeFilter: ["class"]
|
|
666
|
-
});
|
|
667
|
-
return () => observer.disconnect();
|
|
668
|
-
}, []);
|
|
669
|
-
return isDark;
|
|
670
|
-
};
|
|
671
|
-
const LineChart = ({
|
|
672
|
-
data,
|
|
673
|
-
xAxisDataKey,
|
|
674
|
-
yAxisDataKey,
|
|
675
|
-
lineColor = "#3B82F6",
|
|
676
|
-
yAxisTickFormatter
|
|
677
|
-
}) => {
|
|
678
|
-
const isDark = useDarkMode();
|
|
679
|
-
const isSingleDataPoint = data && data.length === 1;
|
|
680
|
-
if (isSingleDataPoint) {
|
|
681
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { aspect: 16 / 9, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data, margin: { left: 20 }, children: [
|
|
682
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
683
|
-
recharts.CartesianGrid,
|
|
684
|
-
{
|
|
685
|
-
strokeDasharray: "3 3",
|
|
686
|
-
stroke: isDark ? "#374151" : "#E5E7EB"
|
|
687
|
-
}
|
|
688
|
-
),
|
|
689
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
690
|
-
recharts.XAxis,
|
|
691
|
-
{
|
|
692
|
-
dataKey: xAxisDataKey,
|
|
693
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
694
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
695
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
696
|
-
tickMargin: 10
|
|
697
|
-
}
|
|
698
|
-
),
|
|
699
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
700
|
-
recharts.YAxis,
|
|
701
|
-
{
|
|
702
|
-
tickFormatter: yAxisTickFormatter,
|
|
703
|
-
allowDecimals: false,
|
|
704
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
705
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
706
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" }
|
|
707
|
-
}
|
|
708
|
-
),
|
|
709
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
710
|
-
recharts.Tooltip,
|
|
711
|
-
{
|
|
712
|
-
cursor: {
|
|
713
|
-
fill: isDark ? "rgba(55, 65, 81, 0.2)" : "rgba(243, 244, 246, 0.5)"
|
|
714
|
-
},
|
|
715
|
-
formatter: (value) => yAxisTickFormatter ? yAxisTickFormatter(value) : value,
|
|
716
|
-
contentStyle: {
|
|
717
|
-
backgroundColor: isDark ? "#1F2937" : "#FFFFFF",
|
|
718
|
-
border: `1px solid ${isDark ? "#374151" : "#E5E7EB"}`,
|
|
719
|
-
borderRadius: "0.5rem",
|
|
720
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
721
|
-
boxShadow: isDark ? "0 4px 6px -1px rgba(0, 0, 0, 0.3)" : "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
722
|
-
},
|
|
723
|
-
labelStyle: {
|
|
724
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
725
|
-
fontWeight: "500",
|
|
726
|
-
marginBottom: "4px"
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
),
|
|
730
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
731
|
-
recharts.Bar,
|
|
732
|
-
{
|
|
733
|
-
dataKey: yAxisDataKey,
|
|
734
|
-
fill: lineColor,
|
|
735
|
-
radius: [4, 4, 0, 0],
|
|
736
|
-
maxBarSize: 60
|
|
737
|
-
}
|
|
738
|
-
)
|
|
739
|
-
] }) }) });
|
|
740
|
-
}
|
|
741
|
-
return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { aspect: 16 / 9, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data, margin: { left: 20 }, children: [
|
|
742
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
743
|
-
recharts.CartesianGrid,
|
|
744
|
-
{
|
|
745
|
-
strokeDasharray: "3 3",
|
|
746
|
-
stroke: isDark ? "#374151" : "#E5E7EB"
|
|
747
|
-
}
|
|
748
|
-
),
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
750
|
-
recharts.XAxis,
|
|
751
|
-
{
|
|
752
|
-
dataKey: xAxisDataKey,
|
|
753
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
754
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
755
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
756
|
-
tickMargin: 10
|
|
757
|
-
}
|
|
758
|
-
),
|
|
759
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
760
|
-
recharts.YAxis,
|
|
761
|
-
{
|
|
762
|
-
tickFormatter: yAxisTickFormatter,
|
|
763
|
-
allowDecimals: false,
|
|
764
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
765
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
766
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" }
|
|
767
|
-
}
|
|
768
|
-
),
|
|
769
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
770
|
-
recharts.Tooltip,
|
|
771
|
-
{
|
|
772
|
-
cursor: {
|
|
773
|
-
stroke: isDark ? "#4B5563" : "#E5E7EB",
|
|
774
|
-
strokeWidth: 1,
|
|
775
|
-
fill: isDark ? "rgba(55, 65, 81, 0.2)" : "rgba(243, 244, 246, 0.5)"
|
|
776
|
-
},
|
|
777
|
-
formatter: (value) => yAxisTickFormatter ? yAxisTickFormatter(value) : value,
|
|
778
|
-
contentStyle: {
|
|
779
|
-
backgroundColor: isDark ? "#1F2937" : "#FFFFFF",
|
|
780
|
-
border: `1px solid ${isDark ? "#374151" : "#E5E7EB"}`,
|
|
781
|
-
borderRadius: "0.5rem",
|
|
782
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
783
|
-
boxShadow: isDark ? "0 4px 6px -1px rgba(0, 0, 0, 0.3)" : "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
784
|
-
},
|
|
785
|
-
labelStyle: {
|
|
786
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
787
|
-
fontWeight: "500",
|
|
788
|
-
marginBottom: "4px"
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
),
|
|
792
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
793
|
-
recharts.Line,
|
|
794
|
-
{
|
|
795
|
-
type: "monotone",
|
|
796
|
-
dataKey: yAxisDataKey,
|
|
797
|
-
stroke: lineColor,
|
|
798
|
-
activeDot: {
|
|
799
|
-
r: 5,
|
|
800
|
-
fill: lineColor,
|
|
801
|
-
stroke: isDark ? "#1F2937" : "#FFFFFF",
|
|
802
|
-
strokeWidth: 2
|
|
803
|
-
},
|
|
804
|
-
strokeWidth: 2,
|
|
805
|
-
dot: {
|
|
806
|
-
r: 4,
|
|
807
|
-
fill: lineColor,
|
|
808
|
-
stroke: isDark ? "#1F2937" : "#FFFFFF",
|
|
809
|
-
strokeWidth: 1
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
)
|
|
813
|
-
] }) });
|
|
814
|
-
};
|
|
815
|
-
function cn(...inputs) {
|
|
816
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
817
|
-
}
|
|
818
|
-
function generateStableColor(input, saturation = 70, lightness = 50) {
|
|
819
|
-
let hash = 0;
|
|
820
|
-
for (let i = 0; i < input.length; i++) {
|
|
821
|
-
const char = input.charCodeAt(i);
|
|
822
|
-
hash = (hash << 5) - hash + char;
|
|
823
|
-
hash = hash & hash;
|
|
824
|
-
}
|
|
825
|
-
const hue = Math.abs(hash) % 360;
|
|
826
|
-
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
827
|
-
}
|
|
828
|
-
function generateColorsForData(data, keyField, saturation = 70, lightness = 50) {
|
|
829
|
-
return data.map(
|
|
830
|
-
(item) => generateStableColor(String(item[keyField]), saturation, lightness)
|
|
831
|
-
);
|
|
832
|
-
}
|
|
833
|
-
const sdk = new Medusa__default.default({
|
|
834
|
-
baseUrl: __BACKEND_URL__ || "/",
|
|
835
|
-
auth: {
|
|
836
|
-
type: "session"
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
const BarChart = ({
|
|
840
|
-
data,
|
|
841
|
-
xAxisDataKey,
|
|
842
|
-
yAxisDataKey,
|
|
843
|
-
lineColor = "#3B82F6",
|
|
844
|
-
yAxisTickFormatter,
|
|
845
|
-
useStableColors = false,
|
|
846
|
-
colorKeyField
|
|
847
|
-
}) => {
|
|
848
|
-
const isDark = useDarkMode();
|
|
849
|
-
const colors = React__namespace.default.useMemo(() => {
|
|
850
|
-
if (!useStableColors || !data || !colorKeyField) {
|
|
851
|
-
return [];
|
|
852
|
-
}
|
|
853
|
-
return generateColorsForData(data, colorKeyField, 70, isDark ? 60 : 50);
|
|
854
|
-
}, [data, useStableColors, colorKeyField, isDark]);
|
|
855
|
-
return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { aspect: 16 / 9, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data, margin: { left: 20 }, children: [
|
|
856
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
857
|
-
recharts.CartesianGrid,
|
|
858
|
-
{
|
|
859
|
-
strokeDasharray: "3 3",
|
|
860
|
-
stroke: isDark ? "#374151" : "#E5E7EB"
|
|
861
|
-
}
|
|
862
|
-
),
|
|
863
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
864
|
-
recharts.XAxis,
|
|
865
|
-
{
|
|
866
|
-
dataKey: String(xAxisDataKey),
|
|
867
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
868
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
869
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
870
|
-
tickMargin: 10
|
|
871
|
-
}
|
|
872
|
-
),
|
|
873
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
874
|
-
recharts.YAxis,
|
|
875
|
-
{
|
|
876
|
-
tickFormatter: yAxisTickFormatter,
|
|
877
|
-
allowDecimals: false,
|
|
878
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
879
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
880
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" }
|
|
881
|
-
}
|
|
882
|
-
),
|
|
883
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
-
recharts.Tooltip,
|
|
885
|
-
{
|
|
886
|
-
cursor: {
|
|
887
|
-
fill: isDark ? "rgba(55, 65, 81, 0.2)" : "rgba(243, 244, 246, 0.5)"
|
|
888
|
-
},
|
|
889
|
-
formatter: (value) => yAxisTickFormatter ? yAxisTickFormatter(value) : value,
|
|
890
|
-
contentStyle: {
|
|
891
|
-
backgroundColor: isDark ? "#1F2937" : "#FFFFFF",
|
|
892
|
-
border: `1px solid ${isDark ? "#374151" : "#E5E7EB"}`,
|
|
893
|
-
borderRadius: "0.5rem",
|
|
894
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
895
|
-
boxShadow: isDark ? "0 4px 6px -1px rgba(0, 0, 0, 0.3)" : "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
896
|
-
},
|
|
897
|
-
labelStyle: {
|
|
898
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
899
|
-
fontWeight: "500",
|
|
900
|
-
marginBottom: "4px"
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
),
|
|
904
|
-
/* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { dataKey: String(yAxisDataKey), fill: lineColor, children: useStableColors && colors.length > 0 ? data == null ? void 0 : data.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(recharts.Cell, { fill: colors[index] }, `cell-${index}`)) : null })
|
|
905
|
-
] }) });
|
|
906
|
-
};
|
|
907
|
-
const COLORS = [
|
|
908
|
-
"#3B82F6",
|
|
909
|
-
// blue-500
|
|
910
|
-
"#10B981",
|
|
911
|
-
// emerald-500
|
|
912
|
-
"#F59E0B",
|
|
913
|
-
// amber-500
|
|
914
|
-
"#EF4444",
|
|
915
|
-
// red-500
|
|
916
|
-
"#8B5CF6",
|
|
917
|
-
// violet-500
|
|
918
|
-
"#06B6D4",
|
|
919
|
-
// cyan-500
|
|
920
|
-
"#84CC16",
|
|
921
|
-
// lime-500
|
|
922
|
-
"#F97316"
|
|
923
|
-
// orange-500
|
|
924
|
-
];
|
|
925
|
-
const DARK_COLORS = [
|
|
926
|
-
"#60A5FA",
|
|
927
|
-
// blue-400
|
|
928
|
-
"#34D399",
|
|
929
|
-
// emerald-400
|
|
930
|
-
"#FBBF24",
|
|
931
|
-
// amber-400
|
|
932
|
-
"#F87171",
|
|
933
|
-
// red-400
|
|
934
|
-
"#A78BFA",
|
|
935
|
-
// violet-400
|
|
936
|
-
"#22D3EE",
|
|
937
|
-
// cyan-400
|
|
938
|
-
"#A3E635",
|
|
939
|
-
// lime-400
|
|
940
|
-
"#FB923C"
|
|
941
|
-
// orange-400
|
|
942
|
-
];
|
|
943
|
-
const PieChart = ({ data, dataKey }) => {
|
|
944
|
-
const isDark = useDarkMode();
|
|
945
|
-
const colors = isDark ? DARK_COLORS : COLORS;
|
|
946
|
-
return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { aspect: 16 / 9, maxHeight: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.PieChart, { children: [
|
|
947
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
948
|
-
recharts.Pie,
|
|
949
|
-
{
|
|
950
|
-
data,
|
|
951
|
-
label: ({ percent }) => `${((percent || 0) * 100).toFixed(0)}%`,
|
|
952
|
-
dataKey,
|
|
953
|
-
children: data && data.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
954
|
-
recharts.Cell,
|
|
955
|
-
{
|
|
956
|
-
fill: colors[index % colors.length]
|
|
957
|
-
},
|
|
958
|
-
`cell-${index}`
|
|
959
|
-
))
|
|
960
|
-
}
|
|
961
|
-
),
|
|
962
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
963
|
-
recharts.Tooltip,
|
|
964
|
-
{
|
|
965
|
-
contentStyle: {
|
|
966
|
-
backgroundColor: isDark ? "#1F2937" : "#FFFFFF",
|
|
967
|
-
border: `1px solid ${isDark ? "#374151" : "#E5E7EB"}`,
|
|
968
|
-
borderRadius: "0.5rem",
|
|
969
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
970
|
-
boxShadow: isDark ? "0 4px 6px -1px rgba(0, 0, 0, 0.3)" : "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
971
|
-
},
|
|
972
|
-
labelStyle: {
|
|
973
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
974
|
-
fontWeight: "500",
|
|
975
|
-
marginBottom: "4px"
|
|
976
|
-
},
|
|
977
|
-
itemStyle: {
|
|
978
|
-
color: isDark ? "#F9FAFB" : "#111827"
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
)
|
|
982
|
-
] }) });
|
|
983
|
-
};
|
|
984
|
-
const columnHelper$3 = ui.createDataTableColumnHelper();
|
|
985
|
-
const columns$2 = [
|
|
986
|
-
columnHelper$3.accessor("sku", {
|
|
987
|
-
header: "SKU",
|
|
988
|
-
enableSorting: true,
|
|
989
|
-
sortLabel: "SKU",
|
|
990
|
-
sortAscLabel: "A-Z",
|
|
991
|
-
sortDescLabel: "Z-A"
|
|
992
|
-
}),
|
|
993
|
-
columnHelper$3.accessor("variantName", {
|
|
994
|
-
header: "Variant Name",
|
|
995
|
-
enableSorting: true,
|
|
996
|
-
sortLabel: "Variant Name",
|
|
997
|
-
sortAscLabel: "A-Z",
|
|
998
|
-
sortDescLabel: "Z-A"
|
|
999
|
-
}),
|
|
1000
|
-
columnHelper$3.accessor("inventoryQuantity", {
|
|
1001
|
-
header: "Inventory",
|
|
1002
|
-
enableSorting: true,
|
|
1003
|
-
sortLabel: "Inventory",
|
|
1004
|
-
sortAscLabel: "Low to High",
|
|
1005
|
-
sortDescLabel: "High to Low",
|
|
1006
|
-
cell: ({ getValue }) => {
|
|
1007
|
-
const value = getValue();
|
|
1008
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(value === 0 && "text-ui-fg-error"), children: value === 0 ? "Out of Stock" : value });
|
|
1009
|
-
}
|
|
1010
|
-
})
|
|
1011
|
-
];
|
|
1012
|
-
const PAGE_SIZE$1 = 10;
|
|
1013
|
-
const ProductsTable = ({ products }) => {
|
|
1014
|
-
const [pagination, setPagination] = React__namespace.useState({
|
|
1015
|
-
pageSize: PAGE_SIZE$1,
|
|
1016
|
-
pageIndex: 0
|
|
1017
|
-
});
|
|
1018
|
-
const [search, setSearch] = React__namespace.useState("");
|
|
1019
|
-
const [sorting, setSorting] = React__namespace.useState(
|
|
1020
|
-
null
|
|
1021
|
-
);
|
|
1022
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1023
|
-
const shownProducts = React__namespace.useMemo(() => {
|
|
1024
|
-
let filtered = products.filter(
|
|
1025
|
-
(product) => product.variantName.toLowerCase().includes(search.toLowerCase()) || product.sku.toLowerCase().includes(search.toLowerCase())
|
|
1026
|
-
);
|
|
1027
|
-
if (sorting && sorting.id) {
|
|
1028
|
-
filtered = filtered.slice().sort((a, b) => {
|
|
1029
|
-
const aVal = a[sorting.id];
|
|
1030
|
-
const bVal = b[sorting.id];
|
|
1031
|
-
if (aVal < bVal) {
|
|
1032
|
-
return sorting.desc ? 1 : -1;
|
|
1033
|
-
}
|
|
1034
|
-
if (aVal > bVal) {
|
|
1035
|
-
return sorting.desc ? -1 : 1;
|
|
1036
|
-
}
|
|
1037
|
-
return 0;
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
return filtered.slice(
|
|
1041
|
-
pagination.pageIndex * pagination.pageSize,
|
|
1042
|
-
(pagination.pageIndex + 1) * pagination.pageSize
|
|
1043
|
-
);
|
|
1044
|
-
}, [products, search, sorting, pagination]);
|
|
1045
|
-
const table = ui.useDataTable({
|
|
1046
|
-
columns: columns$2,
|
|
1047
|
-
data: shownProducts,
|
|
1048
|
-
getRowId: (product) => product.sku,
|
|
1049
|
-
rowCount: products.length,
|
|
1050
|
-
search: {
|
|
1051
|
-
state: search,
|
|
1052
|
-
onSearchChange: setSearch
|
|
1053
|
-
},
|
|
1054
|
-
pagination: {
|
|
1055
|
-
state: pagination,
|
|
1056
|
-
onPaginationChange: setPagination
|
|
1057
|
-
},
|
|
1058
|
-
sorting: {
|
|
1059
|
-
state: sorting,
|
|
1060
|
-
onSortingChange: setSorting
|
|
1061
|
-
},
|
|
1062
|
-
onRowClick: (_, row) => {
|
|
1063
|
-
navigate(`/products/${row.original.productId}/variants/${row.original.variantId}`);
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DataTable, { instance: table, children: [
|
|
1067
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Toolbar, { className: "px-0 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Search, { placeholder: "Search..." }) }),
|
|
1068
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
-
ui.DataTable.Table,
|
|
1070
|
-
{
|
|
1071
|
-
emptyState: {
|
|
1072
|
-
filtered: {
|
|
1073
|
-
heading: "No products found"
|
|
1074
|
-
},
|
|
1075
|
-
empty: {
|
|
1076
|
-
heading: "No products available"
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
),
|
|
1081
|
-
products.length > PAGE_SIZE$1 && /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Pagination, {})
|
|
1082
|
-
] });
|
|
1083
|
-
};
|
|
1084
|
-
async function retrieveProductAnalytics(date) {
|
|
1085
|
-
if (!date || !date.from || !(date == null ? void 0 : date.to)) {
|
|
1086
|
-
return void 0;
|
|
1087
|
-
}
|
|
1088
|
-
const dateFrom = dateFns.format(date.from, "yyyy-MM-dd");
|
|
1089
|
-
const dateTo = dateFns.format(date.to, "yyyy-MM-dd");
|
|
1090
|
-
const productAnalytics = await sdk.client.fetch(
|
|
1091
|
-
`/admin/agilo-analytics/products?date_from=${dateFrom}&date_to=${dateTo}`
|
|
1092
|
-
);
|
|
1093
|
-
return productAnalytics;
|
|
1094
|
-
}
|
|
1095
|
-
const useProductAnalytics = (query, options) => {
|
|
1096
|
-
return reactQuery.useQuery({
|
|
1097
|
-
queryKey: ["product-analytics", query == null ? void 0 : query.from, query == null ? void 0 : query.to],
|
|
1098
|
-
queryFn: async () => {
|
|
1099
|
-
const data = await retrieveProductAnalytics(query);
|
|
1100
|
-
return data;
|
|
1101
|
-
},
|
|
1102
|
-
...options
|
|
1103
|
-
});
|
|
1104
|
-
};
|
|
1105
|
-
async function retrieveOrderAnalytics(preset, date) {
|
|
1106
|
-
let url = `/admin/agilo-analytics/orders?preset=${preset}`;
|
|
1107
|
-
if (date && date.from && date.to) {
|
|
1108
|
-
const dateFrom = dateFns.format(date.from, "yyyy-MM-dd");
|
|
1109
|
-
const dateTo = dateFns.format(date.to, "yyyy-MM-dd");
|
|
1110
|
-
url = `/admin/agilo-analytics/orders?preset=custom&date_from=${dateFrom}&date_to=${dateTo}`;
|
|
1111
|
-
}
|
|
1112
|
-
const orderAnalytics = await sdk.client.fetch(url);
|
|
1113
|
-
return orderAnalytics;
|
|
1114
|
-
}
|
|
1115
|
-
const useOrderAnalytics = (preset, query, options) => {
|
|
1116
|
-
return reactQuery.useQuery({
|
|
1117
|
-
queryKey: ["order-analytics", query == null ? void 0 : query.from, query == null ? void 0 : query.to],
|
|
1118
|
-
queryFn: async () => {
|
|
1119
|
-
const data = await retrieveOrderAnalytics(preset, query);
|
|
1120
|
-
return data;
|
|
1121
|
-
},
|
|
1122
|
-
...options
|
|
1123
|
-
});
|
|
1124
|
-
};
|
|
1125
|
-
const Skeleton = ({
|
|
1126
|
-
className,
|
|
1127
|
-
...props
|
|
1128
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
|
-
"div",
|
|
1130
|
-
{
|
|
1131
|
-
...props,
|
|
1132
|
-
className: tailwindMerge.twMerge(
|
|
1133
|
-
"animate-pulse rounded-md bg-[#F4F4F4] dark:bg-[#3F3F46]",
|
|
1134
|
-
className
|
|
1135
|
-
)
|
|
1136
|
-
}
|
|
1137
|
-
);
|
|
1138
|
-
const SmallCardSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1139
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-20 h-[1.4375rem] my-1" }),
|
|
1140
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-40 h-3.5" })
|
|
1141
|
-
] });
|
|
1142
|
-
const LineChartSkeleton = () => {
|
|
1143
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-full" }) });
|
|
1144
|
-
};
|
|
1145
|
-
const BarChartSkeleton = () => {
|
|
1146
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-full" }) });
|
|
1147
|
-
};
|
|
1148
|
-
const PieChartSkeleton = () => {
|
|
1149
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full aspect-square max-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-full" }) });
|
|
1150
|
-
};
|
|
1151
|
-
const dummyData$1 = [
|
|
1152
|
-
{
|
|
1153
|
-
a: "a",
|
|
1154
|
-
b: "b",
|
|
1155
|
-
c: 0
|
|
1156
|
-
},
|
|
1157
|
-
{
|
|
1158
|
-
a: "a",
|
|
1159
|
-
b: "b",
|
|
1160
|
-
c: 0
|
|
1161
|
-
},
|
|
1162
|
-
{
|
|
1163
|
-
a: "a",
|
|
1164
|
-
b: "b",
|
|
1165
|
-
c: 0
|
|
1166
|
-
},
|
|
1167
|
-
{
|
|
1168
|
-
a: "a",
|
|
1169
|
-
b: "b",
|
|
1170
|
-
c: 0
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
a: "a",
|
|
1174
|
-
b: "b",
|
|
1175
|
-
c: 0
|
|
1176
|
-
},
|
|
1177
|
-
{
|
|
1178
|
-
a: "a",
|
|
1179
|
-
b: "b",
|
|
1180
|
-
c: 0
|
|
1181
|
-
}
|
|
1182
|
-
];
|
|
1183
|
-
const columnHelper$2 = ui.createDataTableColumnHelper();
|
|
1184
|
-
const columns$1 = [
|
|
1185
|
-
columnHelper$2.accessor("a", {
|
|
1186
|
-
header: () => null,
|
|
1187
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1188
|
-
}),
|
|
1189
|
-
columnHelper$2.accessor("b", {
|
|
1190
|
-
header: () => null,
|
|
1191
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1192
|
-
}),
|
|
1193
|
-
columnHelper$2.accessor("c", {
|
|
1194
|
-
header: () => null,
|
|
1195
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1196
|
-
})
|
|
1197
|
-
];
|
|
1198
|
-
const ProductsTableSkeleton = () => {
|
|
1199
|
-
const [search, setSearch] = React__namespace.useState("");
|
|
1200
|
-
const table = ui.useDataTable({
|
|
1201
|
-
columns: columns$1,
|
|
1202
|
-
data: dummyData$1,
|
|
1203
|
-
getRowId: (product) => product.a,
|
|
1204
|
-
rowCount: dummyData$1.length,
|
|
1205
|
-
search: {
|
|
1206
|
-
state: search,
|
|
1207
|
-
onSearchChange: setSearch
|
|
1208
|
-
}
|
|
1209
|
-
});
|
|
1210
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DataTable, { instance: table, children: [
|
|
1211
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Toolbar, { className: "px-0 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Search, { placeholder: "Search..." }) }),
|
|
1212
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Table, {})
|
|
1213
|
-
] });
|
|
1214
|
-
};
|
|
1215
|
-
async function retrieveCustomersAnalytics(date) {
|
|
1216
|
-
if (!date || !date.from || !(date == null ? void 0 : date.to)) {
|
|
1217
|
-
return void 0;
|
|
1218
|
-
}
|
|
1219
|
-
const dateFrom = dateFns.format(date.from, "yyyy-MM-dd");
|
|
1220
|
-
const dateTo = dateFns.format(date.to, "yyyy-MM-dd");
|
|
1221
|
-
const customersAnalytics = await sdk.client.fetch(
|
|
1222
|
-
`/admin/agilo-analytics/customers?date_from=${dateFrom}&date_to=${dateTo}`
|
|
1223
|
-
);
|
|
1224
|
-
return customersAnalytics;
|
|
1225
|
-
}
|
|
1226
|
-
const useCustomerAnalytics = (query, options) => {
|
|
1227
|
-
return reactQuery.useQuery({
|
|
1228
|
-
queryKey: ["customer-analytics", query == null ? void 0 : query.from, query == null ? void 0 : query.to],
|
|
1229
|
-
queryFn: async () => {
|
|
1230
|
-
const data = await retrieveCustomersAnalytics(query);
|
|
1231
|
-
return data;
|
|
1232
|
-
},
|
|
1233
|
-
...options
|
|
1234
|
-
});
|
|
1235
|
-
};
|
|
1236
|
-
const StackedBarChart = ({
|
|
1237
|
-
data,
|
|
1238
|
-
xAxisDataKey,
|
|
1239
|
-
yAxisTickFormatter,
|
|
1240
|
-
useStableColors = false,
|
|
1241
|
-
colorKeyField,
|
|
1242
|
-
dataKeys
|
|
1243
|
-
}) => {
|
|
1244
|
-
const isDark = useDarkMode();
|
|
1245
|
-
const colors = React__namespace.default.useMemo(() => {
|
|
1246
|
-
if (!useStableColors || !data || !colorKeyField) {
|
|
1247
|
-
return [];
|
|
1248
|
-
}
|
|
1249
|
-
return generateColorsForData(data, colorKeyField, 70, isDark ? 60 : 50);
|
|
1250
|
-
}, [data, useStableColors, colorKeyField, isDark]);
|
|
1251
|
-
return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { aspect: 16 / 9, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data, margin: { left: 20 }, children: [
|
|
1252
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
|
-
recharts.CartesianGrid,
|
|
1254
|
-
{
|
|
1255
|
-
strokeDasharray: "3 3",
|
|
1256
|
-
stroke: isDark ? "#374151" : "#E5E7EB"
|
|
1257
|
-
}
|
|
1258
|
-
),
|
|
1259
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1260
|
-
recharts.XAxis,
|
|
1261
|
-
{
|
|
1262
|
-
dataKey: String(xAxisDataKey),
|
|
1263
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
1264
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
1265
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
1266
|
-
tickMargin: 10
|
|
1267
|
-
}
|
|
1268
|
-
),
|
|
1269
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
-
recharts.YAxis,
|
|
1271
|
-
{
|
|
1272
|
-
tickFormatter: yAxisTickFormatter,
|
|
1273
|
-
allowDecimals: false,
|
|
1274
|
-
tick: { fill: isDark ? "#D1D5DB" : "#6B7280" },
|
|
1275
|
-
axisLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" },
|
|
1276
|
-
tickLine: { stroke: isDark ? "#4B5563" : "#D1D5DB" }
|
|
1277
|
-
}
|
|
1278
|
-
),
|
|
1279
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1280
|
-
recharts.Tooltip,
|
|
1281
|
-
{
|
|
1282
|
-
cursor: {
|
|
1283
|
-
fill: isDark ? "rgba(55, 65, 81, 0.2)" : "rgba(243, 244, 246, 0.5)"
|
|
1284
|
-
},
|
|
1285
|
-
formatter: (value) => yAxisTickFormatter ? yAxisTickFormatter(value) : value,
|
|
1286
|
-
contentStyle: {
|
|
1287
|
-
backgroundColor: isDark ? "#1F2937" : "#FFFFFF",
|
|
1288
|
-
border: `1px solid ${isDark ? "#374151" : "#E5E7EB"}`,
|
|
1289
|
-
borderRadius: "0.5rem",
|
|
1290
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
1291
|
-
boxShadow: isDark ? "0 4px 6px -1px rgba(0, 0, 0, 0.3)" : "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
1292
|
-
},
|
|
1293
|
-
labelStyle: {
|
|
1294
|
-
color: isDark ? "#F9FAFB" : "#111827",
|
|
1295
|
-
fontWeight: "500",
|
|
1296
|
-
marginBottom: "4px"
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
),
|
|
1300
|
-
dataKeys == null ? void 0 : dataKeys.map((key, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1301
|
-
recharts.Bar,
|
|
1302
|
-
{
|
|
1303
|
-
dataKey: String(key),
|
|
1304
|
-
stackId: "a",
|
|
1305
|
-
fill: useStableColors && colors.length > 0 ? colors[index] : "#3B82F6"
|
|
1306
|
-
},
|
|
1307
|
-
String(key)
|
|
1308
|
-
))
|
|
1309
|
-
] }) });
|
|
1310
|
-
};
|
|
1311
|
-
const dummyData = [
|
|
1312
|
-
{
|
|
1313
|
-
a: "a1",
|
|
1314
|
-
b: "b",
|
|
1315
|
-
c: 0,
|
|
1316
|
-
d: 0,
|
|
1317
|
-
e: /* @__PURE__ */ new Date()
|
|
1318
|
-
},
|
|
1319
|
-
{
|
|
1320
|
-
a: "a2",
|
|
1321
|
-
b: "b",
|
|
1322
|
-
c: 0,
|
|
1323
|
-
d: 0,
|
|
1324
|
-
e: /* @__PURE__ */ new Date()
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
a: "a3",
|
|
1328
|
-
b: "b",
|
|
1329
|
-
c: 0,
|
|
1330
|
-
d: 0,
|
|
1331
|
-
e: /* @__PURE__ */ new Date()
|
|
1332
|
-
},
|
|
1333
|
-
{
|
|
1334
|
-
a: "a4",
|
|
1335
|
-
b: "b",
|
|
1336
|
-
c: 0,
|
|
1337
|
-
d: 0,
|
|
1338
|
-
e: /* @__PURE__ */ new Date()
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
a: "a5",
|
|
1342
|
-
b: "b",
|
|
1343
|
-
c: 0,
|
|
1344
|
-
d: 0,
|
|
1345
|
-
e: /* @__PURE__ */ new Date()
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
a: "a6",
|
|
1349
|
-
b: "b",
|
|
1350
|
-
c: 0,
|
|
1351
|
-
d: 0,
|
|
1352
|
-
e: /* @__PURE__ */ new Date()
|
|
1353
|
-
}
|
|
1354
|
-
];
|
|
1355
|
-
const columnHelper$1 = ui.createDataTableColumnHelper();
|
|
1356
|
-
const columns = [
|
|
1357
|
-
columnHelper$1.accessor("a", {
|
|
1358
|
-
header: () => null,
|
|
1359
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1360
|
-
}),
|
|
1361
|
-
columnHelper$1.accessor("b", {
|
|
1362
|
-
header: () => null,
|
|
1363
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1364
|
-
}),
|
|
1365
|
-
columnHelper$1.accessor("c", {
|
|
1366
|
-
header: () => null,
|
|
1367
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1368
|
-
}),
|
|
1369
|
-
columnHelper$1.accessor("d", {
|
|
1370
|
-
header: () => null,
|
|
1371
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1372
|
-
}),
|
|
1373
|
-
columnHelper$1.accessor("e", {
|
|
1374
|
-
header: () => null,
|
|
1375
|
-
cell: () => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "w-full h-5" })
|
|
1376
|
-
})
|
|
1377
|
-
];
|
|
1378
|
-
const CustomersTableSkeleton = () => {
|
|
1379
|
-
const [search, setSearch] = React__namespace.useState("");
|
|
1380
|
-
const table = ui.useDataTable({
|
|
1381
|
-
columns,
|
|
1382
|
-
data: dummyData,
|
|
1383
|
-
getRowId: (customer) => customer.a,
|
|
1384
|
-
rowCount: dummyData.length,
|
|
1385
|
-
search: {
|
|
1386
|
-
state: search,
|
|
1387
|
-
onSearchChange: setSearch
|
|
1388
|
-
}
|
|
1389
|
-
});
|
|
1390
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DataTable, { instance: table, children: [
|
|
1391
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Toolbar, { className: "px-0 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Search, { placeholder: "Search..." }) }),
|
|
1392
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Table, {})
|
|
1393
|
-
] });
|
|
1394
|
-
};
|
|
1395
|
-
const columnHelper = ui.createDataTableColumnHelper();
|
|
1396
|
-
const PAGE_SIZE = 10;
|
|
1397
|
-
const CustomersTable = ({
|
|
1398
|
-
customers,
|
|
1399
|
-
currencyCode
|
|
1400
|
-
}) => {
|
|
1401
|
-
const [pagination, setPagination] = React__namespace.useState({
|
|
1402
|
-
pageSize: PAGE_SIZE,
|
|
1403
|
-
pageIndex: 0
|
|
1404
|
-
});
|
|
1405
|
-
const [search, setSearch] = React__namespace.useState("");
|
|
1406
|
-
const [sorting, setSorting] = React__namespace.useState(
|
|
1407
|
-
null
|
|
1408
|
-
);
|
|
1409
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1410
|
-
const shownCustomers = React__namespace.useMemo(() => {
|
|
1411
|
-
let filtered = customers.filter(
|
|
1412
|
-
(customer) => customer.name.toLowerCase().includes(search.toLowerCase()) || customer.email.toLowerCase().includes(search.toLowerCase())
|
|
1413
|
-
);
|
|
1414
|
-
if (sorting && sorting.id) {
|
|
1415
|
-
filtered = filtered.slice().sort((a, b) => {
|
|
1416
|
-
const aVal = a[sorting.id];
|
|
1417
|
-
const bVal = b[sorting.id];
|
|
1418
|
-
if (!aVal && !bVal) return 0;
|
|
1419
|
-
if (!aVal) return sorting.desc ? 1 : -1;
|
|
1420
|
-
if (!bVal) return sorting.desc ? -1 : 1;
|
|
1421
|
-
if (aVal < bVal) return sorting.desc ? 1 : -1;
|
|
1422
|
-
if (aVal > bVal) return sorting.desc ? -1 : 1;
|
|
1423
|
-
return 0;
|
|
1424
|
-
});
|
|
1425
|
-
}
|
|
1426
|
-
return filtered.slice(
|
|
1427
|
-
pagination.pageIndex * pagination.pageSize,
|
|
1428
|
-
(pagination.pageIndex + 1) * pagination.pageSize
|
|
1429
|
-
);
|
|
1430
|
-
}, [customers, search, sorting, pagination]);
|
|
1431
|
-
const columns2 = React__namespace.useMemo(
|
|
1432
|
-
() => [
|
|
1433
|
-
columnHelper.accessor("name", {
|
|
1434
|
-
header: "Name",
|
|
1435
|
-
enableSorting: true,
|
|
1436
|
-
sortLabel: "Name",
|
|
1437
|
-
sortAscLabel: "A-Z",
|
|
1438
|
-
sortDescLabel: "Z-A"
|
|
1439
|
-
}),
|
|
1440
|
-
columnHelper.accessor("email", {
|
|
1441
|
-
header: "Email",
|
|
1442
|
-
enableSorting: true,
|
|
1443
|
-
sortLabel: "Email",
|
|
1444
|
-
sortAscLabel: "A-Z",
|
|
1445
|
-
sortDescLabel: "Z-A"
|
|
1446
|
-
}),
|
|
1447
|
-
columnHelper.accessor("order_count", {
|
|
1448
|
-
header: "Order Count",
|
|
1449
|
-
enableSorting: true,
|
|
1450
|
-
sortLabel: "Order Count",
|
|
1451
|
-
sortAscLabel: "Low to High",
|
|
1452
|
-
sortDescLabel: "High to Low"
|
|
1453
|
-
}),
|
|
1454
|
-
columnHelper.accessor("sales", {
|
|
1455
|
-
header: "Total Sales",
|
|
1456
|
-
enableSorting: true,
|
|
1457
|
-
sortLabel: "Total Sales",
|
|
1458
|
-
sortAscLabel: "Low to High",
|
|
1459
|
-
sortDescLabel: "High to Low",
|
|
1460
|
-
cell: ({ getValue }) => {
|
|
1461
|
-
const sales = getValue();
|
|
1462
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", { children: new Intl.NumberFormat("en-US", {
|
|
1463
|
-
style: "currency",
|
|
1464
|
-
currency: currencyCode || "EUR"
|
|
1465
|
-
}).format(sales || 0) });
|
|
1466
|
-
}
|
|
1467
|
-
}),
|
|
1468
|
-
columnHelper.accessor("groups", {
|
|
1469
|
-
header: "Groups",
|
|
1470
|
-
cell: ({ getValue }) => {
|
|
1471
|
-
const groups = getValue();
|
|
1472
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", { children: groups.length ? groups.join(", ") : "No Group" });
|
|
1473
|
-
}
|
|
1474
|
-
}),
|
|
1475
|
-
columnHelper.accessor("last_order", {
|
|
1476
|
-
header: "Last Order",
|
|
1477
|
-
enableSorting: true,
|
|
1478
|
-
sortLabel: "Last Order",
|
|
1479
|
-
sortAscLabel: "Oldest to Newest",
|
|
1480
|
-
sortDescLabel: "Newest to Oldest",
|
|
1481
|
-
cell: ({ getValue }) => {
|
|
1482
|
-
const date = getValue();
|
|
1483
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", { children: date ? dateFns.format(new Date(date), "MMM dd, yyyy") : "No orders yet" });
|
|
1484
|
-
}
|
|
1485
|
-
})
|
|
1486
|
-
],
|
|
1487
|
-
[currencyCode]
|
|
1488
|
-
);
|
|
1489
|
-
const table = ui.useDataTable({
|
|
1490
|
-
columns: columns2,
|
|
1491
|
-
data: shownCustomers,
|
|
1492
|
-
getRowId: (customer) => customer.customer_id,
|
|
1493
|
-
rowCount: customers.length,
|
|
1494
|
-
search: {
|
|
1495
|
-
state: search,
|
|
1496
|
-
onSearchChange: setSearch
|
|
1497
|
-
},
|
|
1498
|
-
pagination: {
|
|
1499
|
-
state: pagination,
|
|
1500
|
-
onPaginationChange: setPagination
|
|
1501
|
-
},
|
|
1502
|
-
sorting: {
|
|
1503
|
-
state: sorting,
|
|
1504
|
-
onSortingChange: setSorting
|
|
1505
|
-
},
|
|
1506
|
-
onRowClick: (_, row) => {
|
|
1507
|
-
navigate(`/customers/${row.original.customer_id}`);
|
|
1508
|
-
}
|
|
1509
|
-
});
|
|
1510
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DataTable, { instance: table, children: [
|
|
1511
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Toolbar, { className: "px-0 pt-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Search, { placeholder: "Search..." }) }),
|
|
1512
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1513
|
-
ui.DataTable.Table,
|
|
1514
|
-
{
|
|
1515
|
-
emptyState: {
|
|
1516
|
-
filtered: {
|
|
1517
|
-
heading: "No customers found"
|
|
1518
|
-
},
|
|
1519
|
-
empty: {
|
|
1520
|
-
heading: "No customers available"
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
),
|
|
1525
|
-
customers.length > PAGE_SIZE && /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable.Pagination, {})
|
|
1526
|
-
] });
|
|
1527
|
-
};
|
|
1528
|
-
function dateToCalendarDate(date) {
|
|
1529
|
-
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(
|
|
1530
|
-
date.getFullYear(),
|
|
1531
|
-
date.getMonth() + 1,
|
|
1532
|
-
date.getDate()
|
|
1533
|
-
);
|
|
1534
|
-
}
|
|
1535
|
-
function calendarDateToDate(calendarDate) {
|
|
1536
|
-
const year = "year" in calendarDate ? calendarDate.year : (/* @__PURE__ */ new Date()).getFullYear();
|
|
1537
|
-
const month = "month" in calendarDate ? calendarDate.month : (/* @__PURE__ */ new Date()).getMonth() + 1;
|
|
1538
|
-
const day = "day" in calendarDate ? calendarDate.day : (/* @__PURE__ */ new Date()).getDate();
|
|
1539
|
-
return new Date(year, month - 1, day);
|
|
1540
|
-
}
|
|
1541
|
-
function dateRangeToRangeValue(dateRange) {
|
|
1542
|
-
if (!(dateRange == null ? void 0 : dateRange.from)) return null;
|
|
1543
|
-
return {
|
|
1544
|
-
start: dateToCalendarDate(dateRange.from),
|
|
1545
|
-
end: dateRange.to ? dateToCalendarDate(dateRange.to) : dateToCalendarDate(dateRange.from)
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
function rangeValueToDateRange(rangeValue) {
|
|
1549
|
-
if (!rangeValue) return void 0;
|
|
1550
|
-
return {
|
|
1551
|
-
from: calendarDateToDate(rangeValue.start),
|
|
1552
|
-
to: rangeValue.end ? calendarDateToDate(rangeValue.end) : void 0
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
function presetToDateRange(preset) {
|
|
1556
|
-
const today = /* @__PURE__ */ new Date();
|
|
1557
|
-
if (preset === "this-month") return { from: dateFns.startOfMonth(today), to: today };
|
|
1558
|
-
if (preset === "last-month")
|
|
1559
|
-
return {
|
|
1560
|
-
from: dateFns.startOfMonth(dateFns.subMonths(today, 1)),
|
|
1561
|
-
to: dateFns.endOfMonth(dateFns.subMonths(today, 1))
|
|
1562
|
-
};
|
|
1563
|
-
return {
|
|
1564
|
-
from: dateFns.startOfMonth(dateFns.subMonths(today, 3)),
|
|
1565
|
-
to: dateFns.endOfMonth(dateFns.subMonths(today, 1))
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
const DATE_RANGE_REGEX = /^(\d{4}-\d{2}-\d{2})-(\d{4}-\d{2}-\d{2})$/;
|
|
1569
|
-
const AnalyticsPage = () => {
|
|
1570
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1571
|
-
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
1572
|
-
const rangeParam = searchParams.get("range") || "this-month";
|
|
1573
|
-
const date = React__namespace.useMemo(() => {
|
|
1574
|
-
if (rangeParam === "this-month" || rangeParam === "last-month" || rangeParam === "last-3-months") {
|
|
1575
|
-
return presetToDateRange(rangeParam);
|
|
1576
|
-
}
|
|
1577
|
-
const dates = rangeParam.match(DATE_RANGE_REGEX);
|
|
1578
|
-
if (dates) {
|
|
1579
|
-
const from = dateFns.parse(dates[1], "yyyy-MM-dd", /* @__PURE__ */ new Date());
|
|
1580
|
-
const to = dateFns.parse(dates[2], "yyyy-MM-dd", /* @__PURE__ */ new Date());
|
|
1581
|
-
return { from, to };
|
|
1582
|
-
}
|
|
1583
|
-
return void 0;
|
|
1584
|
-
}, [rangeParam]);
|
|
1585
|
-
const { data: products, isLoading: isLoadingProducts } = useProductAnalytics(date);
|
|
1586
|
-
const { data: customers, isLoading: isLoadingCustomers } = useCustomerAnalytics(date);
|
|
1587
|
-
const { data: orders, isLoading: isLoadingOrders } = useOrderAnalytics(
|
|
1588
|
-
["this-month", "last-month", "last-3-months"].includes(rangeParam) ? rangeParam : "custom",
|
|
1589
|
-
date
|
|
1590
|
-
);
|
|
1591
|
-
const someOrderCountsGreaterThanZero = (_a = orders == null ? void 0 : orders.order_count) == null ? void 0 : _a.some(
|
|
1592
|
-
(item) => item.count > 0
|
|
1593
|
-
);
|
|
1594
|
-
const someOrderSalesGreaterThanZero = (_b = orders == null ? void 0 : orders.order_sales) == null ? void 0 : _b.some(
|
|
1595
|
-
(item) => item.sales > 0
|
|
1596
|
-
);
|
|
1597
|
-
const someTopSellingProductsGreaterThanZero = (_c = products == null ? void 0 : products.variantQuantitySold) == null ? void 0 : _c.some((item) => item.quantity > 0);
|
|
1598
|
-
const someCustomerCountsGreaterThanZero = (_d = customers == null ? void 0 : customers.customer_count) == null ? void 0 : _d.some(
|
|
1599
|
-
(item) => (item.new_customers || 0) > 0 || (item.returning_customers || 0) > 0
|
|
1600
|
-
);
|
|
1601
|
-
const updateDatePreset = React__namespace.useCallback(
|
|
1602
|
-
(preset) => {
|
|
1603
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
1604
|
-
switch (preset) {
|
|
1605
|
-
case "this-month":
|
|
1606
|
-
params.set("range", "this-month");
|
|
1607
|
-
break;
|
|
1608
|
-
case "last-month":
|
|
1609
|
-
params.set("range", "last-month");
|
|
1610
|
-
break;
|
|
1611
|
-
case "last-3-months":
|
|
1612
|
-
params.set("range", "last-3-months");
|
|
1613
|
-
break;
|
|
1614
|
-
case "custom":
|
|
1615
|
-
default:
|
|
1616
|
-
if (rangeParam === "this-month" || rangeParam === "last-month" || rangeParam === "last-3-months") {
|
|
1617
|
-
const currentDate = presetToDateRange(rangeParam);
|
|
1618
|
-
params.set(
|
|
1619
|
-
"range",
|
|
1620
|
-
`${dateFns.format(currentDate.from || /* @__PURE__ */ new Date(), "yyyy-MM-dd")}-${dateFns.format(
|
|
1621
|
-
currentDate.to || /* @__PURE__ */ new Date(),
|
|
1622
|
-
"yyyy-MM-dd"
|
|
1623
|
-
)}`
|
|
1624
|
-
);
|
|
1625
|
-
}
|
|
1626
|
-
break;
|
|
1627
|
-
}
|
|
1628
|
-
setSearchParams(params);
|
|
1629
|
-
},
|
|
1630
|
-
[searchParams, rangeParam, setSearchParams]
|
|
1631
|
-
);
|
|
1632
|
-
const updateUrlParams = React__namespace.useCallback(
|
|
1633
|
-
(value) => {
|
|
1634
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
1635
|
-
if ((value == null ? void 0 : value.from) && (value == null ? void 0 : value.to)) {
|
|
1636
|
-
params.set(
|
|
1637
|
-
"range",
|
|
1638
|
-
`${dateFns.format(value.from, "yyyy-MM-dd")}-${dateFns.format(
|
|
1639
|
-
value.to,
|
|
1640
|
-
"yyyy-MM-dd"
|
|
1641
|
-
)}`
|
|
1642
|
-
);
|
|
1643
|
-
}
|
|
1644
|
-
setSearchParams(params);
|
|
1645
|
-
},
|
|
1646
|
-
[searchParams, setSearchParams]
|
|
1647
|
-
);
|
|
1648
|
-
const handleDateRangeChange = React__namespace.useCallback(
|
|
1649
|
-
(value) => {
|
|
1650
|
-
const newDateRange = rangeValueToDateRange(value);
|
|
1651
|
-
updateUrlParams(newDateRange);
|
|
1652
|
-
},
|
|
1653
|
-
[updateUrlParams]
|
|
1654
|
-
);
|
|
1655
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
|
|
1656
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-4 items-center justify-between px-6 py-4", children: [
|
|
1657
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Analytics" }),
|
|
1658
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1659
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[170px]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1660
|
-
ui.Select,
|
|
1661
|
-
{
|
|
1662
|
-
disabled: isLoadingOrders || isLoadingProducts,
|
|
1663
|
-
defaultValue: "this-month",
|
|
1664
|
-
value: ["this-month", "last-month", "last-3-months"].includes(
|
|
1665
|
-
rangeParam
|
|
1666
|
-
) ? rangeParam : "custom",
|
|
1667
|
-
onValueChange: updateDatePreset,
|
|
1668
|
-
children: [
|
|
1669
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
|
|
1670
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
|
|
1671
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "this-month", children: "This Month" }),
|
|
1672
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "last-month", children: "Last Month" }),
|
|
1673
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "last-3-months", children: "Last 3 Months" }),
|
|
1674
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "custom", children: "Custom" })
|
|
1675
|
-
] })
|
|
1676
|
-
]
|
|
1677
|
-
}
|
|
1678
|
-
) }),
|
|
1679
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1680
|
-
reactAriaComponents.DateRangePicker,
|
|
1681
|
-
{
|
|
1682
|
-
value: dateRangeToRangeValue(date),
|
|
1683
|
-
onChange: handleDateRangeChange,
|
|
1684
|
-
isDisabled: isLoadingOrders || isLoadingProducts,
|
|
1685
|
-
"aria-label": "Date range",
|
|
1686
|
-
children: [
|
|
1687
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactAriaComponents.Group, { className: "inline-flex items-center gap-2 whitespace-nowrap rounded-md text-sm transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive justify-start focus-visible:shadow-borders-interactive-with-active disabled:bg-ui-bg-disabled disabled:text-ui-fg-disabled bg-ui-bg-field text-ui-fg-base txt-compact-small h-8 text-left font-normal data-[state=open]:!shadow-borders-interactive-with-active shadow-buttons-neutral hover:bg-ui-bg-field-hover outline-none transition-fg disabled:cursor-not-allowed min-w-[260px] bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-ui-bg-field-component dark:border-ui-border-base dark:hover:bg-ui-bg-field-hover px-4 border cursor-pointer", children: [
|
|
1688
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Calendar, { className: "h-4 w-4 text-ui-fg-muted group-disabled:text-ui-fg-disabled flex-shrink-0" }),
|
|
1689
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.DateInput, { slot: "start", className: "flex-1 min-w-0", children: (segment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1690
|
-
reactAriaComponents.DateSegment,
|
|
1691
|
-
{
|
|
1692
|
-
segment,
|
|
1693
|
-
className: "outline-none rounded-sm focus:bg-ui-bg-interactive focus:text-ui-fg-on-color caret-transparent placeholder-shown:italic text-ui-fg-base data-[placeholder]:text-ui-fg-muted"
|
|
1694
|
-
}
|
|
1695
|
-
) }),
|
|
1696
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-ui-fg-muted px-1", children: "—" }),
|
|
1697
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.DateInput, { slot: "end", className: "flex-1 min-w-0", children: (segment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1698
|
-
reactAriaComponents.DateSegment,
|
|
1699
|
-
{
|
|
1700
|
-
segment,
|
|
1701
|
-
className: "outline-none rounded-sm focus:bg-ui-bg-interactive focus:text-ui-fg-on-color caret-transparent placeholder-shown:italic text-ui-fg-base data-[placeholder]:text-ui-fg-muted"
|
|
1702
|
-
}
|
|
1703
|
-
) }),
|
|
1704
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Button, { className: "text-ui-fg-muted hover:bg-ui-bg-subtle dark:hover:bg-ui-bg-subtle rounded p-1", children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, { className: "size-4" }) })
|
|
1705
|
-
] }),
|
|
1706
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Popover, { className: "w-auto p-0 bg-transparent z-50", children: /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Dialog, { className: "bg-ui-bg-base dark:bg-ui-bg-base border border-ui-border-base dark:border-ui-border-base rounded-lg shadow-lg p-6 max-w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1707
|
-
reactAriaComponents.RangeCalendar,
|
|
1708
|
-
{
|
|
1709
|
-
className: "w-fit",
|
|
1710
|
-
visibleDuration: { months: 2 },
|
|
1711
|
-
children: [
|
|
1712
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-center justify-between mb-4", children: [
|
|
1713
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1714
|
-
reactAriaComponents.Button,
|
|
1715
|
-
{
|
|
1716
|
-
slot: "previous",
|
|
1717
|
-
className: "p-2 hover:bg-ui-bg-subtle dark:hover:bg-ui-bg-subtle rounded text-ui-fg-base",
|
|
1718
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronLeft, { className: "size-4" })
|
|
1719
|
-
}
|
|
1720
|
-
),
|
|
1721
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Heading, { className: "font-semibold text-lg text-ui-fg-base" }),
|
|
1722
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1723
|
-
reactAriaComponents.Button,
|
|
1724
|
-
{
|
|
1725
|
-
slot: "next",
|
|
1726
|
-
className: "p-2 hover:bg-ui-bg-subtle dark:hover:bg-ui-bg-subtle rounded text-ui-fg-base",
|
|
1727
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRight, { className: "size-4" })
|
|
1728
|
-
}
|
|
1729
|
-
)
|
|
1730
|
-
] }),
|
|
1731
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6", children: [
|
|
1732
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.CalendarGrid, { className: "border-collapse gap-1", children: (date2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1733
|
-
reactAriaComponents.CalendarCell,
|
|
1734
|
-
{
|
|
1735
|
-
date: date2,
|
|
1736
|
-
className: "w-9 h-9 text-sm cursor-pointer rounded flex items-center justify-center hover:bg-ui-bg-subtle dark:hover:bg-ui-bg-subtle selected:bg-ui-bg-interactive selected:text-ui-fg-on-color selection-start:bg-ui-bg-interactive selection-start:text-ui-fg-on-color selection-end:bg-ui-bg-interactive selection-end:text-ui-fg-on-color outside-month:text-ui-fg-disabled unavailable:text-ui-fg-disabled unavailable:cursor-default text-ui-fg-base data-[selected]:bg-ui-bg-interactive data-[selected]:text-ui-fg-on-color data-[selection-start]:bg-ui-bg-interactive data-[selection-start]:text-ui-fg-on-color data-[selection-end]:bg-ui-bg-interactive data-[selection-end]:text-ui-fg-on-color"
|
|
1737
|
-
}
|
|
1738
|
-
) }),
|
|
1739
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1740
|
-
reactAriaComponents.CalendarGrid,
|
|
1741
|
-
{
|
|
1742
|
-
offset: { months: 1 },
|
|
1743
|
-
className: "border-collapse gap-1",
|
|
1744
|
-
children: (date2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1745
|
-
reactAriaComponents.CalendarCell,
|
|
1746
|
-
{
|
|
1747
|
-
date: date2,
|
|
1748
|
-
className: "w-9 h-9 text-sm cursor-pointer rounded flex items-center justify-center hover:bg-ui-bg-subtle dark:hover:bg-ui-bg-subtle selected:bg-ui-bg-interactive selected:text-ui-fg-on-color selection-start:bg-ui-bg-interactive selection-start:text-ui-fg-on-color selection-end:bg-ui-bg-interactive selection-end:text-ui-fg-on-color outside-month:text-ui-fg-disabled unavailable:text-ui-fg-disabled unavailable:cursor-default text-ui-fg-base data-[selected]:bg-ui-bg-interactive data-[selected]:text-ui-fg-on-color data-[selection-start]:bg-ui-bg-interactive data-[selection-start]:text-ui-fg-on-color data-[selection-end]:bg-ui-bg-interactive data-[selection-end]:text-ui-fg-on-color"
|
|
1749
|
-
}
|
|
1750
|
-
)
|
|
1751
|
-
}
|
|
1752
|
-
)
|
|
1753
|
-
] })
|
|
1754
|
-
]
|
|
1755
|
-
}
|
|
1756
|
-
) }) })
|
|
1757
|
-
]
|
|
1758
|
-
}
|
|
1759
|
-
)
|
|
1760
|
-
] })
|
|
1761
|
-
] }),
|
|
1762
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1763
|
-
ui.Tabs,
|
|
1764
|
-
{
|
|
1765
|
-
value: searchParams.get("tab") || "orders",
|
|
1766
|
-
onValueChange: (value) => {
|
|
1767
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
1768
|
-
params.set("tab", value);
|
|
1769
|
-
setSearchParams(params);
|
|
1770
|
-
},
|
|
1771
|
-
children: [
|
|
1772
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Tabs.List, { children: [
|
|
1773
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1774
|
-
ui.Tabs.Trigger,
|
|
1775
|
-
{
|
|
1776
|
-
value: "orders",
|
|
1777
|
-
disabled: isLoadingOrders || isLoadingProducts,
|
|
1778
|
-
children: "Orders"
|
|
1779
|
-
}
|
|
1780
|
-
),
|
|
1781
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1782
|
-
ui.Tabs.Trigger,
|
|
1783
|
-
{
|
|
1784
|
-
value: "products",
|
|
1785
|
-
disabled: isLoadingOrders || isLoadingProducts,
|
|
1786
|
-
children: "Products"
|
|
1787
|
-
}
|
|
1788
|
-
),
|
|
1789
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1790
|
-
ui.Tabs.Trigger,
|
|
1791
|
-
{
|
|
1792
|
-
value: "customers",
|
|
1793
|
-
disabled: isLoadingOrders || isLoadingProducts,
|
|
1794
|
-
children: "Customers"
|
|
1795
|
-
}
|
|
1796
|
-
)
|
|
1797
|
-
] }),
|
|
1798
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8", children: [
|
|
1799
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Tabs.Content, { value: "orders", children: [
|
|
1800
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-md:flex-col gap-4 mb-4", children: [
|
|
1801
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 flex-1", children: [
|
|
1802
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1803
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ShoppingCart, { className: "absolute right-6 top-4 text-ui-fg-muted" }),
|
|
1804
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Total Orders" }),
|
|
1805
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1806
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: (orders == null ? void 0 : orders.total_orders) || 0 }),
|
|
1807
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
|
|
1808
|
-
((orders == null ? void 0 : orders.prev_orders_percent) || 0) > 0 && "+",
|
|
1809
|
-
(orders == null ? void 0 : orders.prev_orders_percent) || 0,
|
|
1810
|
-
"% from previous period"
|
|
1811
|
-
] })
|
|
1812
|
-
] })
|
|
1813
|
-
] }),
|
|
1814
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
1815
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Orders Over Time" }),
|
|
1816
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Total number of orders in the selected period" }),
|
|
1817
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(LineChartSkeleton, {}) : (orders == null ? void 0 : orders.order_count) && ((_e = orders == null ? void 0 : orders.order_count) == null ? void 0 : _e.length) > 0 && someOrderCountsGreaterThanZero ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1818
|
-
LineChart,
|
|
1819
|
-
{
|
|
1820
|
-
data: orders == null ? void 0 : orders.order_count,
|
|
1821
|
-
xAxisDataKey: "name",
|
|
1822
|
-
yAxisDataKey: "count"
|
|
1823
|
-
}
|
|
1824
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1825
|
-
ui.Text,
|
|
1826
|
-
{
|
|
1827
|
-
size: "small",
|
|
1828
|
-
className: "text-ui-fg-muted text-center",
|
|
1829
|
-
children: "No data available for the selected period."
|
|
1830
|
-
}
|
|
1831
|
-
)
|
|
1832
|
-
] })
|
|
1833
|
-
] }),
|
|
1834
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 flex-1", children: [
|
|
1835
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1836
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChartNoAxesCombined, { className: "absolute right-6 text-ui-fg-muted top-4 size-[15px]" }),
|
|
1837
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Total Sales" }),
|
|
1838
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1839
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: new Intl.NumberFormat("en-US", {
|
|
1840
|
-
style: "currency",
|
|
1841
|
-
currency: (orders == null ? void 0 : orders.currency_code) || "EUR"
|
|
1842
|
-
}).format((orders == null ? void 0 : orders.total_sales) || 0) }),
|
|
1843
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
|
|
1844
|
-
((orders == null ? void 0 : orders.prev_sales_percent) || 0) > 0 && "+",
|
|
1845
|
-
(orders == null ? void 0 : orders.prev_sales_percent) || 0,
|
|
1846
|
-
"% from previous period"
|
|
1847
|
-
] })
|
|
1848
|
-
] })
|
|
1849
|
-
] }),
|
|
1850
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
1851
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Sales Over Time" }),
|
|
1852
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: [
|
|
1853
|
-
"Total sales in the selected period (",
|
|
1854
|
-
orders == null ? void 0 : orders.currency_code,
|
|
1855
|
-
")"
|
|
1856
|
-
] }),
|
|
1857
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(LineChartSkeleton, {}) : (orders == null ? void 0 : orders.order_sales) && ((_f = orders == null ? void 0 : orders.order_sales) == null ? void 0 : _f.length) > 0 && someOrderSalesGreaterThanZero ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1858
|
-
LineChart,
|
|
1859
|
-
{
|
|
1860
|
-
data: orders.order_sales,
|
|
1861
|
-
xAxisDataKey: "name",
|
|
1862
|
-
yAxisDataKey: "sales",
|
|
1863
|
-
lineColor: "#82ca9d",
|
|
1864
|
-
yAxisTickFormatter: (value) => new Intl.NumberFormat("en-US", {
|
|
1865
|
-
currency: orders.currency_code,
|
|
1866
|
-
maximumFractionDigits: 0
|
|
1867
|
-
}).format(value)
|
|
1868
|
-
}
|
|
1869
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1870
|
-
ui.Text,
|
|
1871
|
-
{
|
|
1872
|
-
size: "small",
|
|
1873
|
-
className: "text-ui-fg-muted text-center",
|
|
1874
|
-
children: "No data available for the selected period."
|
|
1875
|
-
}
|
|
1876
|
-
)
|
|
1877
|
-
] })
|
|
1878
|
-
] })
|
|
1879
|
-
] }),
|
|
1880
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-md:flex-col gap-4", children: [
|
|
1881
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
1882
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Top Regions by Sales" }),
|
|
1883
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Sales breakdown by region in the selected period" }),
|
|
1884
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(BarChartSkeleton, {}) : (orders == null ? void 0 : orders.regions) && ((_g = orders == null ? void 0 : orders.regions) == null ? void 0 : _g.length) > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1885
|
-
BarChart,
|
|
1886
|
-
{
|
|
1887
|
-
data: orders.regions,
|
|
1888
|
-
xAxisDataKey: "name",
|
|
1889
|
-
yAxisDataKey: "sales",
|
|
1890
|
-
lineColor: "#82ca9d",
|
|
1891
|
-
useStableColors: true,
|
|
1892
|
-
colorKeyField: "name",
|
|
1893
|
-
yAxisTickFormatter: (value) => new Intl.NumberFormat("en-US", {
|
|
1894
|
-
currency: orders.currency_code,
|
|
1895
|
-
maximumFractionDigits: 0
|
|
1896
|
-
}).format(value)
|
|
1897
|
-
}
|
|
1898
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1899
|
-
ui.Text,
|
|
1900
|
-
{
|
|
1901
|
-
size: "small",
|
|
1902
|
-
className: "text-ui-fg-muted text-center",
|
|
1903
|
-
children: "No data available for the selected period."
|
|
1904
|
-
}
|
|
1905
|
-
)
|
|
1906
|
-
] }) }),
|
|
1907
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
1908
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Order Status Breakdown" }),
|
|
1909
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Distribution of orders by status in the selected period" }),
|
|
1910
|
-
isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(PieChartSkeleton, {}) : (orders == null ? void 0 : orders.statuses) && ((_h = orders == null ? void 0 : orders.statuses) == null ? void 0 : _h.length) > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(PieChart, { data: orders == null ? void 0 : orders.statuses, dataKey: "count" }) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1911
|
-
ui.Text,
|
|
1912
|
-
{
|
|
1913
|
-
size: "small",
|
|
1914
|
-
className: "text-ui-fg-muted text-center",
|
|
1915
|
-
children: "No data available for the selected period."
|
|
1916
|
-
}
|
|
1917
|
-
)
|
|
1918
|
-
] }) })
|
|
1919
|
-
] })
|
|
1920
|
-
] }),
|
|
1921
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Tabs.Content, { value: "products", children: [
|
|
1922
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mb-4 min-h-[9.375rem]", children: [
|
|
1923
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Top-Selling Products" }),
|
|
1924
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Products by quantity sold in selected period" }),
|
|
1925
|
-
isLoadingProducts ? /* @__PURE__ */ jsxRuntime.jsx(BarChartSkeleton, {}) : (products == null ? void 0 : products.variantQuantitySold) && someTopSellingProductsGreaterThanZero ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1926
|
-
BarChart,
|
|
1927
|
-
{
|
|
1928
|
-
data: products.variantQuantitySold,
|
|
1929
|
-
xAxisDataKey: "title",
|
|
1930
|
-
yAxisDataKey: "quantity",
|
|
1931
|
-
lineColor: "#82ca9d",
|
|
1932
|
-
useStableColors: true,
|
|
1933
|
-
colorKeyField: "title"
|
|
1934
|
-
}
|
|
1935
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted text-center", children: "No data available for the selected period." })
|
|
1936
|
-
] }),
|
|
1937
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 max-xl:flex-col", children: [
|
|
1938
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { children: [
|
|
1939
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Out-of-Stock Variants" }),
|
|
1940
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Products with zero inventory" }),
|
|
1941
|
-
isLoadingProducts ? /* @__PURE__ */ jsxRuntime.jsx(ProductsTableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1942
|
-
ProductsTable,
|
|
1943
|
-
{
|
|
1944
|
-
products: ((_i = products == null ? void 0 : products.lowStockVariants) == null ? void 0 : _i.filter(
|
|
1945
|
-
(product) => product.inventoryQuantity === 0
|
|
1946
|
-
)) || []
|
|
1947
|
-
}
|
|
1948
|
-
)
|
|
1949
|
-
] }),
|
|
1950
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { children: [
|
|
1951
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Low Stock Variants" }),
|
|
1952
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Products with inventory below threshold" }),
|
|
1953
|
-
isLoadingProducts ? /* @__PURE__ */ jsxRuntime.jsx(ProductsTableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1954
|
-
ProductsTable,
|
|
1955
|
-
{
|
|
1956
|
-
products: ((_j = products == null ? void 0 : products.lowStockVariants) == null ? void 0 : _j.filter(
|
|
1957
|
-
(product) => product.inventoryQuantity > 0
|
|
1958
|
-
)) || []
|
|
1959
|
-
}
|
|
1960
|
-
)
|
|
1961
|
-
] })
|
|
1962
|
-
] })
|
|
1963
|
-
] }),
|
|
1964
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Tabs.Content, { value: "customers", children: [
|
|
1965
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-md:flex-col gap-4 mb-4", children: [
|
|
1966
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 flex-1", children: [
|
|
1967
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1968
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.User, { className: "absolute right-6 top-4 text-ui-fg-muted" }),
|
|
1969
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Total Customers" }),
|
|
1970
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: (customers == null ? void 0 : customers.total_customers) || 0 }) })
|
|
1971
|
-
] }),
|
|
1972
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1973
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.User, { className: "absolute right-6 top-4 text-ui-fg-muted" }),
|
|
1974
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "New Customers" }),
|
|
1975
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: (customers == null ? void 0 : customers.new_customers) || 0 }) })
|
|
1976
|
-
] })
|
|
1977
|
-
] }),
|
|
1978
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 flex-1", children: [
|
|
1979
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1980
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.User, { className: "absolute right-6 text-ui-fg-muted top-4 size-[15px]" }),
|
|
1981
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Returning Customers" }),
|
|
1982
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: (customers == null ? void 0 : customers.returning_customers) || 0 }) })
|
|
1983
|
-
] }),
|
|
1984
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "relative", children: [
|
|
1985
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChartNoAxesCombined, { className: "absolute right-6 top-4 text-ui-fg-muted" }),
|
|
1986
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Average Sales per Customer" }),
|
|
1987
|
-
isLoadingCustomers || isLoadingOrders ? /* @__PURE__ */ jsxRuntime.jsx(SmallCardSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: new Intl.NumberFormat("en-US", {
|
|
1988
|
-
currency: (customers == null ? void 0 : customers.currency_code) || "EUR",
|
|
1989
|
-
style: "currency"
|
|
1990
|
-
}).format(
|
|
1991
|
-
(customers == null ? void 0 : customers.total_customers) && customers.total_customers > 0 ? ((orders == null ? void 0 : orders.total_sales) || 0) / customers.total_customers : 0
|
|
1992
|
-
) }) })
|
|
1993
|
-
] })
|
|
1994
|
-
] })
|
|
1995
|
-
] }),
|
|
1996
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-md:flex-col gap-4 mb-4", children: [
|
|
1997
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
1998
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "New vs. Returning Customers" }),
|
|
1999
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Distribution of new and returning customers in the selected period" }),
|
|
2000
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(BarChartSkeleton, {}) : (customers == null ? void 0 : customers.customer_count) && customers.customer_count.length > 0 && someCustomerCountsGreaterThanZero ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2001
|
-
StackedBarChart,
|
|
2002
|
-
{
|
|
2003
|
-
data: customers.customer_count,
|
|
2004
|
-
xAxisDataKey: "name",
|
|
2005
|
-
lineColor: "#82ca9d",
|
|
2006
|
-
useStableColors: true,
|
|
2007
|
-
colorKeyField: "returning_customers",
|
|
2008
|
-
dataKeys: ["new_customers", "returning_customers"]
|
|
2009
|
-
}
|
|
2010
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2011
|
-
ui.Text,
|
|
2012
|
-
{
|
|
2013
|
-
size: "small",
|
|
2014
|
-
className: "text-ui-fg-muted text-center",
|
|
2015
|
-
children: "No data available for the selected period."
|
|
2016
|
-
}
|
|
2017
|
-
)
|
|
2018
|
-
] }) }),
|
|
2019
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "min-h-[9.375rem]", children: [
|
|
2020
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Top Customer Groups by Sales" }),
|
|
2021
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Sales breakdown by customer group in the selected period" }),
|
|
2022
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(BarChartSkeleton, {}) : (customers == null ? void 0 : customers.customer_group) && customers.customer_group.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", style: { aspectRatio: "16/9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2023
|
-
BarChart,
|
|
2024
|
-
{
|
|
2025
|
-
data: customers.customer_group,
|
|
2026
|
-
xAxisDataKey: "name",
|
|
2027
|
-
lineColor: "#82ca9d",
|
|
2028
|
-
useStableColors: true,
|
|
2029
|
-
colorKeyField: "name",
|
|
2030
|
-
yAxisDataKey: "total",
|
|
2031
|
-
yAxisTickFormatter: (value) => new Intl.NumberFormat("en-US", {
|
|
2032
|
-
currency: customers.currency_code || "EUR",
|
|
2033
|
-
maximumFractionDigits: 0
|
|
2034
|
-
}).format(value)
|
|
2035
|
-
}
|
|
2036
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2037
|
-
ui.Text,
|
|
2038
|
-
{
|
|
2039
|
-
size: "small",
|
|
2040
|
-
className: "text-ui-fg-muted text-center",
|
|
2041
|
-
children: "No data available for the selected period."
|
|
2042
|
-
}
|
|
2043
|
-
)
|
|
2044
|
-
] }) })
|
|
2045
|
-
] }),
|
|
2046
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4 max-xl:flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { children: [
|
|
2047
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xlarge", weight: "plus", children: "Top Customers by Sales" }),
|
|
2048
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mb-8 text-ui-fg-muted", children: "Customers by sales in the selected period" }),
|
|
2049
|
-
isLoadingCustomers ? /* @__PURE__ */ jsxRuntime.jsx(CustomersTableSkeleton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2050
|
-
CustomersTable,
|
|
2051
|
-
{
|
|
2052
|
-
customers: (customers == null ? void 0 : customers.customer_sales) || [],
|
|
2053
|
-
currencyCode: (customers == null ? void 0 : customers.currency_code) || "EUR"
|
|
2054
|
-
}
|
|
2055
|
-
)
|
|
2056
|
-
] }) })
|
|
2057
|
-
] })
|
|
2058
|
-
] })
|
|
2059
|
-
]
|
|
2060
|
-
}
|
|
2061
|
-
) })
|
|
2062
|
-
] });
|
|
2063
|
-
};
|
|
2064
|
-
const config = adminSdk.defineRouteConfig({
|
|
2065
|
-
label: "Analytics",
|
|
2066
|
-
icon: icons.ChartBar
|
|
2067
|
-
});
|
|
2068
|
-
const widgetModule = { widgets: [] };
|
|
2069
|
-
const routeModule = {
|
|
2070
|
-
routes: [
|
|
2071
|
-
{
|
|
2072
|
-
Component: AnalyticsPage,
|
|
2073
|
-
path: "/analytics"
|
|
2074
|
-
}
|
|
2075
|
-
]
|
|
2076
|
-
};
|
|
2077
|
-
const menuItemModule = {
|
|
2078
|
-
menuItems: [
|
|
2079
|
-
{
|
|
2080
|
-
label: config.label,
|
|
2081
|
-
icon: config.icon,
|
|
2082
|
-
path: "/analytics",
|
|
2083
|
-
nested: void 0
|
|
2084
|
-
}
|
|
2085
|
-
]
|
|
2086
|
-
};
|
|
2087
|
-
const formModule = { customFields: {} };
|
|
2088
|
-
const displayModule = {
|
|
2089
|
-
displays: {}
|
|
2090
|
-
};
|
|
2091
|
-
const plugin = {
|
|
2092
|
-
widgetModule,
|
|
2093
|
-
routeModule,
|
|
2094
|
-
menuItemModule,
|
|
2095
|
-
formModule,
|
|
2096
|
-
displayModule
|
|
2097
|
-
};
|
|
2098
|
-
module.exports = plugin;
|