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