@nice2dev/admin 1.1.10 → 1.2.1
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 +107 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +814 -823
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,295 +1,295 @@
|
|
|
1
|
-
import { jsxs as n, jsx as e, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${c.type}`,
|
|
33
|
-
style: {
|
|
34
|
-
gridColumn: c.colSpan ? `span ${c.colSpan}` : void 0,
|
|
35
|
-
gridRow: c.rowSpan ? `span ${c.rowSpan}` : void 0
|
|
36
|
-
},
|
|
37
|
-
onClick: () => l == null ? void 0 : l(c),
|
|
38
|
-
onKeyDown: l ? (S) => {
|
|
39
|
-
(S.key === "Enter" || S.key === " ") && l(c);
|
|
40
|
-
} : void 0,
|
|
41
|
-
role: l ? "button" : void 0,
|
|
42
|
-
tabIndex: l ? 0 : void 0,
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ n("div", { className: "nice-admin-dashboard__widget-header", children: [
|
|
45
|
-
c.icon && /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-icon", children: c.icon }),
|
|
46
|
-
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children: c.title })
|
|
47
|
-
] }),
|
|
48
|
-
c.type === "stat" && /* @__PURE__ */ n("div", { className: "nice-admin-dashboard__stat", children: [
|
|
49
|
-
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children: c.value }),
|
|
50
|
-
c.change && /* @__PURE__ */ e(
|
|
51
|
-
"span",
|
|
52
|
-
{
|
|
53
|
-
className: `nice-admin-dashboard__stat-change ${c.changePositive ? "nice-admin-dashboard__stat-change--positive" : "nice-admin-dashboard__stat-change--negative"}`,
|
|
54
|
-
children: c.change
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] }),
|
|
58
|
-
c.type === "custom" && c.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__custom", children: c.render() }),
|
|
59
|
-
(c.type === "chart" || c.type === "table" || c.type === "list") && c.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__content", children: c.render() })
|
|
60
|
-
]
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as P, NiceIcon as G, NiceAvatar as J, NiceTag as W, NiceBadge as Q, NiceButton as B, NiceSelect as X, NiceDataGrid as O, NicePromptDialog as Z } from "@nice2dev/ui";
|
|
3
|
+
import { forwardRef as z, useState as A, useMemo as I, useCallback as M, useContext as j, createContext as ee } from "react";
|
|
4
|
+
const oe = /* @__PURE__ */ z(function(_, y) {
|
|
5
|
+
const { t } = P(), {
|
|
6
|
+
widgets: f,
|
|
7
|
+
columns: x = 4,
|
|
8
|
+
title: N,
|
|
9
|
+
headerActions: v,
|
|
10
|
+
onWidgetClick: d,
|
|
11
|
+
className: F,
|
|
12
|
+
style: S
|
|
13
|
+
} = _, s = N ?? t("adminDashboard.title", "Dashboard");
|
|
14
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-dashboard ${F ?? ""}`, style: S, children: [
|
|
15
|
+
/* @__PURE__ */ n("div", { className: "nice-admin-dashboard__header", children: [
|
|
16
|
+
/* @__PURE__ */ e("h2", { children: s }),
|
|
17
|
+
v && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__actions", children: v })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ e(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: "nice-admin-dashboard__grid",
|
|
23
|
+
style: { gridTemplateColumns: `repeat(${x}, 1fr)` },
|
|
24
|
+
children: f.map((h) => /* @__PURE__ */ n(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${h.type}`,
|
|
28
|
+
style: {
|
|
29
|
+
gridColumn: h.colSpan ? `span ${h.colSpan}` : void 0,
|
|
30
|
+
gridRow: h.rowSpan ? `span ${h.rowSpan}` : void 0
|
|
61
31
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
32
|
+
onClick: () => d == null ? void 0 : d(h),
|
|
33
|
+
onKeyDown: d ? (T) => {
|
|
34
|
+
(T.key === "Enter" || T.key === " ") && d(h);
|
|
35
|
+
} : void 0,
|
|
36
|
+
role: d ? "button" : void 0,
|
|
37
|
+
tabIndex: d ? 0 : void 0,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ n("div", { className: "nice-admin-dashboard__widget-header", children: [
|
|
40
|
+
h.icon && /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-icon", children: /* @__PURE__ */ e(G, { name: h.icon, size: 16 }) }),
|
|
41
|
+
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children: h.title })
|
|
42
|
+
] }),
|
|
43
|
+
h.type === "stat" && /* @__PURE__ */ n("div", { className: "nice-admin-dashboard__stat", children: [
|
|
44
|
+
/* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children: h.value }),
|
|
45
|
+
h.change && /* @__PURE__ */ e(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
className: `nice-admin-dashboard__stat-change ${h.changePositive ? "nice-admin-dashboard__stat-change--positive" : "nice-admin-dashboard__stat-change--negative"}`,
|
|
49
|
+
children: h.change
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }),
|
|
53
|
+
h.type === "custom" && h.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__custom", children: h.render() }),
|
|
54
|
+
(h.type === "chart" || h.type === "table" || h.type === "list") && h.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__content", children: h.render() })
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
h.id
|
|
58
|
+
))
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
}), te = {
|
|
69
63
|
active: "success",
|
|
70
64
|
inactive: "secondary",
|
|
71
65
|
suspended: "danger",
|
|
72
66
|
pending: "warning"
|
|
73
|
-
},
|
|
74
|
-
function(
|
|
75
|
-
const {
|
|
76
|
-
users:
|
|
77
|
-
availableRoles:
|
|
78
|
-
onCreate:
|
|
79
|
-
onEdit:
|
|
80
|
-
onDelete:
|
|
81
|
-
onToggleStatus:
|
|
82
|
-
onChangeRoles:
|
|
83
|
-
searchable:
|
|
84
|
-
title:
|
|
67
|
+
}, ce = /* @__PURE__ */ z(
|
|
68
|
+
function(_, y) {
|
|
69
|
+
const { t } = P(), {
|
|
70
|
+
users: f,
|
|
71
|
+
availableRoles: x = [],
|
|
72
|
+
onCreate: N,
|
|
73
|
+
onEdit: v,
|
|
74
|
+
onDelete: d,
|
|
75
|
+
onToggleStatus: F,
|
|
76
|
+
onChangeRoles: S,
|
|
77
|
+
searchable: s = !0,
|
|
78
|
+
title: h,
|
|
85
79
|
className: T,
|
|
86
|
-
style:
|
|
87
|
-
} =
|
|
88
|
-
() =>
|
|
89
|
-
[
|
|
90
|
-
),
|
|
91
|
-
const
|
|
80
|
+
style: R
|
|
81
|
+
} = _, [g, D] = A(""), k = I(
|
|
82
|
+
() => g ? f.filter((o) => o.status === g) : f,
|
|
83
|
+
[f, g]
|
|
84
|
+
), l = I(() => {
|
|
85
|
+
const o = [
|
|
92
86
|
{
|
|
93
87
|
field: "name",
|
|
94
|
-
header: "User",
|
|
88
|
+
header: t("adminUsers.user", "User"),
|
|
95
89
|
sortable: !0,
|
|
96
|
-
render: (
|
|
97
|
-
/* @__PURE__ */ e(
|
|
98
|
-
/* @__PURE__ */ e("span", { children:
|
|
90
|
+
render: (c, p) => /* @__PURE__ */ n("span", { className: "nice-admin-users__user-cell", children: [
|
|
91
|
+
/* @__PURE__ */ e(J, { src: p.avatarUrl, name: p.name, size: "sm" }),
|
|
92
|
+
/* @__PURE__ */ e("span", { children: p.name })
|
|
99
93
|
] })
|
|
100
94
|
},
|
|
101
95
|
{
|
|
102
96
|
field: "email",
|
|
103
|
-
header: "Email",
|
|
97
|
+
header: t("adminUsers.email", "Email"),
|
|
104
98
|
sortable: !0,
|
|
105
|
-
render: (
|
|
99
|
+
render: (c) => /* @__PURE__ */ e("span", { className: "nice-admin-users__email", children: String(c ?? "") })
|
|
106
100
|
},
|
|
107
101
|
{
|
|
108
102
|
field: "roles",
|
|
109
|
-
header: "Roles",
|
|
110
|
-
render: (
|
|
103
|
+
header: t("adminUsers.roles", "Roles"),
|
|
104
|
+
render: (c, p) => S ? /* @__PURE__ */ e(
|
|
111
105
|
"select",
|
|
112
106
|
{
|
|
113
107
|
multiple: !0,
|
|
114
|
-
value:
|
|
115
|
-
onChange: (
|
|
116
|
-
const
|
|
117
|
-
|
|
108
|
+
value: p.roles,
|
|
109
|
+
onChange: (C) => {
|
|
110
|
+
const w = Array.from(C.target.selectedOptions, (m) => m.value);
|
|
111
|
+
S(p.id, w);
|
|
118
112
|
},
|
|
119
113
|
className: "nice-admin-users__roles-select",
|
|
120
|
-
"aria-label":
|
|
121
|
-
|
|
114
|
+
"aria-label": t("adminUsers.rolesFor", "Roles for {name}").replace(
|
|
115
|
+
"{name}",
|
|
116
|
+
p.name
|
|
117
|
+
),
|
|
118
|
+
children: x.map((C) => /* @__PURE__ */ e("option", { value: C, children: C }, C))
|
|
122
119
|
}
|
|
123
|
-
) : /* @__PURE__ */ e("span", { className: "nice-admin-users__roles", children:
|
|
120
|
+
) : /* @__PURE__ */ e("span", { className: "nice-admin-users__roles", children: p.roles.map((C) => /* @__PURE__ */ e(W, { size: "sm", children: C }, C)) })
|
|
124
121
|
},
|
|
125
122
|
{
|
|
126
123
|
field: "status",
|
|
127
|
-
header: "Status",
|
|
124
|
+
header: t("adminUsers.status", "Status"),
|
|
128
125
|
sortable: !0,
|
|
129
|
-
render: (
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
132
|
-
return /* @__PURE__ */ e("span", { className: "nice-admin-users__status-badge", children:
|
|
133
|
-
const
|
|
126
|
+
render: (c, p) => {
|
|
127
|
+
const C = /* @__PURE__ */ e(Q, { variant: te[p.status], size: "sm", children: t(`adminUsers.userStatus.${p.status}`, p.status) });
|
|
128
|
+
if (!F)
|
|
129
|
+
return /* @__PURE__ */ e("span", { className: "nice-admin-users__status-badge", children: C });
|
|
130
|
+
const w = p.status === "active" ? "suspended" : "active";
|
|
134
131
|
return /* @__PURE__ */ e(
|
|
135
132
|
"button",
|
|
136
133
|
{
|
|
137
134
|
type: "button",
|
|
138
135
|
className: "nice-admin-users__status-badge nice-admin-users__status-badge--toggle",
|
|
139
|
-
onClick: () =>
|
|
140
|
-
"aria-label":
|
|
141
|
-
|
|
136
|
+
onClick: () => F(p.id, w),
|
|
137
|
+
"aria-label": t("adminUsers.toggleStatusFor", "Toggle status for {name}").replace(
|
|
138
|
+
"{name}",
|
|
139
|
+
p.name
|
|
140
|
+
),
|
|
141
|
+
children: C
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
field: "createdAt",
|
|
148
|
-
header: "Created",
|
|
148
|
+
header: t("adminUsers.created", "Created"),
|
|
149
149
|
dataType: "date",
|
|
150
150
|
sortable: !0
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
field: "lastLoginAt",
|
|
154
|
-
header: "Last Login",
|
|
154
|
+
header: t("adminUsers.lastLogin", "Last Login"),
|
|
155
155
|
dataType: "date",
|
|
156
156
|
sortable: !0,
|
|
157
|
-
render: (
|
|
157
|
+
render: (c) => c ? String(c) : "—"
|
|
158
158
|
}
|
|
159
159
|
];
|
|
160
|
-
return (
|
|
160
|
+
return (v || d) && o.push({
|
|
161
161
|
field: "__actions",
|
|
162
|
-
header: "Actions",
|
|
162
|
+
header: t("adminUsers.actions", "Actions"),
|
|
163
163
|
align: "right",
|
|
164
|
-
render: (
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
render: (c, p) => /* @__PURE__ */ n("span", { className: "nice-admin-users__actions", children: [
|
|
165
|
+
v && /* @__PURE__ */ e(
|
|
166
|
+
B,
|
|
167
167
|
{
|
|
168
168
|
size: "sm",
|
|
169
169
|
variant: "ghost",
|
|
170
|
-
ariaLabel:
|
|
171
|
-
onClick: () => p
|
|
172
|
-
children: /* @__PURE__ */ e(
|
|
170
|
+
ariaLabel: t("adminUsers.editUser", "Edit {name}").replace("{name}", p.name),
|
|
171
|
+
onClick: () => v(p),
|
|
172
|
+
children: /* @__PURE__ */ e(G, { name: "edit" })
|
|
173
173
|
}
|
|
174
174
|
),
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
d && /* @__PURE__ */ e(
|
|
176
|
+
B,
|
|
177
177
|
{
|
|
178
178
|
size: "sm",
|
|
179
179
|
variant: "ghost",
|
|
180
|
-
ariaLabel:
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
ariaLabel: t("adminUsers.deleteUser", "Delete {name}").replace(
|
|
181
|
+
"{name}",
|
|
182
|
+
p.name
|
|
183
|
+
),
|
|
184
|
+
onClick: () => d(p.id),
|
|
185
|
+
children: /* @__PURE__ */ e(G, { name: "trash" })
|
|
183
186
|
}
|
|
184
187
|
)
|
|
185
188
|
] })
|
|
186
|
-
}),
|
|
187
|
-
}, [
|
|
188
|
-
if (
|
|
189
|
+
}), o;
|
|
190
|
+
}, [x, S, d, v, F, t]), i = I(() => {
|
|
191
|
+
if (d)
|
|
189
192
|
return [
|
|
190
193
|
{
|
|
191
194
|
key: "delete",
|
|
192
|
-
label: "Delete",
|
|
195
|
+
label: t("adminUsers.delete", "Delete"),
|
|
193
196
|
variant: "danger",
|
|
194
|
-
icon: /* @__PURE__ */ e(
|
|
195
|
-
onClick: (
|
|
197
|
+
icon: /* @__PURE__ */ e(G, { name: "trash" }),
|
|
198
|
+
onClick: (o) => o.forEach((c) => d(c))
|
|
196
199
|
}
|
|
197
200
|
];
|
|
198
|
-
}, [
|
|
201
|
+
}, [d, t]), r = /* @__PURE__ */ n("div", { className: "nice-admin-users__toolbar", children: [
|
|
199
202
|
/* @__PURE__ */ e(
|
|
200
|
-
|
|
203
|
+
X,
|
|
201
204
|
{
|
|
202
|
-
value:
|
|
203
|
-
onChange: (
|
|
204
|
-
title: "Filter by status",
|
|
205
|
+
value: g,
|
|
206
|
+
onChange: (o) => D(o ?? ""),
|
|
207
|
+
title: t("adminUsers.filterByStatus", "Filter by status"),
|
|
205
208
|
options: [
|
|
206
|
-
{ value: "", label: "All statuses" },
|
|
207
|
-
{ value: "active", label: "Active" },
|
|
208
|
-
{ value: "inactive", label: "Inactive" },
|
|
209
|
-
{ value: "suspended", label: "Suspended" },
|
|
210
|
-
{ value: "pending", label: "Pending" }
|
|
209
|
+
{ value: "", label: t("adminUsers.allStatuses", "All statuses") },
|
|
210
|
+
{ value: "active", label: t("adminUsers.userStatus.active", "Active") },
|
|
211
|
+
{ value: "inactive", label: t("adminUsers.userStatus.inactive", "Inactive") },
|
|
212
|
+
{ value: "suspended", label: t("adminUsers.userStatus.suspended", "Suspended") },
|
|
213
|
+
{ value: "pending", label: t("adminUsers.userStatus.pending", "Pending") }
|
|
211
214
|
],
|
|
212
215
|
size: "sm"
|
|
213
216
|
}
|
|
214
217
|
),
|
|
215
|
-
|
|
216
|
-
/* @__PURE__ */ e(
|
|
217
|
-
/* @__PURE__ */ e("span", { children: "Add User" })
|
|
218
|
+
N && /* @__PURE__ */ n(B, { size: "sm", variant: "primary", onClick: N, children: [
|
|
219
|
+
/* @__PURE__ */ e(G, { name: "plus" }),
|
|
220
|
+
/* @__PURE__ */ e("span", { children: t("adminUsers.addUser", "Add User") })
|
|
218
221
|
] })
|
|
219
222
|
] });
|
|
220
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
221
|
-
|
|
222
|
-
/* @__PURE__ */ e("h3", { children:
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
m.length,
|
|
225
|
-
" users"
|
|
226
|
-
] })
|
|
223
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-users ${T ?? ""}`, style: R, children: [
|
|
224
|
+
h != null && /* @__PURE__ */ n("div", { className: "nice-admin-users__header", children: [
|
|
225
|
+
/* @__PURE__ */ e("h3", { children: h }),
|
|
226
|
+
/* @__PURE__ */ e("span", { className: "nice-admin-users__count", children: t("adminUsers.count", "{count} users").replace("{count}", String(f.length)) })
|
|
227
227
|
] }),
|
|
228
228
|
/* @__PURE__ */ e(
|
|
229
|
-
|
|
229
|
+
O,
|
|
230
230
|
{
|
|
231
|
-
columns:
|
|
232
|
-
data:
|
|
231
|
+
columns: l,
|
|
232
|
+
data: k,
|
|
233
233
|
keyField: "id",
|
|
234
|
-
searchable:
|
|
235
|
-
searchPlaceholder: "Search users…",
|
|
236
|
-
selectable: !!
|
|
237
|
-
bulkActions:
|
|
234
|
+
searchable: s,
|
|
235
|
+
searchPlaceholder: t("adminUsers.searchUsers", "Search users…"),
|
|
236
|
+
selectable: !!d,
|
|
237
|
+
bulkActions: i,
|
|
238
238
|
striped: !0,
|
|
239
|
-
toolbar:
|
|
240
|
-
emptyText: "No users found."
|
|
239
|
+
toolbar: r,
|
|
240
|
+
emptyText: t("adminUsers.noUsers", "No users found.")
|
|
241
241
|
}
|
|
242
242
|
)
|
|
243
243
|
] });
|
|
244
244
|
}
|
|
245
245
|
);
|
|
246
|
-
function
|
|
247
|
-
let
|
|
248
|
-
for (const
|
|
249
|
-
|
|
250
|
-
return
|
|
246
|
+
function ae(L) {
|
|
247
|
+
let _ = 0;
|
|
248
|
+
for (const y of Object.values(L.permissions))
|
|
249
|
+
_ += y.length;
|
|
250
|
+
return _;
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
function(
|
|
254
|
-
var
|
|
255
|
-
const {
|
|
256
|
-
roles:
|
|
257
|
-
actions:
|
|
258
|
-
resources:
|
|
259
|
-
onPermissionChange:
|
|
260
|
-
onCreate:
|
|
261
|
-
onDelete:
|
|
262
|
-
onRename:
|
|
263
|
-
title:
|
|
264
|
-
className:
|
|
252
|
+
const de = /* @__PURE__ */ z(
|
|
253
|
+
function(_, y) {
|
|
254
|
+
var u;
|
|
255
|
+
const { t } = P(), {
|
|
256
|
+
roles: f,
|
|
257
|
+
actions: x,
|
|
258
|
+
resources: N,
|
|
259
|
+
onPermissionChange: v,
|
|
260
|
+
onCreate: d,
|
|
261
|
+
onDelete: F,
|
|
262
|
+
onRename: S,
|
|
263
|
+
title: s,
|
|
264
|
+
className: h,
|
|
265
265
|
style: T
|
|
266
|
-
} =
|
|
267
|
-
!
|
|
268
|
-
}, [
|
|
269
|
-
var
|
|
270
|
-
return ((
|
|
271
|
-
},
|
|
266
|
+
} = _, [R, g] = A(((u = f[0]) == null ? void 0 : u.id) ?? null), [D, k] = A(!1), [l, i] = A(""), [r, o] = A(""), [c, p] = A(null), C = f.find((a) => a.id === R), w = M(() => {
|
|
267
|
+
!l.trim() || !d || (d(l.trim(), r.trim()), i(""), o(""), k(!1));
|
|
268
|
+
}, [l, r, d]), m = (a, b, E) => {
|
|
269
|
+
var $;
|
|
270
|
+
return (($ = a.permissions[b]) == null ? void 0 : $.includes(E)) ?? !1;
|
|
271
|
+
}, U = I(
|
|
272
272
|
() => [
|
|
273
273
|
{
|
|
274
274
|
field: "name",
|
|
275
|
-
header: "Role",
|
|
275
|
+
header: t("adminRoles.role", "Role"),
|
|
276
276
|
sortable: !0,
|
|
277
|
-
render: (
|
|
278
|
-
|
|
277
|
+
render: (a, b) => /* @__PURE__ */ n("span", { className: "nice-admin-roles__name-cell", children: [
|
|
278
|
+
b.color && /* @__PURE__ */ e(
|
|
279
279
|
"span",
|
|
280
280
|
{
|
|
281
281
|
className: "nice-admin-roles__color-dot",
|
|
282
|
-
style: { background:
|
|
282
|
+
style: { background: b.color },
|
|
283
283
|
"aria-hidden": "true"
|
|
284
284
|
}
|
|
285
285
|
),
|
|
286
|
-
/* @__PURE__ */ e("span", { children:
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
/* @__PURE__ */ e("span", { children: b.name }),
|
|
287
|
+
b.isSystem && /* @__PURE__ */ e(
|
|
288
|
+
G,
|
|
289
289
|
{
|
|
290
290
|
name: "lock",
|
|
291
291
|
size: "sm",
|
|
292
|
-
title: "System role",
|
|
292
|
+
title: t("adminRoles.systemRole", "System role"),
|
|
293
293
|
className: "nice-admin-roles__system-icon"
|
|
294
294
|
}
|
|
295
295
|
)
|
|
@@ -297,291 +297,292 @@ const re = $(
|
|
|
297
297
|
},
|
|
298
298
|
{
|
|
299
299
|
field: "description",
|
|
300
|
-
header: "Description",
|
|
300
|
+
header: t("adminRoles.description", "Description"),
|
|
301
301
|
sortable: !0,
|
|
302
|
-
render: (
|
|
302
|
+
render: (a, b) => b.description ?? "—"
|
|
303
303
|
},
|
|
304
304
|
{
|
|
305
305
|
field: "permissionCount",
|
|
306
|
-
header: "Permissions",
|
|
306
|
+
header: t("adminRoles.permissions", "Permissions"),
|
|
307
307
|
align: "right",
|
|
308
308
|
dataType: "number",
|
|
309
309
|
sortable: !0,
|
|
310
|
-
render: (
|
|
310
|
+
render: (a, b) => ae(b)
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
field: "userCount",
|
|
314
|
-
header: "Users",
|
|
314
|
+
header: t("adminRoles.users", "Users"),
|
|
315
315
|
align: "right",
|
|
316
316
|
dataType: "number",
|
|
317
317
|
sortable: !0,
|
|
318
|
-
render: (
|
|
318
|
+
render: (a, b) => b.userCount ?? 0
|
|
319
319
|
}
|
|
320
320
|
],
|
|
321
|
-
[]
|
|
321
|
+
[t]
|
|
322
322
|
);
|
|
323
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
323
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-roles ${h ?? ""}`, style: T, children: [
|
|
324
|
+
/* @__PURE__ */ e(
|
|
325
|
+
Z,
|
|
326
|
+
{
|
|
327
|
+
open: c !== null,
|
|
328
|
+
title: t("adminRoles.newRoleName", "New role name"),
|
|
329
|
+
defaultValue: c == null ? void 0 : c.name,
|
|
330
|
+
onSubmit: (a) => {
|
|
331
|
+
c && a && (S == null || S(c.id, a)), p(null);
|
|
332
|
+
},
|
|
333
|
+
onCancel: () => p(null)
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
(s || d) && /* @__PURE__ */ n("div", { className: "nice-admin-roles__header", children: [
|
|
337
|
+
s && /* @__PURE__ */ e("h3", { children: s }),
|
|
338
|
+
d && /* @__PURE__ */ e("button", { onClick: () => k(!D), children: t("adminRoles.newRole", "+ New Role") })
|
|
327
339
|
] }),
|
|
328
|
-
|
|
340
|
+
D && /* @__PURE__ */ n("div", { className: "nice-admin-roles__create-form", children: [
|
|
329
341
|
/* @__PURE__ */ e(
|
|
330
342
|
"input",
|
|
331
343
|
{
|
|
332
344
|
type: "text",
|
|
333
|
-
value:
|
|
334
|
-
onChange: (
|
|
335
|
-
placeholder: "Role name"
|
|
345
|
+
value: l,
|
|
346
|
+
onChange: (a) => i(a.target.value),
|
|
347
|
+
placeholder: t("adminRoles.roleName", "Role name")
|
|
336
348
|
}
|
|
337
349
|
),
|
|
338
350
|
/* @__PURE__ */ e(
|
|
339
351
|
"input",
|
|
340
352
|
{
|
|
341
353
|
type: "text",
|
|
342
|
-
value:
|
|
343
|
-
onChange: (
|
|
344
|
-
placeholder: "Description"
|
|
354
|
+
value: r,
|
|
355
|
+
onChange: (a) => o(a.target.value),
|
|
356
|
+
placeholder: t("adminRoles.description", "Description")
|
|
345
357
|
}
|
|
346
358
|
),
|
|
347
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
348
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
359
|
+
/* @__PURE__ */ e("button", { onClick: w, disabled: !l.trim(), children: t("adminRoles.create", "Create") }),
|
|
360
|
+
/* @__PURE__ */ e("button", { onClick: () => k(!1), children: t("adminRoles.cancel", "Cancel") })
|
|
349
361
|
] }),
|
|
350
362
|
/* @__PURE__ */ e(
|
|
351
|
-
|
|
363
|
+
O,
|
|
352
364
|
{
|
|
353
365
|
className: "nice-admin-roles__grid",
|
|
354
|
-
columns:
|
|
355
|
-
data:
|
|
366
|
+
columns: U,
|
|
367
|
+
data: f,
|
|
356
368
|
keyField: "id",
|
|
357
369
|
searchable: !0,
|
|
358
370
|
striped: !0,
|
|
359
371
|
size: "sm",
|
|
360
372
|
selectable: !1,
|
|
361
|
-
onRowClick: (
|
|
373
|
+
onRowClick: (a) => g(a.id)
|
|
362
374
|
}
|
|
363
375
|
),
|
|
364
|
-
|
|
365
|
-
|
|
376
|
+
C && /* @__PURE__ */ n("div", { className: "nice-admin-roles__matrix-wrap", children: [
|
|
377
|
+
C.description && /* @__PURE__ */ e("p", { className: "nice-admin-roles__description", children: C.description }),
|
|
366
378
|
/* @__PURE__ */ n("table", { className: "nice-admin-roles__matrix", children: [
|
|
367
379
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
368
|
-
/* @__PURE__ */ e("th", { children: "Resource" }),
|
|
369
|
-
|
|
380
|
+
/* @__PURE__ */ e("th", { children: t("adminRoles.resource", "Resource") }),
|
|
381
|
+
x.map((a) => /* @__PURE__ */ e("th", { title: a.description, children: a.label }, a.id))
|
|
370
382
|
] }) }),
|
|
371
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
372
|
-
/* @__PURE__ */ e("td", { children:
|
|
373
|
-
|
|
374
|
-
const E =
|
|
383
|
+
/* @__PURE__ */ e("tbody", { children: N.map((a) => /* @__PURE__ */ n("tr", { children: [
|
|
384
|
+
/* @__PURE__ */ e("td", { children: a.label }),
|
|
385
|
+
x.map((b) => {
|
|
386
|
+
const E = m(C, a.id, b.id);
|
|
375
387
|
return /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
376
388
|
"input",
|
|
377
389
|
{
|
|
378
390
|
type: "checkbox",
|
|
379
391
|
checked: E,
|
|
380
|
-
onChange: () =>
|
|
381
|
-
disabled:
|
|
392
|
+
onChange: () => v == null ? void 0 : v(C.id, a.id, b.id, !E),
|
|
393
|
+
disabled: C.isSystem
|
|
382
394
|
}
|
|
383
|
-
) },
|
|
395
|
+
) }, b.id);
|
|
384
396
|
})
|
|
385
|
-
] },
|
|
397
|
+
] }, a.id)) })
|
|
386
398
|
] }),
|
|
387
|
-
!
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
{
|
|
391
|
-
onClick: () => {
|
|
392
|
-
const i = prompt("New role name:", h.name);
|
|
393
|
-
i && C(h.id, i);
|
|
394
|
-
},
|
|
395
|
-
children: "Rename"
|
|
396
|
-
}
|
|
397
|
-
),
|
|
398
|
-
k && /* @__PURE__ */ e("button", { onClick: () => k(h.id), children: "Delete Role" })
|
|
399
|
+
!C.isSystem && /* @__PURE__ */ n("div", { className: "nice-admin-roles__role-actions", children: [
|
|
400
|
+
S && /* @__PURE__ */ e("button", { onClick: () => p(C), children: t("adminRoles.rename", "Rename") }),
|
|
401
|
+
F && /* @__PURE__ */ e("button", { onClick: () => F(C.id), children: t("adminRoles.deleteRole", "Delete Role") })
|
|
399
402
|
] })
|
|
400
403
|
] })
|
|
401
404
|
] });
|
|
402
405
|
}
|
|
403
|
-
),
|
|
406
|
+
), ne = {
|
|
404
407
|
info: { color: "var(--nice-color-info, #3b82f6)", label: "INFO", icon: "info" },
|
|
405
408
|
warning: { color: "var(--nice-color-warning, #eab308)", label: "WARN", icon: "warning" },
|
|
406
409
|
error: { color: "var(--nice-color-danger, #ef4444)", label: "ERROR", icon: "error" },
|
|
407
410
|
critical: { color: "var(--nice-color-danger, #dc2626)", label: "CRIT", icon: "error" }
|
|
408
|
-
},
|
|
409
|
-
function(
|
|
410
|
-
const {
|
|
411
|
-
entries:
|
|
412
|
-
onEntryClick:
|
|
413
|
-
onLoadMore:
|
|
414
|
-
hasMore:
|
|
415
|
-
searchable:
|
|
416
|
-
showSeverityFilter:
|
|
417
|
-
title:
|
|
418
|
-
className:
|
|
419
|
-
style:
|
|
420
|
-
} =
|
|
421
|
-
let
|
|
422
|
-
if (
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
(
|
|
426
|
-
var
|
|
427
|
-
return
|
|
411
|
+
}, he = /* @__PURE__ */ z(
|
|
412
|
+
function(_, y) {
|
|
413
|
+
const { t } = P(), {
|
|
414
|
+
entries: f,
|
|
415
|
+
onEntryClick: x,
|
|
416
|
+
onLoadMore: N,
|
|
417
|
+
hasMore: v = !1,
|
|
418
|
+
searchable: d = !0,
|
|
419
|
+
showSeverityFilter: F = !0,
|
|
420
|
+
title: S,
|
|
421
|
+
className: s,
|
|
422
|
+
style: h
|
|
423
|
+
} = _, [T, R] = A(""), [g, D] = A(""), k = I(() => {
|
|
424
|
+
let i = f;
|
|
425
|
+
if (g && (i = i.filter((r) => r.severity === g)), T.trim()) {
|
|
426
|
+
const r = T.toLowerCase();
|
|
427
|
+
i = i.filter(
|
|
428
|
+
(o) => {
|
|
429
|
+
var c;
|
|
430
|
+
return o.actorName.toLowerCase().includes(r) || o.action.toLowerCase().includes(r) || o.resource.toLowerCase().includes(r) || ((c = o.details) == null ? void 0 : c.toLowerCase().includes(r));
|
|
428
431
|
}
|
|
429
432
|
);
|
|
430
433
|
}
|
|
431
|
-
return
|
|
432
|
-
}, [
|
|
434
|
+
return i;
|
|
435
|
+
}, [f, g, T]), l = I(
|
|
433
436
|
() => [
|
|
434
|
-
{
|
|
437
|
+
{
|
|
438
|
+
field: "timestamp",
|
|
439
|
+
header: t("adminAuditLog.timestamp", "Timestamp"),
|
|
440
|
+
sortable: !0,
|
|
441
|
+
width: 170
|
|
442
|
+
},
|
|
435
443
|
{
|
|
436
444
|
field: "severity",
|
|
437
|
-
header: "Severity",
|
|
445
|
+
header: t("adminAuditLog.severity", "Severity"),
|
|
438
446
|
sortable: !0,
|
|
439
447
|
width: 120,
|
|
440
|
-
render: (
|
|
441
|
-
const
|
|
442
|
-
return /* @__PURE__ */ n(
|
|
443
|
-
|
|
444
|
-
{
|
|
445
|
-
|
|
446
|
-
style: { color: r.color, display: "inline-flex", alignItems: "center", gap: 4 },
|
|
447
|
-
children: [
|
|
448
|
-
/* @__PURE__ */ e(z, { name: r.icon, size: 14 }),
|
|
449
|
-
r.label
|
|
450
|
-
]
|
|
451
|
-
}
|
|
452
|
-
);
|
|
448
|
+
render: (i, r) => {
|
|
449
|
+
const o = ne[r.severity];
|
|
450
|
+
return /* @__PURE__ */ n("span", { className: "nice-admin-audit-log__severity", style: { color: o.color }, children: [
|
|
451
|
+
/* @__PURE__ */ e(G, { name: o.icon, size: 14 }),
|
|
452
|
+
t(`adminAuditLog.short.${r.severity}`, o.label)
|
|
453
|
+
] });
|
|
453
454
|
}
|
|
454
455
|
},
|
|
455
|
-
{ field: "actorName", header: "Actor", sortable: !0 },
|
|
456
|
-
{ field: "action", header: "Action", sortable: !0 },
|
|
456
|
+
{ field: "actorName", header: t("adminAuditLog.actor", "Actor"), sortable: !0 },
|
|
457
|
+
{ field: "action", header: t("adminAuditLog.action", "Action"), sortable: !0 },
|
|
457
458
|
{
|
|
458
459
|
field: "resource",
|
|
459
|
-
header: "Resource",
|
|
460
|
+
header: t("adminAuditLog.resource", "Resource"),
|
|
460
461
|
sortable: !0,
|
|
461
|
-
render: (
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
render: (i, r) => /* @__PURE__ */ n(H, { children: [
|
|
463
|
+
r.resource,
|
|
464
|
+
r.resourceId ? ` #${r.resourceId}` : ""
|
|
464
465
|
] })
|
|
465
466
|
},
|
|
466
467
|
{
|
|
467
468
|
field: "ipAddress",
|
|
468
469
|
header: "IP",
|
|
469
470
|
width: 130,
|
|
470
|
-
render: (
|
|
471
|
+
render: (i) => i ?? "—"
|
|
471
472
|
},
|
|
472
473
|
{
|
|
473
474
|
field: "details",
|
|
474
|
-
header: "Details",
|
|
475
|
-
render: (
|
|
475
|
+
header: t("adminAuditLog.details", "Details"),
|
|
476
|
+
render: (i) => /* @__PURE__ */ e("span", { className: "nice-admin-audit-log__details", children: i ?? "—" })
|
|
476
477
|
}
|
|
477
478
|
],
|
|
478
|
-
[]
|
|
479
|
+
[t]
|
|
479
480
|
);
|
|
480
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
481
|
-
|
|
481
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-audit-log ${s ?? ""}`, style: h, children: [
|
|
482
|
+
S && /* @__PURE__ */ e("div", { className: "nice-admin-audit-log__header", children: /* @__PURE__ */ e("h3", { children: S }) }),
|
|
482
483
|
/* @__PURE__ */ n("div", { className: "nice-admin-audit-log__toolbar", children: [
|
|
483
|
-
|
|
484
|
+
d && /* @__PURE__ */ e(
|
|
484
485
|
"input",
|
|
485
486
|
{
|
|
486
487
|
type: "text",
|
|
487
488
|
value: T,
|
|
488
|
-
onChange: (
|
|
489
|
-
placeholder: "Search audit log…",
|
|
489
|
+
onChange: (i) => R(i.target.value),
|
|
490
|
+
placeholder: t("adminAuditLog.searchAuditLog", "Search audit log…"),
|
|
490
491
|
className: "nice-admin-audit-log__search"
|
|
491
492
|
}
|
|
492
493
|
),
|
|
493
|
-
|
|
494
|
+
F && /* @__PURE__ */ n(
|
|
494
495
|
"select",
|
|
495
496
|
{
|
|
496
|
-
value:
|
|
497
|
-
onChange: (
|
|
497
|
+
value: g,
|
|
498
|
+
onChange: (i) => D(i.target.value),
|
|
498
499
|
className: "nice-admin-audit-log__severity-filter",
|
|
499
500
|
children: [
|
|
500
|
-
/* @__PURE__ */ e("option", { value: "", children: "All severities" }),
|
|
501
|
-
/* @__PURE__ */ e("option", { value: "info", children: "Info" }),
|
|
502
|
-
/* @__PURE__ */ e("option", { value: "warning", children: "Warning" }),
|
|
503
|
-
/* @__PURE__ */ e("option", { value: "error", children: "Error" }),
|
|
504
|
-
/* @__PURE__ */ e("option", { value: "critical", children: "Critical" })
|
|
501
|
+
/* @__PURE__ */ e("option", { value: "", children: t("adminAuditLog.allSeverities", "All severities") }),
|
|
502
|
+
/* @__PURE__ */ e("option", { value: "info", children: t("adminAuditLog.info", "Info") }),
|
|
503
|
+
/* @__PURE__ */ e("option", { value: "warning", children: t("adminAuditLog.warning", "Warning") }),
|
|
504
|
+
/* @__PURE__ */ e("option", { value: "error", children: t("adminAuditLog.error", "Error") }),
|
|
505
|
+
/* @__PURE__ */ e("option", { value: "critical", children: t("adminAuditLog.critical", "Critical") })
|
|
505
506
|
]
|
|
506
507
|
}
|
|
507
508
|
)
|
|
508
509
|
] }),
|
|
509
510
|
/* @__PURE__ */ e(
|
|
510
|
-
|
|
511
|
+
O,
|
|
511
512
|
{
|
|
512
|
-
columns:
|
|
513
|
-
data:
|
|
513
|
+
columns: l,
|
|
514
|
+
data: k,
|
|
514
515
|
keyField: "id",
|
|
515
516
|
striped: !0,
|
|
516
517
|
size: "sm",
|
|
517
|
-
emptyText: "No audit log entries found.",
|
|
518
|
-
onRowClick:
|
|
518
|
+
emptyText: t("adminAuditLog.noEntries", "No audit log entries found."),
|
|
519
|
+
onRowClick: x ? (i) => x(i) : void 0
|
|
519
520
|
}
|
|
520
521
|
),
|
|
521
|
-
|
|
522
|
+
v && N && /* @__PURE__ */ e("button", { className: "nice-admin-audit-log__load-more", onClick: N, children: t("adminAuditLog.loadMore", "Load more") })
|
|
522
523
|
] });
|
|
523
524
|
}
|
|
524
|
-
),
|
|
525
|
-
function(
|
|
526
|
-
const {
|
|
527
|
-
settings:
|
|
528
|
-
onSave:
|
|
529
|
-
onChange:
|
|
530
|
-
onReset:
|
|
531
|
-
saving:
|
|
532
|
-
title:
|
|
533
|
-
className:
|
|
534
|
-
style:
|
|
535
|
-
} =
|
|
536
|
-
const
|
|
537
|
-
for (const
|
|
538
|
-
|
|
539
|
-
return
|
|
540
|
-
}),
|
|
541
|
-
(
|
|
542
|
-
|
|
525
|
+
), me = /* @__PURE__ */ z(
|
|
526
|
+
function(_, y) {
|
|
527
|
+
const { t } = P(), {
|
|
528
|
+
settings: f,
|
|
529
|
+
onSave: x,
|
|
530
|
+
onChange: N,
|
|
531
|
+
onReset: v,
|
|
532
|
+
saving: d = !1,
|
|
533
|
+
title: F,
|
|
534
|
+
className: S,
|
|
535
|
+
style: s
|
|
536
|
+
} = _, h = F ?? t("adminSettings.title", "Settings"), [T, R] = A(() => {
|
|
537
|
+
const i = {};
|
|
538
|
+
for (const r of f)
|
|
539
|
+
i[r.key] = r.value;
|
|
540
|
+
return i;
|
|
541
|
+
}), g = M(
|
|
542
|
+
(i, r) => {
|
|
543
|
+
R((o) => ({ ...o, [i]: r })), N == null || N(i, r);
|
|
543
544
|
},
|
|
544
|
-
[
|
|
545
|
-
),
|
|
546
|
-
|
|
547
|
-
}, [
|
|
548
|
-
for (const
|
|
549
|
-
const
|
|
550
|
-
|
|
545
|
+
[N]
|
|
546
|
+
), D = M(() => {
|
|
547
|
+
x == null || x(T);
|
|
548
|
+
}, [x, T]), k = /* @__PURE__ */ new Map();
|
|
549
|
+
for (const i of f) {
|
|
550
|
+
const r = i.section ?? t("adminSettings.general", "General");
|
|
551
|
+
k.has(r) || k.set(r, []), k.get(r).push(i);
|
|
551
552
|
}
|
|
552
|
-
const
|
|
553
|
-
var
|
|
554
|
-
const
|
|
555
|
-
switch (
|
|
553
|
+
const l = (i) => {
|
|
554
|
+
var o;
|
|
555
|
+
const r = T[i.key];
|
|
556
|
+
switch (i.type) {
|
|
556
557
|
case "boolean":
|
|
557
558
|
return /* @__PURE__ */ n("label", { className: "nice-admin-settings__toggle", children: [
|
|
558
559
|
/* @__PURE__ */ e(
|
|
559
560
|
"input",
|
|
560
561
|
{
|
|
561
562
|
type: "checkbox",
|
|
562
|
-
checked: !!
|
|
563
|
-
onChange: (
|
|
563
|
+
checked: !!r,
|
|
564
|
+
onChange: (c) => g(i.key, c.target.checked)
|
|
564
565
|
}
|
|
565
566
|
),
|
|
566
|
-
|
|
567
|
+
i.label
|
|
567
568
|
] });
|
|
568
569
|
case "select":
|
|
569
570
|
return /* @__PURE__ */ e(
|
|
570
571
|
"select",
|
|
571
572
|
{
|
|
572
|
-
value: String(
|
|
573
|
-
onChange: (
|
|
573
|
+
value: String(r ?? ""),
|
|
574
|
+
onChange: (c) => g(i.key, c.target.value),
|
|
574
575
|
className: "nice-admin-settings__select",
|
|
575
|
-
children: (
|
|
576
|
+
children: (o = i.options) == null ? void 0 : o.map((c) => /* @__PURE__ */ e("option", { value: c.value, children: c.label }, c.value))
|
|
576
577
|
}
|
|
577
578
|
);
|
|
578
579
|
case "textarea":
|
|
579
580
|
return /* @__PURE__ */ e(
|
|
580
581
|
"textarea",
|
|
581
582
|
{
|
|
582
|
-
value: String(
|
|
583
|
-
onChange: (
|
|
584
|
-
placeholder:
|
|
583
|
+
value: String(r ?? ""),
|
|
584
|
+
onChange: (c) => g(i.key, c.target.value),
|
|
585
|
+
placeholder: i.placeholder,
|
|
585
586
|
className: "nice-admin-settings__textarea",
|
|
586
587
|
rows: 4
|
|
587
588
|
}
|
|
@@ -591,9 +592,9 @@ const re = $(
|
|
|
591
592
|
"input",
|
|
592
593
|
{
|
|
593
594
|
type: "number",
|
|
594
|
-
value:
|
|
595
|
-
onChange: (
|
|
596
|
-
placeholder:
|
|
595
|
+
value: r != null ? Number(r) : "",
|
|
596
|
+
onChange: (c) => g(i.key, parseFloat(c.target.value) || 0),
|
|
597
|
+
placeholder: i.placeholder,
|
|
597
598
|
className: "nice-admin-settings__input"
|
|
598
599
|
}
|
|
599
600
|
);
|
|
@@ -602,8 +603,8 @@ const re = $(
|
|
|
602
603
|
"input",
|
|
603
604
|
{
|
|
604
605
|
type: "color",
|
|
605
|
-
value: String(
|
|
606
|
-
onChange: (
|
|
606
|
+
value: String(r ?? "#000000"),
|
|
607
|
+
onChange: (c) => g(i.key, c.target.value),
|
|
607
608
|
className: "nice-admin-settings__color"
|
|
608
609
|
}
|
|
609
610
|
);
|
|
@@ -612,9 +613,9 @@ const re = $(
|
|
|
612
613
|
"input",
|
|
613
614
|
{
|
|
614
615
|
type: "password",
|
|
615
|
-
value: String(
|
|
616
|
-
onChange: (
|
|
617
|
-
placeholder:
|
|
616
|
+
value: String(r ?? ""),
|
|
617
|
+
onChange: (c) => g(i.key, c.target.value),
|
|
618
|
+
placeholder: i.placeholder,
|
|
618
619
|
className: "nice-admin-settings__input",
|
|
619
620
|
autoComplete: "new-password"
|
|
620
621
|
}
|
|
@@ -624,169 +625,164 @@ const re = $(
|
|
|
624
625
|
"input",
|
|
625
626
|
{
|
|
626
627
|
type: "text",
|
|
627
|
-
value: String(
|
|
628
|
-
onChange: (
|
|
629
|
-
placeholder:
|
|
628
|
+
value: String(r ?? ""),
|
|
629
|
+
onChange: (c) => g(i.key, c.target.value),
|
|
630
|
+
placeholder: i.placeholder,
|
|
630
631
|
className: "nice-admin-settings__input"
|
|
631
632
|
}
|
|
632
633
|
);
|
|
633
634
|
}
|
|
634
635
|
};
|
|
635
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
636
|
-
/* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children:
|
|
637
|
-
Array.from(
|
|
638
|
-
/* @__PURE__ */ e("legend", { children:
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
636
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-settings ${S ?? ""}`, style: s, children: [
|
|
637
|
+
/* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children: h }) }),
|
|
638
|
+
Array.from(k.entries()).map(([i, r]) => /* @__PURE__ */ n("fieldset", { className: "nice-admin-settings__section", children: [
|
|
639
|
+
/* @__PURE__ */ e("legend", { children: i }),
|
|
640
|
+
r.map((o) => /* @__PURE__ */ n("div", { className: "nice-admin-settings__field", children: [
|
|
641
|
+
o.type !== "boolean" && /* @__PURE__ */ n("label", { className: "nice-admin-settings__label", children: [
|
|
642
|
+
o.label,
|
|
643
|
+
o.required && /* @__PURE__ */ e("span", { className: "nice-admin-settings__required", children: "*" })
|
|
643
644
|
] }),
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
] },
|
|
647
|
-
] },
|
|
645
|
+
o.description && /* @__PURE__ */ e("p", { className: "nice-admin-settings__description", children: o.description }),
|
|
646
|
+
l(o)
|
|
647
|
+
] }, o.key))
|
|
648
|
+
] }, i)),
|
|
648
649
|
/* @__PURE__ */ n("div", { className: "nice-admin-settings__actions", children: [
|
|
649
|
-
/* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick:
|
|
650
|
-
|
|
650
|
+
/* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick: D, disabled: d, children: d ? t("adminSettings.saving", "Saving…") : t("adminSettings.saveSettings", "Save Settings") }),
|
|
651
|
+
v && /* @__PURE__ */ e("button", { className: "nice-admin-settings__reset-btn", onClick: v, children: t("adminSettings.resetToDefaults", "Reset to Defaults") })
|
|
651
652
|
] })
|
|
652
653
|
] });
|
|
653
654
|
}
|
|
654
|
-
),
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
a.description && /* @__PURE__ */ e("small", { className: "nice-admin-notifications__description", children: a.description })
|
|
692
|
-
] })
|
|
693
|
-
},
|
|
694
|
-
{
|
|
695
|
-
field: "event",
|
|
696
|
-
header: "Event",
|
|
697
|
-
sortable: !0,
|
|
698
|
-
render: (v, a) => /* @__PURE__ */ e("code", { children: a.event })
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
field: "channels",
|
|
702
|
-
header: "Channels",
|
|
703
|
-
render: (v, a) => a.channels.join(", ")
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
field: "lastSentAt",
|
|
707
|
-
header: "Last Sent",
|
|
708
|
-
sortable: !0,
|
|
709
|
-
render: (v, a) => a.lastSentAt ?? "—"
|
|
710
|
-
},
|
|
711
|
-
{
|
|
712
|
-
field: "sentCount",
|
|
713
|
-
header: "Sent",
|
|
714
|
-
align: "right",
|
|
715
|
-
dataType: "number",
|
|
716
|
-
sortable: !0,
|
|
717
|
-
render: (v, a) => a.sentCount ?? 0
|
|
718
|
-
}
|
|
719
|
-
];
|
|
720
|
-
return (p || l || C) && x.push({
|
|
721
|
-
field: "__actions",
|
|
722
|
-
header: "Actions",
|
|
723
|
-
align: "right",
|
|
724
|
-
sortable: !1,
|
|
725
|
-
render: (v, a) => /* @__PURE__ */ n("div", { className: "nice-admin-notifications__actions", children: [
|
|
726
|
-
p && /* @__PURE__ */ e("button", { type: "button", onClick: () => p(a), children: "Edit" }),
|
|
727
|
-
l && /* @__PURE__ */ e("button", { type: "button", onClick: () => l(a.id), children: "Test" }),
|
|
728
|
-
C && /* @__PURE__ */ e("button", { type: "button", onClick: () => C(a.id), children: "Delete" })
|
|
655
|
+
), ue = /* @__PURE__ */ z(function(_, y) {
|
|
656
|
+
const { t } = P(), {
|
|
657
|
+
notifications: f,
|
|
658
|
+
availableChannels: x = ["email", "push", "sms", "in-app", "webhook"],
|
|
659
|
+
onToggle: N,
|
|
660
|
+
onEdit: v,
|
|
661
|
+
onTest: d,
|
|
662
|
+
onCreate: F,
|
|
663
|
+
onDelete: S,
|
|
664
|
+
title: s,
|
|
665
|
+
className: h,
|
|
666
|
+
style: T
|
|
667
|
+
} = _, R = I(() => {
|
|
668
|
+
const D = [
|
|
669
|
+
{
|
|
670
|
+
field: "enabled",
|
|
671
|
+
header: t("adminNotifications.enabled", "Enabled"),
|
|
672
|
+
align: "center",
|
|
673
|
+
width: 90,
|
|
674
|
+
sortable: !0,
|
|
675
|
+
render: (k, l) => /* @__PURE__ */ e(
|
|
676
|
+
"input",
|
|
677
|
+
{
|
|
678
|
+
type: "checkbox",
|
|
679
|
+
checked: l.enabled,
|
|
680
|
+
onChange: () => N == null ? void 0 : N(l.id, !l.enabled),
|
|
681
|
+
"aria-label": t("adminNotifications.toggle", "Toggle {name}").replace("{name}", l.name)
|
|
682
|
+
}
|
|
683
|
+
)
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
field: "name",
|
|
687
|
+
header: t("adminNotifications.name", "Name"),
|
|
688
|
+
sortable: !0,
|
|
689
|
+
render: (k, l) => /* @__PURE__ */ n("div", { className: "nice-admin-notifications__name", children: [
|
|
690
|
+
/* @__PURE__ */ e("strong", { children: l.name }),
|
|
691
|
+
l.description && /* @__PURE__ */ e("small", { className: "nice-admin-notifications__description", children: l.description })
|
|
729
692
|
] })
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
field: "event",
|
|
696
|
+
header: t("adminNotifications.event", "Event"),
|
|
697
|
+
sortable: !0,
|
|
698
|
+
render: (k, l) => /* @__PURE__ */ e("code", { children: l.event })
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
field: "channels",
|
|
702
|
+
header: t("adminNotifications.channels", "Channels"),
|
|
703
|
+
render: (k, l) => l.channels.join(", ")
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
field: "lastSentAt",
|
|
707
|
+
header: t("adminNotifications.lastSent", "Last Sent"),
|
|
708
|
+
sortable: !0,
|
|
709
|
+
render: (k, l) => l.lastSentAt ?? "—"
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
field: "sentCount",
|
|
713
|
+
header: t("adminNotifications.sent", "Sent"),
|
|
714
|
+
align: "right",
|
|
715
|
+
dataType: "number",
|
|
716
|
+
sortable: !0,
|
|
717
|
+
render: (k, l) => l.sentCount ?? 0
|
|
718
|
+
}
|
|
719
|
+
];
|
|
720
|
+
return (v || d || S) && D.push({
|
|
721
|
+
field: "__actions",
|
|
722
|
+
header: t("adminNotifications.actions", "Actions"),
|
|
723
|
+
align: "right",
|
|
724
|
+
sortable: !1,
|
|
725
|
+
render: (k, l) => /* @__PURE__ */ n("div", { className: "nice-admin-notifications__actions", children: [
|
|
726
|
+
v && /* @__PURE__ */ e("button", { type: "button", onClick: () => v(l), children: t("adminNotifications.edit", "Edit") }),
|
|
727
|
+
d && /* @__PURE__ */ e("button", { type: "button", onClick: () => d(l.id), children: t("adminNotifications.test", "Test") }),
|
|
728
|
+
S && /* @__PURE__ */ e("button", { type: "button", onClick: () => S(l.id), children: t("adminNotifications.delete", "Delete") })
|
|
729
|
+
] })
|
|
730
|
+
}), D;
|
|
731
|
+
}, [N, v, d, S, t]), g = F ? /* @__PURE__ */ e("button", { type: "button", onClick: F, className: "nice-admin-notifications__create", children: t("adminNotifications.newNotification", "New Notification") }) : void 0;
|
|
732
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-notifications ${h ?? ""}`, style: T, children: [
|
|
733
|
+
s && /* @__PURE__ */ e("div", { className: "nice-admin-notifications__header", children: /* @__PURE__ */ e("h3", { children: s }) }),
|
|
734
|
+
/* @__PURE__ */ e(
|
|
735
|
+
O,
|
|
736
|
+
{
|
|
737
|
+
data: f,
|
|
738
|
+
columns: R,
|
|
739
|
+
keyField: "id",
|
|
740
|
+
searchable: !0,
|
|
741
|
+
striped: !0,
|
|
742
|
+
emptyText: t("adminNotifications.noNotifications", "No notifications found."),
|
|
743
|
+
toolbar: g
|
|
744
|
+
}
|
|
745
|
+
)
|
|
746
|
+
] });
|
|
747
|
+
}), pe = /* @__PURE__ */ z(
|
|
748
|
+
function(_, y) {
|
|
749
|
+
const { t } = P(), {
|
|
750
|
+
flags: f,
|
|
751
|
+
environmentNames: x = ["development", "staging", "production"],
|
|
752
|
+
onToggle: N,
|
|
753
|
+
onPercentageChange: v,
|
|
754
|
+
onCreate: d,
|
|
755
|
+
onDelete: F,
|
|
756
|
+
onEdit: S,
|
|
757
|
+
title: s,
|
|
758
|
+
className: h,
|
|
760
759
|
style: T
|
|
761
|
-
} =
|
|
762
|
-
if (!
|
|
763
|
-
return
|
|
764
|
-
const
|
|
765
|
-
return
|
|
766
|
-
(
|
|
767
|
-
var
|
|
768
|
-
return
|
|
760
|
+
} = _, R = s ?? t("featureFlags.title", "Feature Flags"), [g, D] = A(""), [k, l] = A(!1), [i, r] = A(""), [o, c] = A(""), [p, C] = A(""), w = I(() => {
|
|
761
|
+
if (!g.trim())
|
|
762
|
+
return f;
|
|
763
|
+
const u = g.toLowerCase();
|
|
764
|
+
return f.filter(
|
|
765
|
+
(a) => {
|
|
766
|
+
var b, E;
|
|
767
|
+
return a.key.toLowerCase().includes(u) || a.name.toLowerCase().includes(u) || ((b = a.description) == null ? void 0 : b.toLowerCase().includes(u)) || ((E = a.tags) == null ? void 0 : E.some(($) => $.toLowerCase().includes(u)));
|
|
769
768
|
}
|
|
770
769
|
);
|
|
771
|
-
}, [
|
|
772
|
-
!
|
|
773
|
-
}, [
|
|
774
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
770
|
+
}, [f, g]), m = M(() => {
|
|
771
|
+
!i.trim() || !o.trim() || !d || (d(i.trim(), o.trim(), p.trim()), r(""), c(""), C(""), l(!1));
|
|
772
|
+
}, [i, o, p, d]), U = (u, a) => u.environments.find((b) => b.name === a);
|
|
773
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-feature-flags ${h ?? ""}`, style: T, children: [
|
|
775
774
|
/* @__PURE__ */ n("div", { className: "nice-feature-flags__header", children: [
|
|
776
|
-
/* @__PURE__ */ e("h3", { children:
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
|
|
779
|
-
" flags"
|
|
780
|
-
] }),
|
|
781
|
-
l && /* @__PURE__ */ e("button", { onClick: () => v(!x), children: "+ New Flag" })
|
|
775
|
+
/* @__PURE__ */ e("h3", { children: R }),
|
|
776
|
+
/* @__PURE__ */ e("span", { className: "nice-feature-flags__count", children: t("featureFlags.count", "{count} flags").replace("{count}", String(f.length)) }),
|
|
777
|
+
d && /* @__PURE__ */ e("button", { onClick: () => l(!k), children: t("featureFlags.newFlag", "+ New Flag") })
|
|
782
778
|
] }),
|
|
783
|
-
|
|
779
|
+
k && /* @__PURE__ */ n("div", { className: "nice-feature-flags__create-form", children: [
|
|
784
780
|
/* @__PURE__ */ e(
|
|
785
781
|
"input",
|
|
786
782
|
{
|
|
787
783
|
type: "text",
|
|
788
|
-
value:
|
|
789
|
-
onChange: (
|
|
784
|
+
value: i,
|
|
785
|
+
onChange: (u) => r(u.target.value),
|
|
790
786
|
placeholder: "flag_key"
|
|
791
787
|
}
|
|
792
788
|
),
|
|
@@ -794,445 +790,440 @@ const re = $(
|
|
|
794
790
|
"input",
|
|
795
791
|
{
|
|
796
792
|
type: "text",
|
|
797
|
-
value:
|
|
798
|
-
onChange: (
|
|
799
|
-
placeholder: "Display name"
|
|
793
|
+
value: o,
|
|
794
|
+
onChange: (u) => c(u.target.value),
|
|
795
|
+
placeholder: t("featureFlags.displayName", "Display name")
|
|
800
796
|
}
|
|
801
797
|
),
|
|
802
798
|
/* @__PURE__ */ e(
|
|
803
799
|
"input",
|
|
804
800
|
{
|
|
805
801
|
type: "text",
|
|
806
|
-
value:
|
|
807
|
-
onChange: (
|
|
808
|
-
placeholder: "Description"
|
|
802
|
+
value: p,
|
|
803
|
+
onChange: (u) => C(u.target.value),
|
|
804
|
+
placeholder: t("featureFlags.description", "Description")
|
|
809
805
|
}
|
|
810
806
|
),
|
|
811
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
812
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
807
|
+
/* @__PURE__ */ e("button", { onClick: m, disabled: !i.trim() || !o.trim(), children: t("featureFlags.create", "Create") }),
|
|
808
|
+
/* @__PURE__ */ e("button", { onClick: () => l(!1), children: t("featureFlags.cancel", "Cancel") })
|
|
813
809
|
] }),
|
|
814
810
|
/* @__PURE__ */ e(
|
|
815
811
|
"input",
|
|
816
812
|
{
|
|
817
813
|
type: "text",
|
|
818
|
-
value:
|
|
819
|
-
onChange: (
|
|
820
|
-
placeholder: "Search flags…",
|
|
814
|
+
value: g,
|
|
815
|
+
onChange: (u) => D(u.target.value),
|
|
816
|
+
placeholder: t("featureFlags.searchFlags", "Search flags…"),
|
|
821
817
|
className: "nice-feature-flags__search"
|
|
822
818
|
}
|
|
823
819
|
),
|
|
824
|
-
w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-feature-flags__empty", children: "No feature flags found." }) : /* @__PURE__ */ n("table", { className: "nice-feature-flags__table", children: [
|
|
820
|
+
w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-feature-flags__empty", children: t("featureFlags.noFeatureFlagsFound", "No feature flags found.") }) : /* @__PURE__ */ n("table", { className: "nice-feature-flags__table", children: [
|
|
825
821
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
826
|
-
/* @__PURE__ */ e("th", { children: "Flag" }),
|
|
827
|
-
|
|
828
|
-
/* @__PURE__ */ e("th", { children: "Tags" }),
|
|
829
|
-
/* @__PURE__ */ e("th", { children: "Updated" }),
|
|
830
|
-
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
822
|
+
/* @__PURE__ */ e("th", { children: t("featureFlags.flag", "Flag") }),
|
|
823
|
+
x.map((u) => /* @__PURE__ */ e("th", { children: u }, u)),
|
|
824
|
+
/* @__PURE__ */ e("th", { children: t("featureFlags.tags", "Tags") }),
|
|
825
|
+
/* @__PURE__ */ e("th", { children: t("featureFlags.updated", "Updated") }),
|
|
826
|
+
/* @__PURE__ */ e("th", { children: t("featureFlags.actions", "Actions") })
|
|
831
827
|
] }) }),
|
|
832
|
-
/* @__PURE__ */ e("tbody", { children: w.map((
|
|
833
|
-
var
|
|
828
|
+
/* @__PURE__ */ e("tbody", { children: w.map((u) => {
|
|
829
|
+
var a;
|
|
834
830
|
return /* @__PURE__ */ n("tr", { children: [
|
|
835
831
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ n("div", { className: "nice-feature-flags__flag-info", children: [
|
|
836
|
-
/* @__PURE__ */ e("strong", { children:
|
|
837
|
-
/* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children:
|
|
838
|
-
|
|
832
|
+
/* @__PURE__ */ e("strong", { children: u.name }),
|
|
833
|
+
/* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children: u.key }),
|
|
834
|
+
u.description && /* @__PURE__ */ e("small", { children: u.description })
|
|
839
835
|
] }) }),
|
|
840
|
-
|
|
841
|
-
const
|
|
836
|
+
x.map((b) => {
|
|
837
|
+
const E = U(u, b);
|
|
842
838
|
return /* @__PURE__ */ n("td", { className: "nice-feature-flags__env-cell", children: [
|
|
843
839
|
/* @__PURE__ */ e(
|
|
844
840
|
"input",
|
|
845
841
|
{
|
|
846
842
|
type: "checkbox",
|
|
847
|
-
checked: (
|
|
848
|
-
onChange: () =>
|
|
843
|
+
checked: (E == null ? void 0 : E.enabled) ?? !1,
|
|
844
|
+
onChange: () => N == null ? void 0 : N(u.id, b, !((E == null ? void 0 : E.enabled) ?? !1))
|
|
849
845
|
}
|
|
850
846
|
),
|
|
851
|
-
(
|
|
847
|
+
(E == null ? void 0 : E.percentage) != null && /* @__PURE__ */ e(
|
|
852
848
|
"input",
|
|
853
849
|
{
|
|
854
850
|
type: "number",
|
|
855
851
|
min: 0,
|
|
856
852
|
max: 100,
|
|
857
|
-
value:
|
|
858
|
-
onChange: (
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
parseInt(
|
|
853
|
+
value: E.percentage,
|
|
854
|
+
onChange: ($) => v == null ? void 0 : v(
|
|
855
|
+
u.id,
|
|
856
|
+
b,
|
|
857
|
+
parseInt($.target.value, 10) || 0
|
|
862
858
|
),
|
|
863
859
|
className: "nice-feature-flags__percentage",
|
|
864
|
-
title: "Rollout %"
|
|
860
|
+
title: t("featureFlags.rollout", "Rollout %")
|
|
865
861
|
}
|
|
866
862
|
)
|
|
867
|
-
] },
|
|
863
|
+
] }, b);
|
|
868
864
|
}),
|
|
869
|
-
/* @__PURE__ */ e("td", { children: ((
|
|
870
|
-
/* @__PURE__ */ e("td", { children:
|
|
865
|
+
/* @__PURE__ */ e("td", { children: ((a = u.tags) == null ? void 0 : a.join(", ")) || "—" }),
|
|
866
|
+
/* @__PURE__ */ e("td", { children: u.updatedAt ?? u.createdAt }),
|
|
871
867
|
/* @__PURE__ */ n("td", { className: "nice-feature-flags__actions", children: [
|
|
872
|
-
|
|
873
|
-
|
|
868
|
+
S && /* @__PURE__ */ e("button", { onClick: () => S(u), children: t("featureFlags.edit", "Edit") }),
|
|
869
|
+
F && /* @__PURE__ */ e("button", { onClick: () => F(u.id), children: t("featureFlags.delete", "Delete") })
|
|
874
870
|
] })
|
|
875
|
-
] },
|
|
871
|
+
] }, u.id);
|
|
876
872
|
}) })
|
|
877
873
|
] })
|
|
878
874
|
] });
|
|
879
875
|
}
|
|
880
|
-
),
|
|
881
|
-
function(
|
|
876
|
+
), ge = /* @__PURE__ */ z(
|
|
877
|
+
function(_, y) {
|
|
882
878
|
var w;
|
|
883
|
-
const {
|
|
884
|
-
entities:
|
|
885
|
-
formats:
|
|
886
|
-
jobs:
|
|
887
|
-
onImport:
|
|
888
|
-
onExport:
|
|
889
|
-
onDownload:
|
|
890
|
-
title:
|
|
891
|
-
className:
|
|
892
|
-
style:
|
|
893
|
-
} =
|
|
894
|
-
!
|
|
895
|
-
}, [
|
|
896
|
-
!
|
|
897
|
-
}, [
|
|
898
|
-
var
|
|
899
|
-
|
|
879
|
+
const { t } = P(), {
|
|
880
|
+
entities: f,
|
|
881
|
+
formats: x = ["json", "csv", "xlsx"],
|
|
882
|
+
jobs: N = [],
|
|
883
|
+
onImport: v,
|
|
884
|
+
onExport: d,
|
|
885
|
+
onDownload: F,
|
|
886
|
+
title: S,
|
|
887
|
+
className: s,
|
|
888
|
+
style: h
|
|
889
|
+
} = _, T = S ?? t("importExport.title", "Import / Export"), [R, g] = A("export"), [D, k] = A(((w = f[0]) == null ? void 0 : w.id) ?? ""), [l, i] = A(x[0] ?? "json"), [r, o] = A(null), c = M(() => {
|
|
890
|
+
!v || !r || !D || (v(D, l, r), o(null));
|
|
891
|
+
}, [v, D, l, r]), p = M(() => {
|
|
892
|
+
!d || !D || d(D, l);
|
|
893
|
+
}, [d, D, l]), C = (m) => {
|
|
894
|
+
var U;
|
|
895
|
+
o(((U = m.target.files) == null ? void 0 : U[0]) ?? null);
|
|
900
896
|
};
|
|
901
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
902
|
-
/* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children:
|
|
897
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-import-export ${s ?? ""}`, style: h, children: [
|
|
898
|
+
/* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children: T }) }),
|
|
903
899
|
/* @__PURE__ */ n("div", { className: "nice-import-export__tabs", children: [
|
|
904
900
|
/* @__PURE__ */ e(
|
|
905
901
|
"button",
|
|
906
902
|
{
|
|
907
|
-
className: `nice-import-export__tab ${
|
|
908
|
-
onClick: () =>
|
|
909
|
-
children: "Import"
|
|
903
|
+
className: `nice-import-export__tab ${R === "import" ? "nice-import-export__tab--active" : ""}`,
|
|
904
|
+
onClick: () => g("import"),
|
|
905
|
+
children: t("importExport.import", "Import")
|
|
910
906
|
}
|
|
911
907
|
),
|
|
912
908
|
/* @__PURE__ */ e(
|
|
913
909
|
"button",
|
|
914
910
|
{
|
|
915
|
-
className: `nice-import-export__tab ${
|
|
916
|
-
onClick: () =>
|
|
917
|
-
children: "Export"
|
|
911
|
+
className: `nice-import-export__tab ${R === "export" ? "nice-import-export__tab--active" : ""}`,
|
|
912
|
+
onClick: () => g("export"),
|
|
913
|
+
children: t("importExport.export", "Export")
|
|
918
914
|
}
|
|
919
915
|
)
|
|
920
916
|
] }),
|
|
921
917
|
/* @__PURE__ */ n("div", { className: "nice-import-export__form", children: [
|
|
922
918
|
/* @__PURE__ */ n("label", { children: [
|
|
923
|
-
"Entity",
|
|
924
|
-
/* @__PURE__ */ e("select", { value:
|
|
919
|
+
t("importExport.entity", "Entity"),
|
|
920
|
+
/* @__PURE__ */ e("select", { value: D, onChange: (m) => k(m.target.value), children: f.map((m) => /* @__PURE__ */ e("option", { value: m.id, children: m.label }, m.id)) })
|
|
925
921
|
] }),
|
|
926
922
|
/* @__PURE__ */ n("label", { children: [
|
|
927
|
-
"Format",
|
|
923
|
+
t("importExport.format", "Format"),
|
|
928
924
|
/* @__PURE__ */ e(
|
|
929
925
|
"select",
|
|
930
926
|
{
|
|
931
|
-
value:
|
|
932
|
-
onChange: (
|
|
933
|
-
children:
|
|
927
|
+
value: l,
|
|
928
|
+
onChange: (m) => i(m.target.value),
|
|
929
|
+
children: x.map((m) => /* @__PURE__ */ e("option", { value: m, children: m.toUpperCase() }, m))
|
|
934
930
|
}
|
|
935
931
|
)
|
|
936
932
|
] }),
|
|
937
|
-
|
|
933
|
+
R === "import" && /* @__PURE__ */ n(H, { children: [
|
|
938
934
|
/* @__PURE__ */ n("label", { children: [
|
|
939
|
-
"File",
|
|
940
|
-
/* @__PURE__ */ e("input", { type: "file", onChange:
|
|
935
|
+
t("importExport.file", "File"),
|
|
936
|
+
/* @__PURE__ */ e("input", { type: "file", onChange: C, accept: `.${l}` })
|
|
941
937
|
] }),
|
|
942
938
|
/* @__PURE__ */ e(
|
|
943
939
|
"button",
|
|
944
940
|
{
|
|
945
941
|
className: "nice-import-export__action-btn",
|
|
946
|
-
onClick:
|
|
947
|
-
disabled: !
|
|
948
|
-
children: "Start Import"
|
|
942
|
+
onClick: c,
|
|
943
|
+
disabled: !r,
|
|
944
|
+
children: t("importExport.startImport", "Start Import")
|
|
949
945
|
}
|
|
950
946
|
)
|
|
951
947
|
] }),
|
|
952
|
-
|
|
948
|
+
R === "export" && /* @__PURE__ */ e("button", { className: "nice-import-export__action-btn", onClick: p, children: t("importExport.startExport", "Start Export") })
|
|
953
949
|
] }),
|
|
954
|
-
|
|
955
|
-
/* @__PURE__ */ e("h4", { children: "Recent Jobs" }),
|
|
950
|
+
N.length > 0 && /* @__PURE__ */ n("div", { className: "nice-import-export__jobs", children: [
|
|
951
|
+
/* @__PURE__ */ e("h4", { children: t("importExport.recentJobs", "Recent Jobs") }),
|
|
956
952
|
/* @__PURE__ */ n("table", { className: "nice-import-export__jobs-table", children: [
|
|
957
953
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
958
|
-
/* @__PURE__ */ e("th", { children: "Type" }),
|
|
959
|
-
/* @__PURE__ */ e("th", { children: "Format" }),
|
|
960
|
-
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
961
|
-
/* @__PURE__ */ e("th", { children: "Progress" }),
|
|
962
|
-
/* @__PURE__ */ e("th", { children: "Errors" }),
|
|
963
|
-
/* @__PURE__ */ e("th", { children: "Created" }),
|
|
954
|
+
/* @__PURE__ */ e("th", { children: t("importExport.type", "Type") }),
|
|
955
|
+
/* @__PURE__ */ e("th", { children: t("importExport.format", "Format") }),
|
|
956
|
+
/* @__PURE__ */ e("th", { children: t("importExport.status", "Status") }),
|
|
957
|
+
/* @__PURE__ */ e("th", { children: t("importExport.progress", "Progress") }),
|
|
958
|
+
/* @__PURE__ */ e("th", { children: t("importExport.errors", "Errors") }),
|
|
959
|
+
/* @__PURE__ */ e("th", { children: t("importExport.created", "Created") }),
|
|
964
960
|
/* @__PURE__ */ e("th", {})
|
|
965
961
|
] }) }),
|
|
966
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
967
|
-
/* @__PURE__ */ e("td", { children:
|
|
968
|
-
/* @__PURE__ */ e("td", { children:
|
|
962
|
+
/* @__PURE__ */ e("tbody", { children: N.map((m) => /* @__PURE__ */ n("tr", { children: [
|
|
963
|
+
/* @__PURE__ */ e("td", { children: m.type }),
|
|
964
|
+
/* @__PURE__ */ e("td", { children: m.format.toUpperCase() }),
|
|
969
965
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
970
966
|
"span",
|
|
971
967
|
{
|
|
972
|
-
className: `nice-import-export__status nice-import-export__status--${
|
|
973
|
-
children:
|
|
968
|
+
className: `nice-import-export__status nice-import-export__status--${m.status}`,
|
|
969
|
+
children: m.status
|
|
974
970
|
}
|
|
975
971
|
) }),
|
|
976
|
-
/* @__PURE__ */ e("td", { children:
|
|
977
|
-
/* @__PURE__ */ e("td", { children:
|
|
978
|
-
/* @__PURE__ */ e("td", { children:
|
|
979
|
-
/* @__PURE__ */ e("td", { children:
|
|
980
|
-
] },
|
|
972
|
+
/* @__PURE__ */ e("td", { children: m.processedRows != null && m.totalRows ? `${m.processedRows} / ${m.totalRows}` : "—" }),
|
|
973
|
+
/* @__PURE__ */ e("td", { children: m.errorCount ?? 0 }),
|
|
974
|
+
/* @__PURE__ */ e("td", { children: m.createdAt }),
|
|
975
|
+
/* @__PURE__ */ e("td", { children: m.type === "export" && m.status === "completed" && F && /* @__PURE__ */ e("button", { onClick: () => F(m.id), children: t("importExport.download", "Download") }) })
|
|
976
|
+
] }, m.id)) })
|
|
981
977
|
] })
|
|
982
978
|
] })
|
|
983
979
|
] });
|
|
984
980
|
}
|
|
985
|
-
),
|
|
986
|
-
function
|
|
987
|
-
return /* @__PURE__ */ e(
|
|
981
|
+
), Y = /* @__PURE__ */ ee({ flags: {} });
|
|
982
|
+
function _e({ config: L, children: _ }) {
|
|
983
|
+
return /* @__PURE__ */ e(Y.Provider, { value: L, children: _ });
|
|
988
984
|
}
|
|
989
|
-
function
|
|
990
|
-
const
|
|
991
|
-
return
|
|
992
|
-
const
|
|
993
|
-
return
|
|
994
|
-
}, [
|
|
985
|
+
function ie(L) {
|
|
986
|
+
const _ = j(Y);
|
|
987
|
+
return I(() => {
|
|
988
|
+
const y = _.flags[L];
|
|
989
|
+
return y === void 0 ? { enabled: !1 } : typeof y == "boolean" ? { enabled: y } : { enabled: y > 0, percentage: y };
|
|
990
|
+
}, [_.flags, L]);
|
|
995
991
|
}
|
|
996
|
-
function
|
|
997
|
-
const { enabled:
|
|
998
|
-
return /* @__PURE__ */ e(
|
|
992
|
+
function be({ flag: L, fallback: _ = null, children: y }) {
|
|
993
|
+
const { enabled: t } = ie(L);
|
|
994
|
+
return /* @__PURE__ */ e(H, { children: t ? y : _ });
|
|
999
995
|
}
|
|
1000
|
-
const
|
|
996
|
+
const V = {
|
|
1001
997
|
low: "#2196f3",
|
|
1002
998
|
medium: "#ff9800",
|
|
1003
999
|
high: "#f44336",
|
|
1004
1000
|
critical: "#9c27b0"
|
|
1005
|
-
},
|
|
1001
|
+
}, q = {
|
|
1006
1002
|
field: "Hidden Field",
|
|
1007
1003
|
endpoint: "Decoy Endpoint",
|
|
1008
1004
|
file: "Canary File",
|
|
1009
1005
|
credential: "Fake Credential",
|
|
1010
1006
|
cookie: "Tracking Cookie"
|
|
1011
|
-
},
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}, c)
|
|
1023
|
-
|
|
1024
|
-
() =>
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
),
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
"
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
className:
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
L.activeCount,
|
|
1052
|
-
"/",
|
|
1053
|
-
L.totalCount
|
|
1054
|
-
] }),
|
|
1055
|
-
/* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat", children: [
|
|
1056
|
-
"Trips: ",
|
|
1057
|
-
L.totalTrips
|
|
1058
|
-
] }),
|
|
1059
|
-
L.criticalEvents > 0 && /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
|
|
1060
|
-
"Critical: ",
|
|
1061
|
-
L.criticalEvents
|
|
1062
|
-
] })
|
|
1063
|
-
] })
|
|
1064
|
-
] }),
|
|
1065
|
-
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__toolbar", children: [
|
|
1066
|
-
/* @__PURE__ */ e(
|
|
1067
|
-
"input",
|
|
1068
|
-
{
|
|
1069
|
-
type: "text",
|
|
1070
|
-
className: "nice-honey-token-dashboard__search",
|
|
1071
|
-
placeholder: "Search tokens...",
|
|
1072
|
-
value: S,
|
|
1073
|
-
onChange: (t) => T(t.target.value)
|
|
1074
|
-
}
|
|
1075
|
-
),
|
|
1076
|
-
m && /* @__PURE__ */ e(
|
|
1077
|
-
"button",
|
|
1078
|
-
{
|
|
1079
|
-
className: "nice-honey-token-dashboard__btn",
|
|
1080
|
-
onClick: () => N(!f),
|
|
1081
|
-
children: f ? "Cancel" : "+ New Token"
|
|
1082
|
-
}
|
|
1083
|
-
)
|
|
1084
|
-
] }),
|
|
1085
|
-
f && /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__create", children: [
|
|
1086
|
-
/* @__PURE__ */ e(
|
|
1087
|
-
"input",
|
|
1088
|
-
{
|
|
1089
|
-
type: "text",
|
|
1090
|
-
placeholder: "Token name",
|
|
1091
|
-
value: x,
|
|
1092
|
-
onChange: (t) => v(t.target.value)
|
|
1093
|
-
}
|
|
1094
|
-
),
|
|
1095
|
-
/* @__PURE__ */ e("select", { value: a, onChange: (t) => s(t.target.value), children: Object.entries(H).map(([t, E]) => /* @__PURE__ */ e("option", { value: t, children: E }, t)) }),
|
|
1096
|
-
/* @__PURE__ */ n(
|
|
1097
|
-
"select",
|
|
1098
|
-
{
|
|
1099
|
-
value: d,
|
|
1100
|
-
onChange: (t) => r(t.target.value),
|
|
1101
|
-
children: [
|
|
1102
|
-
/* @__PURE__ */ e("option", { value: "low", children: "Low" }),
|
|
1103
|
-
/* @__PURE__ */ e("option", { value: "medium", children: "Medium" }),
|
|
1104
|
-
/* @__PURE__ */ e("option", { value: "high", children: "High" }),
|
|
1105
|
-
/* @__PURE__ */ e("option", { value: "critical", children: "Critical" })
|
|
1106
|
-
]
|
|
1107
|
-
}
|
|
1108
|
-
),
|
|
1109
|
-
/* @__PURE__ */ e(
|
|
1110
|
-
"input",
|
|
1111
|
-
{
|
|
1112
|
-
type: "text",
|
|
1113
|
-
placeholder: "Location (e.g. /api/admin/secret)",
|
|
1114
|
-
value: h,
|
|
1115
|
-
onChange: (t) => b(t.target.value)
|
|
1116
|
-
}
|
|
1117
|
-
),
|
|
1118
|
-
/* @__PURE__ */ e("button", { onClick: i, children: "Create" })
|
|
1119
|
-
] }),
|
|
1120
|
-
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__tokens", children: [
|
|
1121
|
-
/* @__PURE__ */ n("h3", { children: [
|
|
1122
|
-
"Tokens (",
|
|
1123
|
-
w.length,
|
|
1124
|
-
")"
|
|
1007
|
+
}, ve = /* @__PURE__ */ z(function({
|
|
1008
|
+
tokens: _,
|
|
1009
|
+
events: y,
|
|
1010
|
+
onCreate: t,
|
|
1011
|
+
onToggle: f,
|
|
1012
|
+
onDelete: x,
|
|
1013
|
+
onDismissEvent: N,
|
|
1014
|
+
title: v,
|
|
1015
|
+
className: d,
|
|
1016
|
+
style: F
|
|
1017
|
+
}, S) {
|
|
1018
|
+
const { t: s } = P(), h = v ?? s("honeyTokenDashboard.title", "Honey Tokens"), [T, R] = A(""), [g, D] = A(!1), [k, l] = A(""), [i, r] = A("field"), [o, c] = A("medium"), [p, C] = A(""), w = I(
|
|
1019
|
+
() => _.filter(
|
|
1020
|
+
(a) => a.name.toLowerCase().includes(T.toLowerCase()) || a.location.toLowerCase().includes(T.toLowerCase())
|
|
1021
|
+
),
|
|
1022
|
+
[_, T]
|
|
1023
|
+
), m = I(
|
|
1024
|
+
() => [...y].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()),
|
|
1025
|
+
[y]
|
|
1026
|
+
), U = I(() => {
|
|
1027
|
+
const a = _.filter(($) => $.active).length, b = _.reduce(($, K) => $ + K.tripCount, 0), E = y.filter(($) => $.severity === "critical").length;
|
|
1028
|
+
return { activeCount: a, totalCount: _.length, totalTrips: b, criticalEvents: E };
|
|
1029
|
+
}, [_, y]), u = () => {
|
|
1030
|
+
k.trim() && p.trim() && t && (t(k.trim(), i, o, p.trim()), l(""), C(""), D(!1));
|
|
1031
|
+
};
|
|
1032
|
+
return /* @__PURE__ */ n(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
ref: S,
|
|
1036
|
+
className: `nice-honey-token-dashboard${d ? ` ${d}` : ""}`,
|
|
1037
|
+
style: F,
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__header", children: [
|
|
1040
|
+
/* @__PURE__ */ e("h2", { children: h }),
|
|
1041
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__stats", children: [
|
|
1042
|
+
/* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat", children: [
|
|
1043
|
+
"Active: ",
|
|
1044
|
+
U.activeCount,
|
|
1045
|
+
"/",
|
|
1046
|
+
U.totalCount
|
|
1125
1047
|
] }),
|
|
1126
|
-
/* @__PURE__ */ n("
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
/* @__PURE__ */ e("th", { children: "Last Tripped" }),
|
|
1134
|
-
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
1135
|
-
/* @__PURE__ */ e("th", { children: "Actions" })
|
|
1136
|
-
] }) }),
|
|
1137
|
-
/* @__PURE__ */ e("tbody", { children: w.map((t) => /* @__PURE__ */ n(
|
|
1138
|
-
"tr",
|
|
1139
|
-
{
|
|
1140
|
-
className: t.tripCount > 0 ? "nice-honey-token-dashboard__row--tripped" : "",
|
|
1141
|
-
children: [
|
|
1142
|
-
/* @__PURE__ */ e("td", { children: t.name }),
|
|
1143
|
-
/* @__PURE__ */ e("td", { children: H[t.type] }),
|
|
1144
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
1145
|
-
"span",
|
|
1146
|
-
{
|
|
1147
|
-
className: "nice-honey-token-dashboard__severity",
|
|
1148
|
-
style: { color: M[t.severity] },
|
|
1149
|
-
children: t.severity
|
|
1150
|
-
}
|
|
1151
|
-
) }),
|
|
1152
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: t.location }) }),
|
|
1153
|
-
/* @__PURE__ */ e("td", { children: t.tripCount }),
|
|
1154
|
-
/* @__PURE__ */ e("td", { children: t.lastTripped ?? "—" }),
|
|
1155
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
1156
|
-
"span",
|
|
1157
|
-
{
|
|
1158
|
-
className: `nice-honey-token-dashboard__status--${t.active ? "active" : "inactive"}`,
|
|
1159
|
-
children: t.active ? "Active" : "Inactive"
|
|
1160
|
-
}
|
|
1161
|
-
) }),
|
|
1162
|
-
/* @__PURE__ */ n("td", { children: [
|
|
1163
|
-
y && /* @__PURE__ */ e("button", { onClick: () => y(t.id, !t.active), children: t.active ? "Disable" : "Enable" }),
|
|
1164
|
-
g && /* @__PURE__ */ e("button", { onClick: () => g(t.id), children: "Delete" })
|
|
1165
|
-
] })
|
|
1166
|
-
]
|
|
1167
|
-
},
|
|
1168
|
-
t.id
|
|
1169
|
-
)) })
|
|
1048
|
+
/* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat", children: [
|
|
1049
|
+
"Trips: ",
|
|
1050
|
+
U.totalTrips
|
|
1051
|
+
] }),
|
|
1052
|
+
U.criticalEvents > 0 && /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
|
|
1053
|
+
"Critical: ",
|
|
1054
|
+
U.criticalEvents
|
|
1170
1055
|
] })
|
|
1056
|
+
] })
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__toolbar", children: [
|
|
1059
|
+
/* @__PURE__ */ e(
|
|
1060
|
+
"input",
|
|
1061
|
+
{
|
|
1062
|
+
type: "text",
|
|
1063
|
+
className: "nice-honey-token-dashboard__search",
|
|
1064
|
+
placeholder: s("honeyTokenDashboard.searchTokens", "Search tokens..."),
|
|
1065
|
+
value: T,
|
|
1066
|
+
onChange: (a) => R(a.target.value)
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
t && /* @__PURE__ */ e(
|
|
1070
|
+
"button",
|
|
1071
|
+
{
|
|
1072
|
+
className: "nice-honey-token-dashboard__btn",
|
|
1073
|
+
onClick: () => D(!g),
|
|
1074
|
+
children: g ? s("honeyTokenDashboard.cancel", "Cancel") : s("honeyTokenDashboard.newToken", "+ New Token")
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] }),
|
|
1078
|
+
g && /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__create", children: [
|
|
1079
|
+
/* @__PURE__ */ e(
|
|
1080
|
+
"input",
|
|
1081
|
+
{
|
|
1082
|
+
type: "text",
|
|
1083
|
+
placeholder: s("honeyTokenDashboard.tokenName", "Token name"),
|
|
1084
|
+
value: k,
|
|
1085
|
+
onChange: (a) => l(a.target.value)
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ e("select", { value: i, onChange: (a) => r(a.target.value), children: Object.entries(q).map(([a, b]) => /* @__PURE__ */ e("option", { value: a, children: s(`honeyTokenDashboard.tokenType.${a}`, b) }, a)) }),
|
|
1089
|
+
/* @__PURE__ */ n(
|
|
1090
|
+
"select",
|
|
1091
|
+
{
|
|
1092
|
+
value: o,
|
|
1093
|
+
onChange: (a) => c(a.target.value),
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ e("option", { value: "low", children: s("honeyTokenDashboard.low", "Low") }),
|
|
1096
|
+
/* @__PURE__ */ e("option", { value: "medium", children: s("honeyTokenDashboard.medium", "Medium") }),
|
|
1097
|
+
/* @__PURE__ */ e("option", { value: "high", children: s("honeyTokenDashboard.high", "High") }),
|
|
1098
|
+
/* @__PURE__ */ e("option", { value: "critical", children: s("honeyTokenDashboard.critical", "Critical") })
|
|
1099
|
+
]
|
|
1100
|
+
}
|
|
1101
|
+
),
|
|
1102
|
+
/* @__PURE__ */ e(
|
|
1103
|
+
"input",
|
|
1104
|
+
{
|
|
1105
|
+
type: "text",
|
|
1106
|
+
placeholder: s(
|
|
1107
|
+
"honeyTokenDashboard.locationEGApiAdmin",
|
|
1108
|
+
"Location (e.g. /api/admin/secret)"
|
|
1109
|
+
),
|
|
1110
|
+
value: p,
|
|
1111
|
+
onChange: (a) => C(a.target.value)
|
|
1112
|
+
}
|
|
1113
|
+
),
|
|
1114
|
+
/* @__PURE__ */ e("button", { onClick: u, children: s("honeyTokenDashboard.create", "Create") })
|
|
1115
|
+
] }),
|
|
1116
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__tokens", children: [
|
|
1117
|
+
/* @__PURE__ */ n("h3", { children: [
|
|
1118
|
+
"Tokens (",
|
|
1119
|
+
w.length,
|
|
1120
|
+
")"
|
|
1171
1121
|
] }),
|
|
1172
|
-
|
|
1173
|
-
/* @__PURE__ */ n("
|
|
1174
|
-
"
|
|
1175
|
-
|
|
1176
|
-
")
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
"
|
|
1122
|
+
/* @__PURE__ */ n("table", { className: "nice-honey-token-dashboard__table", children: [
|
|
1123
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
1124
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.name", "Name") }),
|
|
1125
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.type", "Type") }),
|
|
1126
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.severity", "Severity") }),
|
|
1127
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.location", "Location") }),
|
|
1128
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.trips", "Trips") }),
|
|
1129
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.lastTripped", "Last Tripped") }),
|
|
1130
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.status", "Status") }),
|
|
1131
|
+
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.actions", "Actions") })
|
|
1132
|
+
] }) }),
|
|
1133
|
+
/* @__PURE__ */ e("tbody", { children: w.map((a) => /* @__PURE__ */ n(
|
|
1134
|
+
"tr",
|
|
1180
1135
|
{
|
|
1181
|
-
className:
|
|
1136
|
+
className: a.tripCount > 0 ? "nice-honey-token-dashboard__row--tripped" : "",
|
|
1182
1137
|
children: [
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
{
|
|
1188
|
-
className: "nice-honey-token-dashboard__severity",
|
|
1189
|
-
style: { color: M[t.severity] },
|
|
1190
|
-
children: t.severity
|
|
1191
|
-
}
|
|
1192
|
-
),
|
|
1193
|
-
/* @__PURE__ */ e("time", { children: t.timestamp })
|
|
1194
|
-
] }),
|
|
1195
|
-
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__event-details", children: [
|
|
1196
|
-
/* @__PURE__ */ n("span", { children: [
|
|
1197
|
-
"IP: ",
|
|
1198
|
-
t.sourceIp
|
|
1199
|
-
] }),
|
|
1200
|
-
t.userId && /* @__PURE__ */ n("span", { children: [
|
|
1201
|
-
"User: ",
|
|
1202
|
-
t.userId
|
|
1203
|
-
] }),
|
|
1204
|
-
t.details && /* @__PURE__ */ e("span", { children: t.details })
|
|
1205
|
-
] }),
|
|
1206
|
-
p && /* @__PURE__ */ e(
|
|
1207
|
-
"button",
|
|
1138
|
+
/* @__PURE__ */ e("td", { children: a.name }),
|
|
1139
|
+
/* @__PURE__ */ e("td", { children: s(`honeyTokenDashboard.tokenType.${a.type}`, q[a.type]) }),
|
|
1140
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
1141
|
+
"span",
|
|
1208
1142
|
{
|
|
1209
|
-
className: "nice-honey-token-
|
|
1210
|
-
|
|
1211
|
-
children:
|
|
1143
|
+
className: "nice-honey-token-dashboard__severity",
|
|
1144
|
+
style: { color: V[a.severity] },
|
|
1145
|
+
children: s(`honeyTokenDashboard.${a.severity}`, a.severity)
|
|
1212
1146
|
}
|
|
1213
|
-
)
|
|
1147
|
+
) }),
|
|
1148
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: a.location }) }),
|
|
1149
|
+
/* @__PURE__ */ e("td", { children: a.tripCount }),
|
|
1150
|
+
/* @__PURE__ */ e("td", { children: a.lastTripped ?? "—" }),
|
|
1151
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
1152
|
+
"span",
|
|
1153
|
+
{
|
|
1154
|
+
className: `nice-honey-token-dashboard__status--${a.active ? "active" : "inactive"}`,
|
|
1155
|
+
children: a.active ? s("honeyTokenDashboard.active", "Active") : s("honeyTokenDashboard.inactive", "Inactive")
|
|
1156
|
+
}
|
|
1157
|
+
) }),
|
|
1158
|
+
/* @__PURE__ */ n("td", { children: [
|
|
1159
|
+
f && /* @__PURE__ */ e("button", { onClick: () => f(a.id, !a.active), children: a.active ? s("honeyTokenDashboard.disable", "Disable") : s("honeyTokenDashboard.enable", "Enable") }),
|
|
1160
|
+
x && /* @__PURE__ */ e("button", { onClick: () => x(a.id), children: s("honeyTokenDashboard.delete", "Delete") })
|
|
1161
|
+
] })
|
|
1214
1162
|
]
|
|
1215
1163
|
},
|
|
1216
|
-
|
|
1164
|
+
a.id
|
|
1217
1165
|
)) })
|
|
1218
1166
|
] })
|
|
1219
|
-
]
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
)
|
|
1167
|
+
] }),
|
|
1168
|
+
m.length > 0 && /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__events", children: [
|
|
1169
|
+
/* @__PURE__ */ e("h3", { children: s("honeyTokenDashboard.recentEvents", "Recent Events ({count})").replace(
|
|
1170
|
+
"{count}",
|
|
1171
|
+
String(m.length)
|
|
1172
|
+
) }),
|
|
1173
|
+
/* @__PURE__ */ e("div", { className: "nice-honey-token-dashboard__event-list", children: m.map((a) => /* @__PURE__ */ n(
|
|
1174
|
+
"div",
|
|
1175
|
+
{
|
|
1176
|
+
className: `nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${a.severity}`,
|
|
1177
|
+
children: [
|
|
1178
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__event-header", children: [
|
|
1179
|
+
/* @__PURE__ */ e("strong", { children: a.tokenName }),
|
|
1180
|
+
/* @__PURE__ */ e(
|
|
1181
|
+
"span",
|
|
1182
|
+
{
|
|
1183
|
+
className: "nice-honey-token-dashboard__severity",
|
|
1184
|
+
style: { color: V[a.severity] },
|
|
1185
|
+
children: s(`honeyTokenDashboard.${a.severity}`, a.severity)
|
|
1186
|
+
}
|
|
1187
|
+
),
|
|
1188
|
+
/* @__PURE__ */ e("time", { children: a.timestamp })
|
|
1189
|
+
] }),
|
|
1190
|
+
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__event-details", children: [
|
|
1191
|
+
/* @__PURE__ */ e("span", { children: s("honeyTokenDashboard.ip", "IP: {ip}").replace("{ip}", a.sourceIp) }),
|
|
1192
|
+
a.userId && /* @__PURE__ */ e("span", { children: s("honeyTokenDashboard.user", "User: {user}").replace(
|
|
1193
|
+
"{user}",
|
|
1194
|
+
a.userId
|
|
1195
|
+
) }),
|
|
1196
|
+
a.details && /* @__PURE__ */ e("span", { children: a.details })
|
|
1197
|
+
] }),
|
|
1198
|
+
N && /* @__PURE__ */ e(
|
|
1199
|
+
"button",
|
|
1200
|
+
{
|
|
1201
|
+
className: "nice-honey-token-dashboard__dismiss",
|
|
1202
|
+
onClick: () => N(a.id),
|
|
1203
|
+
children: s("honeyTokenDashboard.dismiss", "Dismiss")
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
]
|
|
1207
|
+
},
|
|
1208
|
+
a.id
|
|
1209
|
+
)) })
|
|
1210
|
+
] })
|
|
1211
|
+
]
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
});
|
|
1224
1215
|
export {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1216
|
+
be as FeatureGate,
|
|
1217
|
+
he as NiceAdminAuditLog,
|
|
1218
|
+
oe as NiceAdminDashboard,
|
|
1219
|
+
ue as NiceAdminNotifications,
|
|
1220
|
+
de as NiceAdminRoles,
|
|
1221
|
+
me as NiceAdminSettings,
|
|
1222
|
+
ce as NiceAdminUsers,
|
|
1223
|
+
pe as NiceFeatureFlags,
|
|
1224
|
+
be as NiceFeatureGate,
|
|
1225
|
+
_e as NiceFeatureGateProvider,
|
|
1226
|
+
ve as NiceHoneyTokenDashboard,
|
|
1227
|
+
ge as NiceImportExport,
|
|
1228
|
+
ie as useFeatureGate
|
|
1238
1229
|
};
|