@nice2dev/ui-enterprise 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/NiceForm-Ci3XG7s7-CAq39zwv.cjs +339 -0
- package/dist/NiceForm-Ci3XG7s7-Dq5cdcJt.js +7210 -0
- package/dist/NicePinCodeInput-C43eB9h4-9S12b1D4.js +11892 -0
- package/dist/NicePinCodeInput-C43eB9h4-Bt_HXN30.cjs +696 -0
- package/dist/NiceSavedQueryPanel-Dgbn1ExK-CYhzGBS0.cjs +596 -0
- package/dist/NiceSavedQueryPanel-Dgbn1ExK-zDRNgNys.js +7057 -0
- package/dist/charts-CJruxLRY-DYDGLy1C.js +3880 -0
- package/dist/charts-CJruxLRY-UAG860e8.cjs +546 -0
- package/dist/index-BK_Uwmz0-BSjMtmAO.cjs +4949 -0
- package/dist/index-BK_Uwmz0-BSxCB6OM.js +45113 -0
- package/dist/index-Bq2MEi2D.js +19610 -0
- package/dist/index-DCOjCg44.cjs +91 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +0 -156
- package/dist/index.mjs +2751 -8
- package/dist/style.css +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,2753 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
+
import { NtdClipboard as Be, NtdFile as He, NtdBrackets as Fe, NtdBarChart as Je, NtdFileText as we, NtdList as Ge, NtdGrid as Ke, NtdSearch as pe, NtdDownload as me, NtdChevronDown as De, NtdChevronRight as $e, NtdCircle as Ce, NtdSettings as Pe, NtdKey as be, NtdLogOut as Re, NtdLogIn as We, NtdError as oe, NtdCheck as ie, NtdUpload as Xe, NtdEye as Ze, NtdClose as ge, NtdEdit as Oe, NtdPlus as Se, NtdArrowRight as Qe, NtdBook as ec, NtdClock as xe, NtdArrowUp as cc, NtdArrowDown as ac, NtdLock as Ee, NtdOctagon as ic, NtdDollar as sc, NtdWarning as Me, NtdCookieConsent as tc, NtdArrowLeft as nc, NtdTrash as lc, NtdZap as je, NtdHelp as Ue, NtdFolder as rc, NtdUser as Ye, NtdRefresh as Ne, NtdMinus as oc, NtdTable as dc, NtdCalendar as hc, NtdMap as Te, NtdShield as qe, NtdSlash as uc, NtdFlag as pc, NtdUnlock as mc, NtdSmartphone as fe, NtdMonitor as gc } from "@nice2dev/icons";
|
|
3
|
+
import vc, { forwardRef as te, useState as w, useCallback as $, useImperativeHandle as ne, useEffect as ue, useRef as ye, useId as bc, useMemo as he } from "react";
|
|
4
|
+
import { NiceAppShell as Nc, NiceTutorialButton as fc, resolveTutorial as yc } from "@nice2dev/ui";
|
|
5
|
+
function kc(a, s, t) {
|
|
6
|
+
const i = t.csvDelimiter || ",", n = [];
|
|
7
|
+
return t.includeHeaders !== !1 && n.push(
|
|
8
|
+
s.filter((l) => l.include).map((l) => `"${l.label}"`).join(i)
|
|
9
|
+
), a.forEach((l) => {
|
|
10
|
+
const h = s.filter((r) => r.include).map((r) => {
|
|
11
|
+
let u = l[r.field];
|
|
12
|
+
return r.transform && (u = r.transform(u)), u == null ? "" : typeof u == "string" ? `"${u.replace(/"/g, '""')}"` : String(u);
|
|
13
|
+
});
|
|
14
|
+
n.push(h.join(i));
|
|
15
|
+
}), n.join(`
|
|
16
|
+
`);
|
|
17
|
+
}
|
|
18
|
+
function wc(a, s, t) {
|
|
19
|
+
const i = s.filter((l) => l.include), n = a.map((l) => {
|
|
20
|
+
const h = {};
|
|
21
|
+
return i.forEach((r) => {
|
|
22
|
+
let u = l[r.field];
|
|
23
|
+
r.transform && (u = r.transform(u)), h[r.field] = u;
|
|
24
|
+
}), h;
|
|
25
|
+
});
|
|
26
|
+
return JSON.stringify(n, null, 2);
|
|
27
|
+
}
|
|
28
|
+
const ke = {
|
|
29
|
+
csv: { label: "CSV", icon: /* @__PURE__ */ e(we, { size: 20 }), description: "Comma-separated values" },
|
|
30
|
+
xlsx: { label: "Excel", icon: /* @__PURE__ */ e(Je, { size: 20 }), description: "Microsoft Excel" },
|
|
31
|
+
json: {
|
|
32
|
+
label: "JSON",
|
|
33
|
+
icon: /* @__PURE__ */ e(Fe, { size: 20 }),
|
|
34
|
+
description: "JavaScript Object Notation"
|
|
35
|
+
},
|
|
36
|
+
pdf: { label: "PDF", icon: /* @__PURE__ */ e(He, { size: 20 }), description: "Portable Document Format" },
|
|
37
|
+
xml: {
|
|
38
|
+
label: "XML",
|
|
39
|
+
icon: /* @__PURE__ */ e(Be, { size: 20 }),
|
|
40
|
+
description: "Extensible Markup Language"
|
|
41
|
+
}
|
|
42
|
+
}, Dc = ({ formats: a, selected: s, onChange: t }) => /* @__PURE__ */ e("div", { className: "nice-export-formats", children: a.map((i) => {
|
|
43
|
+
const n = ke[i];
|
|
44
|
+
return /* @__PURE__ */ c(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: `nice-export-format ${s === i ? "nice-export-format--selected" : ""}`,
|
|
49
|
+
onClick: () => t(i),
|
|
50
|
+
title: n.description,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ e("span", { className: "nice-export-format-icon", children: n.icon }),
|
|
53
|
+
/* @__PURE__ */ e("span", { className: "nice-export-format-label", children: n.label })
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
i
|
|
57
|
+
);
|
|
58
|
+
}) }), Cc = ({ fields: a, onChange: s }) => {
|
|
59
|
+
const t = (l) => {
|
|
60
|
+
const h = [...a];
|
|
61
|
+
h[l] = { ...h[l], include: !h[l].include }, s(h);
|
|
62
|
+
}, i = (l) => {
|
|
63
|
+
s(a.map((h) => ({ ...h, include: l })));
|
|
64
|
+
}, n = a.filter((l) => l.include).length;
|
|
65
|
+
return /* @__PURE__ */ c("div", { className: "nice-export-fields", children: [
|
|
66
|
+
/* @__PURE__ */ c("div", { className: "nice-export-fields-header", children: [
|
|
67
|
+
/* @__PURE__ */ c("span", { children: [
|
|
68
|
+
"Fields to export (",
|
|
69
|
+
n,
|
|
70
|
+
"/",
|
|
71
|
+
a.length,
|
|
72
|
+
")"
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ c("div", { className: "nice-export-fields-actions", children: [
|
|
75
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => i(!0), children: "Select all" }),
|
|
76
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => i(!1), children: "Deselect all" })
|
|
77
|
+
] })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ e("div", { className: "nice-export-fields-list", children: a.map((l, h) => /* @__PURE__ */ c("label", { className: "nice-export-field", children: [
|
|
80
|
+
/* @__PURE__ */ e("input", { type: "checkbox", checked: l.include, onChange: () => t(h) }),
|
|
81
|
+
/* @__PURE__ */ e("span", { className: "nice-export-field-label", children: l.label }),
|
|
82
|
+
/* @__PURE__ */ e("span", { className: "nice-export-field-name", children: l.field })
|
|
83
|
+
] }, l.field)) })
|
|
84
|
+
] });
|
|
85
|
+
}, Sc = ({ format: a, options: s, onChange: t }) => {
|
|
86
|
+
const i = (n, l) => {
|
|
87
|
+
t({ ...s, [n]: l });
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ c("div", { className: "nice-export-options", children: [
|
|
90
|
+
/* @__PURE__ */ e("h4", { children: "Export Options" }),
|
|
91
|
+
/* @__PURE__ */ c("label", { className: "nice-export-option", children: [
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
"input",
|
|
94
|
+
{
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
checked: s.includeHeaders !== !1,
|
|
97
|
+
onChange: (n) => i("includeHeaders", n.target.checked)
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
"Include headers"
|
|
101
|
+
] }),
|
|
102
|
+
a === "csv" && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
|
|
103
|
+
/* @__PURE__ */ e("span", { children: "Delimiter:" }),
|
|
104
|
+
/* @__PURE__ */ c(
|
|
105
|
+
"select",
|
|
106
|
+
{
|
|
107
|
+
value: s.csvDelimiter || ",",
|
|
108
|
+
onChange: (n) => i("csvDelimiter", n.target.value),
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ e("option", { value: ",", children: "Comma (,)" }),
|
|
111
|
+
/* @__PURE__ */ e("option", { value: ";", children: "Semicolon (;)" }),
|
|
112
|
+
/* @__PURE__ */ e("option", { value: "\\t", children: "Tab" }),
|
|
113
|
+
/* @__PURE__ */ e("option", { value: "|", children: "Pipe (|)" })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ c("label", { className: "nice-export-option", children: [
|
|
119
|
+
/* @__PURE__ */ e("span", { children: "Date format:" }),
|
|
120
|
+
/* @__PURE__ */ c(
|
|
121
|
+
"select",
|
|
122
|
+
{
|
|
123
|
+
value: s.dateFormat || "YYYY-MM-DD",
|
|
124
|
+
onChange: (n) => i("dateFormat", n.target.value),
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ e("option", { value: "YYYY-MM-DD", children: "YYYY-MM-DD" }),
|
|
127
|
+
/* @__PURE__ */ e("option", { value: "DD/MM/YYYY", children: "DD/MM/YYYY" }),
|
|
128
|
+
/* @__PURE__ */ e("option", { value: "MM/DD/YYYY", children: "MM/DD/YYYY" }),
|
|
129
|
+
/* @__PURE__ */ e("option", { value: "ISO", children: "ISO 8601" })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ c("label", { className: "nice-export-option", children: [
|
|
135
|
+
/* @__PURE__ */ e("span", { children: "Encoding:" }),
|
|
136
|
+
/* @__PURE__ */ c(
|
|
137
|
+
"select",
|
|
138
|
+
{
|
|
139
|
+
value: s.encoding || "utf-8",
|
|
140
|
+
onChange: (n) => i("encoding", n.target.value),
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ e("option", { value: "utf-8", children: "UTF-8" }),
|
|
143
|
+
/* @__PURE__ */ e("option", { value: "utf-16", children: "UTF-16" }),
|
|
144
|
+
/* @__PURE__ */ e("option", { value: "iso-8859-1", children: "ISO-8859-1" })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] }),
|
|
149
|
+
(a === "xlsx" || a === "pdf") && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
|
|
150
|
+
/* @__PURE__ */ e("span", { children: "Password protect:" }),
|
|
151
|
+
/* @__PURE__ */ e(
|
|
152
|
+
"input",
|
|
153
|
+
{
|
|
154
|
+
type: "password",
|
|
155
|
+
value: s.password || "",
|
|
156
|
+
onChange: (n) => i("password", n.target.value || void 0),
|
|
157
|
+
placeholder: "Leave empty for no password"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] })
|
|
161
|
+
] });
|
|
162
|
+
}, xc = ({ jobs: a, onDownload: s }) => {
|
|
163
|
+
if (a.length === 0)
|
|
164
|
+
return /* @__PURE__ */ e("div", { className: "nice-export-history-empty", children: "No export history" });
|
|
165
|
+
const t = (i) => i ? i < 1024 ? `${i} B` : i < 1024 * 1024 ? `${(i / 1024).toFixed(1)} KB` : `${(i / 1024 / 1024).toFixed(1)} MB` : "-";
|
|
166
|
+
return /* @__PURE__ */ c("div", { className: "nice-export-history", children: [
|
|
167
|
+
/* @__PURE__ */ e("h4", { children: "Export History" }),
|
|
168
|
+
/* @__PURE__ */ e("div", { className: "nice-export-history-list", children: a.map((i) => /* @__PURE__ */ c("div", { className: `nice-export-job nice-export-job--${i.status}`, children: [
|
|
169
|
+
/* @__PURE__ */ c("div", { className: "nice-export-job-info", children: [
|
|
170
|
+
/* @__PURE__ */ e("span", { className: "nice-export-job-name", children: i.name }),
|
|
171
|
+
/* @__PURE__ */ e("span", { className: "nice-export-job-format", children: i.format.toUpperCase() }),
|
|
172
|
+
/* @__PURE__ */ e("span", { className: "nice-export-job-date", children: new Date(i.createdAt).toLocaleString() })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ c("div", { className: "nice-export-job-meta", children: [
|
|
175
|
+
i.rowCount && /* @__PURE__ */ c("span", { children: [
|
|
176
|
+
i.rowCount,
|
|
177
|
+
" rows"
|
|
178
|
+
] }),
|
|
179
|
+
i.fileSize && /* @__PURE__ */ e("span", { children: t(i.fileSize) })
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ c("div", { className: "nice-export-job-status", children: [
|
|
182
|
+
i.status === "processing" && /* @__PURE__ */ e("div", { className: "nice-export-job-progress", children: /* @__PURE__ */ e(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
className: "nice-export-job-progress-bar",
|
|
186
|
+
style: { width: `${i.progress}%` }
|
|
187
|
+
}
|
|
188
|
+
) }),
|
|
189
|
+
i.status === "completed" && i.downloadUrl && /* @__PURE__ */ e(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
className: "nice-export-job-download",
|
|
194
|
+
onClick: () => s == null ? void 0 : s(i),
|
|
195
|
+
children: "Download"
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
i.status === "failed" && /* @__PURE__ */ e("span", { className: "nice-export-job-error", title: i.error, children: "Failed" })
|
|
199
|
+
] })
|
|
200
|
+
] }, i.id)) })
|
|
201
|
+
] });
|
|
202
|
+
}, zc = te(
|
|
203
|
+
({
|
|
204
|
+
dataSource: a,
|
|
205
|
+
formats: s = ["csv", "xlsx", "json", "pdf"],
|
|
206
|
+
templates: t = [],
|
|
207
|
+
enableScheduling: i = !1,
|
|
208
|
+
exportHistory: n = [],
|
|
209
|
+
onExportStart: l,
|
|
210
|
+
onExportComplete: h,
|
|
211
|
+
onExportError: r,
|
|
212
|
+
onSaveTemplate: u,
|
|
213
|
+
onDeleteTemplate: T,
|
|
214
|
+
onSchedule: E,
|
|
215
|
+
customExportHandler: S,
|
|
216
|
+
title: y = "Data Export",
|
|
217
|
+
description: J,
|
|
218
|
+
className: _ = "",
|
|
219
|
+
style: K
|
|
220
|
+
}, O) => {
|
|
221
|
+
const [M, j] = w(s[0]), [U, B] = w(a.getFields()), [m, k] = w({
|
|
222
|
+
includeHeaders: !0,
|
|
223
|
+
dateFormat: "YYYY-MM-DD",
|
|
224
|
+
encoding: "utf-8"
|
|
225
|
+
}), [g, Y] = w(!1), [p, P] = w(0), [A, I] = w("export"), C = $(async () => {
|
|
226
|
+
const v = {
|
|
227
|
+
id: Date.now().toString(),
|
|
228
|
+
name: `Export ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
229
|
+
format: M,
|
|
230
|
+
status: "processing",
|
|
231
|
+
progress: 0,
|
|
232
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
233
|
+
};
|
|
234
|
+
Y(!0), P(0), l == null || l(v);
|
|
235
|
+
try {
|
|
236
|
+
const x = await a.fetchData({
|
|
237
|
+
fields: U,
|
|
238
|
+
filters: void 0,
|
|
239
|
+
sorting: void 0
|
|
240
|
+
});
|
|
241
|
+
P(50);
|
|
242
|
+
let z;
|
|
243
|
+
if (S)
|
|
244
|
+
z = await S(M, x, m);
|
|
245
|
+
else
|
|
246
|
+
switch (M) {
|
|
247
|
+
case "csv":
|
|
248
|
+
z = kc(x, U, m);
|
|
249
|
+
break;
|
|
250
|
+
case "json":
|
|
251
|
+
z = wc(x, U, m);
|
|
252
|
+
break;
|
|
253
|
+
default:
|
|
254
|
+
throw new Error(`Format ${M} requires a custom export handler`);
|
|
255
|
+
}
|
|
256
|
+
P(100);
|
|
257
|
+
const G = typeof z == "string" ? new Blob([z], { type: "text/plain" }) : z, V = URL.createObjectURL(G), b = document.createElement("a");
|
|
258
|
+
b.href = V, b.download = `export-${Date.now()}.${M}`, document.body.appendChild(b), b.click(), document.body.removeChild(b), URL.revokeObjectURL(V);
|
|
259
|
+
const L = {
|
|
260
|
+
...v,
|
|
261
|
+
status: "completed",
|
|
262
|
+
progress: 100,
|
|
263
|
+
completedAt: /* @__PURE__ */ new Date(),
|
|
264
|
+
rowCount: x.length,
|
|
265
|
+
fileSize: G.size
|
|
266
|
+
};
|
|
267
|
+
h == null || h(L);
|
|
268
|
+
} catch (x) {
|
|
269
|
+
const z = {
|
|
270
|
+
...v,
|
|
271
|
+
status: "failed",
|
|
272
|
+
error: x instanceof Error ? x.message : "Unknown error"
|
|
273
|
+
};
|
|
274
|
+
r == null || r(z, x instanceof Error ? x : new Error("Export failed"));
|
|
275
|
+
} finally {
|
|
276
|
+
Y(!1), P(0);
|
|
277
|
+
}
|
|
278
|
+
}, [
|
|
279
|
+
M,
|
|
280
|
+
U,
|
|
281
|
+
m,
|
|
282
|
+
a,
|
|
283
|
+
S,
|
|
284
|
+
l,
|
|
285
|
+
h,
|
|
286
|
+
r
|
|
287
|
+
]), q = $(
|
|
288
|
+
(v) => {
|
|
289
|
+
const x = t.find((z) => z.id === v);
|
|
290
|
+
x && (j(x.format), B(x.fields), x.options && k(x.options));
|
|
291
|
+
},
|
|
292
|
+
[t]
|
|
293
|
+
);
|
|
294
|
+
return ne(O, () => ({
|
|
295
|
+
exportNow: async (v) => {
|
|
296
|
+
j(v), await C();
|
|
297
|
+
},
|
|
298
|
+
getSelectedFields: () => U,
|
|
299
|
+
loadTemplate: q
|
|
300
|
+
})), /* @__PURE__ */ c("div", { className: `nice-export-center ${_}`, style: K, children: [
|
|
301
|
+
/* @__PURE__ */ e("div", { className: "nice-export-header", children: /* @__PURE__ */ c("div", { className: "nice-export-title-area", children: [
|
|
302
|
+
/* @__PURE__ */ e("h3", { className: "nice-export-title", children: y }),
|
|
303
|
+
J && /* @__PURE__ */ e("p", { className: "nice-export-description", children: J })
|
|
304
|
+
] }) }),
|
|
305
|
+
/* @__PURE__ */ c("div", { className: "nice-export-tabs", children: [
|
|
306
|
+
/* @__PURE__ */ e(
|
|
307
|
+
"button",
|
|
308
|
+
{
|
|
309
|
+
type: "button",
|
|
310
|
+
className: `nice-export-tab ${A === "export" ? "nice-export-tab--active" : ""}`,
|
|
311
|
+
onClick: () => I("export"),
|
|
312
|
+
children: "Export"
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
t.length > 0 && /* @__PURE__ */ c(
|
|
316
|
+
"button",
|
|
317
|
+
{
|
|
318
|
+
type: "button",
|
|
319
|
+
className: `nice-export-tab ${A === "templates" ? "nice-export-tab--active" : ""}`,
|
|
320
|
+
onClick: () => I("templates"),
|
|
321
|
+
children: [
|
|
322
|
+
"Templates (",
|
|
323
|
+
t.length,
|
|
324
|
+
")"
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
n.length > 0 && /* @__PURE__ */ e(
|
|
329
|
+
"button",
|
|
330
|
+
{
|
|
331
|
+
type: "button",
|
|
332
|
+
className: `nice-export-tab ${A === "history" ? "nice-export-tab--active" : ""}`,
|
|
333
|
+
onClick: () => I("history"),
|
|
334
|
+
children: "History"
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ c("div", { className: "nice-export-content", children: [
|
|
339
|
+
A === "export" && /* @__PURE__ */ c(ee, { children: [
|
|
340
|
+
/* @__PURE__ */ e(
|
|
341
|
+
Dc,
|
|
342
|
+
{
|
|
343
|
+
formats: s,
|
|
344
|
+
selected: M,
|
|
345
|
+
onChange: j
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ e(Cc, { fields: U, onChange: B }),
|
|
349
|
+
/* @__PURE__ */ e(Sc, { format: M, options: m, onChange: k }),
|
|
350
|
+
/* @__PURE__ */ c("div", { className: "nice-export-actions", children: [
|
|
351
|
+
/* @__PURE__ */ e(
|
|
352
|
+
"button",
|
|
353
|
+
{
|
|
354
|
+
type: "button",
|
|
355
|
+
className: "nice-export-btn nice-export-btn--primary",
|
|
356
|
+
onClick: C,
|
|
357
|
+
disabled: g || U.filter((v) => v.include).length === 0,
|
|
358
|
+
children: g ? `Exporting... ${p}%` : "Export Now"
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
u && /* @__PURE__ */ e(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
type: "button",
|
|
365
|
+
className: "nice-export-btn nice-export-btn--secondary",
|
|
366
|
+
onClick: () => u({
|
|
367
|
+
id: Date.now().toString(),
|
|
368
|
+
name: `Template ${t.length + 1}`,
|
|
369
|
+
format: M,
|
|
370
|
+
fields: U,
|
|
371
|
+
options: m
|
|
372
|
+
}),
|
|
373
|
+
children: "Save as Template"
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] })
|
|
377
|
+
] }),
|
|
378
|
+
A === "templates" && /* @__PURE__ */ e("div", { className: "nice-export-templates", children: t.map((v) => /* @__PURE__ */ c("div", { className: "nice-export-template", children: [
|
|
379
|
+
/* @__PURE__ */ c("div", { className: "nice-export-template-info", children: [
|
|
380
|
+
/* @__PURE__ */ e("span", { className: "nice-export-template-name", children: v.name }),
|
|
381
|
+
/* @__PURE__ */ c("span", { className: "nice-export-template-format", children: [
|
|
382
|
+
ke[v.format].icon,
|
|
383
|
+
" ",
|
|
384
|
+
ke[v.format].label
|
|
385
|
+
] }),
|
|
386
|
+
v.description && /* @__PURE__ */ e("span", { className: "nice-export-template-desc", children: v.description })
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ c("div", { className: "nice-export-template-actions", children: [
|
|
389
|
+
/* @__PURE__ */ e(
|
|
390
|
+
"button",
|
|
391
|
+
{
|
|
392
|
+
type: "button",
|
|
393
|
+
onClick: () => {
|
|
394
|
+
q(v.id), I("export");
|
|
395
|
+
},
|
|
396
|
+
children: "Use"
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
T && /* @__PURE__ */ e("button", { type: "button", onClick: () => T(v.id), children: "Delete" })
|
|
400
|
+
] })
|
|
401
|
+
] }, v.id)) }),
|
|
402
|
+
A === "history" && /* @__PURE__ */ e(
|
|
403
|
+
xc,
|
|
404
|
+
{
|
|
405
|
+
jobs: n,
|
|
406
|
+
onDownload: (v) => {
|
|
407
|
+
v.downloadUrl && window.open(v.downloadUrl, "_blank");
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
] })
|
|
412
|
+
] });
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
zc.displayName = "NiceDataExportCenter";
|
|
416
|
+
const se = {
|
|
417
|
+
create: { icon: /* @__PURE__ */ e(Se, { size: 16 }), label: "Created", color: "var(--color-success, #10b981)" },
|
|
418
|
+
update: { icon: /* @__PURE__ */ e(Oe, { size: 16 }), label: "Updated", color: "var(--color-primary, #3b82f6)" },
|
|
419
|
+
delete: { icon: /* @__PURE__ */ e(ge, { size: 16 }), label: "Deleted", color: "var(--color-error, #ef4444)" },
|
|
420
|
+
view: { icon: /* @__PURE__ */ e(Ze, { size: 16 }), label: "Viewed", color: "var(--text-muted, #6b7280)" },
|
|
421
|
+
export: {
|
|
422
|
+
icon: /* @__PURE__ */ e(me, { size: 16 }),
|
|
423
|
+
label: "Exported",
|
|
424
|
+
color: "var(--color-accent, #8b5cf6)"
|
|
425
|
+
},
|
|
426
|
+
import: {
|
|
427
|
+
icon: /* @__PURE__ */ e(Xe, { size: 16 }),
|
|
428
|
+
label: "Imported",
|
|
429
|
+
color: "var(--color-accent, #8b5cf6)"
|
|
430
|
+
},
|
|
431
|
+
approve: {
|
|
432
|
+
icon: /* @__PURE__ */ e(ie, { size: 16 }),
|
|
433
|
+
label: "Approved",
|
|
434
|
+
color: "var(--color-success, #10b981)"
|
|
435
|
+
},
|
|
436
|
+
reject: { icon: /* @__PURE__ */ e(oe, { size: 16 }), label: "Rejected", color: "var(--color-error, #ef4444)" },
|
|
437
|
+
login: { icon: /* @__PURE__ */ e(We, { size: 16 }), label: "Login", color: "var(--color-success, #10b981)" },
|
|
438
|
+
logout: { icon: /* @__PURE__ */ e(Re, { size: 16 }), label: "Logout", color: "var(--text-muted, #6b7280)" },
|
|
439
|
+
permission_change: {
|
|
440
|
+
icon: /* @__PURE__ */ e(be, { size: 16 }),
|
|
441
|
+
label: "Permissions",
|
|
442
|
+
color: "var(--color-warning, #f59e0b)"
|
|
443
|
+
},
|
|
444
|
+
config_change: {
|
|
445
|
+
icon: /* @__PURE__ */ e(Pe, { size: 16 }),
|
|
446
|
+
label: "Config",
|
|
447
|
+
color: "var(--color-warning, #f59e0b)"
|
|
448
|
+
},
|
|
449
|
+
custom: { icon: /* @__PURE__ */ e(Ce, { size: 16 }), label: "Action", color: "var(--text-muted, #6b7280)" }
|
|
450
|
+
}, Tc = ({
|
|
451
|
+
filter: a,
|
|
452
|
+
onChange: s,
|
|
453
|
+
availableFilters: t
|
|
454
|
+
}) => {
|
|
455
|
+
var n, l;
|
|
456
|
+
const i = (h, r) => {
|
|
457
|
+
s({ ...a, [h]: r });
|
|
458
|
+
};
|
|
459
|
+
return /* @__PURE__ */ c("div", { className: "nice-audit-filters", children: [
|
|
460
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
|
|
461
|
+
/* @__PURE__ */ e("label", { children: "Date Range" }),
|
|
462
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-date-range", children: [
|
|
463
|
+
/* @__PURE__ */ e(
|
|
464
|
+
"input",
|
|
465
|
+
{
|
|
466
|
+
type: "date",
|
|
467
|
+
value: ((n = a.startDate) == null ? void 0 : n.toISOString().split("T")[0]) || "",
|
|
468
|
+
onChange: (h) => i("startDate", h.target.value ? new Date(h.target.value) : void 0)
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
/* @__PURE__ */ e("span", { children: "to" }),
|
|
472
|
+
/* @__PURE__ */ e(
|
|
473
|
+
"input",
|
|
474
|
+
{
|
|
475
|
+
type: "date",
|
|
476
|
+
value: ((l = a.endDate) == null ? void 0 : l.toISOString().split("T")[0]) || "",
|
|
477
|
+
onChange: (h) => i("endDate", h.target.value ? new Date(h.target.value) : void 0)
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
] })
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
|
|
483
|
+
/* @__PURE__ */ e("label", { children: "Actions" }),
|
|
484
|
+
/* @__PURE__ */ e("div", { className: "nice-audit-action-chips", children: Object.keys(se).slice(0, 8).map((h) => {
|
|
485
|
+
var T;
|
|
486
|
+
const r = se[h], u = (T = a.actions) == null ? void 0 : T.includes(h);
|
|
487
|
+
return /* @__PURE__ */ c(
|
|
488
|
+
"button",
|
|
489
|
+
{
|
|
490
|
+
type: "button",
|
|
491
|
+
className: `nice-audit-chip ${u ? "nice-audit-chip--selected" : ""}`,
|
|
492
|
+
style: { "--chip-color": r.color },
|
|
493
|
+
onClick: () => {
|
|
494
|
+
const E = a.actions || [];
|
|
495
|
+
i(
|
|
496
|
+
"actions",
|
|
497
|
+
u ? E.filter((S) => S !== h) : [...E, h]
|
|
498
|
+
);
|
|
499
|
+
},
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-chip-icon", children: r.icon }),
|
|
502
|
+
r.label
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
h
|
|
506
|
+
);
|
|
507
|
+
}) })
|
|
508
|
+
] }),
|
|
509
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
|
|
510
|
+
/* @__PURE__ */ e("label", { children: "Search" }),
|
|
511
|
+
/* @__PURE__ */ e(
|
|
512
|
+
"input",
|
|
513
|
+
{
|
|
514
|
+
type: "text",
|
|
515
|
+
className: "nice-audit-search",
|
|
516
|
+
placeholder: "Search entries...",
|
|
517
|
+
value: a.searchQuery || "",
|
|
518
|
+
onChange: (h) => i("searchQuery", h.target.value || void 0)
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
] })
|
|
522
|
+
] });
|
|
523
|
+
}, _c = ({ changes: a }) => {
|
|
524
|
+
if (!a.length)
|
|
525
|
+
return null;
|
|
526
|
+
const s = (t, i) => i || (t == null ? "(empty)" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t));
|
|
527
|
+
return /* @__PURE__ */ e("div", { className: "nice-audit-diff", children: a.map((t, i) => /* @__PURE__ */ c("div", { className: "nice-audit-diff-row", children: [
|
|
528
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-diff-field", children: t.field }),
|
|
529
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-diff-values", children: [
|
|
530
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-diff-old", children: s(t.oldValue, t.displayOldValue) }),
|
|
531
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-diff-arrow", children: /* @__PURE__ */ e(Qe, { size: 14 }) }),
|
|
532
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-diff-new", children: s(t.newValue, t.displayNewValue) })
|
|
533
|
+
] })
|
|
534
|
+
] }, i)) });
|
|
535
|
+
}, Lc = ({
|
|
536
|
+
entry: a,
|
|
537
|
+
showDiff: s,
|
|
538
|
+
renderActionIcon: t,
|
|
539
|
+
renderUser: i,
|
|
540
|
+
onClick: n
|
|
541
|
+
}) => {
|
|
542
|
+
const [l, h] = w(!1), r = se[a.action] || se.custom;
|
|
543
|
+
return /* @__PURE__ */ c(
|
|
544
|
+
"div",
|
|
545
|
+
{
|
|
546
|
+
className: `nice-audit-timeline-entry nice-audit-timeline-entry--${a.severity || "info"}`,
|
|
547
|
+
onClick: n,
|
|
548
|
+
role: n ? "button" : void 0,
|
|
549
|
+
tabIndex: n ? 0 : void 0,
|
|
550
|
+
children: [
|
|
551
|
+
/* @__PURE__ */ e(
|
|
552
|
+
"div",
|
|
553
|
+
{
|
|
554
|
+
className: "nice-audit-timeline-marker",
|
|
555
|
+
style: { "--marker-color": r.color },
|
|
556
|
+
children: t ? t(a.action) : r.icon
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-timeline-content", children: [
|
|
560
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-timeline-header", children: [
|
|
561
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-timeline-action", children: a.actionLabel || r.label }),
|
|
562
|
+
/* @__PURE__ */ c("span", { className: "nice-audit-timeline-entity", children: [
|
|
563
|
+
a.entityType,
|
|
564
|
+
" ",
|
|
565
|
+
a.entityName && `"${a.entityName}"`
|
|
566
|
+
] }),
|
|
567
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-timeline-time", children: new Date(a.timestamp).toLocaleString() })
|
|
568
|
+
] }),
|
|
569
|
+
/* @__PURE__ */ e("div", { className: "nice-audit-timeline-user", children: i ? i(a) : /* @__PURE__ */ c(ee, { children: [
|
|
570
|
+
a.userAvatar && /* @__PURE__ */ e("img", { src: a.userAvatar, alt: "", className: "nice-audit-avatar" }),
|
|
571
|
+
/* @__PURE__ */ e("span", { className: "nice-audit-username", children: a.userName }),
|
|
572
|
+
a.userRole && /* @__PURE__ */ e("span", { className: "nice-audit-role", children: a.userRole })
|
|
573
|
+
] }) }),
|
|
574
|
+
a.notes && /* @__PURE__ */ e("div", { className: "nice-audit-timeline-notes", children: a.notes }),
|
|
575
|
+
s && a.changes && a.changes.length > 0 && /* @__PURE__ */ c(ee, { children: [
|
|
576
|
+
/* @__PURE__ */ e(
|
|
577
|
+
"button",
|
|
578
|
+
{
|
|
579
|
+
type: "button",
|
|
580
|
+
className: "nice-audit-expand-btn",
|
|
581
|
+
onClick: (u) => {
|
|
582
|
+
u.stopPropagation(), h(!l);
|
|
583
|
+
},
|
|
584
|
+
children: l ? /* @__PURE__ */ c(ee, { children: [
|
|
585
|
+
/* @__PURE__ */ e(De, { size: 14 }),
|
|
586
|
+
" Hide changes"
|
|
587
|
+
] }) : /* @__PURE__ */ c(ee, { children: [
|
|
588
|
+
/* @__PURE__ */ e($e, { size: 14 }),
|
|
589
|
+
" Show ",
|
|
590
|
+
a.changes.length,
|
|
591
|
+
" changes"
|
|
592
|
+
] })
|
|
593
|
+
}
|
|
594
|
+
),
|
|
595
|
+
l && /* @__PURE__ */ e(_c, { changes: a.changes })
|
|
596
|
+
] }),
|
|
597
|
+
a.ipAddress && /* @__PURE__ */ c("div", { className: "nice-audit-timeline-meta", children: [
|
|
598
|
+
/* @__PURE__ */ c("span", { children: [
|
|
599
|
+
"IP: ",
|
|
600
|
+
a.ipAddress
|
|
601
|
+
] }),
|
|
602
|
+
a.location && /* @__PURE__ */ c("span", { children: [
|
|
603
|
+
"• ",
|
|
604
|
+
a.location
|
|
605
|
+
] })
|
|
606
|
+
] })
|
|
607
|
+
] })
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
}, Ac = ({ entries: a, showDiff: s, onEntryClick: t }) => /* @__PURE__ */ c("table", { className: "nice-audit-table", children: [
|
|
612
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
613
|
+
/* @__PURE__ */ e("th", { children: "Timestamp" }),
|
|
614
|
+
/* @__PURE__ */ e("th", { children: "Action" }),
|
|
615
|
+
/* @__PURE__ */ e("th", { children: "User" }),
|
|
616
|
+
/* @__PURE__ */ e("th", { children: "Entity" }),
|
|
617
|
+
/* @__PURE__ */ e("th", { children: "Changes" }),
|
|
618
|
+
/* @__PURE__ */ e("th", { children: "IP Address" })
|
|
619
|
+
] }) }),
|
|
620
|
+
/* @__PURE__ */ e("tbody", { children: a.map((i) => {
|
|
621
|
+
const n = se[i.action] || se.custom;
|
|
622
|
+
return /* @__PURE__ */ c(
|
|
623
|
+
"tr",
|
|
624
|
+
{
|
|
625
|
+
className: `nice-audit-row nice-audit-row--${i.severity || "info"}`,
|
|
626
|
+
onClick: () => t == null ? void 0 : t(i),
|
|
627
|
+
role: t ? "button" : void 0,
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ e("td", { className: "nice-audit-cell-time", children: new Date(i.timestamp).toLocaleString() }),
|
|
630
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ c(
|
|
631
|
+
"span",
|
|
632
|
+
{
|
|
633
|
+
className: "nice-audit-action-badge",
|
|
634
|
+
style: { "--badge-color": n.color },
|
|
635
|
+
children: [
|
|
636
|
+
n.icon,
|
|
637
|
+
" ",
|
|
638
|
+
i.actionLabel || n.label
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
) }),
|
|
642
|
+
/* @__PURE__ */ c("td", { className: "nice-audit-cell-user", children: [
|
|
643
|
+
i.userAvatar && /* @__PURE__ */ e("img", { src: i.userAvatar, alt: "", className: "nice-audit-avatar-sm" }),
|
|
644
|
+
i.userName
|
|
645
|
+
] }),
|
|
646
|
+
/* @__PURE__ */ c("td", { children: [
|
|
647
|
+
i.entityType,
|
|
648
|
+
i.entityName && `: ${i.entityName}`
|
|
649
|
+
] }),
|
|
650
|
+
/* @__PURE__ */ e("td", { children: i.changes && i.changes.length > 0 ? /* @__PURE__ */ c("span", { className: "nice-audit-changes-count", children: [
|
|
651
|
+
i.changes.length,
|
|
652
|
+
" field(s)"
|
|
653
|
+
] }) : "-" }),
|
|
654
|
+
/* @__PURE__ */ e("td", { className: "nice-audit-cell-ip", children: i.ipAddress || "-" })
|
|
655
|
+
]
|
|
656
|
+
},
|
|
657
|
+
i.id
|
|
658
|
+
);
|
|
659
|
+
}) })
|
|
660
|
+
] }), Ic = te(
|
|
661
|
+
({
|
|
662
|
+
dataSource: a,
|
|
663
|
+
initialFilter: s = {},
|
|
664
|
+
pageSize: t = 50,
|
|
665
|
+
viewMode: i = "timeline",
|
|
666
|
+
enableExport: n = !0,
|
|
667
|
+
showDiffs: l = !0,
|
|
668
|
+
renderActionIcon: h,
|
|
669
|
+
renderUser: r,
|
|
670
|
+
onEntryClick: u,
|
|
671
|
+
onExport: T,
|
|
672
|
+
title: E = "Audit Trail",
|
|
673
|
+
className: S = "",
|
|
674
|
+
style: y
|
|
675
|
+
}, J) => {
|
|
676
|
+
const [_, K] = w([]), [O, M] = w(0), [j, U] = w(s), [B, m] = w(1), [k, g] = w(!1), [Y, p] = w(i), [P, A] = w(!1), I = $(async () => {
|
|
677
|
+
g(!0);
|
|
678
|
+
try {
|
|
679
|
+
const v = await a.fetchEntries(j, { page: B, pageSize: t });
|
|
680
|
+
K(v.entries), M(v.totalCount);
|
|
681
|
+
} finally {
|
|
682
|
+
g(!1);
|
|
683
|
+
}
|
|
684
|
+
}, [a, j, B, t]);
|
|
685
|
+
vc.useEffect(() => {
|
|
686
|
+
I();
|
|
687
|
+
}, [I]);
|
|
688
|
+
const C = $(
|
|
689
|
+
(v) => {
|
|
690
|
+
if (T)
|
|
691
|
+
T(_, v);
|
|
692
|
+
else {
|
|
693
|
+
let x, z;
|
|
694
|
+
if (v === "json")
|
|
695
|
+
x = JSON.stringify(_, null, 2), z = "application/json";
|
|
696
|
+
else {
|
|
697
|
+
const L = [
|
|
698
|
+
"Timestamp",
|
|
699
|
+
"Action",
|
|
700
|
+
"User",
|
|
701
|
+
"Entity Type",
|
|
702
|
+
"Entity",
|
|
703
|
+
"IP",
|
|
704
|
+
"Changes"
|
|
705
|
+
], W = _.map((F) => {
|
|
706
|
+
var Q;
|
|
707
|
+
return [
|
|
708
|
+
new Date(F.timestamp).toISOString(),
|
|
709
|
+
F.action,
|
|
710
|
+
F.userName,
|
|
711
|
+
F.entityType,
|
|
712
|
+
F.entityName || F.entityId,
|
|
713
|
+
F.ipAddress || "",
|
|
714
|
+
((Q = F.changes) == null ? void 0 : Q.length) || 0
|
|
715
|
+
];
|
|
716
|
+
});
|
|
717
|
+
x = [L.join(","), ...W.map((F) => F.join(","))].join(`
|
|
718
|
+
`), z = "text/csv";
|
|
719
|
+
}
|
|
720
|
+
const G = new Blob([x], { type: z }), V = URL.createObjectURL(G), b = document.createElement("a");
|
|
721
|
+
b.href = V, b.download = `audit-trail-${Date.now()}.${v}`, b.click(), URL.revokeObjectURL(V);
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
[_, T]
|
|
725
|
+
);
|
|
726
|
+
ne(J, () => ({
|
|
727
|
+
refresh: I,
|
|
728
|
+
setFilter: (v) => {
|
|
729
|
+
U(v), m(1);
|
|
730
|
+
},
|
|
731
|
+
getEntries: () => _
|
|
732
|
+
}));
|
|
733
|
+
const q = Math.ceil(O / t);
|
|
734
|
+
return /* @__PURE__ */ c("div", { className: `nice-audit-trail ${S}`, style: y, children: [
|
|
735
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-header", children: [
|
|
736
|
+
/* @__PURE__ */ e("h3", { className: "nice-audit-title", children: E }),
|
|
737
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-header-actions", children: [
|
|
738
|
+
/* @__PURE__ */ e(
|
|
739
|
+
"button",
|
|
740
|
+
{
|
|
741
|
+
type: "button",
|
|
742
|
+
className: `nice-audit-view-btn ${Y === "timeline" ? "nice-audit-view-btn--active" : ""}`,
|
|
743
|
+
onClick: () => p("timeline"),
|
|
744
|
+
title: "Timeline view",
|
|
745
|
+
children: /* @__PURE__ */ e(Ge, { size: 16 })
|
|
746
|
+
}
|
|
747
|
+
),
|
|
748
|
+
/* @__PURE__ */ e(
|
|
749
|
+
"button",
|
|
750
|
+
{
|
|
751
|
+
type: "button",
|
|
752
|
+
className: `nice-audit-view-btn ${Y === "table" ? "nice-audit-view-btn--active" : ""}`,
|
|
753
|
+
onClick: () => p("table"),
|
|
754
|
+
title: "Table view",
|
|
755
|
+
children: /* @__PURE__ */ e(Ke, { size: 16 })
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
/* @__PURE__ */ c(
|
|
759
|
+
"button",
|
|
760
|
+
{
|
|
761
|
+
type: "button",
|
|
762
|
+
className: `nice-audit-filter-btn ${P ? "nice-audit-filter-btn--active" : ""}`,
|
|
763
|
+
onClick: () => A(!P),
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ e(pe, { size: 16 }),
|
|
766
|
+
" Filter"
|
|
767
|
+
]
|
|
768
|
+
}
|
|
769
|
+
),
|
|
770
|
+
n && /* @__PURE__ */ c("div", { className: "nice-audit-export-dropdown", children: [
|
|
771
|
+
/* @__PURE__ */ c("button", { type: "button", className: "nice-audit-export-btn", children: [
|
|
772
|
+
/* @__PURE__ */ e(me, { size: 16 }),
|
|
773
|
+
" Export"
|
|
774
|
+
] }),
|
|
775
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-export-menu", children: [
|
|
776
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => C("csv"), children: "Export as CSV" }),
|
|
777
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => C("json"), children: "Export as JSON" })
|
|
778
|
+
] })
|
|
779
|
+
] })
|
|
780
|
+
] })
|
|
781
|
+
] }),
|
|
782
|
+
P && /* @__PURE__ */ e(Tc, { filter: j, onChange: U }),
|
|
783
|
+
/* @__PURE__ */ c("div", { className: "nice-audit-stats", children: [
|
|
784
|
+
/* @__PURE__ */ c("span", { children: [
|
|
785
|
+
"Showing ",
|
|
786
|
+
_.length,
|
|
787
|
+
" of ",
|
|
788
|
+
O,
|
|
789
|
+
" entries"
|
|
790
|
+
] }),
|
|
791
|
+
j.startDate && j.endDate && /* @__PURE__ */ c("span", { className: "nice-audit-date-indicator", children: [
|
|
792
|
+
j.startDate.toLocaleDateString(),
|
|
793
|
+
" - ",
|
|
794
|
+
j.endDate.toLocaleDateString()
|
|
795
|
+
] })
|
|
796
|
+
] }),
|
|
797
|
+
/* @__PURE__ */ c("div", { className: `nice-audit-content ${k ? "nice-audit-content--loading" : ""}`, children: [
|
|
798
|
+
k && /* @__PURE__ */ e("div", { className: "nice-audit-loader", children: /* @__PURE__ */ e("div", { className: "nice-audit-spinner" }) }),
|
|
799
|
+
Y === "timeline" ? /* @__PURE__ */ e("div", { className: "nice-audit-timeline", children: _.map((v) => /* @__PURE__ */ e(
|
|
800
|
+
Lc,
|
|
801
|
+
{
|
|
802
|
+
entry: v,
|
|
803
|
+
showDiff: l,
|
|
804
|
+
renderActionIcon: h,
|
|
805
|
+
renderUser: r,
|
|
806
|
+
onClick: u ? () => u(v) : void 0
|
|
807
|
+
},
|
|
808
|
+
v.id
|
|
809
|
+
)) }) : /* @__PURE__ */ e(Ac, { entries: _, showDiff: l, onEntryClick: u }),
|
|
810
|
+
_.length === 0 && !k && /* @__PURE__ */ e("div", { className: "nice-audit-empty", children: "No audit entries found matching the current filters." })
|
|
811
|
+
] }),
|
|
812
|
+
q > 1 && /* @__PURE__ */ c("div", { className: "nice-audit-pagination", children: [
|
|
813
|
+
/* @__PURE__ */ e("button", { type: "button", disabled: B === 1, onClick: () => m(B - 1), children: "Previous" }),
|
|
814
|
+
/* @__PURE__ */ c("span", { children: [
|
|
815
|
+
"Page ",
|
|
816
|
+
B,
|
|
817
|
+
" of ",
|
|
818
|
+
q
|
|
819
|
+
] }),
|
|
820
|
+
/* @__PURE__ */ e("button", { type: "button", disabled: B === q, onClick: () => m(B + 1), children: "Next" })
|
|
821
|
+
] })
|
|
822
|
+
] });
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
Ic.displayName = "NiceAuditTrail";
|
|
826
|
+
const Fc = [
|
|
827
|
+
{
|
|
828
|
+
target: ".nice-contract-editor",
|
|
829
|
+
titleKey: "tutorial.contractEditor.intro.title",
|
|
830
|
+
title: "Contract editor",
|
|
831
|
+
contentKey: "tutorial.contractEditor.intro.content",
|
|
832
|
+
content: "Assemble the contract from the clause library, fill template variables, track versions and approvals, then save or export to PDF/DOCX/HTML.",
|
|
833
|
+
placement: "auto"
|
|
834
|
+
}
|
|
835
|
+
], ae = {
|
|
836
|
+
general: {
|
|
837
|
+
label: "General",
|
|
838
|
+
color: "var(--text-muted, #6b7280)",
|
|
839
|
+
icon: /* @__PURE__ */ e(we, { size: 16 })
|
|
840
|
+
},
|
|
841
|
+
liability: {
|
|
842
|
+
label: "Liability",
|
|
843
|
+
color: "var(--color-error, #ef4444)",
|
|
844
|
+
icon: /* @__PURE__ */ e(Me, { size: 16 })
|
|
845
|
+
},
|
|
846
|
+
payment: {
|
|
847
|
+
label: "Payment",
|
|
848
|
+
color: "var(--color-success, #10b981)",
|
|
849
|
+
icon: /* @__PURE__ */ e(sc, { size: 16 })
|
|
850
|
+
},
|
|
851
|
+
termination: {
|
|
852
|
+
label: "Termination",
|
|
853
|
+
color: "var(--color-warning, #f59e0b)",
|
|
854
|
+
icon: /* @__PURE__ */ e(ic, { size: 16 })
|
|
855
|
+
},
|
|
856
|
+
confidentiality: {
|
|
857
|
+
label: "Confidentiality",
|
|
858
|
+
color: "var(--color-accent, #8b5cf6)",
|
|
859
|
+
icon: /* @__PURE__ */ e(Ee, { size: 16 })
|
|
860
|
+
},
|
|
861
|
+
compliance: {
|
|
862
|
+
label: "Compliance",
|
|
863
|
+
color: "var(--color-primary, #3b82f6)",
|
|
864
|
+
icon: /* @__PURE__ */ e(ie, { size: 16 })
|
|
865
|
+
},
|
|
866
|
+
custom: { label: "Custom", color: "var(--text-muted, #64748b)", icon: /* @__PURE__ */ e(Oe, { size: 16 }) }
|
|
867
|
+
}, $c = {
|
|
868
|
+
draft: { label: "Draft", color: "var(--text-muted, #6b7280)" },
|
|
869
|
+
pending_review: { label: "Pending Review", color: "var(--color-warning, #f59e0b)" },
|
|
870
|
+
approved: { label: "Approved", color: "var(--color-success, #10b981)" },
|
|
871
|
+
rejected: { label: "Rejected", color: "var(--color-error, #ef4444)" },
|
|
872
|
+
signed: { label: "Signed", color: "var(--color-accent, #8b5cf6)" }
|
|
873
|
+
}, Pc = ({ clauses: a, onInsert: s }) => {
|
|
874
|
+
const [t, i] = w(""), [n, l] = w("all"), h = a.filter((r) => {
|
|
875
|
+
const u = t === "" || r.name.toLowerCase().includes(t.toLowerCase()) || r.content.toLowerCase().includes(t.toLowerCase()), T = n === "all" || r.category === n;
|
|
876
|
+
return u && T;
|
|
877
|
+
});
|
|
878
|
+
return /* @__PURE__ */ c("div", { className: "nice-contract-library", children: [
|
|
879
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-library-header", children: [
|
|
880
|
+
/* @__PURE__ */ e("h4", { children: "Clause Library" }),
|
|
881
|
+
/* @__PURE__ */ e(
|
|
882
|
+
"input",
|
|
883
|
+
{
|
|
884
|
+
type: "text",
|
|
885
|
+
placeholder: "Search clauses...",
|
|
886
|
+
value: t,
|
|
887
|
+
onChange: (r) => i(r.target.value),
|
|
888
|
+
className: "nice-contract-library-search"
|
|
889
|
+
}
|
|
890
|
+
)
|
|
891
|
+
] }),
|
|
892
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-library-categories", children: [
|
|
893
|
+
/* @__PURE__ */ e(
|
|
894
|
+
"button",
|
|
895
|
+
{
|
|
896
|
+
type: "button",
|
|
897
|
+
className: `nice-contract-category-btn ${n === "all" ? "nice-contract-category-btn--active" : ""}`,
|
|
898
|
+
onClick: () => l("all"),
|
|
899
|
+
children: "All"
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
Object.keys(ae).map((r) => /* @__PURE__ */ c(
|
|
903
|
+
"button",
|
|
904
|
+
{
|
|
905
|
+
type: "button",
|
|
906
|
+
className: `nice-contract-category-btn ${n === r ? "nice-contract-category-btn--active" : ""}`,
|
|
907
|
+
onClick: () => l(r),
|
|
908
|
+
style: { "--cat-color": ae[r].color },
|
|
909
|
+
children: [
|
|
910
|
+
ae[r].icon,
|
|
911
|
+
" ",
|
|
912
|
+
ae[r].label
|
|
913
|
+
]
|
|
914
|
+
},
|
|
915
|
+
r
|
|
916
|
+
))
|
|
917
|
+
] }),
|
|
918
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-library-list", children: [
|
|
919
|
+
h.map((r) => /* @__PURE__ */ c("div", { className: "nice-contract-library-item", children: [
|
|
920
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-library-item-header", children: [
|
|
921
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-library-item-name", children: r.name }),
|
|
922
|
+
/* @__PURE__ */ e(
|
|
923
|
+
"span",
|
|
924
|
+
{
|
|
925
|
+
className: "nice-contract-library-item-cat",
|
|
926
|
+
style: { "--cat-color": ae[r.category].color },
|
|
927
|
+
children: ae[r.category].icon
|
|
928
|
+
}
|
|
929
|
+
)
|
|
930
|
+
] }),
|
|
931
|
+
r.description && /* @__PURE__ */ e("p", { className: "nice-contract-library-item-desc", children: r.description }),
|
|
932
|
+
/* @__PURE__ */ c(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
type: "button",
|
|
936
|
+
className: "nice-contract-library-insert",
|
|
937
|
+
onClick: () => s(r),
|
|
938
|
+
children: [
|
|
939
|
+
/* @__PURE__ */ e(Se, { size: 14 }),
|
|
940
|
+
" Insert"
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
] }, r.id)),
|
|
945
|
+
h.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-library-empty", children: "No matching clauses" })
|
|
946
|
+
] })
|
|
947
|
+
] });
|
|
948
|
+
}, Rc = ({ variables: a, definitions: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-contract-variables", children: [
|
|
949
|
+
/* @__PURE__ */ e("h4", { children: "Variables" }),
|
|
950
|
+
/* @__PURE__ */ e("div", { className: "nice-contract-variables-list", children: s.map((i) => /* @__PURE__ */ c("div", { className: "nice-contract-variable", children: [
|
|
951
|
+
/* @__PURE__ */ c("label", { children: [
|
|
952
|
+
i.name,
|
|
953
|
+
i.required && /* @__PURE__ */ e("span", { className: "nice-contract-required", children: "*" })
|
|
954
|
+
] }),
|
|
955
|
+
i.type === "select" && i.options ? /* @__PURE__ */ c(
|
|
956
|
+
"select",
|
|
957
|
+
{
|
|
958
|
+
value: a[i.name] || i.defaultValue || "",
|
|
959
|
+
onChange: (n) => t(i.name, n.target.value),
|
|
960
|
+
children: [
|
|
961
|
+
/* @__PURE__ */ e("option", { value: "", children: "Select..." }),
|
|
962
|
+
i.options.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
|
|
963
|
+
]
|
|
964
|
+
}
|
|
965
|
+
) : i.type === "date" ? /* @__PURE__ */ e(
|
|
966
|
+
"input",
|
|
967
|
+
{
|
|
968
|
+
type: "date",
|
|
969
|
+
value: a[i.name] || i.defaultValue || "",
|
|
970
|
+
onChange: (n) => t(i.name, n.target.value)
|
|
971
|
+
}
|
|
972
|
+
) : /* @__PURE__ */ e(
|
|
973
|
+
"input",
|
|
974
|
+
{
|
|
975
|
+
type: i.type === "number" || i.type === "currency" ? "number" : "text",
|
|
976
|
+
value: a[i.name] || i.defaultValue || "",
|
|
977
|
+
placeholder: i.placeholder,
|
|
978
|
+
onChange: (n) => t(i.name, n.target.value)
|
|
979
|
+
}
|
|
980
|
+
)
|
|
981
|
+
] }, i.name)) })
|
|
982
|
+
] }), Oc = ({
|
|
983
|
+
section: a,
|
|
984
|
+
variables: s,
|
|
985
|
+
readOnly: t,
|
|
986
|
+
onToggle: i,
|
|
987
|
+
onRemoveClause: n,
|
|
988
|
+
onMoveClause: l
|
|
989
|
+
}) => {
|
|
990
|
+
const h = (r) => r.replace(/\{\{(\w+)\}\}/g, (u, T) => s[T] || `[${T}]`);
|
|
991
|
+
return /* @__PURE__ */ c(
|
|
992
|
+
"div",
|
|
993
|
+
{
|
|
994
|
+
className: `nice-contract-section ${a.collapsed ? "nice-contract-section--collapsed" : ""}`,
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-section-header", onClick: i, children: [
|
|
997
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-section-toggle", children: a.collapsed ? /* @__PURE__ */ e($e, { size: 14 }) : /* @__PURE__ */ e(De, { size: 14 }) }),
|
|
998
|
+
/* @__PURE__ */ e("h3", { children: a.title }),
|
|
999
|
+
/* @__PURE__ */ c("span", { className: "nice-contract-section-count", children: [
|
|
1000
|
+
a.clauses.length,
|
|
1001
|
+
" clause(s)"
|
|
1002
|
+
] })
|
|
1003
|
+
] }),
|
|
1004
|
+
!a.collapsed && /* @__PURE__ */ c("div", { className: "nice-contract-section-content", children: [
|
|
1005
|
+
a.clauses.map((r, u) => /* @__PURE__ */ c("div", { className: "nice-contract-clause", children: [
|
|
1006
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-clause-header", children: [
|
|
1007
|
+
/* @__PURE__ */ e(
|
|
1008
|
+
"span",
|
|
1009
|
+
{
|
|
1010
|
+
className: "nice-contract-clause-cat",
|
|
1011
|
+
style: { "--cat-color": ae[r.category].color },
|
|
1012
|
+
children: ae[r.category].icon
|
|
1013
|
+
}
|
|
1014
|
+
),
|
|
1015
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-clause-name", children: r.name }),
|
|
1016
|
+
r.isRequired && /* @__PURE__ */ e("span", { className: "nice-contract-clause-required", children: "Required" }),
|
|
1017
|
+
!t && /* @__PURE__ */ c("div", { className: "nice-contract-clause-actions", children: [
|
|
1018
|
+
/* @__PURE__ */ e(
|
|
1019
|
+
"button",
|
|
1020
|
+
{
|
|
1021
|
+
type: "button",
|
|
1022
|
+
onClick: () => l(r.id, "up"),
|
|
1023
|
+
disabled: u === 0,
|
|
1024
|
+
children: /* @__PURE__ */ e(cc, { size: 14 })
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
/* @__PURE__ */ e(
|
|
1028
|
+
"button",
|
|
1029
|
+
{
|
|
1030
|
+
type: "button",
|
|
1031
|
+
onClick: () => l(r.id, "down"),
|
|
1032
|
+
disabled: u === a.clauses.length - 1,
|
|
1033
|
+
children: /* @__PURE__ */ e(ac, { size: 14 })
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => n(r.id), children: /* @__PURE__ */ e(ge, { size: 14 }) })
|
|
1037
|
+
] })
|
|
1038
|
+
] }),
|
|
1039
|
+
/* @__PURE__ */ e(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
className: "nice-contract-clause-content",
|
|
1043
|
+
dangerouslySetInnerHTML: { __html: h(r.content) }
|
|
1044
|
+
}
|
|
1045
|
+
)
|
|
1046
|
+
] }, r.id)),
|
|
1047
|
+
a.clauses.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-section-empty", children: "No clauses in this section. Drag clauses here or use the library." })
|
|
1048
|
+
] })
|
|
1049
|
+
]
|
|
1050
|
+
}
|
|
1051
|
+
);
|
|
1052
|
+
}, Ec = ({ workflow: a, onAction: s }) => {
|
|
1053
|
+
const [t, i] = w(null), [n, l] = w("");
|
|
1054
|
+
return /* @__PURE__ */ c("div", { className: "nice-contract-workflow", children: [
|
|
1055
|
+
/* @__PURE__ */ e("h4", { children: "Approval Workflow" }),
|
|
1056
|
+
/* @__PURE__ */ e("div", { className: "nice-contract-workflow-steps", children: a.steps.map((h, r) => /* @__PURE__ */ c(
|
|
1057
|
+
"div",
|
|
1058
|
+
{
|
|
1059
|
+
className: `nice-contract-workflow-step nice-contract-workflow-step--${h.status}`,
|
|
1060
|
+
children: [
|
|
1061
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-workflow-step-header", children: [
|
|
1062
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-num", children: r + 1 }),
|
|
1063
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-name", children: h.name }),
|
|
1064
|
+
/* @__PURE__ */ e(
|
|
1065
|
+
"span",
|
|
1066
|
+
{
|
|
1067
|
+
className: `nice-contract-workflow-step-status nice-contract-workflow-step-status--${h.status}`,
|
|
1068
|
+
children: h.status
|
|
1069
|
+
}
|
|
1070
|
+
)
|
|
1071
|
+
] }),
|
|
1072
|
+
/* @__PURE__ */ e("div", { className: "nice-contract-workflow-approvers", children: h.approvers.map((u) => /* @__PURE__ */ c("div", { className: "nice-contract-approver", children: [
|
|
1073
|
+
u.avatar && /* @__PURE__ */ e("img", { src: u.avatar, alt: "", className: "nice-contract-approver-avatar" }),
|
|
1074
|
+
/* @__PURE__ */ e("span", { children: u.name }),
|
|
1075
|
+
/* @__PURE__ */ e("span", { className: "nice-contract-approver-role", children: u.role })
|
|
1076
|
+
] }, u.id)) }),
|
|
1077
|
+
h.status === "pending" && a.currentStep === r && /* @__PURE__ */ e("div", { className: "nice-contract-workflow-actions", children: t === h.id ? /* @__PURE__ */ c(ee, { children: [
|
|
1078
|
+
/* @__PURE__ */ e(
|
|
1079
|
+
"textarea",
|
|
1080
|
+
{
|
|
1081
|
+
placeholder: "Comments (optional)",
|
|
1082
|
+
value: n,
|
|
1083
|
+
onChange: (u) => l(u.target.value)
|
|
1084
|
+
}
|
|
1085
|
+
),
|
|
1086
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-workflow-btns", children: [
|
|
1087
|
+
/* @__PURE__ */ c(
|
|
1088
|
+
"button",
|
|
1089
|
+
{
|
|
1090
|
+
type: "button",
|
|
1091
|
+
className: "nice-contract-btn nice-contract-btn--approve",
|
|
1092
|
+
onClick: () => {
|
|
1093
|
+
s(h.id, "approve", n), i(null), l("");
|
|
1094
|
+
},
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ e(ie, { size: 14 }),
|
|
1097
|
+
" Approve"
|
|
1098
|
+
]
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ c(
|
|
1102
|
+
"button",
|
|
1103
|
+
{
|
|
1104
|
+
type: "button",
|
|
1105
|
+
className: "nice-contract-btn nice-contract-btn--reject",
|
|
1106
|
+
onClick: () => {
|
|
1107
|
+
s(h.id, "reject", n), i(null), l("");
|
|
1108
|
+
},
|
|
1109
|
+
children: [
|
|
1110
|
+
/* @__PURE__ */ e(oe, { size: 14 }),
|
|
1111
|
+
" Reject"
|
|
1112
|
+
]
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => i(null), children: "Cancel" })
|
|
1116
|
+
] })
|
|
1117
|
+
] }) : /* @__PURE__ */ e(
|
|
1118
|
+
"button",
|
|
1119
|
+
{
|
|
1120
|
+
type: "button",
|
|
1121
|
+
className: "nice-contract-btn",
|
|
1122
|
+
onClick: () => i(h.id),
|
|
1123
|
+
children: "Review"
|
|
1124
|
+
}
|
|
1125
|
+
) })
|
|
1126
|
+
]
|
|
1127
|
+
},
|
|
1128
|
+
h.id
|
|
1129
|
+
)) })
|
|
1130
|
+
] });
|
|
1131
|
+
}, Mc = te(
|
|
1132
|
+
({
|
|
1133
|
+
document: a,
|
|
1134
|
+
clauseLibrary: s = [],
|
|
1135
|
+
readOnly: t = !1,
|
|
1136
|
+
showClauseLibrary: i = !0,
|
|
1137
|
+
showVersionHistory: n = !1,
|
|
1138
|
+
showComments: l = !1,
|
|
1139
|
+
showWorkflow: h = !0,
|
|
1140
|
+
currentUser: r,
|
|
1141
|
+
onChange: u,
|
|
1142
|
+
onAddClause: T,
|
|
1143
|
+
onRemoveClause: E,
|
|
1144
|
+
onVariableChange: S,
|
|
1145
|
+
onAddComment: y,
|
|
1146
|
+
onApprovalAction: J,
|
|
1147
|
+
onRestoreVersion: _,
|
|
1148
|
+
onSave: K,
|
|
1149
|
+
onExport: O,
|
|
1150
|
+
className: M = "",
|
|
1151
|
+
style: j,
|
|
1152
|
+
tutorial: U
|
|
1153
|
+
}, B) => {
|
|
1154
|
+
var Q;
|
|
1155
|
+
const [m, k] = w(a), [g, Y] = w(i ? "library" : null), [p, P] = w(
|
|
1156
|
+
((Q = m.sections[0]) == null ? void 0 : Q.id) || null
|
|
1157
|
+
), I = m.sections.flatMap(
|
|
1158
|
+
(N) => N.clauses.flatMap((D) => D.variables || [])
|
|
1159
|
+
).filter(
|
|
1160
|
+
(N, D, R) => R.findIndex((H) => H.name === N.name) === D
|
|
1161
|
+
), C = $(
|
|
1162
|
+
(N) => {
|
|
1163
|
+
const D = { ...m, ...N, updatedAt: /* @__PURE__ */ new Date() };
|
|
1164
|
+
k(D), u == null || u(D);
|
|
1165
|
+
},
|
|
1166
|
+
[m, u]
|
|
1167
|
+
), q = $(
|
|
1168
|
+
(N, D) => {
|
|
1169
|
+
const R = m.sections.map(
|
|
1170
|
+
(H) => H.id === D ? { ...H, clauses: [...H.clauses, { ...N, id: `${N.id}-${Date.now()}` }] } : H
|
|
1171
|
+
);
|
|
1172
|
+
C({ sections: R }), T == null || T(N, D);
|
|
1173
|
+
},
|
|
1174
|
+
[m, C, T]
|
|
1175
|
+
), v = $(
|
|
1176
|
+
(N, D) => {
|
|
1177
|
+
const R = m.sections.map(
|
|
1178
|
+
(H) => H.id === D ? { ...H, clauses: H.clauses.filter((X) => X.id !== N) } : H
|
|
1179
|
+
);
|
|
1180
|
+
C({ sections: R }), E == null || E(N, D);
|
|
1181
|
+
},
|
|
1182
|
+
[m, C, E]
|
|
1183
|
+
), x = $(
|
|
1184
|
+
(N, D, R) => {
|
|
1185
|
+
const H = m.sections.map((X) => {
|
|
1186
|
+
if (X.id !== N)
|
|
1187
|
+
return X;
|
|
1188
|
+
const o = X.clauses.findIndex((Z) => Z.id === D);
|
|
1189
|
+
if (o === -1)
|
|
1190
|
+
return X;
|
|
1191
|
+
const d = R === "up" ? o - 1 : o + 1;
|
|
1192
|
+
if (d < 0 || d >= X.clauses.length)
|
|
1193
|
+
return X;
|
|
1194
|
+
const f = [...X.clauses];
|
|
1195
|
+
return [f[o], f[d]] = [f[d], f[o]], { ...X, clauses: f };
|
|
1196
|
+
});
|
|
1197
|
+
C({ sections: H });
|
|
1198
|
+
},
|
|
1199
|
+
[m, C]
|
|
1200
|
+
), z = $(
|
|
1201
|
+
(N) => {
|
|
1202
|
+
const D = m.sections.map(
|
|
1203
|
+
(R) => R.id === N ? { ...R, collapsed: !R.collapsed } : R
|
|
1204
|
+
);
|
|
1205
|
+
C({ sections: D });
|
|
1206
|
+
},
|
|
1207
|
+
[m, C]
|
|
1208
|
+
), G = $(
|
|
1209
|
+
(N, D) => {
|
|
1210
|
+
C({ variables: { ...m.variables, [N]: D } }), S == null || S(N, D);
|
|
1211
|
+
},
|
|
1212
|
+
[m, C, S]
|
|
1213
|
+
), V = $(() => {
|
|
1214
|
+
const N = [];
|
|
1215
|
+
return I.forEach((D) => {
|
|
1216
|
+
D.required && !m.variables[D.name] && N.push(`Missing required variable: ${D.name}`);
|
|
1217
|
+
}), m.sections.forEach((D) => {
|
|
1218
|
+
D.clauses.forEach((R) => {
|
|
1219
|
+
R.isRequired && !R.content && N.push(`Required clause "${R.name}" is empty`);
|
|
1220
|
+
});
|
|
1221
|
+
}), { valid: N.length === 0, errors: N };
|
|
1222
|
+
}, [m, I]);
|
|
1223
|
+
ne(B, () => ({
|
|
1224
|
+
getDocument: () => m,
|
|
1225
|
+
insertClause: q,
|
|
1226
|
+
setVariable: G,
|
|
1227
|
+
exportDocument: (N) => O == null ? void 0 : O(N),
|
|
1228
|
+
validate: V
|
|
1229
|
+
}));
|
|
1230
|
+
const b = $c[m.status], L = /* @__PURE__ */ c("div", { className: "nice-contract-header", children: [
|
|
1231
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-header-info", children: [
|
|
1232
|
+
/* @__PURE__ */ e("h2", { className: "nice-contract-title", children: m.title }),
|
|
1233
|
+
/* @__PURE__ */ e(
|
|
1234
|
+
"span",
|
|
1235
|
+
{
|
|
1236
|
+
className: "nice-contract-status",
|
|
1237
|
+
style: { "--status-color": b.color },
|
|
1238
|
+
children: b.label
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
] }),
|
|
1242
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-header-actions", children: [
|
|
1243
|
+
K && !t && /* @__PURE__ */ e(
|
|
1244
|
+
"button",
|
|
1245
|
+
{
|
|
1246
|
+
type: "button",
|
|
1247
|
+
className: "nice-contract-btn nice-contract-btn--primary",
|
|
1248
|
+
onClick: () => K(m),
|
|
1249
|
+
children: "Save"
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
O && /* @__PURE__ */ c("div", { className: "nice-contract-export-dropdown", children: [
|
|
1253
|
+
/* @__PURE__ */ c("button", { type: "button", className: "nice-contract-btn", children: [
|
|
1254
|
+
"Export ",
|
|
1255
|
+
/* @__PURE__ */ e(De, { size: 14 })
|
|
1256
|
+
] }),
|
|
1257
|
+
/* @__PURE__ */ c("div", { className: "nice-contract-export-menu", children: [
|
|
1258
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => O("pdf"), children: "PDF" }),
|
|
1259
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => O("docx"), children: "Word (.docx)" }),
|
|
1260
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => O("html"), children: "HTML" })
|
|
1261
|
+
] })
|
|
1262
|
+
] })
|
|
1263
|
+
] })
|
|
1264
|
+
] }), W = /* @__PURE__ */ c("div", { className: "nice-contract-toolbar", children: [
|
|
1265
|
+
i && /* @__PURE__ */ c(
|
|
1266
|
+
"button",
|
|
1267
|
+
{
|
|
1268
|
+
type: "button",
|
|
1269
|
+
className: `nice-contract-toolbar-btn ${g === "library" ? "nice-contract-toolbar-btn--active" : ""}`,
|
|
1270
|
+
onClick: () => Y(g === "library" ? null : "library"),
|
|
1271
|
+
children: [
|
|
1272
|
+
/* @__PURE__ */ e(ec, { size: 16 }),
|
|
1273
|
+
" Library"
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ c(
|
|
1278
|
+
"button",
|
|
1279
|
+
{
|
|
1280
|
+
type: "button",
|
|
1281
|
+
className: `nice-contract-toolbar-btn ${g === "variables" ? "nice-contract-toolbar-btn--active" : ""}`,
|
|
1282
|
+
onClick: () => Y(g === "variables" ? null : "variables"),
|
|
1283
|
+
children: [
|
|
1284
|
+
/* @__PURE__ */ e(Fe, { size: 16 }),
|
|
1285
|
+
" Variables"
|
|
1286
|
+
]
|
|
1287
|
+
}
|
|
1288
|
+
),
|
|
1289
|
+
h && m.workflow && /* @__PURE__ */ c(
|
|
1290
|
+
"button",
|
|
1291
|
+
{
|
|
1292
|
+
type: "button",
|
|
1293
|
+
className: `nice-contract-toolbar-btn ${g === "workflow" ? "nice-contract-toolbar-btn--active" : ""}`,
|
|
1294
|
+
onClick: () => Y(g === "workflow" ? null : "workflow"),
|
|
1295
|
+
children: [
|
|
1296
|
+
/* @__PURE__ */ e(ie, { size: 16 }),
|
|
1297
|
+
" Workflow"
|
|
1298
|
+
]
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
n && /* @__PURE__ */ c(
|
|
1302
|
+
"button",
|
|
1303
|
+
{
|
|
1304
|
+
type: "button",
|
|
1305
|
+
className: `nice-contract-toolbar-btn ${g === "history" ? "nice-contract-toolbar-btn--active" : ""}`,
|
|
1306
|
+
onClick: () => Y(g === "history" ? null : "history"),
|
|
1307
|
+
children: [
|
|
1308
|
+
/* @__PURE__ */ e(xe, { size: 16 }),
|
|
1309
|
+
" History"
|
|
1310
|
+
]
|
|
1311
|
+
}
|
|
1312
|
+
)
|
|
1313
|
+
] }), F = g ? /* @__PURE__ */ c("div", { className: "nice-contract-panel", children: [
|
|
1314
|
+
g === "library" && /* @__PURE__ */ e(
|
|
1315
|
+
Pc,
|
|
1316
|
+
{
|
|
1317
|
+
clauses: s,
|
|
1318
|
+
onInsert: (N) => p && q(N, p)
|
|
1319
|
+
}
|
|
1320
|
+
),
|
|
1321
|
+
g === "variables" && /* @__PURE__ */ e(
|
|
1322
|
+
Rc,
|
|
1323
|
+
{
|
|
1324
|
+
variables: m.variables,
|
|
1325
|
+
definitions: I,
|
|
1326
|
+
onChange: G
|
|
1327
|
+
}
|
|
1328
|
+
),
|
|
1329
|
+
g === "workflow" && m.workflow && /* @__PURE__ */ e(
|
|
1330
|
+
Ec,
|
|
1331
|
+
{
|
|
1332
|
+
workflow: m.workflow,
|
|
1333
|
+
onAction: (N, D, R) => J == null ? void 0 : J(N, D, R)
|
|
1334
|
+
}
|
|
1335
|
+
)
|
|
1336
|
+
] }) : void 0;
|
|
1337
|
+
return /* @__PURE__ */ e(
|
|
1338
|
+
Nc,
|
|
1339
|
+
{
|
|
1340
|
+
flush: !0,
|
|
1341
|
+
className: `nice-contract-editor ${M}`,
|
|
1342
|
+
style: j,
|
|
1343
|
+
menubar: L,
|
|
1344
|
+
toolbar: W,
|
|
1345
|
+
sidebar: F,
|
|
1346
|
+
children: /* @__PURE__ */ c("div", { className: "nice-contract-document", children: [
|
|
1347
|
+
/* @__PURE__ */ e("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ e(fc, { steps: yc(U, Fc) }) }),
|
|
1348
|
+
m.sections.map((N) => /* @__PURE__ */ e(
|
|
1349
|
+
Oc,
|
|
1350
|
+
{
|
|
1351
|
+
section: N,
|
|
1352
|
+
variables: m.variables,
|
|
1353
|
+
readOnly: t,
|
|
1354
|
+
onToggle: () => z(N.id),
|
|
1355
|
+
onRemoveClause: (D) => v(D, N.id),
|
|
1356
|
+
onMoveClause: (D, R) => x(N.id, D, R)
|
|
1357
|
+
},
|
|
1358
|
+
N.id
|
|
1359
|
+
))
|
|
1360
|
+
] })
|
|
1361
|
+
}
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1365
|
+
Mc.displayName = "NiceContractEditor";
|
|
1366
|
+
const jc = [
|
|
1367
|
+
{
|
|
1368
|
+
id: "necessary",
|
|
1369
|
+
label: "Necessary",
|
|
1370
|
+
description: "Essential cookies for site functionality. Cannot be disabled.",
|
|
1371
|
+
required: !0,
|
|
1372
|
+
enabled: !0,
|
|
1373
|
+
cookies: ["session_id", "csrf_token", "consent"]
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
id: "analytics",
|
|
1377
|
+
label: "Analytics",
|
|
1378
|
+
description: "Help us understand how visitors interact with our website.",
|
|
1379
|
+
enabled: !1,
|
|
1380
|
+
cookies: ["_ga", "_gid", "_gat"],
|
|
1381
|
+
partners: ["Google Analytics", "Hotjar"]
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
id: "marketing",
|
|
1385
|
+
label: "Marketing",
|
|
1386
|
+
description: "Used to deliver personalized advertisements.",
|
|
1387
|
+
enabled: !1,
|
|
1388
|
+
cookies: ["_fbp", "_gcl_au", "ads_id"],
|
|
1389
|
+
partners: ["Facebook", "Google Ads", "LinkedIn"]
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
id: "preferences",
|
|
1393
|
+
label: "Preferences",
|
|
1394
|
+
description: "Remember your settings and preferences.",
|
|
1395
|
+
enabled: !1,
|
|
1396
|
+
cookies: ["theme", "language", "timezone"]
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
id: "social",
|
|
1400
|
+
label: "Social Media",
|
|
1401
|
+
description: "Enable social sharing and embedded content.",
|
|
1402
|
+
enabled: !1,
|
|
1403
|
+
cookies: ["social_session"],
|
|
1404
|
+
partners: ["Twitter", "YouTube", "Instagram"]
|
|
1405
|
+
}
|
|
1406
|
+
], Uc = {
|
|
1407
|
+
title: "Cookie Preferences",
|
|
1408
|
+
description: "We use cookies to enhance your experience. Choose which types of cookies you allow.",
|
|
1409
|
+
acceptAll: "Accept All",
|
|
1410
|
+
rejectAll: "Reject All",
|
|
1411
|
+
customize: "Customize",
|
|
1412
|
+
savePreferences: "Save Preferences",
|
|
1413
|
+
necessary: "Necessary",
|
|
1414
|
+
analytics: "Analytics",
|
|
1415
|
+
marketing: "Marketing",
|
|
1416
|
+
preferences: "Preferences",
|
|
1417
|
+
social: "Social Media",
|
|
1418
|
+
dataRights: "Your Data Rights",
|
|
1419
|
+
exportData: "Export My Data",
|
|
1420
|
+
deleteData: "Delete My Data",
|
|
1421
|
+
pending: "Pending",
|
|
1422
|
+
processing: "Processing",
|
|
1423
|
+
completed: "Completed",
|
|
1424
|
+
close: "Close"
|
|
1425
|
+
}, Yc = ({ option: a, enabled: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-gdpr-option", children: [
|
|
1426
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-option-header", children: [
|
|
1427
|
+
/* @__PURE__ */ c("label", { className: "nice-gdpr-option-toggle", children: [
|
|
1428
|
+
/* @__PURE__ */ e(
|
|
1429
|
+
"input",
|
|
1430
|
+
{
|
|
1431
|
+
type: "checkbox",
|
|
1432
|
+
checked: s,
|
|
1433
|
+
onChange: (i) => t(i.target.checked),
|
|
1434
|
+
disabled: a.required
|
|
1435
|
+
}
|
|
1436
|
+
),
|
|
1437
|
+
/* @__PURE__ */ e("span", { className: "nice-gdpr-toggle-slider" })
|
|
1438
|
+
] }),
|
|
1439
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-option-info", children: [
|
|
1440
|
+
/* @__PURE__ */ c("span", { className: "nice-gdpr-option-label", children: [
|
|
1441
|
+
a.label,
|
|
1442
|
+
a.required && /* @__PURE__ */ e("span", { className: "nice-gdpr-required", children: "Required" })
|
|
1443
|
+
] }),
|
|
1444
|
+
/* @__PURE__ */ e("span", { className: "nice-gdpr-option-desc", children: a.description })
|
|
1445
|
+
] })
|
|
1446
|
+
] }),
|
|
1447
|
+
a.partners && a.partners.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-option-partners", children: [
|
|
1448
|
+
/* @__PURE__ */ e("span", { children: "Partners: " }),
|
|
1449
|
+
a.partners.join(", ")
|
|
1450
|
+
] })
|
|
1451
|
+
] }), qc = ({
|
|
1452
|
+
requests: a,
|
|
1453
|
+
policies: s,
|
|
1454
|
+
onRequest: t,
|
|
1455
|
+
onDownload: i,
|
|
1456
|
+
labels: n
|
|
1457
|
+
}) => /* @__PURE__ */ c("div", { className: "nice-gdpr-rights", children: [
|
|
1458
|
+
/* @__PURE__ */ e("h4", { children: n.dataRights }),
|
|
1459
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-rights-actions", children: [
|
|
1460
|
+
/* @__PURE__ */ c(
|
|
1461
|
+
"button",
|
|
1462
|
+
{
|
|
1463
|
+
type: "button",
|
|
1464
|
+
className: "nice-gdpr-btn nice-gdpr-btn--secondary",
|
|
1465
|
+
onClick: () => t("export"),
|
|
1466
|
+
children: [
|
|
1467
|
+
/* @__PURE__ */ e(me, { size: 16 }),
|
|
1468
|
+
" ",
|
|
1469
|
+
n.exportData
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
/* @__PURE__ */ c(
|
|
1474
|
+
"button",
|
|
1475
|
+
{
|
|
1476
|
+
type: "button",
|
|
1477
|
+
className: "nice-gdpr-btn nice-gdpr-btn--danger",
|
|
1478
|
+
onClick: () => t("delete"),
|
|
1479
|
+
children: [
|
|
1480
|
+
/* @__PURE__ */ e(lc, { size: 16 }),
|
|
1481
|
+
" ",
|
|
1482
|
+
n.deleteData
|
|
1483
|
+
]
|
|
1484
|
+
}
|
|
1485
|
+
)
|
|
1486
|
+
] }),
|
|
1487
|
+
a.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-requests", children: [
|
|
1488
|
+
/* @__PURE__ */ e("h5", { children: "Previous Requests" }),
|
|
1489
|
+
a.map((l) => /* @__PURE__ */ c("div", { className: `nice-gdpr-request nice-gdpr-request--${l.status}`, children: [
|
|
1490
|
+
/* @__PURE__ */ e("span", { className: "nice-gdpr-request-type", children: l.type }),
|
|
1491
|
+
/* @__PURE__ */ e("span", { className: "nice-gdpr-request-date", children: new Date(l.requestedAt).toLocaleDateString() }),
|
|
1492
|
+
/* @__PURE__ */ e("span", { className: "nice-gdpr-request-status", children: l.status }),
|
|
1493
|
+
l.status === "completed" && l.downloadUrl && /* @__PURE__ */ e(
|
|
1494
|
+
"button",
|
|
1495
|
+
{
|
|
1496
|
+
type: "button",
|
|
1497
|
+
className: "nice-gdpr-download-btn",
|
|
1498
|
+
onClick: () => i(l.id),
|
|
1499
|
+
children: "Download"
|
|
1500
|
+
}
|
|
1501
|
+
)
|
|
1502
|
+
] }, l.id))
|
|
1503
|
+
] }),
|
|
1504
|
+
s.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-policies", children: [
|
|
1505
|
+
/* @__PURE__ */ e("h5", { children: "Data Retention" }),
|
|
1506
|
+
/* @__PURE__ */ c("table", { className: "nice-gdpr-policies-table", children: [
|
|
1507
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
1508
|
+
/* @__PURE__ */ e("th", { children: "Category" }),
|
|
1509
|
+
/* @__PURE__ */ e("th", { children: "Retention" }),
|
|
1510
|
+
/* @__PURE__ */ e("th", { children: "Legal Basis" })
|
|
1511
|
+
] }) }),
|
|
1512
|
+
/* @__PURE__ */ e("tbody", { children: s.map((l, h) => /* @__PURE__ */ c("tr", { children: [
|
|
1513
|
+
/* @__PURE__ */ e("td", { children: l.category }),
|
|
1514
|
+
/* @__PURE__ */ c("td", { children: [
|
|
1515
|
+
l.retentionDays,
|
|
1516
|
+
" days"
|
|
1517
|
+
] }),
|
|
1518
|
+
/* @__PURE__ */ e("td", { children: l.legalBasis })
|
|
1519
|
+
] }, h)) })
|
|
1520
|
+
] })
|
|
1521
|
+
] })
|
|
1522
|
+
] }), Vc = te(
|
|
1523
|
+
({
|
|
1524
|
+
appName: a,
|
|
1525
|
+
companyName: s,
|
|
1526
|
+
options: t = jc,
|
|
1527
|
+
currentConsent: i = null,
|
|
1528
|
+
retentionPolicies: n = [],
|
|
1529
|
+
dataRequests: l = [],
|
|
1530
|
+
privacyPolicy: h = [],
|
|
1531
|
+
storageKey: r = "nice_gdpr_consent",
|
|
1532
|
+
consentVersion: u = "1.0",
|
|
1533
|
+
variant: T = "banner",
|
|
1534
|
+
position: E = "bottom",
|
|
1535
|
+
onConsentChange: S,
|
|
1536
|
+
onDataRequest: y,
|
|
1537
|
+
onDownloadExport: J,
|
|
1538
|
+
privacyPolicyUrl: _,
|
|
1539
|
+
cookiePolicyUrl: K,
|
|
1540
|
+
termsUrl: O,
|
|
1541
|
+
labels: M,
|
|
1542
|
+
className: j = "",
|
|
1543
|
+
style: U
|
|
1544
|
+
}, B) => {
|
|
1545
|
+
const m = { ...Uc, ...M }, [k, g] = w(!1), [Y, p] = w(!1), [P, A] = w(!1), [I, C] = w(() => {
|
|
1546
|
+
const b = {};
|
|
1547
|
+
return t.forEach((L) => {
|
|
1548
|
+
b[L.id] = (i == null ? void 0 : i.categories[L.id]) ?? L.enabled;
|
|
1549
|
+
}), b;
|
|
1550
|
+
});
|
|
1551
|
+
ue(() => {
|
|
1552
|
+
(!i || i.version !== u) && g(!0);
|
|
1553
|
+
}, [i, u]);
|
|
1554
|
+
const q = $(
|
|
1555
|
+
(b, L) => {
|
|
1556
|
+
const W = L || I;
|
|
1557
|
+
W.necessary = !0;
|
|
1558
|
+
const F = {
|
|
1559
|
+
version: u,
|
|
1560
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1561
|
+
categories: W,
|
|
1562
|
+
action: b
|
|
1563
|
+
};
|
|
1564
|
+
try {
|
|
1565
|
+
localStorage.setItem(r, JSON.stringify(F));
|
|
1566
|
+
} catch {
|
|
1567
|
+
}
|
|
1568
|
+
C(W), g(!1), p(!1), S == null || S(F);
|
|
1569
|
+
},
|
|
1570
|
+
[I, u, r, S]
|
|
1571
|
+
), v = $(() => {
|
|
1572
|
+
const b = {};
|
|
1573
|
+
t.forEach((L) => {
|
|
1574
|
+
b[L.id] = !0;
|
|
1575
|
+
}), q("accept_all", b);
|
|
1576
|
+
}, [t, q]), x = $(() => {
|
|
1577
|
+
const b = {};
|
|
1578
|
+
t.forEach((L) => {
|
|
1579
|
+
b[L.id] = L.required || !1;
|
|
1580
|
+
}), q("reject_all", b);
|
|
1581
|
+
}, [t, q]), z = $(
|
|
1582
|
+
async (b) => {
|
|
1583
|
+
y && await y(b);
|
|
1584
|
+
},
|
|
1585
|
+
[y]
|
|
1586
|
+
);
|
|
1587
|
+
if (ne(B, () => ({
|
|
1588
|
+
showBanner: () => g(!0),
|
|
1589
|
+
hideBanner: () => g(!1),
|
|
1590
|
+
getConsent: () => {
|
|
1591
|
+
try {
|
|
1592
|
+
const b = localStorage.getItem(r);
|
|
1593
|
+
return b ? JSON.parse(b) : null;
|
|
1594
|
+
} catch {
|
|
1595
|
+
return null;
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
revokeConsent: () => {
|
|
1599
|
+
try {
|
|
1600
|
+
localStorage.removeItem(r);
|
|
1601
|
+
} catch {
|
|
1602
|
+
}
|
|
1603
|
+
g(!0);
|
|
1604
|
+
},
|
|
1605
|
+
openPreferences: () => {
|
|
1606
|
+
g(!0), p(!0);
|
|
1607
|
+
}
|
|
1608
|
+
})), !k && T !== "embedded")
|
|
1609
|
+
return null;
|
|
1610
|
+
const G = /* @__PURE__ */ c("div", { className: "nice-gdpr-content", children: [
|
|
1611
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-header", children: [
|
|
1612
|
+
/* @__PURE__ */ e("div", { className: "nice-gdpr-icon", children: /* @__PURE__ */ e(tc, { size: 32 }) }),
|
|
1613
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-header-text", children: [
|
|
1614
|
+
/* @__PURE__ */ e("h3", { children: m.title }),
|
|
1615
|
+
/* @__PURE__ */ e("p", { children: m.description.replace("{app}", a).replace("{company}", s) })
|
|
1616
|
+
] })
|
|
1617
|
+
] }),
|
|
1618
|
+
!Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-quick-actions", children: [
|
|
1619
|
+
/* @__PURE__ */ e(
|
|
1620
|
+
"button",
|
|
1621
|
+
{
|
|
1622
|
+
type: "button",
|
|
1623
|
+
className: "nice-gdpr-btn nice-gdpr-btn--primary",
|
|
1624
|
+
onClick: v,
|
|
1625
|
+
children: m.acceptAll
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
/* @__PURE__ */ e(
|
|
1629
|
+
"button",
|
|
1630
|
+
{
|
|
1631
|
+
type: "button",
|
|
1632
|
+
className: "nice-gdpr-btn nice-gdpr-btn--secondary",
|
|
1633
|
+
onClick: x,
|
|
1634
|
+
children: m.rejectAll
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
/* @__PURE__ */ e(
|
|
1638
|
+
"button",
|
|
1639
|
+
{
|
|
1640
|
+
type: "button",
|
|
1641
|
+
className: "nice-gdpr-btn nice-gdpr-btn--link",
|
|
1642
|
+
onClick: () => p(!0),
|
|
1643
|
+
children: m.customize
|
|
1644
|
+
}
|
|
1645
|
+
)
|
|
1646
|
+
] }),
|
|
1647
|
+
Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-preferences", children: [
|
|
1648
|
+
/* @__PURE__ */ e("div", { className: "nice-gdpr-options", children: t.map((b) => /* @__PURE__ */ e(
|
|
1649
|
+
Yc,
|
|
1650
|
+
{
|
|
1651
|
+
option: b,
|
|
1652
|
+
enabled: I[b.id],
|
|
1653
|
+
onChange: (L) => C((W) => ({ ...W, [b.id]: L }))
|
|
1654
|
+
},
|
|
1655
|
+
b.id
|
|
1656
|
+
)) }),
|
|
1657
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-pref-actions", children: [
|
|
1658
|
+
/* @__PURE__ */ e(
|
|
1659
|
+
"button",
|
|
1660
|
+
{
|
|
1661
|
+
type: "button",
|
|
1662
|
+
className: "nice-gdpr-btn nice-gdpr-btn--primary",
|
|
1663
|
+
onClick: () => q("custom"),
|
|
1664
|
+
children: m.savePreferences
|
|
1665
|
+
}
|
|
1666
|
+
),
|
|
1667
|
+
/* @__PURE__ */ e(
|
|
1668
|
+
"button",
|
|
1669
|
+
{
|
|
1670
|
+
type: "button",
|
|
1671
|
+
className: "nice-gdpr-btn nice-gdpr-btn--link",
|
|
1672
|
+
onClick: () => A(!0),
|
|
1673
|
+
children: m.dataRights
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] })
|
|
1677
|
+
] }),
|
|
1678
|
+
P && /* @__PURE__ */ c(ee, { children: [
|
|
1679
|
+
/* @__PURE__ */ e(
|
|
1680
|
+
qc,
|
|
1681
|
+
{
|
|
1682
|
+
requests: l,
|
|
1683
|
+
policies: n,
|
|
1684
|
+
onRequest: z,
|
|
1685
|
+
onDownload: (b) => J == null ? void 0 : J(b),
|
|
1686
|
+
labels: m
|
|
1687
|
+
}
|
|
1688
|
+
),
|
|
1689
|
+
/* @__PURE__ */ c(
|
|
1690
|
+
"button",
|
|
1691
|
+
{
|
|
1692
|
+
type: "button",
|
|
1693
|
+
className: "nice-gdpr-btn nice-gdpr-btn--link",
|
|
1694
|
+
onClick: () => A(!1),
|
|
1695
|
+
children: [
|
|
1696
|
+
/* @__PURE__ */ e(nc, { size: 14 }),
|
|
1697
|
+
" Back to preferences"
|
|
1698
|
+
]
|
|
1699
|
+
}
|
|
1700
|
+
)
|
|
1701
|
+
] }),
|
|
1702
|
+
/* @__PURE__ */ c("div", { className: "nice-gdpr-footer", children: [
|
|
1703
|
+
_ && /* @__PURE__ */ e("a", { href: _, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" }),
|
|
1704
|
+
K && /* @__PURE__ */ e("a", { href: K, target: "_blank", rel: "noopener noreferrer", children: "Cookie Policy" }),
|
|
1705
|
+
O && /* @__PURE__ */ e("a", { href: O, target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" })
|
|
1706
|
+
] })
|
|
1707
|
+
] }), V = `nice-gdpr-consent nice-gdpr-consent--${T} nice-gdpr-consent--${E} ${j}`;
|
|
1708
|
+
return T === "modal" ? /* @__PURE__ */ e("div", { className: "nice-gdpr-overlay", children: /* @__PURE__ */ e("div", { className: V, style: U, role: "dialog", "aria-modal": "true", children: G }) }) : /* @__PURE__ */ e("div", { className: V, style: U, children: G });
|
|
1709
|
+
}
|
|
1710
|
+
);
|
|
1711
|
+
Vc.displayName = "NiceGDPRConsent";
|
|
1712
|
+
const Ve = {
|
|
1713
|
+
document: /* @__PURE__ */ e(we, { size: 16 }),
|
|
1714
|
+
user: /* @__PURE__ */ e(Ye, { size: 16 }),
|
|
1715
|
+
task: /* @__PURE__ */ e(ie, { size: 16 }),
|
|
1716
|
+
project: /* @__PURE__ */ e(rc, { size: 16 }),
|
|
1717
|
+
setting: /* @__PURE__ */ e(Pe, { size: 16 }),
|
|
1718
|
+
help: /* @__PURE__ */ e(Ue, { size: 16 }),
|
|
1719
|
+
action: /* @__PURE__ */ e(je, { size: 16 }),
|
|
1720
|
+
custom: /* @__PURE__ */ e(Ce, { size: 16 })
|
|
1721
|
+
}, Bc = ({
|
|
1722
|
+
value: a,
|
|
1723
|
+
onChange: s,
|
|
1724
|
+
onKeyDown: t,
|
|
1725
|
+
placeholder: i,
|
|
1726
|
+
isLoading: n,
|
|
1727
|
+
inputRef: l
|
|
1728
|
+
}) => /* @__PURE__ */ c("div", { className: "nice-search-input-container", children: [
|
|
1729
|
+
/* @__PURE__ */ e("span", { className: "nice-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
|
|
1730
|
+
/* @__PURE__ */ e(
|
|
1731
|
+
"input",
|
|
1732
|
+
{
|
|
1733
|
+
ref: l,
|
|
1734
|
+
type: "text",
|
|
1735
|
+
className: "nice-search-input",
|
|
1736
|
+
placeholder: i,
|
|
1737
|
+
value: a,
|
|
1738
|
+
onChange: (h) => s(h.target.value),
|
|
1739
|
+
onKeyDown: t,
|
|
1740
|
+
"aria-label": "Search"
|
|
1741
|
+
}
|
|
1742
|
+
),
|
|
1743
|
+
n && /* @__PURE__ */ e("span", { className: "nice-search-loader" }),
|
|
1744
|
+
a && !n && /* @__PURE__ */ e(
|
|
1745
|
+
"button",
|
|
1746
|
+
{
|
|
1747
|
+
type: "button",
|
|
1748
|
+
className: "nice-search-clear",
|
|
1749
|
+
onClick: () => s(""),
|
|
1750
|
+
"aria-label": "Clear search",
|
|
1751
|
+
children: /* @__PURE__ */ e(ge, { size: 16 })
|
|
1752
|
+
}
|
|
1753
|
+
)
|
|
1754
|
+
] }), Hc = ({ result: a, isSelected: s, onSelect: t, renderResult: i }) => i ? /* @__PURE__ */ e("div", { onClick: t, children: i(a, s) }) : /* @__PURE__ */ c(
|
|
1755
|
+
"div",
|
|
1756
|
+
{
|
|
1757
|
+
className: `nice-search-result ${s ? "nice-search-result--selected" : ""}`,
|
|
1758
|
+
onClick: t,
|
|
1759
|
+
role: "option",
|
|
1760
|
+
"aria-selected": s,
|
|
1761
|
+
children: [
|
|
1762
|
+
/* @__PURE__ */ e("div", { className: "nice-search-result-icon", children: a.icon || (a.image ? /* @__PURE__ */ e("img", { src: a.image, alt: "" }) : Ve[a.type]) }),
|
|
1763
|
+
/* @__PURE__ */ c("div", { className: "nice-search-result-content", children: [
|
|
1764
|
+
/* @__PURE__ */ e("span", { className: "nice-search-result-title", children: a.title }),
|
|
1765
|
+
a.subtitle && /* @__PURE__ */ e("span", { className: "nice-search-result-subtitle", children: a.subtitle }),
|
|
1766
|
+
a.description && /* @__PURE__ */ e("span", { className: "nice-search-result-desc", children: a.description })
|
|
1767
|
+
] }),
|
|
1768
|
+
/* @__PURE__ */ c("div", { className: "nice-search-result-meta", children: [
|
|
1769
|
+
/* @__PURE__ */ e("span", { className: "nice-search-result-source", children: a.source }),
|
|
1770
|
+
/* @__PURE__ */ e("span", { className: "nice-search-result-type", children: a.type })
|
|
1771
|
+
] }),
|
|
1772
|
+
a.actions && a.actions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-search-result-actions", children: a.actions.map((n) => /* @__PURE__ */ e(
|
|
1773
|
+
"button",
|
|
1774
|
+
{
|
|
1775
|
+
type: "button",
|
|
1776
|
+
className: "nice-search-action-btn",
|
|
1777
|
+
onClick: (l) => {
|
|
1778
|
+
l.stopPropagation(), n.onClick();
|
|
1779
|
+
},
|
|
1780
|
+
title: n.label,
|
|
1781
|
+
children: n.icon || n.label
|
|
1782
|
+
},
|
|
1783
|
+
n.id
|
|
1784
|
+
)) })
|
|
1785
|
+
]
|
|
1786
|
+
}
|
|
1787
|
+
), Jc = ({ categories: a, selected: s, onSelect: t }) => /* @__PURE__ */ c("div", { className: "nice-search-categories", children: [
|
|
1788
|
+
/* @__PURE__ */ e(
|
|
1789
|
+
"button",
|
|
1790
|
+
{
|
|
1791
|
+
type: "button",
|
|
1792
|
+
className: `nice-search-category ${s === null ? "nice-search-category--active" : ""}`,
|
|
1793
|
+
onClick: () => t(null),
|
|
1794
|
+
children: "All"
|
|
1795
|
+
}
|
|
1796
|
+
),
|
|
1797
|
+
a.map((i) => /* @__PURE__ */ c(
|
|
1798
|
+
"button",
|
|
1799
|
+
{
|
|
1800
|
+
type: "button",
|
|
1801
|
+
className: `nice-search-category ${s === i.id ? "nice-search-category--active" : ""}`,
|
|
1802
|
+
onClick: () => t(i.id),
|
|
1803
|
+
children: [
|
|
1804
|
+
i.icon && /* @__PURE__ */ e("span", { className: "nice-search-category-icon", children: i.icon }),
|
|
1805
|
+
i.label,
|
|
1806
|
+
i.count !== void 0 && /* @__PURE__ */ e("span", { className: "nice-search-category-count", children: i.count })
|
|
1807
|
+
]
|
|
1808
|
+
},
|
|
1809
|
+
i.id
|
|
1810
|
+
))
|
|
1811
|
+
] }), Gc = ({
|
|
1812
|
+
searches: a,
|
|
1813
|
+
onSelect: s,
|
|
1814
|
+
onClear: t,
|
|
1815
|
+
label: i,
|
|
1816
|
+
clearLabel: n
|
|
1817
|
+
}) => /* @__PURE__ */ c("div", { className: "nice-search-recent", children: [
|
|
1818
|
+
/* @__PURE__ */ c("div", { className: "nice-search-recent-header", children: [
|
|
1819
|
+
/* @__PURE__ */ e("span", { children: i }),
|
|
1820
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: t, children: n })
|
|
1821
|
+
] }),
|
|
1822
|
+
/* @__PURE__ */ e("div", { className: "nice-search-recent-list", children: a.map((l, h) => /* @__PURE__ */ c(
|
|
1823
|
+
"button",
|
|
1824
|
+
{
|
|
1825
|
+
type: "button",
|
|
1826
|
+
className: "nice-search-recent-item",
|
|
1827
|
+
onClick: () => s(l.query),
|
|
1828
|
+
children: [
|
|
1829
|
+
/* @__PURE__ */ e("span", { className: "nice-search-recent-icon", children: /* @__PURE__ */ e(xe, { size: 14 }) }),
|
|
1830
|
+
/* @__PURE__ */ e("span", { className: "nice-search-recent-query", children: l.query })
|
|
1831
|
+
]
|
|
1832
|
+
},
|
|
1833
|
+
h
|
|
1834
|
+
)) })
|
|
1835
|
+
] }), Kc = {
|
|
1836
|
+
placeholder: "Search...",
|
|
1837
|
+
recent: "Recent Searches",
|
|
1838
|
+
noResults: "No results found for",
|
|
1839
|
+
searching: "Searching...",
|
|
1840
|
+
clearRecent: "Clear",
|
|
1841
|
+
categories: "Categories",
|
|
1842
|
+
filters: "Filters"
|
|
1843
|
+
}, Wc = te(
|
|
1844
|
+
({
|
|
1845
|
+
sources: a,
|
|
1846
|
+
placeholder: s,
|
|
1847
|
+
minQueryLength: t = 2,
|
|
1848
|
+
debounceMs: i = 300,
|
|
1849
|
+
showCategories: n = !0,
|
|
1850
|
+
filters: l = [],
|
|
1851
|
+
showRecent: h = !0,
|
|
1852
|
+
maxRecent: r = 5,
|
|
1853
|
+
showShortcuts: u = !0,
|
|
1854
|
+
hotkey: T = "k",
|
|
1855
|
+
onResultSelect: E,
|
|
1856
|
+
onSearch: S,
|
|
1857
|
+
onClose: y,
|
|
1858
|
+
renderResult: J,
|
|
1859
|
+
renderEmpty: _,
|
|
1860
|
+
defaultOpen: K = !1,
|
|
1861
|
+
open: O,
|
|
1862
|
+
variant: M = "modal",
|
|
1863
|
+
labels: j,
|
|
1864
|
+
className: U = "",
|
|
1865
|
+
style: B
|
|
1866
|
+
}, m) => {
|
|
1867
|
+
const k = { ...Kc, ...j }, g = ye(null), Y = ye(), [p, P] = w(K), [A, I] = w(""), [C, q] = w([]), [v, x] = w(!1), [z, G] = w(0), [V, b] = w(null), [L, W] = w([]), F = O !== void 0 ? O : p;
|
|
1868
|
+
ue(() => {
|
|
1869
|
+
try {
|
|
1870
|
+
const d = localStorage.getItem("nice_recent_searches");
|
|
1871
|
+
d && W(JSON.parse(d));
|
|
1872
|
+
} catch {
|
|
1873
|
+
}
|
|
1874
|
+
}, []);
|
|
1875
|
+
const Q = $(
|
|
1876
|
+
(d, f) => {
|
|
1877
|
+
const ce = [{
|
|
1878
|
+
query: d,
|
|
1879
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1880
|
+
resultCount: f
|
|
1881
|
+
}, ...L.filter((de) => de.query !== d)].slice(
|
|
1882
|
+
0,
|
|
1883
|
+
r
|
|
1884
|
+
);
|
|
1885
|
+
W(ce);
|
|
1886
|
+
try {
|
|
1887
|
+
localStorage.setItem("nice_recent_searches", JSON.stringify(ce));
|
|
1888
|
+
} catch {
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
[L, r]
|
|
1892
|
+
), N = $(
|
|
1893
|
+
async (d) => {
|
|
1894
|
+
if (d.length < t) {
|
|
1895
|
+
q([]);
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
x(!0);
|
|
1899
|
+
try {
|
|
1900
|
+
const f = a.map(async (ce) => {
|
|
1901
|
+
try {
|
|
1902
|
+
return (await ce.search(d)).map((ze) => ({
|
|
1903
|
+
...ze,
|
|
1904
|
+
source: ce.name,
|
|
1905
|
+
relevanceScore: ze.relevanceScore * (ce.priority || 1)
|
|
1906
|
+
}));
|
|
1907
|
+
} catch {
|
|
1908
|
+
return [];
|
|
1909
|
+
}
|
|
1910
|
+
}), Z = (await Promise.all(f)).flat();
|
|
1911
|
+
Z.sort((ce, de) => de.relevanceScore - ce.relevanceScore), q(Z), G(0), S == null || S(d, Z), Z.length > 0 && Q(d, Z.length);
|
|
1912
|
+
} finally {
|
|
1913
|
+
x(!1);
|
|
1914
|
+
}
|
|
1915
|
+
},
|
|
1916
|
+
[a, t, S, Q]
|
|
1917
|
+
), D = $(
|
|
1918
|
+
(d) => {
|
|
1919
|
+
I(d), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => {
|
|
1920
|
+
N(d);
|
|
1921
|
+
}, i);
|
|
1922
|
+
},
|
|
1923
|
+
[N, i]
|
|
1924
|
+
), R = $(
|
|
1925
|
+
(d) => {
|
|
1926
|
+
switch (d.key) {
|
|
1927
|
+
case "ArrowDown":
|
|
1928
|
+
d.preventDefault(), G((f) => Math.min(f + 1, C.length - 1));
|
|
1929
|
+
break;
|
|
1930
|
+
case "ArrowUp":
|
|
1931
|
+
d.preventDefault(), G((f) => Math.max(f - 1, 0));
|
|
1932
|
+
break;
|
|
1933
|
+
case "Enter":
|
|
1934
|
+
d.preventDefault(), C[z] && (E == null || E(C[z]), P(!1), y == null || y());
|
|
1935
|
+
break;
|
|
1936
|
+
case "Escape":
|
|
1937
|
+
d.preventDefault(), P(!1), y == null || y();
|
|
1938
|
+
break;
|
|
1939
|
+
}
|
|
1940
|
+
},
|
|
1941
|
+
[C, z, E, y]
|
|
1942
|
+
);
|
|
1943
|
+
ue(() => {
|
|
1944
|
+
const d = (f) => {
|
|
1945
|
+
(f.metaKey || f.ctrlKey) && f.key === T && (f.preventDefault(), P(!0), setTimeout(() => {
|
|
1946
|
+
var Z;
|
|
1947
|
+
return (Z = g.current) == null ? void 0 : Z.focus();
|
|
1948
|
+
}, 0));
|
|
1949
|
+
};
|
|
1950
|
+
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
1951
|
+
}, [T]), ue(() => {
|
|
1952
|
+
F && setTimeout(() => {
|
|
1953
|
+
var d;
|
|
1954
|
+
return (d = g.current) == null ? void 0 : d.focus();
|
|
1955
|
+
}, 0);
|
|
1956
|
+
}, [F]);
|
|
1957
|
+
const H = V ? C.filter((d) => d.type === V) : C, X = Array.from(new Set(C.map((d) => d.type))).map(
|
|
1958
|
+
(d) => ({
|
|
1959
|
+
id: d,
|
|
1960
|
+
label: d.charAt(0).toUpperCase() + d.slice(1),
|
|
1961
|
+
icon: Ve[d],
|
|
1962
|
+
count: C.filter((f) => f.type === d).length
|
|
1963
|
+
})
|
|
1964
|
+
);
|
|
1965
|
+
if (ne(m, () => ({
|
|
1966
|
+
open: () => P(!0),
|
|
1967
|
+
close: () => {
|
|
1968
|
+
P(!1), y == null || y();
|
|
1969
|
+
},
|
|
1970
|
+
focus: () => {
|
|
1971
|
+
var d;
|
|
1972
|
+
return (d = g.current) == null ? void 0 : d.focus();
|
|
1973
|
+
},
|
|
1974
|
+
clear: () => {
|
|
1975
|
+
I(""), q([]);
|
|
1976
|
+
},
|
|
1977
|
+
search: async (d) => {
|
|
1978
|
+
I(d), await N(d);
|
|
1979
|
+
}
|
|
1980
|
+
})), !F && M !== "inline")
|
|
1981
|
+
return null;
|
|
1982
|
+
const o = /* @__PURE__ */ c("div", { className: "nice-search-content", children: [
|
|
1983
|
+
/* @__PURE__ */ e(
|
|
1984
|
+
Bc,
|
|
1985
|
+
{
|
|
1986
|
+
value: A,
|
|
1987
|
+
onChange: D,
|
|
1988
|
+
onKeyDown: R,
|
|
1989
|
+
placeholder: s || k.placeholder,
|
|
1990
|
+
isLoading: v,
|
|
1991
|
+
inputRef: g
|
|
1992
|
+
}
|
|
1993
|
+
),
|
|
1994
|
+
n && X.length > 1 && A.length >= t && /* @__PURE__ */ e(
|
|
1995
|
+
Jc,
|
|
1996
|
+
{
|
|
1997
|
+
categories: X,
|
|
1998
|
+
selected: V,
|
|
1999
|
+
onSelect: b
|
|
2000
|
+
}
|
|
2001
|
+
),
|
|
2002
|
+
/* @__PURE__ */ c("div", { className: "nice-search-results", role: "listbox", children: [
|
|
2003
|
+
v && A.length >= t && /* @__PURE__ */ e("div", { className: "nice-search-loading", children: k.searching }),
|
|
2004
|
+
!v && A.length >= t && H.length === 0 && /* @__PURE__ */ e("div", { className: "nice-search-empty", children: _ ? _(A) : /* @__PURE__ */ c(ee, { children: [
|
|
2005
|
+
/* @__PURE__ */ e("span", { className: "nice-search-empty-icon", children: /* @__PURE__ */ e(pe, { size: 32 }) }),
|
|
2006
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2007
|
+
k.noResults,
|
|
2008
|
+
' "',
|
|
2009
|
+
A,
|
|
2010
|
+
'"'
|
|
2011
|
+
] })
|
|
2012
|
+
] }) }),
|
|
2013
|
+
H.map((d, f) => /* @__PURE__ */ e(
|
|
2014
|
+
Hc,
|
|
2015
|
+
{
|
|
2016
|
+
result: d,
|
|
2017
|
+
isSelected: f === z,
|
|
2018
|
+
onSelect: () => {
|
|
2019
|
+
E == null || E(d), P(!1), y == null || y();
|
|
2020
|
+
},
|
|
2021
|
+
renderResult: J
|
|
2022
|
+
},
|
|
2023
|
+
d.id
|
|
2024
|
+
))
|
|
2025
|
+
] }),
|
|
2026
|
+
h && A.length < t && L.length > 0 && /* @__PURE__ */ e(
|
|
2027
|
+
Gc,
|
|
2028
|
+
{
|
|
2029
|
+
searches: L,
|
|
2030
|
+
onSelect: (d) => {
|
|
2031
|
+
I(d), N(d);
|
|
2032
|
+
},
|
|
2033
|
+
onClear: () => {
|
|
2034
|
+
W([]), localStorage.removeItem("nice_recent_searches");
|
|
2035
|
+
},
|
|
2036
|
+
label: k.recent,
|
|
2037
|
+
clearLabel: k.clearRecent
|
|
2038
|
+
}
|
|
2039
|
+
),
|
|
2040
|
+
u && /* @__PURE__ */ c("div", { className: "nice-search-shortcuts", children: [
|
|
2041
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2042
|
+
/* @__PURE__ */ e("kbd", { children: "↑" }),
|
|
2043
|
+
/* @__PURE__ */ e("kbd", { children: "↓" }),
|
|
2044
|
+
" Navigate"
|
|
2045
|
+
] }),
|
|
2046
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2047
|
+
/* @__PURE__ */ e("kbd", { children: "↵" }),
|
|
2048
|
+
" Select"
|
|
2049
|
+
] }),
|
|
2050
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2051
|
+
/* @__PURE__ */ e("kbd", { children: "Esc" }),
|
|
2052
|
+
" Close"
|
|
2053
|
+
] })
|
|
2054
|
+
] })
|
|
2055
|
+
] });
|
|
2056
|
+
return M === "modal" ? /* @__PURE__ */ e(
|
|
2057
|
+
"div",
|
|
2058
|
+
{
|
|
2059
|
+
className: "nice-search-overlay",
|
|
2060
|
+
onClick: () => {
|
|
2061
|
+
P(!1), y == null || y();
|
|
2062
|
+
},
|
|
2063
|
+
children: /* @__PURE__ */ e(
|
|
2064
|
+
"div",
|
|
2065
|
+
{
|
|
2066
|
+
className: `nice-global-search nice-global-search--modal ${U}`,
|
|
2067
|
+
style: B,
|
|
2068
|
+
onClick: (d) => d.stopPropagation(),
|
|
2069
|
+
role: "dialog",
|
|
2070
|
+
"aria-modal": "true",
|
|
2071
|
+
children: o
|
|
2072
|
+
}
|
|
2073
|
+
)
|
|
2074
|
+
}
|
|
2075
|
+
) : /* @__PURE__ */ e(
|
|
2076
|
+
"div",
|
|
2077
|
+
{
|
|
2078
|
+
className: `nice-global-search nice-global-search--${M} ${U}`,
|
|
2079
|
+
style: B,
|
|
2080
|
+
children: o
|
|
2081
|
+
}
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
);
|
|
2085
|
+
Wc.displayName = "NiceGlobalSearch";
|
|
2086
|
+
const le = {
|
|
2087
|
+
title: "Access Log",
|
|
2088
|
+
filters: "Filters",
|
|
2089
|
+
search: "Search users, IPs...",
|
|
2090
|
+
export: "Export",
|
|
2091
|
+
refresh: "Refresh",
|
|
2092
|
+
details: "Details",
|
|
2093
|
+
stats: "Statistics",
|
|
2094
|
+
map: "Geographic Distribution",
|
|
2095
|
+
timeline: "Timeline",
|
|
2096
|
+
showMore: "Show More",
|
|
2097
|
+
noResults: "No access logs found",
|
|
2098
|
+
eventTypes: {
|
|
2099
|
+
login_success: "Login Success",
|
|
2100
|
+
login_failed: "Login Failed",
|
|
2101
|
+
logout: "Logout",
|
|
2102
|
+
password_change: "Password Change",
|
|
2103
|
+
password_reset: "Password Reset",
|
|
2104
|
+
mfa_enabled: "MFA Enabled",
|
|
2105
|
+
mfa_disabled: "MFA Disabled",
|
|
2106
|
+
mfa_challenged: "MFA Challenge",
|
|
2107
|
+
permission_change: "Permission Change",
|
|
2108
|
+
session_expired: "Session Expired",
|
|
2109
|
+
account_locked: "Account Locked",
|
|
2110
|
+
account_unlocked: "Account Unlocked",
|
|
2111
|
+
api_key_created: "API Key Created",
|
|
2112
|
+
api_key_revoked: "API Key Revoked",
|
|
2113
|
+
token_refresh: "Token Refresh",
|
|
2114
|
+
suspicious_activity: "Suspicious Activity"
|
|
2115
|
+
},
|
|
2116
|
+
riskLevels: {
|
|
2117
|
+
low: "Low",
|
|
2118
|
+
medium: "Medium",
|
|
2119
|
+
high: "High",
|
|
2120
|
+
critical: "Critical"
|
|
2121
|
+
},
|
|
2122
|
+
deviceTypes: {
|
|
2123
|
+
desktop: "Desktop",
|
|
2124
|
+
mobile: "Mobile",
|
|
2125
|
+
tablet: "Tablet",
|
|
2126
|
+
unknown: "Unknown"
|
|
2127
|
+
},
|
|
2128
|
+
columns: {
|
|
2129
|
+
timestamp: "Time",
|
|
2130
|
+
user: "User",
|
|
2131
|
+
event: "Event",
|
|
2132
|
+
ip: "IP Address",
|
|
2133
|
+
location: "Location",
|
|
2134
|
+
device: "Device",
|
|
2135
|
+
risk: "Risk",
|
|
2136
|
+
status: "Status"
|
|
2137
|
+
}
|
|
2138
|
+
}, ve = {
|
|
2139
|
+
login_success: /* @__PURE__ */ e(ie, { size: 16 }),
|
|
2140
|
+
login_failed: /* @__PURE__ */ e(oe, { size: 16 }),
|
|
2141
|
+
logout: /* @__PURE__ */ e(Re, { size: 16 }),
|
|
2142
|
+
password_change: /* @__PURE__ */ e(be, { size: 16 }),
|
|
2143
|
+
password_reset: /* @__PURE__ */ e(Ne, { size: 16 }),
|
|
2144
|
+
mfa_enabled: /* @__PURE__ */ e(qe, { size: 16 }),
|
|
2145
|
+
mfa_disabled: /* @__PURE__ */ e(Me, { size: 16 }),
|
|
2146
|
+
mfa_challenged: /* @__PURE__ */ e(fe, { size: 16 }),
|
|
2147
|
+
permission_change: /* @__PURE__ */ e(Ye, { size: 16 }),
|
|
2148
|
+
session_expired: /* @__PURE__ */ e(xe, { size: 16 }),
|
|
2149
|
+
account_locked: /* @__PURE__ */ e(Ee, { size: 16 }),
|
|
2150
|
+
account_unlocked: /* @__PURE__ */ e(mc, { size: 16 }),
|
|
2151
|
+
api_key_created: /* @__PURE__ */ e(be, { size: 16 }),
|
|
2152
|
+
api_key_revoked: /* @__PURE__ */ e(oe, { size: 16 }),
|
|
2153
|
+
token_refresh: /* @__PURE__ */ e(Ne, { size: 16 }),
|
|
2154
|
+
suspicious_activity: /* @__PURE__ */ e(je, { size: 16 })
|
|
2155
|
+
}, re = {
|
|
2156
|
+
low: "var(--color-success, #22c55e)",
|
|
2157
|
+
medium: "var(--color-warning, #f59e0b)",
|
|
2158
|
+
high: "var(--color-error, #ef4444)",
|
|
2159
|
+
critical: "var(--color-accent-hover, #7c3aed)"
|
|
2160
|
+
}, _e = {
|
|
2161
|
+
desktop: /* @__PURE__ */ e(gc, { size: 16 }),
|
|
2162
|
+
mobile: /* @__PURE__ */ e(fe, { size: 16 }),
|
|
2163
|
+
tablet: /* @__PURE__ */ e(fe, { size: 16 }),
|
|
2164
|
+
unknown: /* @__PURE__ */ e(Ue, { size: 16 })
|
|
2165
|
+
}, Le = (a) => (typeof a == "string" ? new Date(a) : a).toLocaleString("en-US", {
|
|
2166
|
+
month: "short",
|
|
2167
|
+
day: "numeric",
|
|
2168
|
+
hour: "2-digit",
|
|
2169
|
+
minute: "2-digit",
|
|
2170
|
+
second: "2-digit"
|
|
2171
|
+
}), Ae = (a) => {
|
|
2172
|
+
if (!a)
|
|
2173
|
+
return "Unknown";
|
|
2174
|
+
const s = [];
|
|
2175
|
+
return a.city && s.push(a.city), a.country && s.push(a.country), s.length > 0 ? s.join(", ") : "Unknown";
|
|
2176
|
+
}, Xc = (a) => {
|
|
2177
|
+
if (!a)
|
|
2178
|
+
return "Unknown";
|
|
2179
|
+
const s = [];
|
|
2180
|
+
return a.browser && s.push(a.browser), a.os && s.push(a.os), s.length > 0 ? s.join(" / ") : a.type;
|
|
2181
|
+
}, Ie = (a) => a >= 80 ? re.critical : a >= 60 ? re.high : a >= 40 ? re.medium : re.low, Zc = (a, s) => {
|
|
2182
|
+
var t, i, n, l, h;
|
|
2183
|
+
if (s.startDate) {
|
|
2184
|
+
const r = typeof s.startDate == "string" ? new Date(s.startDate) : s.startDate;
|
|
2185
|
+
if ((typeof a.timestamp == "string" ? new Date(a.timestamp) : a.timestamp) < r)
|
|
2186
|
+
return !1;
|
|
2187
|
+
}
|
|
2188
|
+
if (s.endDate) {
|
|
2189
|
+
const r = typeof s.endDate == "string" ? new Date(s.endDate) : s.endDate;
|
|
2190
|
+
if ((typeof a.timestamp == "string" ? new Date(a.timestamp) : a.timestamp) > r)
|
|
2191
|
+
return !1;
|
|
2192
|
+
}
|
|
2193
|
+
if ((t = s.eventTypes) != null && t.length && !s.eventTypes.includes(a.eventType) || (i = s.riskLevels) != null && i.length && !s.riskLevels.includes(a.riskLevel) || s.userId && a.userId !== s.userId || s.ipAddress && !a.ipAddress.includes(s.ipAddress) || s.country && ((n = a.location) == null ? void 0 : n.country) !== s.country || s.successOnly && !a.success || s.failedOnly && a.success)
|
|
2194
|
+
return !1;
|
|
2195
|
+
if (s.searchQuery) {
|
|
2196
|
+
const r = s.searchQuery.toLowerCase();
|
|
2197
|
+
if (![
|
|
2198
|
+
a.userName,
|
|
2199
|
+
a.userEmail,
|
|
2200
|
+
a.userId,
|
|
2201
|
+
a.ipAddress,
|
|
2202
|
+
(l = a.location) == null ? void 0 : l.city,
|
|
2203
|
+
(h = a.location) == null ? void 0 : h.country
|
|
2204
|
+
].filter(Boolean).join(" ").toLowerCase().includes(r))
|
|
2205
|
+
return !1;
|
|
2206
|
+
}
|
|
2207
|
+
return !0;
|
|
2208
|
+
}, Qc = te(
|
|
2209
|
+
function(s, t) {
|
|
2210
|
+
var H, X;
|
|
2211
|
+
const {
|
|
2212
|
+
entries: i,
|
|
2213
|
+
filter: n = {},
|
|
2214
|
+
stats: l,
|
|
2215
|
+
realtime: h = !1,
|
|
2216
|
+
pollingInterval: r = 3e4,
|
|
2217
|
+
showMap: u = !1,
|
|
2218
|
+
showStats: T = !0,
|
|
2219
|
+
showDetails: E = !0,
|
|
2220
|
+
pageSize: S = 50,
|
|
2221
|
+
labels: y,
|
|
2222
|
+
loading: J = !1,
|
|
2223
|
+
onFilterChange: _,
|
|
2224
|
+
onExport: K,
|
|
2225
|
+
onEntrySelect: O,
|
|
2226
|
+
onBlockIP: M,
|
|
2227
|
+
onRefresh: j,
|
|
2228
|
+
className: U = "",
|
|
2229
|
+
...B
|
|
2230
|
+
} = s, m = ye(null);
|
|
2231
|
+
bc();
|
|
2232
|
+
const k = he(
|
|
2233
|
+
() => ({
|
|
2234
|
+
...le,
|
|
2235
|
+
...y,
|
|
2236
|
+
eventTypes: { ...le.eventTypes, ...y == null ? void 0 : y.eventTypes },
|
|
2237
|
+
riskLevels: { ...le.riskLevels, ...y == null ? void 0 : y.riskLevels },
|
|
2238
|
+
deviceTypes: { ...le.deviceTypes, ...y == null ? void 0 : y.deviceTypes },
|
|
2239
|
+
columns: { ...le.columns, ...y == null ? void 0 : y.columns }
|
|
2240
|
+
}),
|
|
2241
|
+
[y]
|
|
2242
|
+
), [g, Y] = w(n), [p, P] = w(null), [A, I] = w(S), [C, q] = w(!1), [v, x] = w("table"), z = he(() => i.filter((o) => Zc(o, g)), [i, g]), G = he(() => z.slice(0, A), [z, A]), V = he(() => {
|
|
2243
|
+
if (l)
|
|
2244
|
+
return l;
|
|
2245
|
+
const o = new Set(i.map((f) => f.ipAddress)), d = new Set(i.map((f) => {
|
|
2246
|
+
var Z;
|
|
2247
|
+
return (Z = f.location) == null ? void 0 : Z.country;
|
|
2248
|
+
}).filter(Boolean));
|
|
2249
|
+
return {
|
|
2250
|
+
totalEvents: i.length,
|
|
2251
|
+
successfulLogins: i.filter((f) => f.eventType === "login_success").length,
|
|
2252
|
+
failedLogins: i.filter((f) => f.eventType === "login_failed").length,
|
|
2253
|
+
uniqueIPs: o.size,
|
|
2254
|
+
uniqueCountries: d.size,
|
|
2255
|
+
highRiskEvents: i.filter((f) => f.riskLevel === "high" || f.riskLevel === "critical").length,
|
|
2256
|
+
suspiciousActivities: i.filter((f) => f.eventType === "suspicious_activity").length
|
|
2257
|
+
};
|
|
2258
|
+
}, [i, l]), b = $(
|
|
2259
|
+
(o) => {
|
|
2260
|
+
const d = { ...g, ...o };
|
|
2261
|
+
Y(d), I(S), _ == null || _(d);
|
|
2262
|
+
},
|
|
2263
|
+
[g, _, S]
|
|
2264
|
+
), L = $(() => {
|
|
2265
|
+
Y({}), I(S), _ == null || _({});
|
|
2266
|
+
}, [_, S]), W = $(
|
|
2267
|
+
(o) => {
|
|
2268
|
+
P(o), O == null || O(o);
|
|
2269
|
+
},
|
|
2270
|
+
[O]
|
|
2271
|
+
), F = $(
|
|
2272
|
+
(o) => {
|
|
2273
|
+
K == null || K(o);
|
|
2274
|
+
},
|
|
2275
|
+
[K]
|
|
2276
|
+
), Q = $(() => {
|
|
2277
|
+
j == null || j();
|
|
2278
|
+
}, [j]), N = $(() => {
|
|
2279
|
+
I((o) => o + S);
|
|
2280
|
+
}, [S]);
|
|
2281
|
+
ne(
|
|
2282
|
+
t,
|
|
2283
|
+
() => ({
|
|
2284
|
+
getFilter: () => g,
|
|
2285
|
+
applyFilter: b,
|
|
2286
|
+
clearFilters: L,
|
|
2287
|
+
export: F,
|
|
2288
|
+
refresh: Q,
|
|
2289
|
+
getSelectedEntry: () => p,
|
|
2290
|
+
getElement: () => m.current
|
|
2291
|
+
}),
|
|
2292
|
+
[g, b, L, F, Q, p]
|
|
2293
|
+
);
|
|
2294
|
+
const D = (o) => {
|
|
2295
|
+
var d, f;
|
|
2296
|
+
return /* @__PURE__ */ c(
|
|
2297
|
+
"tr",
|
|
2298
|
+
{
|
|
2299
|
+
className: `nice-accesslog-row ${(p == null ? void 0 : p.id) === o.id ? "nice-accesslog-row--selected" : ""} ${o.success ? "" : "nice-accesslog-row--failed"}`,
|
|
2300
|
+
onClick: () => W(o),
|
|
2301
|
+
children: [
|
|
2302
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--timestamp", children: Le(o.timestamp) }),
|
|
2303
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--user", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-user", children: [
|
|
2304
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-username", children: o.userName || o.userId }),
|
|
2305
|
+
o.userEmail && /* @__PURE__ */ e("span", { className: "nice-accesslog-email", children: o.userEmail })
|
|
2306
|
+
] }) }),
|
|
2307
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--event", children: /* @__PURE__ */ c("span", { className: `nice-accesslog-event nice-accesslog-event--${o.eventType}`, children: [
|
|
2308
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-event-icon", children: ve[o.eventType] }),
|
|
2309
|
+
k.eventTypes[o.eventType]
|
|
2310
|
+
] }) }),
|
|
2311
|
+
/* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--ip", children: [
|
|
2312
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-ip", children: o.ipAddress }),
|
|
2313
|
+
M && /* @__PURE__ */ e(
|
|
2314
|
+
"button",
|
|
2315
|
+
{
|
|
2316
|
+
type: "button",
|
|
2317
|
+
className: "nice-accesslog-block-btn",
|
|
2318
|
+
onClick: (Z) => {
|
|
2319
|
+
Z.stopPropagation(), M(o.ipAddress);
|
|
2320
|
+
},
|
|
2321
|
+
title: "Block IP",
|
|
2322
|
+
children: /* @__PURE__ */ e(uc, { size: 14 })
|
|
2323
|
+
}
|
|
2324
|
+
)
|
|
2325
|
+
] }),
|
|
2326
|
+
/* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--location", children: [
|
|
2327
|
+
((d = o.location) == null ? void 0 : d.countryCode) && /* @__PURE__ */ e("span", { className: "nice-accesslog-flag", children: /* @__PURE__ */ e(pc, { size: 14 }) }),
|
|
2328
|
+
Ae(o.location)
|
|
2329
|
+
] }),
|
|
2330
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--device", children: /* @__PURE__ */ c("span", { className: "nice-accesslog-device", children: [
|
|
2331
|
+
_e[((f = o.device) == null ? void 0 : f.type) || "unknown"],
|
|
2332
|
+
Xc(o.device)
|
|
2333
|
+
] }) }),
|
|
2334
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--risk", children: /* @__PURE__ */ c(
|
|
2335
|
+
"span",
|
|
2336
|
+
{
|
|
2337
|
+
className: `nice-accesslog-risk nice-accesslog-risk--${o.riskLevel}`,
|
|
2338
|
+
style: { "--risk-color": Ie(o.riskScore) },
|
|
2339
|
+
children: [
|
|
2340
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-risk-score", children: o.riskScore }),
|
|
2341
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-risk-label", children: k.riskLevels[o.riskLevel] })
|
|
2342
|
+
]
|
|
2343
|
+
}
|
|
2344
|
+
) }),
|
|
2345
|
+
/* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--status", children: /* @__PURE__ */ e(
|
|
2346
|
+
"span",
|
|
2347
|
+
{
|
|
2348
|
+
className: `nice-accesslog-status ${o.success ? "nice-accesslog-status--success" : "nice-accesslog-status--failed"}`,
|
|
2349
|
+
children: o.success ? /* @__PURE__ */ e(ie, { size: 14 }) : /* @__PURE__ */ e(oe, { size: 14 })
|
|
2350
|
+
}
|
|
2351
|
+
) })
|
|
2352
|
+
]
|
|
2353
|
+
},
|
|
2354
|
+
o.id
|
|
2355
|
+
);
|
|
2356
|
+
}, R = (o) => /* @__PURE__ */ c(
|
|
2357
|
+
"div",
|
|
2358
|
+
{
|
|
2359
|
+
className: `nice-accesslog-timeline-item nice-accesslog-timeline-item--${o.riskLevel}`,
|
|
2360
|
+
onClick: () => W(o),
|
|
2361
|
+
children: [
|
|
2362
|
+
/* @__PURE__ */ e(
|
|
2363
|
+
"div",
|
|
2364
|
+
{
|
|
2365
|
+
className: "nice-accesslog-timeline-marker",
|
|
2366
|
+
style: { background: re[o.riskLevel] }
|
|
2367
|
+
}
|
|
2368
|
+
),
|
|
2369
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-content", children: [
|
|
2370
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-header", children: [
|
|
2371
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-timeline-event", children: [
|
|
2372
|
+
ve[o.eventType],
|
|
2373
|
+
" ",
|
|
2374
|
+
k.eventTypes[o.eventType]
|
|
2375
|
+
] }),
|
|
2376
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-timeline-time", children: Le(o.timestamp) })
|
|
2377
|
+
] }),
|
|
2378
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-details", children: [
|
|
2379
|
+
/* @__PURE__ */ e("span", { children: o.userName || o.userId }),
|
|
2380
|
+
/* @__PURE__ */ e("span", { children: "•" }),
|
|
2381
|
+
/* @__PURE__ */ e("span", { children: o.ipAddress }),
|
|
2382
|
+
/* @__PURE__ */ e("span", { children: "•" }),
|
|
2383
|
+
/* @__PURE__ */ e("span", { children: Ae(o.location) })
|
|
2384
|
+
] }),
|
|
2385
|
+
o.flags && o.flags.length > 0 && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline-flags", children: o.flags.map((d, f) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: d }, f)) })
|
|
2386
|
+
] })
|
|
2387
|
+
]
|
|
2388
|
+
},
|
|
2389
|
+
o.id
|
|
2390
|
+
);
|
|
2391
|
+
return /* @__PURE__ */ c("div", { ref: m, className: `nice-accesslog ${U}`, ...B, children: [
|
|
2392
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-header", children: [
|
|
2393
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-header-left", children: [
|
|
2394
|
+
/* @__PURE__ */ e("h2", { className: "nice-accesslog-title", children: k.title }),
|
|
2395
|
+
h && /* @__PURE__ */ c("span", { className: "nice-accesslog-realtime-badge", children: [
|
|
2396
|
+
/* @__PURE__ */ e(Ce, { size: 10 }),
|
|
2397
|
+
" Live"
|
|
2398
|
+
] })
|
|
2399
|
+
] }),
|
|
2400
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-header-actions", children: [
|
|
2401
|
+
/* @__PURE__ */ c(
|
|
2402
|
+
"button",
|
|
2403
|
+
{
|
|
2404
|
+
type: "button",
|
|
2405
|
+
className: "nice-accesslog-btn",
|
|
2406
|
+
onClick: Q,
|
|
2407
|
+
disabled: J,
|
|
2408
|
+
children: [
|
|
2409
|
+
/* @__PURE__ */ e(Ne, { size: 16 }),
|
|
2410
|
+
" ",
|
|
2411
|
+
k.refresh
|
|
2412
|
+
]
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2415
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-export-dropdown", children: [
|
|
2416
|
+
/* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-btn", children: [
|
|
2417
|
+
/* @__PURE__ */ e(me, { size: 16 }),
|
|
2418
|
+
" ",
|
|
2419
|
+
k.export
|
|
2420
|
+
] }),
|
|
2421
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-export-menu", children: [
|
|
2422
|
+
/* @__PURE__ */ e("button", { onClick: () => F("csv"), children: "CSV" }),
|
|
2423
|
+
/* @__PURE__ */ e("button", { onClick: () => F("json"), children: "JSON" }),
|
|
2424
|
+
/* @__PURE__ */ e("button", { onClick: () => F("pdf"), children: "PDF" })
|
|
2425
|
+
] })
|
|
2426
|
+
] })
|
|
2427
|
+
] })
|
|
2428
|
+
] }),
|
|
2429
|
+
T && /* @__PURE__ */ c("div", { className: "nice-accesslog-stats", children: [
|
|
2430
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
|
|
2431
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.totalEvents }),
|
|
2432
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Total Events" })
|
|
2433
|
+
] }),
|
|
2434
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--success", children: [
|
|
2435
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.successfulLogins }),
|
|
2436
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Successful" })
|
|
2437
|
+
] }),
|
|
2438
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--failed", children: [
|
|
2439
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.failedLogins }),
|
|
2440
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Failed" })
|
|
2441
|
+
] }),
|
|
2442
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
|
|
2443
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueIPs }),
|
|
2444
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Unique IPs" })
|
|
2445
|
+
] }),
|
|
2446
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
|
|
2447
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueCountries }),
|
|
2448
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Countries" })
|
|
2449
|
+
] }),
|
|
2450
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--warning", children: [
|
|
2451
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.highRiskEvents }),
|
|
2452
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "High Risk" })
|
|
2453
|
+
] })
|
|
2454
|
+
] }),
|
|
2455
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filters", children: [
|
|
2456
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filters-row", children: [
|
|
2457
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-search", children: [
|
|
2458
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
|
|
2459
|
+
/* @__PURE__ */ e(
|
|
2460
|
+
"input",
|
|
2461
|
+
{
|
|
2462
|
+
type: "text",
|
|
2463
|
+
placeholder: k.search,
|
|
2464
|
+
value: g.searchQuery || "",
|
|
2465
|
+
onChange: (o) => b({ searchQuery: o.target.value })
|
|
2466
|
+
}
|
|
2467
|
+
)
|
|
2468
|
+
] }),
|
|
2469
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filter-quick", children: [
|
|
2470
|
+
/* @__PURE__ */ e(
|
|
2471
|
+
"button",
|
|
2472
|
+
{
|
|
2473
|
+
type: "button",
|
|
2474
|
+
className: `nice-accesslog-filter-chip ${g.failedOnly ? "nice-accesslog-filter-chip--active" : ""}`,
|
|
2475
|
+
onClick: () => b({ failedOnly: !g.failedOnly, successOnly: !1 }),
|
|
2476
|
+
children: "Failed Only"
|
|
2477
|
+
}
|
|
2478
|
+
),
|
|
2479
|
+
/* @__PURE__ */ e(
|
|
2480
|
+
"button",
|
|
2481
|
+
{
|
|
2482
|
+
type: "button",
|
|
2483
|
+
className: `nice-accesslog-filter-chip ${(H = g.riskLevels) != null && H.includes("high") || (X = g.riskLevels) != null && X.includes("critical") ? "nice-accesslog-filter-chip--active" : ""}`,
|
|
2484
|
+
onClick: () => {
|
|
2485
|
+
var o;
|
|
2486
|
+
return b({
|
|
2487
|
+
riskLevels: (o = g.riskLevels) != null && o.includes("high") ? [] : ["high", "critical"]
|
|
2488
|
+
});
|
|
2489
|
+
},
|
|
2490
|
+
children: "High Risk"
|
|
2491
|
+
}
|
|
2492
|
+
),
|
|
2493
|
+
/* @__PURE__ */ e(
|
|
2494
|
+
"button",
|
|
2495
|
+
{
|
|
2496
|
+
type: "button",
|
|
2497
|
+
className: "nice-accesslog-filter-toggle",
|
|
2498
|
+
onClick: () => q(!C),
|
|
2499
|
+
children: C ? /* @__PURE__ */ c(ee, { children: [
|
|
2500
|
+
/* @__PURE__ */ e(oc, { size: 14 }),
|
|
2501
|
+
" Less"
|
|
2502
|
+
] }) : /* @__PURE__ */ c(ee, { children: [
|
|
2503
|
+
/* @__PURE__ */ e(Se, { size: 14 }),
|
|
2504
|
+
" More"
|
|
2505
|
+
] })
|
|
2506
|
+
}
|
|
2507
|
+
)
|
|
2508
|
+
] })
|
|
2509
|
+
] }),
|
|
2510
|
+
C && /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-expanded", children: [
|
|
2511
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
|
|
2512
|
+
/* @__PURE__ */ e("label", { children: "Event Type" }),
|
|
2513
|
+
/* @__PURE__ */ e(
|
|
2514
|
+
"select",
|
|
2515
|
+
{
|
|
2516
|
+
multiple: !0,
|
|
2517
|
+
value: g.eventTypes || [],
|
|
2518
|
+
onChange: (o) => {
|
|
2519
|
+
const d = Array.from(
|
|
2520
|
+
o.target.selectedOptions,
|
|
2521
|
+
(f) => f.value
|
|
2522
|
+
);
|
|
2523
|
+
b({ eventTypes: d.length ? d : void 0 });
|
|
2524
|
+
},
|
|
2525
|
+
children: Object.entries(k.eventTypes).map(([o, d]) => /* @__PURE__ */ e("option", { value: o, children: d }, o))
|
|
2526
|
+
}
|
|
2527
|
+
)
|
|
2528
|
+
] }),
|
|
2529
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
|
|
2530
|
+
/* @__PURE__ */ e("label", { children: "Date Range" }),
|
|
2531
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-date-range", children: [
|
|
2532
|
+
/* @__PURE__ */ e(
|
|
2533
|
+
"input",
|
|
2534
|
+
{
|
|
2535
|
+
type: "date",
|
|
2536
|
+
value: g.startDate ? new Date(g.startDate).toISOString().split("T")[0] : "",
|
|
2537
|
+
onChange: (o) => b({ startDate: o.target.value || void 0 })
|
|
2538
|
+
}
|
|
2539
|
+
),
|
|
2540
|
+
/* @__PURE__ */ e("span", { children: "to" }),
|
|
2541
|
+
/* @__PURE__ */ e(
|
|
2542
|
+
"input",
|
|
2543
|
+
{
|
|
2544
|
+
type: "date",
|
|
2545
|
+
value: g.endDate ? new Date(g.endDate).toISOString().split("T")[0] : "",
|
|
2546
|
+
onChange: (o) => b({ endDate: o.target.value || void 0 })
|
|
2547
|
+
}
|
|
2548
|
+
)
|
|
2549
|
+
] })
|
|
2550
|
+
] }),
|
|
2551
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
|
|
2552
|
+
/* @__PURE__ */ e("label", { children: "IP Address" }),
|
|
2553
|
+
/* @__PURE__ */ e(
|
|
2554
|
+
"input",
|
|
2555
|
+
{
|
|
2556
|
+
type: "text",
|
|
2557
|
+
placeholder: "e.g., 192.168",
|
|
2558
|
+
value: g.ipAddress || "",
|
|
2559
|
+
onChange: (o) => b({ ipAddress: o.target.value || void 0 })
|
|
2560
|
+
}
|
|
2561
|
+
)
|
|
2562
|
+
] }),
|
|
2563
|
+
/* @__PURE__ */ e("button", { type: "button", className: "nice-accesslog-clear-filters", onClick: L, children: "Clear All Filters" })
|
|
2564
|
+
] })
|
|
2565
|
+
] }),
|
|
2566
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-tabs", children: [
|
|
2567
|
+
/* @__PURE__ */ c(
|
|
2568
|
+
"button",
|
|
2569
|
+
{
|
|
2570
|
+
type: "button",
|
|
2571
|
+
className: `nice-accesslog-tab ${v === "table" ? "nice-accesslog-tab--active" : ""}`,
|
|
2572
|
+
onClick: () => x("table"),
|
|
2573
|
+
children: [
|
|
2574
|
+
/* @__PURE__ */ e(dc, { size: 16 }),
|
|
2575
|
+
" Table"
|
|
2576
|
+
]
|
|
2577
|
+
}
|
|
2578
|
+
),
|
|
2579
|
+
/* @__PURE__ */ c(
|
|
2580
|
+
"button",
|
|
2581
|
+
{
|
|
2582
|
+
type: "button",
|
|
2583
|
+
className: `nice-accesslog-tab ${v === "timeline" ? "nice-accesslog-tab--active" : ""}`,
|
|
2584
|
+
onClick: () => x("timeline"),
|
|
2585
|
+
children: [
|
|
2586
|
+
/* @__PURE__ */ e(hc, { size: 16 }),
|
|
2587
|
+
" ",
|
|
2588
|
+
k.timeline
|
|
2589
|
+
]
|
|
2590
|
+
}
|
|
2591
|
+
),
|
|
2592
|
+
u && /* @__PURE__ */ c(
|
|
2593
|
+
"button",
|
|
2594
|
+
{
|
|
2595
|
+
type: "button",
|
|
2596
|
+
className: `nice-accesslog-tab ${v === "map" ? "nice-accesslog-tab--active" : ""}`,
|
|
2597
|
+
onClick: () => x("map"),
|
|
2598
|
+
children: [
|
|
2599
|
+
/* @__PURE__ */ e(Te, { size: 16 }),
|
|
2600
|
+
" ",
|
|
2601
|
+
k.map
|
|
2602
|
+
]
|
|
2603
|
+
}
|
|
2604
|
+
),
|
|
2605
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-count", children: [
|
|
2606
|
+
z.length,
|
|
2607
|
+
" entries"
|
|
2608
|
+
] })
|
|
2609
|
+
] }),
|
|
2610
|
+
/* @__PURE__ */ e("div", { className: "nice-accesslog-content", children: J ? /* @__PURE__ */ c("div", { className: "nice-accesslog-loading", children: [
|
|
2611
|
+
/* @__PURE__ */ e("div", { className: "nice-accesslog-spinner" }),
|
|
2612
|
+
"Loading access logs..."
|
|
2613
|
+
] }) : z.length === 0 ? /* @__PURE__ */ c("div", { className: "nice-accesslog-empty", children: [
|
|
2614
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-empty-icon", children: /* @__PURE__ */ e(qe, { size: 32 }) }),
|
|
2615
|
+
/* @__PURE__ */ e("span", { children: k.noResults })
|
|
2616
|
+
] }) : /* @__PURE__ */ c(ee, { children: [
|
|
2617
|
+
v === "table" && /* @__PURE__ */ e("div", { className: "nice-accesslog-table-wrapper", children: /* @__PURE__ */ c("table", { className: "nice-accesslog-table", children: [
|
|
2618
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
2619
|
+
/* @__PURE__ */ e("th", { children: k.columns.timestamp }),
|
|
2620
|
+
/* @__PURE__ */ e("th", { children: k.columns.user }),
|
|
2621
|
+
/* @__PURE__ */ e("th", { children: k.columns.event }),
|
|
2622
|
+
/* @__PURE__ */ e("th", { children: k.columns.ip }),
|
|
2623
|
+
/* @__PURE__ */ e("th", { children: k.columns.location }),
|
|
2624
|
+
/* @__PURE__ */ e("th", { children: k.columns.device }),
|
|
2625
|
+
/* @__PURE__ */ e("th", { children: k.columns.risk }),
|
|
2626
|
+
/* @__PURE__ */ e("th", { children: k.columns.status })
|
|
2627
|
+
] }) }),
|
|
2628
|
+
/* @__PURE__ */ e("tbody", { children: G.map(D) })
|
|
2629
|
+
] }) }),
|
|
2630
|
+
v === "timeline" && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline", children: G.map(R) }),
|
|
2631
|
+
v === "map" && /* @__PURE__ */ e("div", { className: "nice-accesslog-map", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-map-placeholder", children: [
|
|
2632
|
+
/* @__PURE__ */ e(Te, { size: 16 }),
|
|
2633
|
+
" Geographic visualization would render here"
|
|
2634
|
+
] }) }),
|
|
2635
|
+
A < z.length && /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-show-more", onClick: N, children: [
|
|
2636
|
+
k.showMore,
|
|
2637
|
+
" (",
|
|
2638
|
+
z.length - A,
|
|
2639
|
+
" remaining)"
|
|
2640
|
+
] })
|
|
2641
|
+
] }) }),
|
|
2642
|
+
E && p && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail", children: [
|
|
2643
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-header", children: [
|
|
2644
|
+
/* @__PURE__ */ e("h3", { children: k.details }),
|
|
2645
|
+
/* @__PURE__ */ e(
|
|
2646
|
+
"button",
|
|
2647
|
+
{
|
|
2648
|
+
type: "button",
|
|
2649
|
+
className: "nice-accesslog-detail-close",
|
|
2650
|
+
onClick: () => P(null),
|
|
2651
|
+
children: /* @__PURE__ */ e(ge, { size: 16 })
|
|
2652
|
+
}
|
|
2653
|
+
)
|
|
2654
|
+
] }),
|
|
2655
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-content", children: [
|
|
2656
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2657
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event ID" }),
|
|
2658
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.id })
|
|
2659
|
+
] }),
|
|
2660
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2661
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Timestamp" }),
|
|
2662
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: new Date(p.timestamp).toISOString() })
|
|
2663
|
+
] }),
|
|
2664
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2665
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "User" }),
|
|
2666
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
|
|
2667
|
+
p.userName,
|
|
2668
|
+
" (",
|
|
2669
|
+
p.userId,
|
|
2670
|
+
")",
|
|
2671
|
+
p.userEmail && /* @__PURE__ */ e("div", { children: p.userEmail })
|
|
2672
|
+
] })
|
|
2673
|
+
] }),
|
|
2674
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2675
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event Type" }),
|
|
2676
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
|
|
2677
|
+
ve[p.eventType],
|
|
2678
|
+
" ",
|
|
2679
|
+
k.eventTypes[p.eventType]
|
|
2680
|
+
] })
|
|
2681
|
+
] }),
|
|
2682
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2683
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "IP Address" }),
|
|
2684
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.ipAddress })
|
|
2685
|
+
] }),
|
|
2686
|
+
p.location && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2687
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Location" }),
|
|
2688
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
|
|
2689
|
+
p.location.city,
|
|
2690
|
+
", ",
|
|
2691
|
+
p.location.region,
|
|
2692
|
+
",",
|
|
2693
|
+
" ",
|
|
2694
|
+
p.location.country,
|
|
2695
|
+
p.location.latitude && p.location.longitude && /* @__PURE__ */ c("div", { className: "nice-accesslog-coords", children: [
|
|
2696
|
+
"(",
|
|
2697
|
+
p.location.latitude,
|
|
2698
|
+
", ",
|
|
2699
|
+
p.location.longitude,
|
|
2700
|
+
")"
|
|
2701
|
+
] })
|
|
2702
|
+
] })
|
|
2703
|
+
] }),
|
|
2704
|
+
p.device && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2705
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Device" }),
|
|
2706
|
+
/* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
|
|
2707
|
+
_e[p.device.type],
|
|
2708
|
+
" ",
|
|
2709
|
+
p.device.os,
|
|
2710
|
+
" ",
|
|
2711
|
+
p.device.osVersion,
|
|
2712
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2713
|
+
p.device.browser,
|
|
2714
|
+
" ",
|
|
2715
|
+
p.device.browserVersion
|
|
2716
|
+
] }),
|
|
2717
|
+
p.device.fingerprint && /* @__PURE__ */ c("div", { className: "nice-accesslog-fingerprint", children: [
|
|
2718
|
+
"Fingerprint: ",
|
|
2719
|
+
p.device.fingerprint
|
|
2720
|
+
] })
|
|
2721
|
+
] })
|
|
2722
|
+
] }),
|
|
2723
|
+
/* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2724
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Risk Score" }),
|
|
2725
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: /* @__PURE__ */ c("span", { style: { color: Ie(p.riskScore) }, children: [
|
|
2726
|
+
p.riskScore,
|
|
2727
|
+
"/100 (",
|
|
2728
|
+
k.riskLevels[p.riskLevel],
|
|
2729
|
+
")"
|
|
2730
|
+
] }) })
|
|
2731
|
+
] }),
|
|
2732
|
+
p.flags && p.flags.length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2733
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Flags" }),
|
|
2734
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.flags.map((o, d) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: o }, d)) })
|
|
2735
|
+
] }),
|
|
2736
|
+
p.details && Object.keys(p.details).length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
|
|
2737
|
+
/* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Additional Details" }),
|
|
2738
|
+
/* @__PURE__ */ e("pre", { className: "nice-accesslog-detail-json", children: JSON.stringify(p.details, null, 2) })
|
|
2739
|
+
] })
|
|
2740
|
+
] })
|
|
2741
|
+
] })
|
|
2742
|
+
] });
|
|
2743
|
+
}
|
|
2744
|
+
);
|
|
2745
|
+
Qc.displayName = "NiceAccessLog";
|
|
2
2746
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
N as NiceInvoiceDesigner
|
|
2747
|
+
Qc as NiceAccessLog,
|
|
2748
|
+
Ic as NiceAuditTrail,
|
|
2749
|
+
Mc as NiceContractEditor,
|
|
2750
|
+
zc as NiceDataExportCenter,
|
|
2751
|
+
Vc as NiceGDPRConsent,
|
|
2752
|
+
Wc as NiceGlobalSearch
|
|
10
2753
|
};
|