medusa-stats 1.0.8 → 1.0.9
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/.medusa/server/src/admin/index.js +105 -105
- package/.medusa/server/src/admin/index.mjs +105 -105
- package/README.md +4 -4
- package/package.json +2 -2
- package/.medusa/server/src/admin/composite.png +0 -0
- package/.medusa/server/src/admin/params.png +0 -0
- package/.medusa/server/src/admin/view.png +0 -0
- package/.medusa/server/src/admin/visualizations.png +0 -0
|
@@ -7209,6 +7209,103 @@ const AlertsPage = () => {
|
|
|
7209
7209
|
const config$4 = adminSdk.defineRouteConfig({
|
|
7210
7210
|
label: "Alerts"
|
|
7211
7211
|
});
|
|
7212
|
+
const ProviderRow = ({ provider, isExpanded, onToggle }) => {
|
|
7213
|
+
const statistics = (provider == null ? void 0 : provider.statistics) || [];
|
|
7214
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7215
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7216
|
+
ui.Table.Row,
|
|
7217
|
+
{
|
|
7218
|
+
className: "cursor-pointer",
|
|
7219
|
+
onClick: onToggle,
|
|
7220
|
+
children: [
|
|
7221
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 py-2", children: [
|
|
7222
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-bg-subtle border rounded-lg p-2", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Adjustments, { className: "text-ui-fg-muted" }) }),
|
|
7223
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7224
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: provider.display_name || provider.id }),
|
|
7225
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-fg-muted text-xs", children: provider.id })
|
|
7226
|
+
] })
|
|
7227
|
+
] }) }),
|
|
7228
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-ui-fg-subtle", children: [
|
|
7229
|
+
statistics.length || 0,
|
|
7230
|
+
" available"
|
|
7231
|
+
] }) }),
|
|
7232
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.StatusBadge, { color: provider.is_enabled ? "green" : "grey", children: provider.is_enabled ? "Active" : "Disabled" }) }),
|
|
7233
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "text-right", children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronUpMini, { className: "inline-block text-ui-fg-muted" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownMini, { className: "inline-block text-ui-fg-muted" }) })
|
|
7234
|
+
]
|
|
7235
|
+
}
|
|
7236
|
+
),
|
|
7237
|
+
isExpanded && /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { className: "bg-ui-bg-subtle hover:bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { ...{ colSpan: 4 }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 py-4", children: [
|
|
7238
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-sm font-medium mb-3", children: "Available Statistics" }),
|
|
7239
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2", children: statistics.map((stat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7240
|
+
"div",
|
|
7241
|
+
{
|
|
7242
|
+
className: "bg-ui-bg-base rounded-lg p-3 border border-ui-border-base",
|
|
7243
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
7244
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm", children: stat.name || stat.id }),
|
|
7245
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-muted mt-1", children: stat.id }),
|
|
7246
|
+
stat.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-subtle mt-2", children: stat.description })
|
|
7247
|
+
] }) })
|
|
7248
|
+
},
|
|
7249
|
+
stat.id
|
|
7250
|
+
)) })
|
|
7251
|
+
] }) }) })
|
|
7252
|
+
] });
|
|
7253
|
+
};
|
|
7254
|
+
const LoadingRow = () => /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
|
|
7255
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7256
|
+
/* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-48 mb-1" }),
|
|
7257
|
+
/* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-4 w-32" })
|
|
7258
|
+
] }) }),
|
|
7259
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-24" }) }),
|
|
7260
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-20" }) }),
|
|
7261
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-24" }) })
|
|
7262
|
+
] });
|
|
7263
|
+
const ProvidersPage = () => {
|
|
7264
|
+
const [expandedRows, setExpandedRows] = React.useState(/* @__PURE__ */ new Set());
|
|
7265
|
+
const { data, isLoading } = reactQuery.useQuery({
|
|
7266
|
+
queryFn: () => listProviders(),
|
|
7267
|
+
queryKey: [STATISTICS_QUERY, "providers"]
|
|
7268
|
+
});
|
|
7269
|
+
const providers = (data == null ? void 0 : data.providers) || [];
|
|
7270
|
+
const toggleRow = (providerId) => {
|
|
7271
|
+
setExpandedRows((prev) => {
|
|
7272
|
+
const newSet = new Set(prev);
|
|
7273
|
+
if (newSet.has(providerId)) {
|
|
7274
|
+
newSet.delete(providerId);
|
|
7275
|
+
} else {
|
|
7276
|
+
newSet.add(providerId);
|
|
7277
|
+
}
|
|
7278
|
+
return newSet;
|
|
7279
|
+
});
|
|
7280
|
+
};
|
|
7281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0 overflow-hidden", children: [
|
|
7282
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Providers" }) }),
|
|
7283
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { children: [
|
|
7284
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Header, { className: "!border-none", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
|
|
7285
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Provider" }),
|
|
7286
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Statistics" }),
|
|
7287
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Status" }),
|
|
7288
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, {})
|
|
7289
|
+
] }) }),
|
|
7290
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Body, { className: "!border-none", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7291
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {}),
|
|
7292
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {}),
|
|
7293
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {})
|
|
7294
|
+
] }) : providers.length > 0 ? providers.map((provider) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7295
|
+
ProviderRow,
|
|
7296
|
+
{
|
|
7297
|
+
provider,
|
|
7298
|
+
isExpanded: expandedRows.has(provider.id),
|
|
7299
|
+
onToggle: () => toggleRow(provider.id)
|
|
7300
|
+
},
|
|
7301
|
+
provider.id
|
|
7302
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { ...{ colSpan: 4 }, className: "text-center text-ui-fg-muted ", children: "No providers found" }) }) })
|
|
7303
|
+
] }) })
|
|
7304
|
+
] });
|
|
7305
|
+
};
|
|
7306
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
7307
|
+
label: "Providers"
|
|
7308
|
+
});
|
|
7212
7309
|
const OptionSelector = ({
|
|
7213
7310
|
onSelect,
|
|
7214
7311
|
title,
|
|
@@ -8119,7 +8216,7 @@ const OptionEditDrawer = ({
|
|
|
8119
8216
|
] })
|
|
8120
8217
|
] }) });
|
|
8121
8218
|
};
|
|
8122
|
-
const config$
|
|
8219
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
8123
8220
|
label: "Option Presets",
|
|
8124
8221
|
icon: icons.ArrowDownTray
|
|
8125
8222
|
});
|
|
@@ -8448,103 +8545,6 @@ const PresetsPage = () => {
|
|
|
8448
8545
|
)
|
|
8449
8546
|
] });
|
|
8450
8547
|
};
|
|
8451
|
-
const ProviderRow = ({ provider, isExpanded, onToggle }) => {
|
|
8452
|
-
const statistics = (provider == null ? void 0 : provider.statistics) || [];
|
|
8453
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8454
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8455
|
-
ui.Table.Row,
|
|
8456
|
-
{
|
|
8457
|
-
className: "cursor-pointer",
|
|
8458
|
-
onClick: onToggle,
|
|
8459
|
-
children: [
|
|
8460
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 py-2", children: [
|
|
8461
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-bg-subtle border rounded-lg p-2", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Adjustments, { className: "text-ui-fg-muted" }) }),
|
|
8462
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8463
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: provider.display_name || provider.id }),
|
|
8464
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-fg-muted text-xs", children: provider.id })
|
|
8465
|
-
] })
|
|
8466
|
-
] }) }),
|
|
8467
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-ui-fg-subtle", children: [
|
|
8468
|
-
statistics.length || 0,
|
|
8469
|
-
" available"
|
|
8470
|
-
] }) }),
|
|
8471
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.StatusBadge, { color: provider.is_enabled ? "green" : "grey", children: provider.is_enabled ? "Active" : "Disabled" }) }),
|
|
8472
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "text-right", children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronUpMini, { className: "inline-block text-ui-fg-muted" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownMini, { className: "inline-block text-ui-fg-muted" }) })
|
|
8473
|
-
]
|
|
8474
|
-
}
|
|
8475
|
-
),
|
|
8476
|
-
isExpanded && /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { className: "bg-ui-bg-subtle hover:bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { ...{ colSpan: 4 }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 py-4", children: [
|
|
8477
|
-
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-sm font-medium mb-3", children: "Available Statistics" }),
|
|
8478
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2", children: statistics.map((stat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8479
|
-
"div",
|
|
8480
|
-
{
|
|
8481
|
-
className: "bg-ui-bg-base rounded-lg p-3 border border-ui-border-base",
|
|
8482
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
8483
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm", children: stat.name || stat.id }),
|
|
8484
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-muted mt-1", children: stat.id }),
|
|
8485
|
-
stat.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ui-fg-subtle mt-2", children: stat.description })
|
|
8486
|
-
] }) })
|
|
8487
|
-
},
|
|
8488
|
-
stat.id
|
|
8489
|
-
)) })
|
|
8490
|
-
] }) }) })
|
|
8491
|
-
] });
|
|
8492
|
-
};
|
|
8493
|
-
const LoadingRow = () => /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
|
|
8494
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8495
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-48 mb-1" }),
|
|
8496
|
-
/* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-4 w-32" })
|
|
8497
|
-
] }) }),
|
|
8498
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-24" }) }),
|
|
8499
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-20" }) }),
|
|
8500
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton$1, { className: "h-5 w-24" }) })
|
|
8501
|
-
] });
|
|
8502
|
-
const ProvidersPage = () => {
|
|
8503
|
-
const [expandedRows, setExpandedRows] = React.useState(/* @__PURE__ */ new Set());
|
|
8504
|
-
const { data, isLoading } = reactQuery.useQuery({
|
|
8505
|
-
queryFn: () => listProviders(),
|
|
8506
|
-
queryKey: [STATISTICS_QUERY, "providers"]
|
|
8507
|
-
});
|
|
8508
|
-
const providers = (data == null ? void 0 : data.providers) || [];
|
|
8509
|
-
const toggleRow = (providerId) => {
|
|
8510
|
-
setExpandedRows((prev) => {
|
|
8511
|
-
const newSet = new Set(prev);
|
|
8512
|
-
if (newSet.has(providerId)) {
|
|
8513
|
-
newSet.delete(providerId);
|
|
8514
|
-
} else {
|
|
8515
|
-
newSet.add(providerId);
|
|
8516
|
-
}
|
|
8517
|
-
return newSet;
|
|
8518
|
-
});
|
|
8519
|
-
};
|
|
8520
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0 overflow-hidden", children: [
|
|
8521
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Providers" }) }),
|
|
8522
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { children: [
|
|
8523
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Header, { className: "!border-none", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
|
|
8524
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Provider" }),
|
|
8525
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Statistics" }),
|
|
8526
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Status" }),
|
|
8527
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, {})
|
|
8528
|
-
] }) }),
|
|
8529
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Body, { className: "!border-none", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8530
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {}),
|
|
8531
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {}),
|
|
8532
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {})
|
|
8533
|
-
] }) : providers.length > 0 ? providers.map((provider) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8534
|
-
ProviderRow,
|
|
8535
|
-
{
|
|
8536
|
-
provider,
|
|
8537
|
-
isExpanded: expandedRows.has(provider.id),
|
|
8538
|
-
onToggle: () => toggleRow(provider.id)
|
|
8539
|
-
},
|
|
8540
|
-
provider.id
|
|
8541
|
-
)) : /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { ...{ colSpan: 4 }, className: "text-center text-ui-fg-muted ", children: "No providers found" }) }) })
|
|
8542
|
-
] }) })
|
|
8543
|
-
] });
|
|
8544
|
-
};
|
|
8545
|
-
const config$2 = adminSdk.defineRouteConfig({
|
|
8546
|
-
label: "Providers"
|
|
8547
|
-
});
|
|
8548
8548
|
const columnHelper = ui.createDataTableColumnHelper();
|
|
8549
8549
|
const getColumns = () => [
|
|
8550
8550
|
columnHelper.accessor("alert.name", {
|
|
@@ -10426,14 +10426,14 @@ const routeModule = {
|
|
|
10426
10426
|
Component: AlertsPage,
|
|
10427
10427
|
path: "/statistics/alerts"
|
|
10428
10428
|
},
|
|
10429
|
-
{
|
|
10430
|
-
Component: PresetsPage,
|
|
10431
|
-
path: "/statistics/presets"
|
|
10432
|
-
},
|
|
10433
10429
|
{
|
|
10434
10430
|
Component: ProvidersPage,
|
|
10435
10431
|
path: "/statistics/providers"
|
|
10436
10432
|
},
|
|
10433
|
+
{
|
|
10434
|
+
Component: PresetsPage,
|
|
10435
|
+
path: "/statistics/presets"
|
|
10436
|
+
},
|
|
10437
10437
|
{
|
|
10438
10438
|
Component: AlertLogsPage,
|
|
10439
10439
|
path: "/statistics/alerts/logs"
|
|
@@ -10463,15 +10463,15 @@ const menuItemModule = {
|
|
|
10463
10463
|
translationNs: void 0
|
|
10464
10464
|
},
|
|
10465
10465
|
{
|
|
10466
|
-
label: config$
|
|
10467
|
-
icon: config$
|
|
10466
|
+
label: config$2.label,
|
|
10467
|
+
icon: config$2.icon,
|
|
10468
10468
|
path: "/statistics/presets",
|
|
10469
10469
|
nested: void 0,
|
|
10470
10470
|
rank: void 0,
|
|
10471
10471
|
translationNs: void 0
|
|
10472
10472
|
},
|
|
10473
10473
|
{
|
|
10474
|
-
label: config$
|
|
10474
|
+
label: config$3.label,
|
|
10475
10475
|
icon: void 0,
|
|
10476
10476
|
path: "/statistics/providers",
|
|
10477
10477
|
nested: void 0,
|
|
@@ -7205,6 +7205,103 @@ const AlertsPage = () => {
|
|
|
7205
7205
|
const config$4 = defineRouteConfig({
|
|
7206
7206
|
label: "Alerts"
|
|
7207
7207
|
});
|
|
7208
|
+
const ProviderRow = ({ provider, isExpanded, onToggle }) => {
|
|
7209
|
+
const statistics = (provider == null ? void 0 : provider.statistics) || [];
|
|
7210
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7211
|
+
/* @__PURE__ */ jsxs(
|
|
7212
|
+
Table.Row,
|
|
7213
|
+
{
|
|
7214
|
+
className: "cursor-pointer",
|
|
7215
|
+
onClick: onToggle,
|
|
7216
|
+
children: [
|
|
7217
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 py-2", children: [
|
|
7218
|
+
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle border rounded-lg p-2", children: /* @__PURE__ */ jsx(Adjustments, { className: "text-ui-fg-muted" }) }),
|
|
7219
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7220
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium", children: provider.display_name || provider.id }),
|
|
7221
|
+
/* @__PURE__ */ jsx("p", { className: "text-ui-fg-muted text-xs", children: provider.id })
|
|
7222
|
+
] })
|
|
7223
|
+
] }) }),
|
|
7224
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("span", { className: "text-xs text-ui-fg-subtle", children: [
|
|
7225
|
+
statistics.length || 0,
|
|
7226
|
+
" available"
|
|
7227
|
+
] }) }),
|
|
7228
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(StatusBadge, { color: provider.is_enabled ? "green" : "grey", children: provider.is_enabled ? "Active" : "Disabled" }) }),
|
|
7229
|
+
/* @__PURE__ */ jsx(Table.Cell, { className: "text-right", children: isExpanded ? /* @__PURE__ */ jsx(ChevronUpMini, { className: "inline-block text-ui-fg-muted" }) : /* @__PURE__ */ jsx(ChevronDownMini, { className: "inline-block text-ui-fg-muted" }) })
|
|
7230
|
+
]
|
|
7231
|
+
}
|
|
7232
|
+
),
|
|
7233
|
+
isExpanded && /* @__PURE__ */ jsx(Table.Row, { className: "bg-ui-bg-subtle hover:bg-ui-bg-subtle", children: /* @__PURE__ */ jsx(Table.Cell, { ...{ colSpan: 4 }, children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 py-4", children: [
|
|
7234
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium mb-3", children: "Available Statistics" }),
|
|
7235
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-2", children: statistics.map((stat) => /* @__PURE__ */ jsx(
|
|
7236
|
+
"div",
|
|
7237
|
+
{
|
|
7238
|
+
className: "bg-ui-bg-base rounded-lg p-3 border border-ui-border-base",
|
|
7239
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
7240
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-sm", children: stat.name || stat.id }),
|
|
7241
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-ui-fg-muted mt-1", children: stat.id }),
|
|
7242
|
+
stat.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-ui-fg-subtle mt-2", children: stat.description })
|
|
7243
|
+
] }) })
|
|
7244
|
+
},
|
|
7245
|
+
stat.id
|
|
7246
|
+
)) })
|
|
7247
|
+
] }) }) })
|
|
7248
|
+
] });
|
|
7249
|
+
};
|
|
7250
|
+
const LoadingRow = () => /* @__PURE__ */ jsxs(Table.Row, { children: [
|
|
7251
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("div", { children: [
|
|
7252
|
+
/* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-48 mb-1" }),
|
|
7253
|
+
/* @__PURE__ */ jsx(Skeleton$1, { className: "h-4 w-32" })
|
|
7254
|
+
] }) }),
|
|
7255
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-24" }) }),
|
|
7256
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-20" }) }),
|
|
7257
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-24" }) })
|
|
7258
|
+
] });
|
|
7259
|
+
const ProvidersPage = () => {
|
|
7260
|
+
const [expandedRows, setExpandedRows] = useState(/* @__PURE__ */ new Set());
|
|
7261
|
+
const { data, isLoading } = useQuery({
|
|
7262
|
+
queryFn: () => listProviders(),
|
|
7263
|
+
queryKey: [STATISTICS_QUERY, "providers"]
|
|
7264
|
+
});
|
|
7265
|
+
const providers = (data == null ? void 0 : data.providers) || [];
|
|
7266
|
+
const toggleRow = (providerId) => {
|
|
7267
|
+
setExpandedRows((prev) => {
|
|
7268
|
+
const newSet = new Set(prev);
|
|
7269
|
+
if (newSet.has(providerId)) {
|
|
7270
|
+
newSet.delete(providerId);
|
|
7271
|
+
} else {
|
|
7272
|
+
newSet.add(providerId);
|
|
7273
|
+
}
|
|
7274
|
+
return newSet;
|
|
7275
|
+
});
|
|
7276
|
+
};
|
|
7277
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0 overflow-hidden", children: [
|
|
7278
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx(Heading, { level: "h2", children: "Providers" }) }),
|
|
7279
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
7280
|
+
/* @__PURE__ */ jsx(Table.Header, { className: "!border-none", children: /* @__PURE__ */ jsxs(Table.Row, { children: [
|
|
7281
|
+
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Provider" }),
|
|
7282
|
+
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Statistics" }),
|
|
7283
|
+
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Status" }),
|
|
7284
|
+
/* @__PURE__ */ jsx(Table.HeaderCell, {})
|
|
7285
|
+
] }) }),
|
|
7286
|
+
/* @__PURE__ */ jsx(Table.Body, { className: "!border-none", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7287
|
+
/* @__PURE__ */ jsx(LoadingRow, {}),
|
|
7288
|
+
/* @__PURE__ */ jsx(LoadingRow, {}),
|
|
7289
|
+
/* @__PURE__ */ jsx(LoadingRow, {})
|
|
7290
|
+
] }) : providers.length > 0 ? providers.map((provider) => /* @__PURE__ */ jsx(
|
|
7291
|
+
ProviderRow,
|
|
7292
|
+
{
|
|
7293
|
+
provider,
|
|
7294
|
+
isExpanded: expandedRows.has(provider.id),
|
|
7295
|
+
onToggle: () => toggleRow(provider.id)
|
|
7296
|
+
},
|
|
7297
|
+
provider.id
|
|
7298
|
+
)) : /* @__PURE__ */ jsx(Table.Row, { children: /* @__PURE__ */ jsx(Table.Cell, { ...{ colSpan: 4 }, className: "text-center text-ui-fg-muted ", children: "No providers found" }) }) })
|
|
7299
|
+
] }) })
|
|
7300
|
+
] });
|
|
7301
|
+
};
|
|
7302
|
+
const config$3 = defineRouteConfig({
|
|
7303
|
+
label: "Providers"
|
|
7304
|
+
});
|
|
7208
7305
|
const OptionSelector = ({
|
|
7209
7306
|
onSelect,
|
|
7210
7307
|
title,
|
|
@@ -8115,7 +8212,7 @@ const OptionEditDrawer = ({
|
|
|
8115
8212
|
] })
|
|
8116
8213
|
] }) });
|
|
8117
8214
|
};
|
|
8118
|
-
const config$
|
|
8215
|
+
const config$2 = defineRouteConfig({
|
|
8119
8216
|
label: "Option Presets",
|
|
8120
8217
|
icon: ArrowDownTray
|
|
8121
8218
|
});
|
|
@@ -8444,103 +8541,6 @@ const PresetsPage = () => {
|
|
|
8444
8541
|
)
|
|
8445
8542
|
] });
|
|
8446
8543
|
};
|
|
8447
|
-
const ProviderRow = ({ provider, isExpanded, onToggle }) => {
|
|
8448
|
-
const statistics = (provider == null ? void 0 : provider.statistics) || [];
|
|
8449
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8450
|
-
/* @__PURE__ */ jsxs(
|
|
8451
|
-
Table.Row,
|
|
8452
|
-
{
|
|
8453
|
-
className: "cursor-pointer",
|
|
8454
|
-
onClick: onToggle,
|
|
8455
|
-
children: [
|
|
8456
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 py-2", children: [
|
|
8457
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle border rounded-lg p-2", children: /* @__PURE__ */ jsx(Adjustments, { className: "text-ui-fg-muted" }) }),
|
|
8458
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8459
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium", children: provider.display_name || provider.id }),
|
|
8460
|
-
/* @__PURE__ */ jsx("p", { className: "text-ui-fg-muted text-xs", children: provider.id })
|
|
8461
|
-
] })
|
|
8462
|
-
] }) }),
|
|
8463
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("span", { className: "text-xs text-ui-fg-subtle", children: [
|
|
8464
|
-
statistics.length || 0,
|
|
8465
|
-
" available"
|
|
8466
|
-
] }) }),
|
|
8467
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(StatusBadge, { color: provider.is_enabled ? "green" : "grey", children: provider.is_enabled ? "Active" : "Disabled" }) }),
|
|
8468
|
-
/* @__PURE__ */ jsx(Table.Cell, { className: "text-right", children: isExpanded ? /* @__PURE__ */ jsx(ChevronUpMini, { className: "inline-block text-ui-fg-muted" }) : /* @__PURE__ */ jsx(ChevronDownMini, { className: "inline-block text-ui-fg-muted" }) })
|
|
8469
|
-
]
|
|
8470
|
-
}
|
|
8471
|
-
),
|
|
8472
|
-
isExpanded && /* @__PURE__ */ jsx(Table.Row, { className: "bg-ui-bg-subtle hover:bg-ui-bg-subtle", children: /* @__PURE__ */ jsx(Table.Cell, { ...{ colSpan: 4 }, children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 py-4", children: [
|
|
8473
|
-
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium mb-3", children: "Available Statistics" }),
|
|
8474
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-2", children: statistics.map((stat) => /* @__PURE__ */ jsx(
|
|
8475
|
-
"div",
|
|
8476
|
-
{
|
|
8477
|
-
className: "bg-ui-bg-base rounded-lg p-3 border border-ui-border-base",
|
|
8478
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
8479
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium text-sm", children: stat.name || stat.id }),
|
|
8480
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-ui-fg-muted mt-1", children: stat.id }),
|
|
8481
|
-
stat.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-ui-fg-subtle mt-2", children: stat.description })
|
|
8482
|
-
] }) })
|
|
8483
|
-
},
|
|
8484
|
-
stat.id
|
|
8485
|
-
)) })
|
|
8486
|
-
] }) }) })
|
|
8487
|
-
] });
|
|
8488
|
-
};
|
|
8489
|
-
const LoadingRow = () => /* @__PURE__ */ jsxs(Table.Row, { children: [
|
|
8490
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs("div", { children: [
|
|
8491
|
-
/* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-48 mb-1" }),
|
|
8492
|
-
/* @__PURE__ */ jsx(Skeleton$1, { className: "h-4 w-32" })
|
|
8493
|
-
] }) }),
|
|
8494
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-24" }) }),
|
|
8495
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-20" }) }),
|
|
8496
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Skeleton$1, { className: "h-5 w-24" }) })
|
|
8497
|
-
] });
|
|
8498
|
-
const ProvidersPage = () => {
|
|
8499
|
-
const [expandedRows, setExpandedRows] = useState(/* @__PURE__ */ new Set());
|
|
8500
|
-
const { data, isLoading } = useQuery({
|
|
8501
|
-
queryFn: () => listProviders(),
|
|
8502
|
-
queryKey: [STATISTICS_QUERY, "providers"]
|
|
8503
|
-
});
|
|
8504
|
-
const providers = (data == null ? void 0 : data.providers) || [];
|
|
8505
|
-
const toggleRow = (providerId) => {
|
|
8506
|
-
setExpandedRows((prev) => {
|
|
8507
|
-
const newSet = new Set(prev);
|
|
8508
|
-
if (newSet.has(providerId)) {
|
|
8509
|
-
newSet.delete(providerId);
|
|
8510
|
-
} else {
|
|
8511
|
-
newSet.add(providerId);
|
|
8512
|
-
}
|
|
8513
|
-
return newSet;
|
|
8514
|
-
});
|
|
8515
|
-
};
|
|
8516
|
-
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0 overflow-hidden", children: [
|
|
8517
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx(Heading, { level: "h2", children: "Providers" }) }),
|
|
8518
|
-
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
8519
|
-
/* @__PURE__ */ jsx(Table.Header, { className: "!border-none", children: /* @__PURE__ */ jsxs(Table.Row, { children: [
|
|
8520
|
-
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Provider" }),
|
|
8521
|
-
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Statistics" }),
|
|
8522
|
-
/* @__PURE__ */ jsx(Table.HeaderCell, { children: "Status" }),
|
|
8523
|
-
/* @__PURE__ */ jsx(Table.HeaderCell, {})
|
|
8524
|
-
] }) }),
|
|
8525
|
-
/* @__PURE__ */ jsx(Table.Body, { className: "!border-none", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8526
|
-
/* @__PURE__ */ jsx(LoadingRow, {}),
|
|
8527
|
-
/* @__PURE__ */ jsx(LoadingRow, {}),
|
|
8528
|
-
/* @__PURE__ */ jsx(LoadingRow, {})
|
|
8529
|
-
] }) : providers.length > 0 ? providers.map((provider) => /* @__PURE__ */ jsx(
|
|
8530
|
-
ProviderRow,
|
|
8531
|
-
{
|
|
8532
|
-
provider,
|
|
8533
|
-
isExpanded: expandedRows.has(provider.id),
|
|
8534
|
-
onToggle: () => toggleRow(provider.id)
|
|
8535
|
-
},
|
|
8536
|
-
provider.id
|
|
8537
|
-
)) : /* @__PURE__ */ jsx(Table.Row, { children: /* @__PURE__ */ jsx(Table.Cell, { ...{ colSpan: 4 }, className: "text-center text-ui-fg-muted ", children: "No providers found" }) }) })
|
|
8538
|
-
] }) })
|
|
8539
|
-
] });
|
|
8540
|
-
};
|
|
8541
|
-
const config$2 = defineRouteConfig({
|
|
8542
|
-
label: "Providers"
|
|
8543
|
-
});
|
|
8544
8544
|
const columnHelper = createDataTableColumnHelper();
|
|
8545
8545
|
const getColumns = () => [
|
|
8546
8546
|
columnHelper.accessor("alert.name", {
|
|
@@ -10422,14 +10422,14 @@ const routeModule = {
|
|
|
10422
10422
|
Component: AlertsPage,
|
|
10423
10423
|
path: "/statistics/alerts"
|
|
10424
10424
|
},
|
|
10425
|
-
{
|
|
10426
|
-
Component: PresetsPage,
|
|
10427
|
-
path: "/statistics/presets"
|
|
10428
|
-
},
|
|
10429
10425
|
{
|
|
10430
10426
|
Component: ProvidersPage,
|
|
10431
10427
|
path: "/statistics/providers"
|
|
10432
10428
|
},
|
|
10429
|
+
{
|
|
10430
|
+
Component: PresetsPage,
|
|
10431
|
+
path: "/statistics/presets"
|
|
10432
|
+
},
|
|
10433
10433
|
{
|
|
10434
10434
|
Component: AlertLogsPage,
|
|
10435
10435
|
path: "/statistics/alerts/logs"
|
|
@@ -10459,15 +10459,15 @@ const menuItemModule = {
|
|
|
10459
10459
|
translationNs: void 0
|
|
10460
10460
|
},
|
|
10461
10461
|
{
|
|
10462
|
-
label: config$
|
|
10463
|
-
icon: config$
|
|
10462
|
+
label: config$2.label,
|
|
10463
|
+
icon: config$2.icon,
|
|
10464
10464
|
path: "/statistics/presets",
|
|
10465
10465
|
nested: void 0,
|
|
10466
10466
|
rank: void 0,
|
|
10467
10467
|
translationNs: void 0
|
|
10468
10468
|
},
|
|
10469
10469
|
{
|
|
10470
|
-
label: config$
|
|
10470
|
+
label: config$3.label,
|
|
10471
10471
|
icon: void 0,
|
|
10472
10472
|
path: "/statistics/providers",
|
|
10473
10473
|
nested: void 0,
|
package/README.md
CHANGED
|
@@ -66,16 +66,16 @@ The module can also be used out-of-the-box with pre-defined statistics providers
|
|
|
66
66
|
### Views
|
|
67
67
|
Views are collections of related statistics visualizations. They allow you to organize statistics in any way that suits your needs. Every chart in a view can display multiple statistical measurements, each based on a different statistic option.
|
|
68
68
|
|
|
69
|
-

|
|
70
70
|
|
|
71
71
|
### Options
|
|
72
72
|
Options are instances of statistics that are calculated with specific parameters. By changing an option's parameters, you can adjust the underlying statistic calculation.
|
|
73
73
|
|
|
74
|
-

|
|
75
75
|
|
|
76
76
|
When editing, options can also be configured in terms of their visualization (chart type, dimensions, etc.), cache settings and other parameters.
|
|
77
77
|
|
|
78
|
-

|
|
79
79
|
|
|
80
80
|
## Providers
|
|
81
81
|
|
|
@@ -202,7 +202,7 @@ Composite statistics allow one statistic option to use another option's output a
|
|
|
202
202
|
### Admin Usage
|
|
203
203
|
A stat option can be configured to receive another statistic's output by settings its value in the Dependecnies section when editing a stat instance in the admin dashboard.
|
|
204
204
|
|
|
205
|
-

|
|
206
206
|
|
|
207
207
|
### Using composite fields in providers
|
|
208
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "medusa-stats",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "The most flexible statistics plugin for the most flexible commerce platform.",
|
|
5
5
|
"author": "Maciej (https://github.com/tax1driver)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
"node": ">=20"
|
|
86
86
|
},
|
|
87
87
|
"packageManager": "yarn@4.12.0"
|
|
88
|
-
}
|
|
88
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|