@nice2dev/admin 0.1.0 → 1.0.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/CHANGELOG.md +32 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +123 -0
- package/dist/index.mjs +644 -423
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as I, useState as k, useMemo as $, useCallback as U, useContext as H, createContext as Y } from "react";
|
|
3
|
+
const z = I(function(v, g) {
|
|
4
4
|
const {
|
|
5
|
-
widgets:
|
|
6
|
-
columns:
|
|
7
|
-
title:
|
|
8
|
-
headerActions:
|
|
9
|
-
onWidgetClick:
|
|
10
|
-
className:
|
|
11
|
-
style:
|
|
12
|
-
} =
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */ e("h2", { children:
|
|
16
|
-
|
|
5
|
+
widgets: m,
|
|
6
|
+
columns: C = 4,
|
|
7
|
+
title: N = "Dashboard",
|
|
8
|
+
headerActions: b,
|
|
9
|
+
onWidgetClick: p,
|
|
10
|
+
className: f,
|
|
11
|
+
style: S
|
|
12
|
+
} = v;
|
|
13
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-dashboard ${f ?? ""}`, style: S, children: [
|
|
14
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-dashboard__header", children: [
|
|
15
|
+
/* @__PURE__ */ e("h2", { children: N }),
|
|
16
|
+
b && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__actions", children: b })
|
|
17
17
|
] }),
|
|
18
18
|
/* @__PURE__ */ e(
|
|
19
19
|
"div",
|
|
@@ -21,101 +21,101 @@ const P = D(function(S, k) {
|
|
|
21
21
|
className: "nice-admin-dashboard__grid",
|
|
22
22
|
style: {
|
|
23
23
|
display: "grid",
|
|
24
|
-
gridTemplateColumns: `repeat(${
|
|
24
|
+
gridTemplateColumns: `repeat(${C}, 1fr)`,
|
|
25
25
|
gap: 16
|
|
26
26
|
},
|
|
27
|
-
children:
|
|
27
|
+
children: m.map((r) => /* @__PURE__ */ t(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
|
-
className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${
|
|
30
|
+
className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${r.type}`,
|
|
31
31
|
style: {
|
|
32
|
-
gridColumn:
|
|
33
|
-
gridRow:
|
|
32
|
+
gridColumn: r.colSpan ? `span ${r.colSpan}` : void 0,
|
|
33
|
+
gridRow: r.rowSpan ? `span ${r.rowSpan}` : void 0
|
|
34
34
|
},
|
|
35
|
-
onClick: () =>
|
|
36
|
-
role:
|
|
37
|
-
tabIndex:
|
|
35
|
+
onClick: () => p == null ? void 0 : p(r),
|
|
36
|
+
role: p ? "button" : void 0,
|
|
37
|
+
tabIndex: p ? 0 : void 0,
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children:
|
|
39
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-dashboard__widget-header", children: [
|
|
40
|
+
r.icon && /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-icon", children: r.icon }),
|
|
41
|
+
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children: r.title })
|
|
42
42
|
] }),
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children:
|
|
45
|
-
|
|
43
|
+
r.type === "stat" && /* @__PURE__ */ t("div", { className: "nice-admin-dashboard__stat", children: [
|
|
44
|
+
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children: r.value }),
|
|
45
|
+
r.change && /* @__PURE__ */ e(
|
|
46
46
|
"span",
|
|
47
47
|
{
|
|
48
|
-
className: `nice-admin-dashboard__stat-change ${
|
|
49
|
-
children:
|
|
48
|
+
className: `nice-admin-dashboard__stat-change ${r.changePositive ? "nice-admin-dashboard__stat-change--positive" : "nice-admin-dashboard__stat-change--negative"}`,
|
|
49
|
+
children: r.change
|
|
50
50
|
}
|
|
51
51
|
)
|
|
52
52
|
] }),
|
|
53
|
-
|
|
54
|
-
(
|
|
53
|
+
r.type === "custom" && r.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__custom", children: r.render() }),
|
|
54
|
+
(r.type === "chart" || r.type === "table" || r.type === "list") && r.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__content", children: r.render() })
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
r.id
|
|
58
58
|
))
|
|
59
59
|
}
|
|
60
60
|
)
|
|
61
61
|
] });
|
|
62
|
-
}),
|
|
62
|
+
}), V = {
|
|
63
63
|
active: "#22c55e",
|
|
64
64
|
inactive: "#9ca3af",
|
|
65
65
|
suspended: "#ef4444",
|
|
66
66
|
pending: "#eab308"
|
|
67
|
-
},
|
|
67
|
+
}, Q = I(function(v, g) {
|
|
68
68
|
const {
|
|
69
|
-
users:
|
|
70
|
-
availableRoles:
|
|
71
|
-
onCreate:
|
|
72
|
-
onEdit:
|
|
73
|
-
onDelete:
|
|
74
|
-
onToggleStatus:
|
|
75
|
-
onChangeRoles:
|
|
76
|
-
searchable:
|
|
77
|
-
title:
|
|
78
|
-
className:
|
|
79
|
-
style:
|
|
80
|
-
} =
|
|
81
|
-
let
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
(
|
|
69
|
+
users: m,
|
|
70
|
+
availableRoles: C = [],
|
|
71
|
+
onCreate: N,
|
|
72
|
+
onEdit: b,
|
|
73
|
+
onDelete: p,
|
|
74
|
+
onToggleStatus: f,
|
|
75
|
+
onChangeRoles: S,
|
|
76
|
+
searchable: r = !0,
|
|
77
|
+
title: L = "User Management",
|
|
78
|
+
className: x,
|
|
79
|
+
style: _
|
|
80
|
+
} = v, [y, w] = k(""), [c, n] = k(""), l = $(() => {
|
|
81
|
+
let a = m;
|
|
82
|
+
if (c && (a = a.filter((u) => u.status === c)), y.trim()) {
|
|
83
|
+
const u = y.toLowerCase();
|
|
84
|
+
a = a.filter(
|
|
85
|
+
(E) => E.name.toLowerCase().includes(u) || E.email.toLowerCase().includes(u) || E.roles.some((T) => T.toLowerCase().includes(u))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
return
|
|
89
|
-
}, [
|
|
90
|
-
if (!
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */ e("h3", { children:
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
88
|
+
return a;
|
|
89
|
+
}, [m, c, y]), h = U((a) => {
|
|
90
|
+
if (!f) return;
|
|
91
|
+
const u = a.status === "active" ? "suspended" : "active";
|
|
92
|
+
f(a.id, u);
|
|
93
|
+
}, [f]);
|
|
94
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-users ${x ?? ""}`, style: _, children: [
|
|
95
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-users__header", children: [
|
|
96
|
+
/* @__PURE__ */ e("h3", { children: L }),
|
|
97
|
+
/* @__PURE__ */ t("span", { className: "nice-admin-users__count", children: [
|
|
98
|
+
m.length,
|
|
99
99
|
" users"
|
|
100
100
|
] }),
|
|
101
|
-
|
|
101
|
+
N && /* @__PURE__ */ e("button", { className: "nice-admin-users__create-btn", onClick: N, children: "+ Add User" })
|
|
102
102
|
] }),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
103
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-users__toolbar", children: [
|
|
104
|
+
r && /* @__PURE__ */ e(
|
|
105
105
|
"input",
|
|
106
106
|
{
|
|
107
107
|
type: "text",
|
|
108
|
-
value:
|
|
109
|
-
onChange: (
|
|
108
|
+
value: y,
|
|
109
|
+
onChange: (a) => w(a.target.value),
|
|
110
110
|
placeholder: "Search users…",
|
|
111
111
|
className: "nice-admin-users__search"
|
|
112
112
|
}
|
|
113
113
|
),
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ t(
|
|
115
115
|
"select",
|
|
116
116
|
{
|
|
117
|
-
value:
|
|
118
|
-
onChange: (
|
|
117
|
+
value: c,
|
|
118
|
+
onChange: (a) => n(a.target.value),
|
|
119
119
|
className: "nice-admin-users__status-filter",
|
|
120
120
|
children: [
|
|
121
121
|
/* @__PURE__ */ e("option", { value: "", children: "All statuses" }),
|
|
@@ -127,8 +127,8 @@ const P = D(function(S, k) {
|
|
|
127
127
|
}
|
|
128
128
|
)
|
|
129
129
|
] }),
|
|
130
|
-
|
|
131
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
130
|
+
l.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-users__empty", children: "No users found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-users__table", children: [
|
|
131
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
132
132
|
/* @__PURE__ */ e("th", { children: "User" }),
|
|
133
133
|
/* @__PURE__ */ e("th", { children: "Email" }),
|
|
134
134
|
/* @__PURE__ */ e("th", { children: "Roles" }),
|
|
@@ -137,177 +137,177 @@ const P = D(function(S, k) {
|
|
|
137
137
|
/* @__PURE__ */ e("th", { children: "Last Login" }),
|
|
138
138
|
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
139
139
|
] }) }),
|
|
140
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
|
|
143
|
-
/* @__PURE__ */ e("span", { children:
|
|
140
|
+
/* @__PURE__ */ e("tbody", { children: l.map((a) => /* @__PURE__ */ t("tr", { children: [
|
|
141
|
+
/* @__PURE__ */ t("td", { className: "nice-admin-users__user-cell", children: [
|
|
142
|
+
a.avatarUrl && /* @__PURE__ */ e("img", { src: a.avatarUrl, alt: "", className: "nice-admin-users__avatar" }),
|
|
143
|
+
/* @__PURE__ */ e("span", { children: a.name })
|
|
144
144
|
] }),
|
|
145
|
-
/* @__PURE__ */ e("td", { children:
|
|
146
|
-
/* @__PURE__ */ e("td", { children:
|
|
145
|
+
/* @__PURE__ */ e("td", { children: a.email }),
|
|
146
|
+
/* @__PURE__ */ e("td", { children: S ? /* @__PURE__ */ e(
|
|
147
147
|
"select",
|
|
148
148
|
{
|
|
149
149
|
multiple: !0,
|
|
150
|
-
value:
|
|
151
|
-
onChange: (
|
|
152
|
-
const
|
|
153
|
-
|
|
150
|
+
value: a.roles,
|
|
151
|
+
onChange: (u) => {
|
|
152
|
+
const E = Array.from(u.target.selectedOptions, (T) => T.value);
|
|
153
|
+
S(a.id, E);
|
|
154
154
|
},
|
|
155
155
|
className: "nice-admin-users__roles-select",
|
|
156
|
-
children:
|
|
156
|
+
children: C.map((u) => /* @__PURE__ */ e("option", { value: u, children: u }, u))
|
|
157
157
|
}
|
|
158
|
-
) :
|
|
158
|
+
) : a.roles.join(", ") }),
|
|
159
159
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
160
160
|
"span",
|
|
161
161
|
{
|
|
162
162
|
className: "nice-admin-users__status-badge",
|
|
163
|
-
style: { backgroundColor:
|
|
164
|
-
onClick: () =>
|
|
165
|
-
role:
|
|
166
|
-
children:
|
|
163
|
+
style: { backgroundColor: V[a.status] },
|
|
164
|
+
onClick: () => h(a),
|
|
165
|
+
role: f ? "button" : void 0,
|
|
166
|
+
children: a.status
|
|
167
167
|
}
|
|
168
168
|
) }),
|
|
169
|
-
/* @__PURE__ */ e("td", { children:
|
|
170
|
-
/* @__PURE__ */ e("td", { children:
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
/* @__PURE__ */ e("td", { children: a.createdAt }),
|
|
170
|
+
/* @__PURE__ */ e("td", { children: a.lastLoginAt ?? "—" }),
|
|
171
|
+
/* @__PURE__ */ t("td", { className: "nice-admin-users__actions", children: [
|
|
172
|
+
b && /* @__PURE__ */ e("button", { onClick: () => b(a), children: "Edit" }),
|
|
173
|
+
p && /* @__PURE__ */ e("button", { onClick: () => p(a.id), children: "Delete" })
|
|
174
174
|
] })
|
|
175
|
-
] },
|
|
175
|
+
] }, a.id)) })
|
|
176
176
|
] })
|
|
177
177
|
] });
|
|
178
|
-
}),
|
|
179
|
-
var
|
|
178
|
+
}), X = I(function(v, g) {
|
|
179
|
+
var o;
|
|
180
180
|
const {
|
|
181
|
-
roles:
|
|
182
|
-
actions:
|
|
183
|
-
resources:
|
|
184
|
-
onPermissionChange:
|
|
185
|
-
onCreate:
|
|
186
|
-
onDelete:
|
|
187
|
-
onRename:
|
|
188
|
-
title:
|
|
189
|
-
className:
|
|
190
|
-
style:
|
|
191
|
-
} =
|
|
192
|
-
!
|
|
193
|
-
}, [
|
|
194
|
-
var
|
|
195
|
-
return ((
|
|
181
|
+
roles: m,
|
|
182
|
+
actions: C,
|
|
183
|
+
resources: N,
|
|
184
|
+
onPermissionChange: b,
|
|
185
|
+
onCreate: p,
|
|
186
|
+
onDelete: f,
|
|
187
|
+
onRename: S,
|
|
188
|
+
title: r = "Role Management",
|
|
189
|
+
className: L,
|
|
190
|
+
style: x
|
|
191
|
+
} = v, [_, y] = k(((o = m[0]) == null ? void 0 : o.id) ?? null), [w, c] = k(!1), [n, l] = k(""), [h, a] = k(""), u = m.find((s) => s.id === _), E = U(() => {
|
|
192
|
+
!n.trim() || !p || (p(n.trim(), h.trim()), l(""), a(""), c(!1));
|
|
193
|
+
}, [n, h, p]), T = (s, d, i) => {
|
|
194
|
+
var A;
|
|
195
|
+
return ((A = s.permissions[d]) == null ? void 0 : A.includes(i)) ?? !1;
|
|
196
196
|
};
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */ e("h3", { children:
|
|
200
|
-
|
|
197
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-roles ${L ?? ""}`, style: x, children: [
|
|
198
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-roles__header", children: [
|
|
199
|
+
/* @__PURE__ */ e("h3", { children: r }),
|
|
200
|
+
p && /* @__PURE__ */ e("button", { onClick: () => c(!w), children: "+ New Role" })
|
|
201
201
|
] }),
|
|
202
|
-
|
|
203
|
-
/* @__PURE__ */ e("input", { type: "text", value:
|
|
204
|
-
/* @__PURE__ */ e("input", { type: "text", value:
|
|
205
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
206
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
202
|
+
w && /* @__PURE__ */ t("div", { className: "nice-admin-roles__create-form", children: [
|
|
203
|
+
/* @__PURE__ */ e("input", { type: "text", value: n, onChange: (s) => l(s.target.value), placeholder: "Role name" }),
|
|
204
|
+
/* @__PURE__ */ e("input", { type: "text", value: h, onChange: (s) => a(s.target.value), placeholder: "Description" }),
|
|
205
|
+
/* @__PURE__ */ e("button", { onClick: E, disabled: !n.trim(), children: "Create" }),
|
|
206
|
+
/* @__PURE__ */ e("button", { onClick: () => c(!1), children: "Cancel" })
|
|
207
207
|
] }),
|
|
208
|
-
/* @__PURE__ */ e("div", { className: "nice-admin-roles__tabs", children:
|
|
208
|
+
/* @__PURE__ */ e("div", { className: "nice-admin-roles__tabs", children: m.map((s) => /* @__PURE__ */ t(
|
|
209
209
|
"button",
|
|
210
210
|
{
|
|
211
|
-
className: `nice-admin-roles__tab ${
|
|
212
|
-
onClick: () =>
|
|
213
|
-
style:
|
|
211
|
+
className: `nice-admin-roles__tab ${s.id === _ ? "nice-admin-roles__tab--active" : ""}`,
|
|
212
|
+
onClick: () => y(s.id),
|
|
213
|
+
style: s.color ? { borderColor: s.color } : void 0,
|
|
214
214
|
children: [
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
s.name,
|
|
216
|
+
s.userCount != null && /* @__PURE__ */ t("span", { className: "nice-admin-roles__tab-count", children: [
|
|
217
217
|
"(",
|
|
218
|
-
|
|
218
|
+
s.userCount,
|
|
219
219
|
")"
|
|
220
220
|
] }),
|
|
221
|
-
|
|
221
|
+
s.isSystem && /* @__PURE__ */ e("span", { className: "nice-admin-roles__tab-system", children: "🔒" })
|
|
222
222
|
]
|
|
223
223
|
},
|
|
224
|
-
|
|
224
|
+
s.id
|
|
225
225
|
)) }),
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
226
|
+
u && /* @__PURE__ */ t("div", { className: "nice-admin-roles__matrix-wrap", children: [
|
|
227
|
+
u.description && /* @__PURE__ */ e("p", { className: "nice-admin-roles__description", children: u.description }),
|
|
228
|
+
/* @__PURE__ */ t("table", { className: "nice-admin-roles__matrix", children: [
|
|
229
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
230
230
|
/* @__PURE__ */ e("th", { children: "Resource" }),
|
|
231
|
-
|
|
231
|
+
C.map((s) => /* @__PURE__ */ e("th", { title: s.description, children: s.label }, s.id))
|
|
232
232
|
] }) }),
|
|
233
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
234
|
-
/* @__PURE__ */ e("td", { children:
|
|
235
|
-
|
|
236
|
-
const
|
|
233
|
+
/* @__PURE__ */ e("tbody", { children: N.map((s) => /* @__PURE__ */ t("tr", { children: [
|
|
234
|
+
/* @__PURE__ */ e("td", { children: s.label }),
|
|
235
|
+
C.map((d) => {
|
|
236
|
+
const i = T(u, s.id, d.id);
|
|
237
237
|
return /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
238
238
|
"input",
|
|
239
239
|
{
|
|
240
240
|
type: "checkbox",
|
|
241
|
-
checked:
|
|
242
|
-
onChange: () =>
|
|
243
|
-
disabled:
|
|
241
|
+
checked: i,
|
|
242
|
+
onChange: () => b == null ? void 0 : b(u.id, s.id, d.id, !i),
|
|
243
|
+
disabled: u.isSystem
|
|
244
244
|
}
|
|
245
|
-
) },
|
|
245
|
+
) }, d.id);
|
|
246
246
|
})
|
|
247
|
-
] },
|
|
247
|
+
] }, s.id)) })
|
|
248
248
|
] }),
|
|
249
|
-
!
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
249
|
+
!u.isSystem && /* @__PURE__ */ t("div", { className: "nice-admin-roles__role-actions", children: [
|
|
250
|
+
S && /* @__PURE__ */ e("button", { onClick: () => {
|
|
251
|
+
const s = prompt("New role name:", u.name);
|
|
252
|
+
s && S(u.id, s);
|
|
253
253
|
}, children: "Rename" }),
|
|
254
|
-
|
|
254
|
+
f && /* @__PURE__ */ e("button", { onClick: () => f(u.id), children: "Delete Role" })
|
|
255
255
|
] })
|
|
256
256
|
] })
|
|
257
257
|
] });
|
|
258
|
-
}),
|
|
258
|
+
}), K = {
|
|
259
259
|
info: { color: "#3b82f6", label: "INFO" },
|
|
260
260
|
warning: { color: "#eab308", label: "WARN" },
|
|
261
261
|
error: { color: "#ef4444", label: "ERROR" },
|
|
262
262
|
critical: { color: "#dc2626", label: "CRIT" }
|
|
263
|
-
},
|
|
263
|
+
}, Z = I(function(v, g) {
|
|
264
264
|
const {
|
|
265
|
-
entries:
|
|
266
|
-
onEntryClick:
|
|
267
|
-
onLoadMore:
|
|
268
|
-
hasMore:
|
|
269
|
-
searchable:
|
|
270
|
-
showSeverityFilter:
|
|
271
|
-
title:
|
|
272
|
-
className:
|
|
273
|
-
style:
|
|
274
|
-
} =
|
|
275
|
-
let
|
|
276
|
-
if (
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
(
|
|
280
|
-
var
|
|
281
|
-
return
|
|
265
|
+
entries: m,
|
|
266
|
+
onEntryClick: C,
|
|
267
|
+
onLoadMore: N,
|
|
268
|
+
hasMore: b = !1,
|
|
269
|
+
searchable: p = !0,
|
|
270
|
+
showSeverityFilter: f = !0,
|
|
271
|
+
title: S = "Audit Log",
|
|
272
|
+
className: r,
|
|
273
|
+
style: L
|
|
274
|
+
} = v, [x, _] = k(""), [y, w] = k(""), c = $(() => {
|
|
275
|
+
let n = m;
|
|
276
|
+
if (y && (n = n.filter((l) => l.severity === y)), x.trim()) {
|
|
277
|
+
const l = x.toLowerCase();
|
|
278
|
+
n = n.filter(
|
|
279
|
+
(h) => {
|
|
280
|
+
var a;
|
|
281
|
+
return h.actorName.toLowerCase().includes(l) || h.action.toLowerCase().includes(l) || h.resource.toLowerCase().includes(l) || ((a = h.details) == null ? void 0 : a.toLowerCase().includes(l));
|
|
282
282
|
}
|
|
283
283
|
);
|
|
284
284
|
}
|
|
285
|
-
return
|
|
286
|
-
}, [
|
|
287
|
-
return /* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */ e("h3", { children:
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
|
|
285
|
+
return n;
|
|
286
|
+
}, [m, y, x]);
|
|
287
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-audit-log ${r ?? ""}`, style: L, children: [
|
|
288
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-audit-log__header", children: [
|
|
289
|
+
/* @__PURE__ */ e("h3", { children: S }),
|
|
290
|
+
/* @__PURE__ */ t("span", { className: "nice-admin-audit-log__count", children: [
|
|
291
|
+
m.length,
|
|
292
292
|
" entries"
|
|
293
293
|
] })
|
|
294
294
|
] }),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
295
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-audit-log__toolbar", children: [
|
|
296
|
+
p && /* @__PURE__ */ e(
|
|
297
297
|
"input",
|
|
298
298
|
{
|
|
299
299
|
type: "text",
|
|
300
|
-
value:
|
|
301
|
-
onChange: (
|
|
300
|
+
value: x,
|
|
301
|
+
onChange: (n) => _(n.target.value),
|
|
302
302
|
placeholder: "Search audit log…",
|
|
303
303
|
className: "nice-admin-audit-log__search"
|
|
304
304
|
}
|
|
305
305
|
),
|
|
306
|
-
|
|
306
|
+
f && /* @__PURE__ */ t(
|
|
307
307
|
"select",
|
|
308
308
|
{
|
|
309
|
-
value:
|
|
310
|
-
onChange: (
|
|
309
|
+
value: y,
|
|
310
|
+
onChange: (n) => w(n.target.value),
|
|
311
311
|
className: "nice-admin-audit-log__severity-filter",
|
|
312
312
|
children: [
|
|
313
313
|
/* @__PURE__ */ e("option", { value: "", children: "All severities" }),
|
|
@@ -319,8 +319,8 @@ const P = D(function(S, k) {
|
|
|
319
319
|
}
|
|
320
320
|
)
|
|
321
321
|
] }),
|
|
322
|
-
|
|
323
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
322
|
+
c.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-audit-log__empty", children: "No audit log entries found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-audit-log__table", children: [
|
|
323
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
324
324
|
/* @__PURE__ */ e("th", { children: "Timestamp" }),
|
|
325
325
|
/* @__PURE__ */ e("th", { children: "Severity" }),
|
|
326
326
|
/* @__PURE__ */ e("th", { children: "Actor" }),
|
|
@@ -329,90 +329,90 @@ const P = D(function(S, k) {
|
|
|
329
329
|
/* @__PURE__ */ e("th", { children: "IP" }),
|
|
330
330
|
/* @__PURE__ */ e("th", { children: "Details" })
|
|
331
331
|
] }) }),
|
|
332
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
333
|
-
const
|
|
334
|
-
return /* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ e("tbody", { children: c.map((n) => {
|
|
333
|
+
const l = K[n.severity];
|
|
334
|
+
return /* @__PURE__ */ t(
|
|
335
335
|
"tr",
|
|
336
336
|
{
|
|
337
337
|
className: "nice-admin-audit-log__row",
|
|
338
|
-
onClick: () =>
|
|
339
|
-
role:
|
|
340
|
-
tabIndex:
|
|
338
|
+
onClick: () => C == null ? void 0 : C(n),
|
|
339
|
+
role: C ? "button" : void 0,
|
|
340
|
+
tabIndex: C ? 0 : void 0,
|
|
341
341
|
children: [
|
|
342
|
-
/* @__PURE__ */ e("td", { children:
|
|
343
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: "nice-admin-audit-log__severity", style: { color:
|
|
344
|
-
/* @__PURE__ */ e("td", { children:
|
|
345
|
-
/* @__PURE__ */ e("td", { children:
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
|
|
348
|
-
|
|
342
|
+
/* @__PURE__ */ e("td", { children: n.timestamp }),
|
|
343
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: "nice-admin-audit-log__severity", style: { color: l.color }, children: l.label }) }),
|
|
344
|
+
/* @__PURE__ */ e("td", { children: n.actorName }),
|
|
345
|
+
/* @__PURE__ */ e("td", { children: n.action }),
|
|
346
|
+
/* @__PURE__ */ t("td", { children: [
|
|
347
|
+
n.resource,
|
|
348
|
+
n.resourceId ? ` #${n.resourceId}` : ""
|
|
349
349
|
] }),
|
|
350
|
-
/* @__PURE__ */ e("td", { children:
|
|
351
|
-
/* @__PURE__ */ e("td", { className: "nice-admin-audit-log__details", children:
|
|
350
|
+
/* @__PURE__ */ e("td", { children: n.ipAddress ?? "—" }),
|
|
351
|
+
/* @__PURE__ */ e("td", { className: "nice-admin-audit-log__details", children: n.details ?? "—" })
|
|
352
352
|
]
|
|
353
353
|
},
|
|
354
|
-
|
|
354
|
+
n.id
|
|
355
355
|
);
|
|
356
356
|
}) })
|
|
357
357
|
] }),
|
|
358
|
-
|
|
358
|
+
b && N && /* @__PURE__ */ e("button", { className: "nice-admin-audit-log__load-more", onClick: N, children: "Load more" })
|
|
359
359
|
] });
|
|
360
|
-
}),
|
|
360
|
+
}), j = I(function(v, g) {
|
|
361
361
|
const {
|
|
362
|
-
settings:
|
|
363
|
-
onSave:
|
|
364
|
-
onChange:
|
|
365
|
-
onReset:
|
|
366
|
-
saving:
|
|
367
|
-
title:
|
|
368
|
-
className:
|
|
369
|
-
style:
|
|
370
|
-
} =
|
|
371
|
-
const
|
|
372
|
-
for (const
|
|
373
|
-
return
|
|
374
|
-
}),
|
|
375
|
-
|
|
376
|
-
}, [
|
|
377
|
-
|
|
378
|
-
}, [
|
|
379
|
-
for (const
|
|
380
|
-
const
|
|
381
|
-
|
|
362
|
+
settings: m,
|
|
363
|
+
onSave: C,
|
|
364
|
+
onChange: N,
|
|
365
|
+
onReset: b,
|
|
366
|
+
saving: p = !1,
|
|
367
|
+
title: f = "Settings",
|
|
368
|
+
className: S,
|
|
369
|
+
style: r
|
|
370
|
+
} = v, [L, x] = k(() => {
|
|
371
|
+
const n = {};
|
|
372
|
+
for (const l of m) n[l.key] = l.value;
|
|
373
|
+
return n;
|
|
374
|
+
}), _ = U((n, l) => {
|
|
375
|
+
x((h) => ({ ...h, [n]: l })), N == null || N(n, l);
|
|
376
|
+
}, [N]), y = U(() => {
|
|
377
|
+
C == null || C(L);
|
|
378
|
+
}, [C, L]), w = /* @__PURE__ */ new Map();
|
|
379
|
+
for (const n of m) {
|
|
380
|
+
const l = n.section ?? "General";
|
|
381
|
+
w.has(l) || w.set(l, []), w.get(l).push(n);
|
|
382
382
|
}
|
|
383
|
-
const
|
|
384
|
-
var
|
|
385
|
-
const
|
|
386
|
-
switch (
|
|
383
|
+
const c = (n) => {
|
|
384
|
+
var h;
|
|
385
|
+
const l = L[n.key];
|
|
386
|
+
switch (n.type) {
|
|
387
387
|
case "boolean":
|
|
388
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ t("label", { className: "nice-admin-settings__toggle", children: [
|
|
389
389
|
/* @__PURE__ */ e(
|
|
390
390
|
"input",
|
|
391
391
|
{
|
|
392
392
|
type: "checkbox",
|
|
393
|
-
checked: !!
|
|
394
|
-
onChange: (
|
|
393
|
+
checked: !!l,
|
|
394
|
+
onChange: (a) => _(n.key, a.target.checked)
|
|
395
395
|
}
|
|
396
396
|
),
|
|
397
|
-
|
|
397
|
+
n.label
|
|
398
398
|
] });
|
|
399
399
|
case "select":
|
|
400
400
|
return /* @__PURE__ */ e(
|
|
401
401
|
"select",
|
|
402
402
|
{
|
|
403
|
-
value: String(
|
|
404
|
-
onChange: (
|
|
403
|
+
value: String(l ?? ""),
|
|
404
|
+
onChange: (a) => _(n.key, a.target.value),
|
|
405
405
|
className: "nice-admin-settings__select",
|
|
406
|
-
children: (
|
|
406
|
+
children: (h = n.options) == null ? void 0 : h.map((a) => /* @__PURE__ */ e("option", { value: a.value, children: a.label }, a.value))
|
|
407
407
|
}
|
|
408
408
|
);
|
|
409
409
|
case "textarea":
|
|
410
410
|
return /* @__PURE__ */ e(
|
|
411
411
|
"textarea",
|
|
412
412
|
{
|
|
413
|
-
value: String(
|
|
414
|
-
onChange: (
|
|
415
|
-
placeholder:
|
|
413
|
+
value: String(l ?? ""),
|
|
414
|
+
onChange: (a) => _(n.key, a.target.value),
|
|
415
|
+
placeholder: n.placeholder,
|
|
416
416
|
className: "nice-admin-settings__textarea",
|
|
417
417
|
rows: 4
|
|
418
418
|
}
|
|
@@ -422,9 +422,9 @@ const P = D(function(S, k) {
|
|
|
422
422
|
"input",
|
|
423
423
|
{
|
|
424
424
|
type: "number",
|
|
425
|
-
value:
|
|
426
|
-
onChange: (
|
|
427
|
-
placeholder:
|
|
425
|
+
value: l != null ? Number(l) : "",
|
|
426
|
+
onChange: (a) => _(n.key, parseFloat(a.target.value) || 0),
|
|
427
|
+
placeholder: n.placeholder,
|
|
428
428
|
className: "nice-admin-settings__input"
|
|
429
429
|
}
|
|
430
430
|
);
|
|
@@ -433,8 +433,8 @@ const P = D(function(S, k) {
|
|
|
433
433
|
"input",
|
|
434
434
|
{
|
|
435
435
|
type: "color",
|
|
436
|
-
value: String(
|
|
437
|
-
onChange: (
|
|
436
|
+
value: String(l ?? "#000000"),
|
|
437
|
+
onChange: (a) => _(n.key, a.target.value),
|
|
438
438
|
className: "nice-admin-settings__color"
|
|
439
439
|
}
|
|
440
440
|
);
|
|
@@ -443,9 +443,9 @@ const P = D(function(S, k) {
|
|
|
443
443
|
"input",
|
|
444
444
|
{
|
|
445
445
|
type: "password",
|
|
446
|
-
value: String(
|
|
447
|
-
onChange: (
|
|
448
|
-
placeholder:
|
|
446
|
+
value: String(l ?? ""),
|
|
447
|
+
onChange: (a) => _(n.key, a.target.value),
|
|
448
|
+
placeholder: n.placeholder,
|
|
449
449
|
className: "nice-admin-settings__input",
|
|
450
450
|
autoComplete: "new-password"
|
|
451
451
|
}
|
|
@@ -455,71 +455,71 @@ const P = D(function(S, k) {
|
|
|
455
455
|
"input",
|
|
456
456
|
{
|
|
457
457
|
type: "text",
|
|
458
|
-
value: String(
|
|
459
|
-
onChange: (
|
|
460
|
-
placeholder:
|
|
458
|
+
value: String(l ?? ""),
|
|
459
|
+
onChange: (a) => _(n.key, a.target.value),
|
|
460
|
+
placeholder: n.placeholder,
|
|
461
461
|
className: "nice-admin-settings__input"
|
|
462
462
|
}
|
|
463
463
|
);
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
|
-
return /* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children:
|
|
468
|
-
Array.from(
|
|
469
|
-
/* @__PURE__ */ e("legend", { children:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
466
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-settings ${S ?? ""}`, style: r, children: [
|
|
467
|
+
/* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children: f }) }),
|
|
468
|
+
Array.from(w.entries()).map(([n, l]) => /* @__PURE__ */ t("fieldset", { className: "nice-admin-settings__section", children: [
|
|
469
|
+
/* @__PURE__ */ e("legend", { children: n }),
|
|
470
|
+
l.map((h) => /* @__PURE__ */ t("div", { className: "nice-admin-settings__field", children: [
|
|
471
|
+
h.type !== "boolean" && /* @__PURE__ */ t("label", { className: "nice-admin-settings__label", children: [
|
|
472
|
+
h.label,
|
|
473
|
+
h.required && /* @__PURE__ */ e("span", { className: "nice-admin-settings__required", children: "*" })
|
|
474
474
|
] }),
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
] },
|
|
478
|
-
] },
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick:
|
|
481
|
-
|
|
475
|
+
h.description && /* @__PURE__ */ e("p", { className: "nice-admin-settings__description", children: h.description }),
|
|
476
|
+
c(h)
|
|
477
|
+
] }, h.key))
|
|
478
|
+
] }, n)),
|
|
479
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-settings__actions", children: [
|
|
480
|
+
/* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick: y, disabled: p, children: p ? "Saving…" : "Save Settings" }),
|
|
481
|
+
b && /* @__PURE__ */ e("button", { className: "nice-admin-settings__reset-btn", onClick: b, children: "Reset to Defaults" })
|
|
482
482
|
] })
|
|
483
483
|
] });
|
|
484
|
-
}),
|
|
484
|
+
}), ee = I(function(v, g) {
|
|
485
485
|
const {
|
|
486
|
-
notifications:
|
|
487
|
-
availableChannels:
|
|
488
|
-
onToggle:
|
|
489
|
-
onEdit:
|
|
490
|
-
onTest:
|
|
491
|
-
onCreate:
|
|
492
|
-
onDelete:
|
|
493
|
-
title:
|
|
494
|
-
className:
|
|
495
|
-
style:
|
|
496
|
-
} =
|
|
497
|
-
if (!
|
|
498
|
-
const
|
|
499
|
-
return
|
|
500
|
-
(
|
|
501
|
-
var
|
|
502
|
-
return
|
|
486
|
+
notifications: m,
|
|
487
|
+
availableChannels: C = ["email", "push", "sms", "in-app", "webhook"],
|
|
488
|
+
onToggle: N,
|
|
489
|
+
onEdit: b,
|
|
490
|
+
onTest: p,
|
|
491
|
+
onCreate: f,
|
|
492
|
+
onDelete: S,
|
|
493
|
+
title: r = "Notification Management",
|
|
494
|
+
className: L,
|
|
495
|
+
style: x
|
|
496
|
+
} = v, [_, y] = k(""), w = $(() => {
|
|
497
|
+
if (!_.trim()) return m;
|
|
498
|
+
const c = _.toLowerCase();
|
|
499
|
+
return m.filter(
|
|
500
|
+
(n) => {
|
|
501
|
+
var l;
|
|
502
|
+
return n.name.toLowerCase().includes(c) || n.event.toLowerCase().includes(c) || ((l = n.description) == null ? void 0 : l.toLowerCase().includes(c));
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
|
-
}, [
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */ e("h3", { children:
|
|
509
|
-
|
|
505
|
+
}, [m, _]);
|
|
506
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-notifications ${L ?? ""}`, style: x, children: [
|
|
507
|
+
/* @__PURE__ */ t("div", { className: "nice-admin-notifications__header", children: [
|
|
508
|
+
/* @__PURE__ */ e("h3", { children: r }),
|
|
509
|
+
f && /* @__PURE__ */ e("button", { onClick: f, children: "+ New Notification" })
|
|
510
510
|
] }),
|
|
511
511
|
/* @__PURE__ */ e(
|
|
512
512
|
"input",
|
|
513
513
|
{
|
|
514
514
|
type: "text",
|
|
515
|
-
value:
|
|
516
|
-
onChange: (
|
|
515
|
+
value: _,
|
|
516
|
+
onChange: (c) => y(c.target.value),
|
|
517
517
|
placeholder: "Search notifications…",
|
|
518
518
|
className: "nice-admin-notifications__search"
|
|
519
519
|
}
|
|
520
520
|
),
|
|
521
|
-
|
|
522
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
521
|
+
w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-notifications__empty", children: "No notifications found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-notifications__table", children: [
|
|
522
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
523
523
|
/* @__PURE__ */ e("th", { children: "Enabled" }),
|
|
524
524
|
/* @__PURE__ */ e("th", { children: "Name" }),
|
|
525
525
|
/* @__PURE__ */ e("th", { children: "Event" }),
|
|
@@ -528,203 +528,203 @@ const P = D(function(S, k) {
|
|
|
528
528
|
/* @__PURE__ */ e("th", { children: "Sent" }),
|
|
529
529
|
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
530
530
|
] }) }),
|
|
531
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
531
|
+
/* @__PURE__ */ e("tbody", { children: w.map((c) => /* @__PURE__ */ t("tr", { children: [
|
|
532
532
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
533
533
|
"input",
|
|
534
534
|
{
|
|
535
535
|
type: "checkbox",
|
|
536
|
-
checked:
|
|
537
|
-
onChange: () =>
|
|
536
|
+
checked: c.enabled,
|
|
537
|
+
onChange: () => N == null ? void 0 : N(c.id, !c.enabled)
|
|
538
538
|
}
|
|
539
539
|
) }),
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */ e("strong", { children:
|
|
542
|
-
|
|
543
|
-
|
|
540
|
+
/* @__PURE__ */ t("td", { children: [
|
|
541
|
+
/* @__PURE__ */ e("strong", { children: c.name }),
|
|
542
|
+
c.description && /* @__PURE__ */ e("br", {}),
|
|
543
|
+
c.description && /* @__PURE__ */ e("small", { children: c.description })
|
|
544
544
|
] }),
|
|
545
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children:
|
|
546
|
-
/* @__PURE__ */ e("td", { children:
|
|
547
|
-
/* @__PURE__ */ e("td", { children:
|
|
548
|
-
/* @__PURE__ */ e("td", { children:
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
545
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: c.event }) }),
|
|
546
|
+
/* @__PURE__ */ e("td", { children: c.channels.join(", ") }),
|
|
547
|
+
/* @__PURE__ */ e("td", { children: c.lastSentAt ?? "—" }),
|
|
548
|
+
/* @__PURE__ */ e("td", { children: c.sentCount ?? 0 }),
|
|
549
|
+
/* @__PURE__ */ t("td", { className: "nice-admin-notifications__actions", children: [
|
|
550
|
+
b && /* @__PURE__ */ e("button", { onClick: () => b(c), children: "Edit" }),
|
|
551
|
+
p && /* @__PURE__ */ e("button", { onClick: () => p(c.id), children: "Test" }),
|
|
552
|
+
S && /* @__PURE__ */ e("button", { onClick: () => S(c.id), children: "Delete" })
|
|
553
553
|
] })
|
|
554
|
-
] },
|
|
554
|
+
] }, c.id)) })
|
|
555
555
|
] })
|
|
556
556
|
] });
|
|
557
|
-
}),
|
|
557
|
+
}), te = I(function(v, g) {
|
|
558
558
|
const {
|
|
559
|
-
flags:
|
|
560
|
-
environmentNames:
|
|
561
|
-
onToggle:
|
|
562
|
-
onPercentageChange:
|
|
563
|
-
onCreate:
|
|
564
|
-
onDelete:
|
|
565
|
-
onEdit:
|
|
566
|
-
title:
|
|
567
|
-
className:
|
|
568
|
-
style:
|
|
569
|
-
} =
|
|
570
|
-
if (!
|
|
571
|
-
const
|
|
572
|
-
return
|
|
573
|
-
(
|
|
574
|
-
var
|
|
575
|
-
return
|
|
559
|
+
flags: m,
|
|
560
|
+
environmentNames: C = ["development", "staging", "production"],
|
|
561
|
+
onToggle: N,
|
|
562
|
+
onPercentageChange: b,
|
|
563
|
+
onCreate: p,
|
|
564
|
+
onDelete: f,
|
|
565
|
+
onEdit: S,
|
|
566
|
+
title: r = "Feature Flags",
|
|
567
|
+
className: L,
|
|
568
|
+
style: x
|
|
569
|
+
} = v, [_, y] = k(""), [w, c] = k(!1), [n, l] = k(""), [h, a] = k(""), [u, E] = k(""), T = $(() => {
|
|
570
|
+
if (!_.trim()) return m;
|
|
571
|
+
const d = _.toLowerCase();
|
|
572
|
+
return m.filter(
|
|
573
|
+
(i) => {
|
|
574
|
+
var A, F;
|
|
575
|
+
return i.key.toLowerCase().includes(d) || i.name.toLowerCase().includes(d) || ((A = i.description) == null ? void 0 : A.toLowerCase().includes(d)) || ((F = i.tags) == null ? void 0 : F.some((D) => D.toLowerCase().includes(d)));
|
|
576
576
|
}
|
|
577
577
|
);
|
|
578
|
-
}, [
|
|
579
|
-
!
|
|
580
|
-
}, [
|
|
581
|
-
return /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */ e("h3", { children:
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
|
|
578
|
+
}, [m, _]), o = U(() => {
|
|
579
|
+
!n.trim() || !h.trim() || !p || (p(n.trim(), h.trim(), u.trim()), l(""), a(""), E(""), c(!1));
|
|
580
|
+
}, [n, h, u, p]), s = (d, i) => d.environments.find((A) => A.name === i);
|
|
581
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-feature-flags ${L ?? ""}`, style: x, children: [
|
|
582
|
+
/* @__PURE__ */ t("div", { className: "nice-feature-flags__header", children: [
|
|
583
|
+
/* @__PURE__ */ e("h3", { children: r }),
|
|
584
|
+
/* @__PURE__ */ t("span", { className: "nice-feature-flags__count", children: [
|
|
585
|
+
m.length,
|
|
586
586
|
" flags"
|
|
587
587
|
] }),
|
|
588
|
-
|
|
588
|
+
p && /* @__PURE__ */ e("button", { onClick: () => c(!w), children: "+ New Flag" })
|
|
589
589
|
] }),
|
|
590
|
-
|
|
591
|
-
/* @__PURE__ */ e("input", { type: "text", value:
|
|
592
|
-
/* @__PURE__ */ e("input", { type: "text", value:
|
|
593
|
-
/* @__PURE__ */ e("input", { type: "text", value:
|
|
594
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
595
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
590
|
+
w && /* @__PURE__ */ t("div", { className: "nice-feature-flags__create-form", children: [
|
|
591
|
+
/* @__PURE__ */ e("input", { type: "text", value: n, onChange: (d) => l(d.target.value), placeholder: "flag_key" }),
|
|
592
|
+
/* @__PURE__ */ e("input", { type: "text", value: h, onChange: (d) => a(d.target.value), placeholder: "Display name" }),
|
|
593
|
+
/* @__PURE__ */ e("input", { type: "text", value: u, onChange: (d) => E(d.target.value), placeholder: "Description" }),
|
|
594
|
+
/* @__PURE__ */ e("button", { onClick: o, disabled: !n.trim() || !h.trim(), children: "Create" }),
|
|
595
|
+
/* @__PURE__ */ e("button", { onClick: () => c(!1), children: "Cancel" })
|
|
596
596
|
] }),
|
|
597
597
|
/* @__PURE__ */ e(
|
|
598
598
|
"input",
|
|
599
599
|
{
|
|
600
600
|
type: "text",
|
|
601
|
-
value:
|
|
602
|
-
onChange: (
|
|
601
|
+
value: _,
|
|
602
|
+
onChange: (d) => y(d.target.value),
|
|
603
603
|
placeholder: "Search flags…",
|
|
604
604
|
className: "nice-feature-flags__search"
|
|
605
605
|
}
|
|
606
606
|
),
|
|
607
|
-
|
|
608
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
607
|
+
T.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-feature-flags__empty", children: "No feature flags found." }) : /* @__PURE__ */ t("table", { className: "nice-feature-flags__table", children: [
|
|
608
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
609
609
|
/* @__PURE__ */ e("th", { children: "Flag" }),
|
|
610
|
-
|
|
610
|
+
C.map((d) => /* @__PURE__ */ e("th", { children: d }, d)),
|
|
611
611
|
/* @__PURE__ */ e("th", { children: "Tags" }),
|
|
612
612
|
/* @__PURE__ */ e("th", { children: "Updated" }),
|
|
613
613
|
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
614
614
|
] }) }),
|
|
615
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
616
|
-
var
|
|
617
|
-
return /* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */ e("strong", { children:
|
|
620
|
-
/* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children:
|
|
621
|
-
|
|
615
|
+
/* @__PURE__ */ e("tbody", { children: T.map((d) => {
|
|
616
|
+
var i;
|
|
617
|
+
return /* @__PURE__ */ t("tr", { children: [
|
|
618
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("div", { className: "nice-feature-flags__flag-info", children: [
|
|
619
|
+
/* @__PURE__ */ e("strong", { children: d.name }),
|
|
620
|
+
/* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children: d.key }),
|
|
621
|
+
d.description && /* @__PURE__ */ e("small", { children: d.description })
|
|
622
622
|
] }) }),
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
return /* @__PURE__ */
|
|
623
|
+
C.map((A) => {
|
|
624
|
+
const F = s(d, A);
|
|
625
|
+
return /* @__PURE__ */ t("td", { className: "nice-feature-flags__env-cell", children: [
|
|
626
626
|
/* @__PURE__ */ e(
|
|
627
627
|
"input",
|
|
628
628
|
{
|
|
629
629
|
type: "checkbox",
|
|
630
|
-
checked: (
|
|
631
|
-
onChange: () =>
|
|
630
|
+
checked: (F == null ? void 0 : F.enabled) ?? !1,
|
|
631
|
+
onChange: () => N == null ? void 0 : N(d.id, A, !((F == null ? void 0 : F.enabled) ?? !1))
|
|
632
632
|
}
|
|
633
633
|
),
|
|
634
|
-
(
|
|
634
|
+
(F == null ? void 0 : F.percentage) != null && /* @__PURE__ */ e(
|
|
635
635
|
"input",
|
|
636
636
|
{
|
|
637
637
|
type: "number",
|
|
638
638
|
min: 0,
|
|
639
639
|
max: 100,
|
|
640
|
-
value:
|
|
641
|
-
onChange: (
|
|
640
|
+
value: F.percentage,
|
|
641
|
+
onChange: (D) => b == null ? void 0 : b(d.id, A, parseInt(D.target.value, 10) || 0),
|
|
642
642
|
className: "nice-feature-flags__percentage",
|
|
643
643
|
title: "Rollout %"
|
|
644
644
|
}
|
|
645
645
|
)
|
|
646
|
-
] },
|
|
646
|
+
] }, A);
|
|
647
647
|
}),
|
|
648
|
-
/* @__PURE__ */ e("td", { children: ((
|
|
649
|
-
/* @__PURE__ */ e("td", { children:
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
|
|
652
|
-
|
|
648
|
+
/* @__PURE__ */ e("td", { children: ((i = d.tags) == null ? void 0 : i.join(", ")) || "—" }),
|
|
649
|
+
/* @__PURE__ */ e("td", { children: d.updatedAt ?? d.createdAt }),
|
|
650
|
+
/* @__PURE__ */ t("td", { className: "nice-feature-flags__actions", children: [
|
|
651
|
+
S && /* @__PURE__ */ e("button", { onClick: () => S(d), children: "Edit" }),
|
|
652
|
+
f && /* @__PURE__ */ e("button", { onClick: () => f(d.id), children: "Delete" })
|
|
653
653
|
] })
|
|
654
|
-
] },
|
|
654
|
+
] }, d.id);
|
|
655
655
|
}) })
|
|
656
656
|
] })
|
|
657
657
|
] });
|
|
658
|
-
}),
|
|
659
|
-
var
|
|
658
|
+
}), ne = I(function(v, g) {
|
|
659
|
+
var T;
|
|
660
660
|
const {
|
|
661
|
-
entities:
|
|
662
|
-
formats:
|
|
663
|
-
jobs:
|
|
664
|
-
onImport:
|
|
665
|
-
onExport:
|
|
666
|
-
onDownload:
|
|
667
|
-
title:
|
|
668
|
-
className:
|
|
669
|
-
style:
|
|
670
|
-
} =
|
|
671
|
-
!
|
|
672
|
-
}, [
|
|
673
|
-
!
|
|
674
|
-
}, [
|
|
675
|
-
var
|
|
676
|
-
|
|
661
|
+
entities: m,
|
|
662
|
+
formats: C = ["json", "csv", "xlsx"],
|
|
663
|
+
jobs: N = [],
|
|
664
|
+
onImport: b,
|
|
665
|
+
onExport: p,
|
|
666
|
+
onDownload: f,
|
|
667
|
+
title: S = "Import / Export",
|
|
668
|
+
className: r,
|
|
669
|
+
style: L
|
|
670
|
+
} = v, [x, _] = k("export"), [y, w] = k(((T = m[0]) == null ? void 0 : T.id) ?? ""), [c, n] = k(C[0] ?? "json"), [l, h] = k(null), a = U(() => {
|
|
671
|
+
!b || !l || !y || (b(y, c, l), h(null));
|
|
672
|
+
}, [b, y, c, l]), u = U(() => {
|
|
673
|
+
!p || !y || p(y, c);
|
|
674
|
+
}, [p, y, c]), E = (o) => {
|
|
675
|
+
var s;
|
|
676
|
+
h(((s = o.target.files) == null ? void 0 : s[0]) ?? null);
|
|
677
677
|
};
|
|
678
|
-
return /* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children:
|
|
680
|
-
/* @__PURE__ */
|
|
678
|
+
return /* @__PURE__ */ t("div", { ref: g, className: `nice-import-export ${r ?? ""}`, style: L, children: [
|
|
679
|
+
/* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children: S }) }),
|
|
680
|
+
/* @__PURE__ */ t("div", { className: "nice-import-export__tabs", children: [
|
|
681
681
|
/* @__PURE__ */ e(
|
|
682
682
|
"button",
|
|
683
683
|
{
|
|
684
|
-
className: `nice-import-export__tab ${
|
|
685
|
-
onClick: () =>
|
|
684
|
+
className: `nice-import-export__tab ${x === "import" ? "nice-import-export__tab--active" : ""}`,
|
|
685
|
+
onClick: () => _("import"),
|
|
686
686
|
children: "Import"
|
|
687
687
|
}
|
|
688
688
|
),
|
|
689
689
|
/* @__PURE__ */ e(
|
|
690
690
|
"button",
|
|
691
691
|
{
|
|
692
|
-
className: `nice-import-export__tab ${
|
|
693
|
-
onClick: () =>
|
|
692
|
+
className: `nice-import-export__tab ${x === "export" ? "nice-import-export__tab--active" : ""}`,
|
|
693
|
+
onClick: () => _("export"),
|
|
694
694
|
children: "Export"
|
|
695
695
|
}
|
|
696
696
|
)
|
|
697
697
|
] }),
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ t("div", { className: "nice-import-export__form", children: [
|
|
699
|
+
/* @__PURE__ */ t("label", { children: [
|
|
700
700
|
"Entity",
|
|
701
|
-
/* @__PURE__ */ e("select", { value:
|
|
701
|
+
/* @__PURE__ */ e("select", { value: y, onChange: (o) => w(o.target.value), children: m.map((o) => /* @__PURE__ */ e("option", { value: o.id, children: o.label }, o.id)) })
|
|
702
702
|
] }),
|
|
703
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ t("label", { children: [
|
|
704
704
|
"Format",
|
|
705
|
-
/* @__PURE__ */ e("select", { value:
|
|
705
|
+
/* @__PURE__ */ e("select", { value: c, onChange: (o) => n(o.target.value), children: C.map((o) => /* @__PURE__ */ e("option", { value: o, children: o.toUpperCase() }, o)) })
|
|
706
706
|
] }),
|
|
707
|
-
|
|
708
|
-
/* @__PURE__ */
|
|
707
|
+
x === "import" && /* @__PURE__ */ t(G, { children: [
|
|
708
|
+
/* @__PURE__ */ t("label", { children: [
|
|
709
709
|
"File",
|
|
710
|
-
/* @__PURE__ */ e("input", { type: "file", onChange:
|
|
710
|
+
/* @__PURE__ */ e("input", { type: "file", onChange: E, accept: `.${c}` })
|
|
711
711
|
] }),
|
|
712
712
|
/* @__PURE__ */ e(
|
|
713
713
|
"button",
|
|
714
714
|
{
|
|
715
715
|
className: "nice-import-export__action-btn",
|
|
716
|
-
onClick:
|
|
717
|
-
disabled: !
|
|
716
|
+
onClick: a,
|
|
717
|
+
disabled: !l,
|
|
718
718
|
children: "Start Import"
|
|
719
719
|
}
|
|
720
720
|
)
|
|
721
721
|
] }),
|
|
722
|
-
|
|
722
|
+
x === "export" && /* @__PURE__ */ e("button", { className: "nice-import-export__action-btn", onClick: u, children: "Start Export" })
|
|
723
723
|
] }),
|
|
724
|
-
|
|
724
|
+
N.length > 0 && /* @__PURE__ */ t("div", { className: "nice-import-export__jobs", children: [
|
|
725
725
|
/* @__PURE__ */ e("h4", { children: "Recent Jobs" }),
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ t("table", { className: "nice-import-export__jobs-table", children: [
|
|
727
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
728
728
|
/* @__PURE__ */ e("th", { children: "Type" }),
|
|
729
729
|
/* @__PURE__ */ e("th", { children: "Format" }),
|
|
730
730
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
@@ -733,26 +733,247 @@ const P = D(function(S, k) {
|
|
|
733
733
|
/* @__PURE__ */ e("th", { children: "Created" }),
|
|
734
734
|
/* @__PURE__ */ e("th", {})
|
|
735
735
|
] }) }),
|
|
736
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
737
|
-
/* @__PURE__ */ e("td", { children:
|
|
738
|
-
/* @__PURE__ */ e("td", { children:
|
|
739
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `nice-import-export__status nice-import-export__status--${
|
|
740
|
-
/* @__PURE__ */ e("td", { children:
|
|
741
|
-
/* @__PURE__ */ e("td", { children:
|
|
742
|
-
/* @__PURE__ */ e("td", { children:
|
|
743
|
-
/* @__PURE__ */ e("td", { children:
|
|
744
|
-
] },
|
|
736
|
+
/* @__PURE__ */ e("tbody", { children: N.map((o) => /* @__PURE__ */ t("tr", { children: [
|
|
737
|
+
/* @__PURE__ */ e("td", { children: o.type }),
|
|
738
|
+
/* @__PURE__ */ e("td", { children: o.format.toUpperCase() }),
|
|
739
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `nice-import-export__status nice-import-export__status--${o.status}`, children: o.status }) }),
|
|
740
|
+
/* @__PURE__ */ e("td", { children: o.processedRows != null && o.totalRows ? `${o.processedRows} / ${o.totalRows}` : "—" }),
|
|
741
|
+
/* @__PURE__ */ e("td", { children: o.errorCount ?? 0 }),
|
|
742
|
+
/* @__PURE__ */ e("td", { children: o.createdAt }),
|
|
743
|
+
/* @__PURE__ */ e("td", { children: o.type === "export" && o.status === "completed" && f && /* @__PURE__ */ e("button", { onClick: () => f(o.id), children: "Download" }) })
|
|
744
|
+
] }, o.id)) })
|
|
745
745
|
] })
|
|
746
746
|
] })
|
|
747
747
|
] });
|
|
748
|
-
});
|
|
748
|
+
}), q = Y({ flags: {} });
|
|
749
|
+
function ie({ config: R, children: v }) {
|
|
750
|
+
return /* @__PURE__ */ e(q.Provider, { value: R, children: v });
|
|
751
|
+
}
|
|
752
|
+
function B(R) {
|
|
753
|
+
const v = H(q);
|
|
754
|
+
return $(() => {
|
|
755
|
+
const g = v.flags[R];
|
|
756
|
+
return g === void 0 ? { enabled: !1 } : typeof g == "boolean" ? { enabled: g } : { enabled: g > 0, percentage: g };
|
|
757
|
+
}, [v.flags, R]);
|
|
758
|
+
}
|
|
759
|
+
function ae({ flag: R, fallback: v = null, children: g }) {
|
|
760
|
+
const { enabled: m } = B(R);
|
|
761
|
+
return /* @__PURE__ */ e(G, { children: m ? g : v });
|
|
762
|
+
}
|
|
763
|
+
const M = {
|
|
764
|
+
low: "#2196f3",
|
|
765
|
+
medium: "#ff9800",
|
|
766
|
+
high: "#f44336",
|
|
767
|
+
critical: "#9c27b0"
|
|
768
|
+
}, O = {
|
|
769
|
+
field: "Hidden Field",
|
|
770
|
+
endpoint: "Decoy Endpoint",
|
|
771
|
+
file: "Canary File",
|
|
772
|
+
credential: "Fake Credential",
|
|
773
|
+
cookie: "Tracking Cookie"
|
|
774
|
+
}, ce = I(
|
|
775
|
+
function({
|
|
776
|
+
tokens: v,
|
|
777
|
+
events: g,
|
|
778
|
+
onCreate: m,
|
|
779
|
+
onToggle: C,
|
|
780
|
+
onDelete: N,
|
|
781
|
+
onDismissEvent: b,
|
|
782
|
+
title: p = "Honey Tokens",
|
|
783
|
+
className: f,
|
|
784
|
+
style: S
|
|
785
|
+
}, r) {
|
|
786
|
+
const [L, x] = k(""), [_, y] = k(!1), [w, c] = k(""), [n, l] = k("field"), [h, a] = k("medium"), [u, E] = k(""), T = $(
|
|
787
|
+
() => v.filter(
|
|
788
|
+
(i) => i.name.toLowerCase().includes(L.toLowerCase()) || i.location.toLowerCase().includes(L.toLowerCase())
|
|
789
|
+
),
|
|
790
|
+
[v, L]
|
|
791
|
+
), o = $(
|
|
792
|
+
() => [...g].sort((i, A) => new Date(A.timestamp).getTime() - new Date(i.timestamp).getTime()),
|
|
793
|
+
[g]
|
|
794
|
+
), s = $(() => {
|
|
795
|
+
const i = v.filter((D) => D.active).length, A = v.reduce((D, P) => D + P.tripCount, 0), F = g.filter((D) => D.severity === "critical").length;
|
|
796
|
+
return { activeCount: i, totalCount: v.length, totalTrips: A, criticalEvents: F };
|
|
797
|
+
}, [v, g]), d = () => {
|
|
798
|
+
w.trim() && u.trim() && m && (m(w.trim(), n, h, u.trim()), c(""), E(""), y(!1));
|
|
799
|
+
};
|
|
800
|
+
return /* @__PURE__ */ t(
|
|
801
|
+
"div",
|
|
802
|
+
{
|
|
803
|
+
ref: r,
|
|
804
|
+
className: `nice-honey-token-dashboard${f ? ` ${f}` : ""}`,
|
|
805
|
+
style: S,
|
|
806
|
+
children: [
|
|
807
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__header", children: [
|
|
808
|
+
/* @__PURE__ */ e("h2", { children: p }),
|
|
809
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__stats", children: [
|
|
810
|
+
/* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat", children: [
|
|
811
|
+
"Active: ",
|
|
812
|
+
s.activeCount,
|
|
813
|
+
"/",
|
|
814
|
+
s.totalCount
|
|
815
|
+
] }),
|
|
816
|
+
/* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat", children: [
|
|
817
|
+
"Trips: ",
|
|
818
|
+
s.totalTrips
|
|
819
|
+
] }),
|
|
820
|
+
s.criticalEvents > 0 && /* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
|
|
821
|
+
"Critical: ",
|
|
822
|
+
s.criticalEvents
|
|
823
|
+
] })
|
|
824
|
+
] })
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__toolbar", children: [
|
|
827
|
+
/* @__PURE__ */ e(
|
|
828
|
+
"input",
|
|
829
|
+
{
|
|
830
|
+
type: "text",
|
|
831
|
+
className: "nice-honey-token-dashboard__search",
|
|
832
|
+
placeholder: "Search tokens...",
|
|
833
|
+
value: L,
|
|
834
|
+
onChange: (i) => x(i.target.value)
|
|
835
|
+
}
|
|
836
|
+
),
|
|
837
|
+
m && /* @__PURE__ */ e(
|
|
838
|
+
"button",
|
|
839
|
+
{
|
|
840
|
+
className: "nice-honey-token-dashboard__btn",
|
|
841
|
+
onClick: () => y(!_),
|
|
842
|
+
children: _ ? "Cancel" : "+ New Token"
|
|
843
|
+
}
|
|
844
|
+
)
|
|
845
|
+
] }),
|
|
846
|
+
_ && /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__create", children: [
|
|
847
|
+
/* @__PURE__ */ e(
|
|
848
|
+
"input",
|
|
849
|
+
{
|
|
850
|
+
type: "text",
|
|
851
|
+
placeholder: "Token name",
|
|
852
|
+
value: w,
|
|
853
|
+
onChange: (i) => c(i.target.value)
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
/* @__PURE__ */ e("select", { value: n, onChange: (i) => l(i.target.value), children: Object.entries(O).map(([i, A]) => /* @__PURE__ */ e("option", { value: i, children: A }, i)) }),
|
|
857
|
+
/* @__PURE__ */ t("select", { value: h, onChange: (i) => a(i.target.value), children: [
|
|
858
|
+
/* @__PURE__ */ e("option", { value: "low", children: "Low" }),
|
|
859
|
+
/* @__PURE__ */ e("option", { value: "medium", children: "Medium" }),
|
|
860
|
+
/* @__PURE__ */ e("option", { value: "high", children: "High" }),
|
|
861
|
+
/* @__PURE__ */ e("option", { value: "critical", children: "Critical" })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ e(
|
|
864
|
+
"input",
|
|
865
|
+
{
|
|
866
|
+
type: "text",
|
|
867
|
+
placeholder: "Location (e.g. /api/admin/secret)",
|
|
868
|
+
value: u,
|
|
869
|
+
onChange: (i) => E(i.target.value)
|
|
870
|
+
}
|
|
871
|
+
),
|
|
872
|
+
/* @__PURE__ */ e("button", { onClick: d, children: "Create" })
|
|
873
|
+
] }),
|
|
874
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__tokens", children: [
|
|
875
|
+
/* @__PURE__ */ t("h3", { children: [
|
|
876
|
+
"Tokens (",
|
|
877
|
+
T.length,
|
|
878
|
+
")"
|
|
879
|
+
] }),
|
|
880
|
+
/* @__PURE__ */ t("table", { className: "nice-honey-token-dashboard__table", children: [
|
|
881
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
882
|
+
/* @__PURE__ */ e("th", { children: "Name" }),
|
|
883
|
+
/* @__PURE__ */ e("th", { children: "Type" }),
|
|
884
|
+
/* @__PURE__ */ e("th", { children: "Severity" }),
|
|
885
|
+
/* @__PURE__ */ e("th", { children: "Location" }),
|
|
886
|
+
/* @__PURE__ */ e("th", { children: "Trips" }),
|
|
887
|
+
/* @__PURE__ */ e("th", { children: "Last Tripped" }),
|
|
888
|
+
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
889
|
+
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
890
|
+
] }) }),
|
|
891
|
+
/* @__PURE__ */ e("tbody", { children: T.map((i) => /* @__PURE__ */ t("tr", { className: i.tripCount > 0 ? "nice-honey-token-dashboard__row--tripped" : "", children: [
|
|
892
|
+
/* @__PURE__ */ e("td", { children: i.name }),
|
|
893
|
+
/* @__PURE__ */ e("td", { children: O[i.type] }),
|
|
894
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
895
|
+
"span",
|
|
896
|
+
{
|
|
897
|
+
className: "nice-honey-token-dashboard__severity",
|
|
898
|
+
style: { color: M[i.severity] },
|
|
899
|
+
children: i.severity
|
|
900
|
+
}
|
|
901
|
+
) }),
|
|
902
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: i.location }) }),
|
|
903
|
+
/* @__PURE__ */ e("td", { children: i.tripCount }),
|
|
904
|
+
/* @__PURE__ */ e("td", { children: i.lastTripped ?? "—" }),
|
|
905
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `nice-honey-token-dashboard__status--${i.active ? "active" : "inactive"}`, children: i.active ? "Active" : "Inactive" }) }),
|
|
906
|
+
/* @__PURE__ */ t("td", { children: [
|
|
907
|
+
C && /* @__PURE__ */ e("button", { onClick: () => C(i.id, !i.active), children: i.active ? "Disable" : "Enable" }),
|
|
908
|
+
N && /* @__PURE__ */ e("button", { onClick: () => N(i.id), children: "Delete" })
|
|
909
|
+
] })
|
|
910
|
+
] }, i.id)) })
|
|
911
|
+
] })
|
|
912
|
+
] }),
|
|
913
|
+
o.length > 0 && /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__events", children: [
|
|
914
|
+
/* @__PURE__ */ t("h3", { children: [
|
|
915
|
+
"Recent Events (",
|
|
916
|
+
o.length,
|
|
917
|
+
")"
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ e("div", { className: "nice-honey-token-dashboard__event-list", children: o.map((i) => /* @__PURE__ */ t(
|
|
920
|
+
"div",
|
|
921
|
+
{
|
|
922
|
+
className: `nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${i.severity}`,
|
|
923
|
+
children: [
|
|
924
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__event-header", children: [
|
|
925
|
+
/* @__PURE__ */ e("strong", { children: i.tokenName }),
|
|
926
|
+
/* @__PURE__ */ e(
|
|
927
|
+
"span",
|
|
928
|
+
{
|
|
929
|
+
className: "nice-honey-token-dashboard__severity",
|
|
930
|
+
style: { color: M[i.severity] },
|
|
931
|
+
children: i.severity
|
|
932
|
+
}
|
|
933
|
+
),
|
|
934
|
+
/* @__PURE__ */ e("time", { children: i.timestamp })
|
|
935
|
+
] }),
|
|
936
|
+
/* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__event-details", children: [
|
|
937
|
+
/* @__PURE__ */ t("span", { children: [
|
|
938
|
+
"IP: ",
|
|
939
|
+
i.sourceIp
|
|
940
|
+
] }),
|
|
941
|
+
i.userId && /* @__PURE__ */ t("span", { children: [
|
|
942
|
+
"User: ",
|
|
943
|
+
i.userId
|
|
944
|
+
] }),
|
|
945
|
+
i.details && /* @__PURE__ */ e("span", { children: i.details })
|
|
946
|
+
] }),
|
|
947
|
+
b && /* @__PURE__ */ e(
|
|
948
|
+
"button",
|
|
949
|
+
{
|
|
950
|
+
className: "nice-honey-token-dashboard__dismiss",
|
|
951
|
+
onClick: () => b(i.id),
|
|
952
|
+
children: "Dismiss"
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
]
|
|
956
|
+
},
|
|
957
|
+
i.id
|
|
958
|
+
)) })
|
|
959
|
+
] })
|
|
960
|
+
]
|
|
961
|
+
}
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
);
|
|
749
965
|
export {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
z as
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
966
|
+
ae as FeatureGate,
|
|
967
|
+
Z as NiceAdminAuditLog,
|
|
968
|
+
z as NiceAdminDashboard,
|
|
969
|
+
ee as NiceAdminNotifications,
|
|
970
|
+
X as NiceAdminRoles,
|
|
971
|
+
j as NiceAdminSettings,
|
|
972
|
+
Q as NiceAdminUsers,
|
|
973
|
+
te as NiceFeatureFlags,
|
|
974
|
+
ae as NiceFeatureGate,
|
|
975
|
+
ie as NiceFeatureGateProvider,
|
|
976
|
+
ce as NiceHoneyTokenDashboard,
|
|
977
|
+
ne as NiceImportExport,
|
|
978
|
+
B as useFeatureGate
|
|
758
979
|
};
|