@nice2dev/admin 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +47 -53
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @nice2dev/admin — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 1.2.2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 06eb0d2: 1.2.2 — library texts through the translator, a translator in the packages that had none, and the
|
|
12
|
+
end of the hook-dependency warnings. Nothing removed or renamed. Upgrade notes:
|
|
13
|
+
`documentation/omniverk/OMNIVERK_UPGRADE_1.2.2.md`.
|
|
14
|
+
|
|
15
|
+
**Translations.** 2,825 new keys in the global dictionary (en, pl, de, fr, es, uk), 80 in the local
|
|
16
|
+
dictionaries of ui-math, ui-diagrams and ui-presentations: column headers, option labels, texts in
|
|
17
|
+
conditions and templates, messages given to setters, labels returned by helpers, Polish texts that
|
|
18
|
+
were the English default. Relative dates through `Intl.RelativeTimeFormat`, plural forms through
|
|
19
|
+
`…One` / `…Many` keys. ui-science, ui-platform, ui-mobile, auth, licensing, templates, social and
|
|
20
|
+
the icon tools translate through `useNiceTranslation` (new peer `@nice2dev/ui-core ^1.2.0`);
|
|
21
|
+
ui-security reads the global translator when its own provider is absent.
|
|
22
|
+
|
|
23
|
+
**Additions.** `labelKey` on ui-mobile `TabItem` and `SwipeAction` (the presets set it);
|
|
24
|
+
`registerWebAuthn` / `authenticateWebAuthn` take the WebAuthn options `NiceWebAuthnButton` used to
|
|
25
|
+
drop (defaults unchanged); `NiceKeyboardHint` shows `descriptionKey`. Eight icons in
|
|
26
|
+
`@nice2dev/icons` — `NtdPoint`, `NtdSegment`, `NtdPerpendicular`, `NtdParallel`, `NtdMidpoint`,
|
|
27
|
+
`NtdAngleBisector`, `NtdGroup`, `NtdUngroup` — and the same names as `NiceIcon` built-ins.
|
|
28
|
+
|
|
29
|
+
**Behaviour changes, agreed.** ui-math, ui-diagrams and ui-presentations follow the app's global
|
|
30
|
+
`NiceI18nProvider` language when their own provider is absent (they stayed English);
|
|
31
|
+
`NicePresentationEditor` without `lang` takes the surrounding language. Icons drawn as glyphs are
|
|
32
|
+
Nice icons: the `NiceGeometry` tools, Align / Group / Ungroup / Layout of the diagram toolbar, the
|
|
33
|
+
presentation grid toggle, zoom and "Add Track" of `NiceDMXTimeline`. icons-gaming and
|
|
34
|
+
icons-filetypes name an icon by its `title` and are decorative without one, like `createIcon`
|
|
35
|
+
(screen readers read "GiHeart" or "DOCX file icon"); new optional `title` on the gaming icon props.
|
|
36
|
+
|
|
37
|
+
**Hook dependencies (161 → 0).** Fixed along the way: `NiceLowPowerMode` re-rendered forever from
|
|
38
|
+
mount and overflowed the stack on wake; `GenericPlayer` / `NiceGenericPlayerStage` restarted the
|
|
39
|
+
track on a volume change; `NiceDMXTimeline` called `onPlay` on every frame and missed cues added
|
|
40
|
+
during playback; `NiceConflictResolution` `autoResolve` never resolved; `NiceMAM` selected by the
|
|
41
|
+
previous filter; `NiceRulesEngine` "Run All" kept only the last result; `NiceCodeEditor` saved with
|
|
42
|
+
the first render's `onSave`; a consumer's cursor handler switched off `NiceCodeEditorAI`
|
|
43
|
+
completion; `useRadioStream` lost a volume set before the first play; `NiceGameEditor` shortcuts,
|
|
44
|
+
`useVoiceControl` continuous sessions, `NiceDeviceTrust` with a host storing the score.
|
|
45
|
+
|
|
3
46
|
## 1.2.1
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("@nice2dev/ui"),n=require("react"),O=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{widgets:N,columns:T=4,title:v,headerActions:_,onWidgetClick:d,className:A,style:k}=g,i=v??s("adminDashboard.title","Dashboard");return e.jsxs("div",{ref:b,className:`nice-admin-dashboard ${A??""}`,style:k,children:[e.jsxs("div",{className:"nice-admin-dashboard__header",children:[e.jsx("h2",{children:i}),_&&e.jsx("div",{className:"nice-admin-dashboard__actions",children:_})]}),e.jsx("div",{className:"nice-admin-dashboard__grid",style:{gridTemplateColumns:`repeat(${T}, 1fr)`},children:N.map(h=>e.jsxs("div",{className:`nice-admin-dashboard__widget nice-admin-dashboard__widget--${h.type}`,style:{gridColumn:h.colSpan?`span ${h.colSpan}`:void 0,gridRow:h.rowSpan?`span ${h.rowSpan}`:void 0},onClick:()=>d==null?void 0:d(h),onKeyDown:d?S=>{(S.key==="Enter"||S.key===" ")&&d(h)}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,children:[e.jsxs("div",{className:"nice-admin-dashboard__widget-header",children:[h.icon&&e.jsx("span",{className:"nice-admin-dashboard__widget-icon",children:e.jsx(C.NiceIcon,{name:h.icon,size:16})}),e.jsx("span",{className:"nice-admin-dashboard__widget-title",children:h.title})]}),h.type==="stat"&&e.jsxs("div",{className:"nice-admin-dashboard__stat",children:[e.jsx("span",{className:"nice-admin-dashboard__stat-value",children:h.value}),h.change&&e.jsx("span",{className:`nice-admin-dashboard__stat-change ${h.changePositive?"nice-admin-dashboard__stat-change--positive":"nice-admin-dashboard__stat-change--negative"}`,children:h.change})]}),h.type==="custom"&&h.render&&e.jsx("div",{className:"nice-admin-dashboard__custom",children:h.render()}),(h.type==="chart"||h.type==="table"||h.type==="list")&&h.render&&e.jsx("div",{className:"nice-admin-dashboard__content",children:h.render()})]},h.id))})]})}),q={active:"success",inactive:"secondary",suspended:"danger",pending:"warning"},B=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{users:N,availableRoles:T=[],onCreate:v,onEdit:_,onDelete:d,onToggleStatus:A,onChangeRoles:k,searchable:i=!0,title:h,className:S,style:R}=g,[x,D]=n.useState(""),y=n.useMemo(()=>x?N.filter(o=>o.status===x):N,[N,x]),l=n.useMemo(()=>{const o=[{field:"name",header:s("adminUsers.user","User"),sortable:!0,render:(c,p)=>e.jsxs("span",{className:"nice-admin-users__user-cell",children:[e.jsx(C.NiceAvatar,{src:p.avatarUrl,name:p.name,size:"sm"}),e.jsx("span",{children:p.name})]})},{field:"email",header:s("adminUsers.email","Email"),sortable:!0,render:c=>e.jsx("span",{className:"nice-admin-users__email",children:String(c??"")})},{field:"roles",header:s("adminUsers.roles","Roles"),render:(c,p)=>k?e.jsx("select",{multiple:!0,value:p.roles,onChange:f=>{const w=Array.from(f.target.selectedOptions,u=>u.value);k(p.id,w)},className:"nice-admin-users__roles-select","aria-label":s("adminUsers.rolesFor","Roles for {name}").replace("{name}",p.name),children:T.map(f=>e.jsx("option",{value:f,children:f},f))}):e.jsx("span",{className:"nice-admin-users__roles",children:p.roles.map(f=>e.jsx(C.NiceTag,{size:"sm",children:f},f))})},{field:"status",header:s("adminUsers.status","Status"),sortable:!0,render:(c,p)=>{const f=e.jsx(C.NiceBadge,{variant:q[p.status],size:"sm",children:s(`adminUsers.userStatus.${p.status}`,p.status)});if(!A)return e.jsx("span",{className:"nice-admin-users__status-badge",children:f});const w=p.status==="active"?"suspended":"active";return e.jsx("button",{type:"button",className:"nice-admin-users__status-badge nice-admin-users__status-badge--toggle",onClick:()=>A(p.id,w),"aria-label":s("adminUsers.toggleStatusFor","Toggle status for {name}").replace("{name}",p.name),children:f})}},{field:"createdAt",header:s("adminUsers.created","Created"),dataType:"date",sortable:!0},{field:"lastLoginAt",header:s("adminUsers.lastLogin","Last Login"),dataType:"date",sortable:!0,render:c=>c?String(c):"—"}];return(_||d)&&o.push({field:"__actions",header:s("adminUsers.actions","Actions"),align:"right",render:(c,p)=>e.jsxs("span",{className:"nice-admin-users__actions",children:[_&&e.jsx(C.NiceButton,{size:"sm",variant:"ghost",ariaLabel:s("adminUsers.editUser","Edit {name}").replace("{name}",p.name),onClick:()=>_(p),children:e.jsx(C.NiceIcon,{name:"edit"})}),d&&e.jsx(C.NiceButton,{size:"sm",variant:"ghost",ariaLabel:s("adminUsers.deleteUser","Delete {name}").replace("{name}",p.name),onClick:()=>d(p.id),children:e.jsx(C.NiceIcon,{name:"trash"})})]})}),o},[T,k,d,_,A,s]),a=n.useMemo(()=>{if(d)return[{key:"delete",label:s("adminUsers.delete","Delete"),variant:"danger",icon:e.jsx(C.NiceIcon,{name:"trash"}),onClick:o=>o.forEach(c=>d(c))}]},[d,s]),r=e.jsxs("div",{className:"nice-admin-users__toolbar",children:[e.jsx(C.NiceSelect,{value:x,onChange:o=>D(o??""),title:s("adminUsers.filterByStatus","Filter by status"),options:[{value:"",label:s("adminUsers.allStatuses","All statuses")},{value:"active",label:s("adminUsers.userStatus.active","Active")},{value:"inactive",label:s("adminUsers.userStatus.inactive","Inactive")},{value:"suspended",label:s("adminUsers.userStatus.suspended","Suspended")},{value:"pending",label:s("adminUsers.userStatus.pending","Pending")}],size:"sm"}),v&&e.jsxs(C.NiceButton,{size:"sm",variant:"primary",onClick:v,children:[e.jsx(C.NiceIcon,{name:"plus"}),e.jsx("span",{children:s("adminUsers.addUser","Add User")})]})]});return e.jsxs("div",{ref:b,className:`nice-admin-users ${S??""}`,style:R,children:[h!=null&&e.jsxs("div",{className:"nice-admin-users__header",children:[e.jsx("h3",{children:h}),e.jsx("span",{className:"nice-admin-users__count",children:s("adminUsers.count","{count} users").replace("{count}",String(N.length))})]}),e.jsx(C.NiceDataGrid,{columns:l,data:y,keyField:"id",searchable:i,searchPlaceholder:s("adminUsers.searchUsers","Search users…"),selectable:!!d,bulkActions:a,striped:!0,toolbar:r,emptyText:s("adminUsers.noUsers","No users found.")})]})});function H(E){let g=0;for(const b of Object.values(E.permissions))g+=b.length;return g}const V=n.forwardRef(function(g,b){var m;const{t:s}=C.useNiceTranslation(),{roles:N,actions:T,resources:v,onPermissionChange:_,onCreate:d,onDelete:A,onRename:k,title:i,className:h,style:S}=g,[R,x]=n.useState(((m=N[0])==null?void 0:m.id)??null),[D,y]=n.useState(!1),[l,a]=n.useState(""),[r,o]=n.useState(""),[c,p]=n.useState(null),f=N.find(t=>t.id===R),w=n.useCallback(()=>{!l.trim()||!d||(d(l.trim(),r.trim()),a(""),o(""),y(!1))},[l,r,d]),u=(t,j,F)=>{var U;return((U=t.permissions[j])==null?void 0:U.includes(F))??!1},L=n.useMemo(()=>[{field:"name",header:s("adminRoles.role","Role"),sortable:!0,render:(t,j)=>e.jsxs("span",{className:"nice-admin-roles__name-cell",children:[j.color&&e.jsx("span",{className:"nice-admin-roles__color-dot",style:{background:j.color},"aria-hidden":"true"}),e.jsx("span",{children:j.name}),j.isSystem&&e.jsx(C.NiceIcon,{name:"lock",size:"sm",title:s("adminRoles.systemRole","System role"),className:"nice-admin-roles__system-icon"})]})},{field:"description",header:s("adminRoles.description","Description"),sortable:!0,render:(t,j)=>j.description??"—"},{field:"permissionCount",header:s("adminRoles.permissions","Permissions"),align:"right",dataType:"number",sortable:!0,render:(t,j)=>H(j)},{field:"userCount",header:s("adminRoles.users","Users"),align:"right",dataType:"number",sortable:!0,render:(t,j)=>j.userCount??0}],[s]);return e.jsxs("div",{ref:b,className:`nice-admin-roles ${h??""}`,style:S,children:[e.jsx(C.NicePromptDialog,{open:c!==null,title:s("adminRoles.newRoleName","New role name"),defaultValue:c==null?void 0:c.name,onSubmit:t=>{c&&t&&(k==null||k(c.id,t)),p(null)},onCancel:()=>p(null)}),(i||d)&&e.jsxs("div",{className:"nice-admin-roles__header",children:[i&&e.jsx("h3",{children:i}),d&&e.jsx("button",{onClick:()=>y(!D),children:s("adminRoles.newRole","+ New Role")})]}),D&&e.jsxs("div",{className:"nice-admin-roles__create-form",children:[e.jsx("input",{type:"text",value:l,onChange:t=>a(t.target.value),placeholder:s("adminRoles.roleName","Role name")}),e.jsx("input",{type:"text",value:r,onChange:t=>o(t.target.value),placeholder:s("adminRoles.description","Description")}),e.jsx("button",{onClick:w,disabled:!l.trim(),children:s("adminRoles.create","Create")}),e.jsx("button",{onClick:()=>y(!1),children:s("adminRoles.cancel","Cancel")})]}),e.jsx(C.NiceDataGrid,{className:"nice-admin-roles__grid",columns:L,data:N,keyField:"id",searchable:!0,striped:!0,size:"sm",selectable:!1,onRowClick:t=>x(t.id)}),f&&e.jsxs("div",{className:"nice-admin-roles__matrix-wrap",children:[f.description&&e.jsx("p",{className:"nice-admin-roles__description",children:f.description}),e.jsxs("table",{className:"nice-admin-roles__matrix",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("adminRoles.resource","Resource")}),T.map(t=>e.jsx("th",{title:t.description,children:t.label},t.id))]})}),e.jsx("tbody",{children:v.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:t.label}),T.map(j=>{const F=u(f,t.id,j.id);return e.jsx("td",{children:e.jsx("input",{type:"checkbox",checked:F,onChange:()=>_==null?void 0:_(f.id,t.id,j.id,!F),disabled:f.isSystem})},j.id)})]},t.id))})]}),!f.isSystem&&e.jsxs("div",{className:"nice-admin-roles__role-actions",children:[k&&e.jsx("button",{onClick:()=>p(f),children:s("adminRoles.rename","Rename")}),A&&e.jsx("button",{onClick:()=>A(f.id),children:s("adminRoles.deleteRole","Delete Role")})]})]})]})}),Y={info:{color:"var(--nice-color-info, #3b82f6)",label:"INFO",icon:"info"},warning:{color:"var(--nice-color-warning, #eab308)",label:"WARN",icon:"warning"},error:{color:"var(--nice-color-danger, #ef4444)",label:"ERROR",icon:"error"},critical:{color:"var(--nice-color-danger, #dc2626)",label:"CRIT",icon:"error"}},K=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{entries:N,onEntryClick:T,onLoadMore:v,hasMore:_=!1,searchable:d=!0,showSeverityFilter:A=!0,title:k,className:i,style:h}=g,[S,R]=n.useState(""),[x,D]=n.useState(""),y=n.useMemo(()=>{let a=N;if(x&&(a=a.filter(r=>r.severity===x)),S.trim()){const r=S.toLowerCase();a=a.filter(o=>{var c;return o.actorName.toLowerCase().includes(r)||o.action.toLowerCase().includes(r)||o.resource.toLowerCase().includes(r)||((c=o.details)==null?void 0:c.toLowerCase().includes(r))})}return a},[N,x,S]),l=n.useMemo(()=>[{field:"timestamp",header:s("adminAuditLog.timestamp","Timestamp"),sortable:!0,width:170},{field:"severity",header:s("adminAuditLog.severity","Severity"),sortable:!0,width:120,render:(a,r)=>{const o=Y[r.severity];return e.jsxs("span",{className:"nice-admin-audit-log__severity",style:{color:o.color},children:[e.jsx(C.NiceIcon,{name:o.icon,size:14}),s(`adminAuditLog.short.${r.severity}`,o.label)]})}},{field:"actorName",header:s("adminAuditLog.actor","Actor"),sortable:!0},{field:"action",header:s("adminAuditLog.action","Action"),sortable:!0},{field:"resource",header:s("adminAuditLog.resource","Resource"),sortable:!0,render:(a,r)=>e.jsxs(e.Fragment,{children:[r.resource,r.resourceId?` #${r.resourceId}`:""]})},{field:"ipAddress",header:"IP",width:130,render:a=>a??"—"},{field:"details",header:s("adminAuditLog.details","Details"),render:a=>e.jsx("span",{className:"nice-admin-audit-log__details",children:a??"—"})}],[s]);return e.jsxs("div",{ref:b,className:`nice-admin-audit-log ${i??""}`,style:h,children:[k&&e.jsx("div",{className:"nice-admin-audit-log__header",children:e.jsx("h3",{children:k})}),e.jsxs("div",{className:"nice-admin-audit-log__toolbar",children:[d&&e.jsx("input",{type:"text",value:S,onChange:a=>R(a.target.value),placeholder:s("adminAuditLog.searchAuditLog","Search audit log…"),className:"nice-admin-audit-log__search"}),A&&e.jsxs("select",{value:x,onChange:a=>D(a.target.value),className:"nice-admin-audit-log__severity-filter",children:[e.jsx("option",{value:"",children:s("adminAuditLog.allSeverities","All severities")}),e.jsx("option",{value:"info",children:s("adminAuditLog.info","Info")}),e.jsx("option",{value:"warning",children:s("adminAuditLog.warning","Warning")}),e.jsx("option",{value:"error",children:s("adminAuditLog.error","Error")}),e.jsx("option",{value:"critical",children:s("adminAuditLog.critical","Critical")})]})]}),e.jsx(C.NiceDataGrid,{columns:l,data:y,keyField:"id",striped:!0,size:"sm",emptyText:s("adminAuditLog.noEntries","No audit log entries found."),onRowClick:T?a=>T(a):void 0}),_&&v&&e.jsx("button",{className:"nice-admin-audit-log__load-more",onClick:v,children:s("adminAuditLog.loadMore","Load more")})]})}),J=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{settings:N,onSave:T,onChange:v,onReset:_,saving:d=!1,title:A,className:k,style:i}=g,h=A??s("adminSettings.title","Settings"),[S,R]=n.useState(()=>{const a={};for(const r of N)a[r.key]=r.value;return a}),x=n.useCallback((a,r)=>{R(o=>({...o,[a]:r})),v==null||v(a,r)},[v]),D=n.useCallback(()=>{T==null||T(S)},[T,S]),y=new Map;for(const a of N){const r=a.section??s("adminSettings.general","General");y.has(r)||y.set(r,[]),y.get(r).push(a)}const l=a=>{var o;const r=S[a.key];switch(a.type){case"boolean":return e.jsxs("label",{className:"nice-admin-settings__toggle",children:[e.jsx("input",{type:"checkbox",checked:!!r,onChange:c=>x(a.key,c.target.checked)}),a.label]});case"select":return e.jsx("select",{value:String(r??""),onChange:c=>x(a.key,c.target.value),className:"nice-admin-settings__select",children:(o=a.options)==null?void 0:o.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))});case"textarea":return e.jsx("textarea",{value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__textarea",rows:4});case"number":return e.jsx("input",{type:"number",value:r!=null?Number(r):"",onChange:c=>x(a.key,parseFloat(c.target.value)||0),placeholder:a.placeholder,className:"nice-admin-settings__input"});case"color":return e.jsx("input",{type:"color",value:String(r??"#000000"),onChange:c=>x(a.key,c.target.value),className:"nice-admin-settings__color"});case"password":return e.jsx("input",{type:"password",value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__input",autoComplete:"new-password"});default:return e.jsx("input",{type:"text",value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__input"})}};return e.jsxs("div",{ref:b,className:`nice-admin-settings ${k??""}`,style:i,children:[e.jsx("div",{className:"nice-admin-settings__header",children:e.jsx("h3",{children:h})}),Array.from(y.entries()).map(([a,r])=>e.jsxs("fieldset",{className:"nice-admin-settings__section",children:[e.jsx("legend",{children:a}),r.map(o=>e.jsxs("div",{className:"nice-admin-settings__field",children:[o.type!=="boolean"&&e.jsxs("label",{className:"nice-admin-settings__label",children:[o.label,o.required&&e.jsx("span",{className:"nice-admin-settings__required",children:"*"})]}),o.description&&e.jsx("p",{className:"nice-admin-settings__description",children:o.description}),l(o)]},o.key))]},a)),e.jsxs("div",{className:"nice-admin-settings__actions",children:[e.jsx("button",{className:"nice-admin-settings__save-btn",onClick:D,disabled:d,children:d?s("adminSettings.saving","Saving…"):s("adminSettings.saveSettings","Save Settings")}),_&&e.jsx("button",{className:"nice-admin-settings__reset-btn",onClick:_,children:s("adminSettings.resetToDefaults","Reset to Defaults")})]})]})}),W=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{notifications:N,availableChannels:T=["email","push","sms","in-app","webhook"],onToggle:v,onEdit:_,onTest:d,onCreate:A,onDelete:k,title:i,className:h,style:S}=g,R=n.useMemo(()=>{const D=[{field:"enabled",header:s("adminNotifications.enabled","Enabled"),align:"center",width:90,sortable:!0,render:(y,l)=>e.jsx("input",{type:"checkbox",checked:l.enabled,onChange:()=>v==null?void 0:v(l.id,!l.enabled),"aria-label":s("adminNotifications.toggle","Toggle {name}").replace("{name}",l.name)})},{field:"name",header:s("adminNotifications.name","Name"),sortable:!0,render:(y,l)=>e.jsxs("div",{className:"nice-admin-notifications__name",children:[e.jsx("strong",{children:l.name}),l.description&&e.jsx("small",{className:"nice-admin-notifications__description",children:l.description})]})},{field:"event",header:s("adminNotifications.event","Event"),sortable:!0,render:(y,l)=>e.jsx("code",{children:l.event})},{field:"channels",header:s("adminNotifications.channels","Channels"),render:(y,l)=>l.channels.join(", ")},{field:"lastSentAt",header:s("adminNotifications.lastSent","Last Sent"),sortable:!0,render:(y,l)=>l.lastSentAt??"—"},{field:"sentCount",header:s("adminNotifications.sent","Sent"),align:"right",dataType:"number",sortable:!0,render:(y,l)=>l.sentCount??0}];return(_||d||k)&&D.push({field:"__actions",header:s("adminNotifications.actions","Actions"),align:"right",sortable:!1,render:(y,l)=>e.jsxs("div",{className:"nice-admin-notifications__actions",children:[_&&e.jsx("button",{type:"button",onClick:()=>_(l),children:s("adminNotifications.edit","Edit")}),d&&e.jsx("button",{type:"button",onClick:()=>d(l.id),children:s("adminNotifications.test","Test")}),k&&e.jsx("button",{type:"button",onClick:()=>k(l.id),children:s("adminNotifications.delete","Delete")})]})}),D},[v,_,d,k,s]),x=A?e.jsx("button",{type:"button",onClick:A,className:"nice-admin-notifications__create",children:s("adminNotifications.newNotification","New Notification")}):void 0;return e.jsxs("div",{ref:b,className:`nice-admin-notifications ${h??""}`,style:S,children:[i&&e.jsx("div",{className:"nice-admin-notifications__header",children:e.jsx("h3",{children:i})}),e.jsx(C.NiceDataGrid,{data:N,columns:R,keyField:"id",searchable:!0,striped:!0,emptyText:s("adminNotifications.noNotifications","No notifications found."),toolbar:x})]})}),Q=n.forwardRef(function(g,b){const{t:s}=C.useNiceTranslation(),{flags:N,environmentNames:T=["development","staging","production"],onToggle:v,onPercentageChange:_,onCreate:d,onDelete:A,onEdit:k,title:i,className:h,style:S}=g,R=i??s("featureFlags.title","Feature Flags"),[x,D]=n.useState(""),[y,l]=n.useState(!1),[a,r]=n.useState(""),[o,c]=n.useState(""),[p,f]=n.useState(""),w=n.useMemo(()=>{if(!x.trim())return N;const m=x.toLowerCase();return N.filter(t=>{var j,F;return t.key.toLowerCase().includes(m)||t.name.toLowerCase().includes(m)||((j=t.description)==null?void 0:j.toLowerCase().includes(m))||((F=t.tags)==null?void 0:F.some(U=>U.toLowerCase().includes(m)))})},[N,x]),u=n.useCallback(()=>{!a.trim()||!o.trim()||!d||(d(a.trim(),o.trim(),p.trim()),r(""),c(""),f(""),l(!1))},[a,o,p,d]),L=(m,t)=>m.environments.find(j=>j.name===t);return e.jsxs("div",{ref:b,className:`nice-feature-flags ${h??""}`,style:S,children:[e.jsxs("div",{className:"nice-feature-flags__header",children:[e.jsx("h3",{children:R}),e.jsx("span",{className:"nice-feature-flags__count",children:s("featureFlags.count","{count} flags").replace("{count}",String(N.length))}),d&&e.jsx("button",{onClick:()=>l(!y),children:s("featureFlags.newFlag","+ New Flag")})]}),y&&e.jsxs("div",{className:"nice-feature-flags__create-form",children:[e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"flag_key"}),e.jsx("input",{type:"text",value:o,onChange:m=>c(m.target.value),placeholder:s("featureFlags.displayName","Display name")}),e.jsx("input",{type:"text",value:p,onChange:m=>f(m.target.value),placeholder:s("featureFlags.description","Description")}),e.jsx("button",{onClick:u,disabled:!a.trim()||!o.trim(),children:s("featureFlags.create","Create")}),e.jsx("button",{onClick:()=>l(!1),children:s("featureFlags.cancel","Cancel")})]}),e.jsx("input",{type:"text",value:x,onChange:m=>D(m.target.value),placeholder:s("featureFlags.searchFlags","Search flags…"),className:"nice-feature-flags__search"}),w.length===0?e.jsx("p",{className:"nice-feature-flags__empty",children:s("featureFlags.noFeatureFlagsFound","No feature flags found.")}):e.jsxs("table",{className:"nice-feature-flags__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("featureFlags.flag","Flag")}),T.map(m=>e.jsx("th",{children:m},m)),e.jsx("th",{children:s("featureFlags.tags","Tags")}),e.jsx("th",{children:s("featureFlags.updated","Updated")}),e.jsx("th",{children:s("featureFlags.actions","Actions")})]})}),e.jsx("tbody",{children:w.map(m=>{var t;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("div",{className:"nice-feature-flags__flag-info",children:[e.jsx("strong",{children:m.name}),e.jsx("code",{className:"nice-feature-flags__key",children:m.key}),m.description&&e.jsx("small",{children:m.description})]})}),T.map(j=>{const F=L(m,j);return e.jsxs("td",{className:"nice-feature-flags__env-cell",children:[e.jsx("input",{type:"checkbox",checked:(F==null?void 0:F.enabled)??!1,onChange:()=>v==null?void 0:v(m.id,j,!((F==null?void 0:F.enabled)??!1))}),(F==null?void 0:F.percentage)!=null&&e.jsx("input",{type:"number",min:0,max:100,value:F.percentage,onChange:U=>_==null?void 0:_(m.id,j,parseInt(U.target.value,10)||0),className:"nice-feature-flags__percentage",title:s("featureFlags.rollout","Rollout %")})]},j)}),e.jsx("td",{children:((t=m.tags)==null?void 0:t.join(", "))||"—"}),e.jsx("td",{children:m.updatedAt??m.createdAt}),e.jsxs("td",{className:"nice-feature-flags__actions",children:[k&&e.jsx("button",{onClick:()=>k(m),children:s("featureFlags.edit","Edit")}),A&&e.jsx("button",{onClick:()=>A(m.id),children:s("featureFlags.delete","Delete")})]})]},m.id)})})]})]})}),X=n.forwardRef(function(g,b){var w;const{t:s}=C.useNiceTranslation(),{entities:N,formats:T=["json","csv","xlsx"],jobs:v=[],onImport:_,onExport:d,onDownload:A,title:k,className:i,style:h}=g,S=k??s("importExport.title","Import / Export"),[R,x]=n.useState("export"),[D,y]=n.useState(((w=N[0])==null?void 0:w.id)??""),[l,a]=n.useState(T[0]??"json"),[r,o]=n.useState(null),c=n.useCallback(()=>{!_||!r||!D||(_(D,l,r),o(null))},[_,D,l,r]),p=n.useCallback(()=>{!d||!D||d(D,l)},[d,D,l]),f=u=>{var L;o(((L=u.target.files)==null?void 0:L[0])??null)};return e.jsxs("div",{ref:b,className:`nice-import-export ${i??""}`,style:h,children:[e.jsx("div",{className:"nice-import-export__header",children:e.jsx("h3",{children:S})}),e.jsxs("div",{className:"nice-import-export__tabs",children:[e.jsx("button",{className:`nice-import-export__tab ${R==="import"?"nice-import-export__tab--active":""}`,onClick:()=>x("import"),children:s("importExport.import","Import")}),e.jsx("button",{className:`nice-import-export__tab ${R==="export"?"nice-import-export__tab--active":""}`,onClick:()=>x("export"),children:s("importExport.export","Export")})]}),e.jsxs("div",{className:"nice-import-export__form",children:[e.jsxs("label",{children:[s("importExport.entity","Entity"),e.jsx("select",{value:D,onChange:u=>y(u.target.value),children:N.map(u=>e.jsx("option",{value:u.id,children:u.label},u.id))})]}),e.jsxs("label",{children:[s("importExport.format","Format"),e.jsx("select",{value:l,onChange:u=>a(u.target.value),children:T.map(u=>e.jsx("option",{value:u,children:u.toUpperCase()},u))})]}),R==="import"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:[s("importExport.file","File"),e.jsx("input",{type:"file",onChange:f,accept:`.${l}`})]}),e.jsx("button",{className:"nice-import-export__action-btn",onClick:c,disabled:!r,children:s("importExport.startImport","Start Import")})]}),R==="export"&&e.jsx("button",{className:"nice-import-export__action-btn",onClick:p,children:s("importExport.startExport","Start Export")})]}),v.length>0&&e.jsxs("div",{className:"nice-import-export__jobs",children:[e.jsx("h4",{children:s("importExport.recentJobs","Recent Jobs")}),e.jsxs("table",{className:"nice-import-export__jobs-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("importExport.type","Type")}),e.jsx("th",{children:s("importExport.format","Format")}),e.jsx("th",{children:s("importExport.status","Status")}),e.jsx("th",{children:s("importExport.progress","Progress")}),e.jsx("th",{children:s("importExport.errors","Errors")}),e.jsx("th",{children:s("importExport.created","Created")}),e.jsx("th",{})]})}),e.jsx("tbody",{children:v.map(u=>e.jsxs("tr",{children:[e.jsx("td",{children:u.type}),e.jsx("td",{children:u.format.toUpperCase()}),e.jsx("td",{children:e.jsx("span",{className:`nice-import-export__status nice-import-export__status--${u.status}`,children:u.status})}),e.jsx("td",{children:u.processedRows!=null&&u.totalRows?`${u.processedRows} / ${u.totalRows}`:"—"}),e.jsx("td",{children:u.errorCount??0}),e.jsx("td",{children:u.createdAt}),e.jsx("td",{children:u.type==="export"&&u.status==="completed"&&A&&e.jsx("button",{onClick:()=>A(u.id),children:s("importExport.download","Download")})})]},u.id))})]})]})]})}),M=n.createContext({flags:{}});function Z({config:E,children:g}){return e.jsx(M.Provider,{value:E,children:g})}function P(E){const g=n.useContext(M);return n.useMemo(()=>{const b=g.flags[E];return b===void 0?{enabled:!1}:typeof b=="boolean"?{enabled:b}:{enabled:b>0,percentage:b}},[g.flags,E])}function G({flag:E,fallback:g=null,children:b}){const{enabled:s}=P(E);return e.jsx(e.Fragment,{children:s?b:g})}const I={low:"#2196f3",medium:"#ff9800",high:"#f44336",critical:"#9c27b0"},$={field:"Hidden Field",endpoint:"Decoy Endpoint",file:"Canary File",credential:"Fake Credential",cookie:"Tracking Cookie"},ee=n.forwardRef(function({tokens:g,events:b,onCreate:s,onToggle:N,onDelete:T,onDismissEvent:v,title:_,className:d,style:A},k){const{t:i}=C.useNiceTranslation(),h=_??i("honeyTokenDashboard.title","Honey Tokens"),[S,R]=n.useState(""),[x,D]=n.useState(!1),[y,l]=n.useState(""),[a,r]=n.useState("field"),[o,c]=n.useState("medium"),[p,f]=n.useState(""),w=n.useMemo(()=>g.filter(t=>t.name.toLowerCase().includes(S.toLowerCase())||t.location.toLowerCase().includes(S.toLowerCase())),[g,S]),u=n.useMemo(()=>[...b].sort((t,j)=>new Date(j.timestamp).getTime()-new Date(t.timestamp).getTime()),[b]),L=n.useMemo(()=>{const t=g.filter(U=>U.active).length,j=g.reduce((U,z)=>U+z.tripCount,0),F=b.filter(U=>U.severity==="critical").length;return{activeCount:t,totalCount:g.length,totalTrips:j,criticalEvents:F}},[g,b]),m=()=>{y.trim()&&p.trim()&&s&&(s(y.trim(),a,o,p.trim()),l(""),f(""),D(!1))};return e.jsxs("div",{ref:k,className:`nice-honey-token-dashboard${d?` ${d}`:""}`,style:A,children:[e.jsxs("div",{className:"nice-honey-token-dashboard__header",children:[e.jsx("h2",{children:h}),e.jsxs("div",{className:"nice-honey-token-dashboard__stats",children:[e.jsxs("span",{className:"nice-honey-token-dashboard__stat",children:["Active: ",L.activeCount,"/",L.totalCount]}),e.jsxs("span",{className:"nice-honey-token-dashboard__stat",children:["Trips: ",L.totalTrips]}),L.criticalEvents>0&&e.jsxs("span",{className:"nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical",children:["Critical: ",L.criticalEvents]})]})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__toolbar",children:[e.jsx("input",{type:"text",className:"nice-honey-token-dashboard__search",placeholder:i("honeyTokenDashboard.searchTokens","Search tokens..."),value:S,onChange:t=>R(t.target.value)}),s&&e.jsx("button",{className:"nice-honey-token-dashboard__btn",onClick:()=>D(!x),children:x?i("honeyTokenDashboard.cancel","Cancel"):i("honeyTokenDashboard.newToken","+ New Token")})]}),x&&e.jsxs("div",{className:"nice-honey-token-dashboard__create",children:[e.jsx("input",{type:"text",placeholder:i("honeyTokenDashboard.tokenName","Token name"),value:y,onChange:t=>l(t.target.value)}),e.jsx("select",{value:a,onChange:t=>r(t.target.value),children:Object.entries($).map(([t,j])=>e.jsx("option",{value:t,children:i(`honeyTokenDashboard.tokenType.${t}`,j)},t))}),e.jsxs("select",{value:o,onChange:t=>c(t.target.value),children:[e.jsx("option",{value:"low",children:i("honeyTokenDashboard.low","Low")}),e.jsx("option",{value:"medium",children:i("honeyTokenDashboard.medium","Medium")}),e.jsx("option",{value:"high",children:i("honeyTokenDashboard.high","High")}),e.jsx("option",{value:"critical",children:i("honeyTokenDashboard.critical","Critical")})]}),e.jsx("input",{type:"text",placeholder:i("honeyTokenDashboard.locationEGApiAdmin","Location (e.g. /api/admin/secret)"),value:p,onChange:t=>f(t.target.value)}),e.jsx("button",{onClick:m,children:i("honeyTokenDashboard.create","Create")})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__tokens",children:[e.jsxs("h3",{children:["Tokens (",w.length,")"]}),e.jsxs("table",{className:"nice-honey-token-dashboard__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:i("honeyTokenDashboard.name","Name")}),e.jsx("th",{children:i("honeyTokenDashboard.type","Type")}),e.jsx("th",{children:i("honeyTokenDashboard.severity","Severity")}),e.jsx("th",{children:i("honeyTokenDashboard.location","Location")}),e.jsx("th",{children:i("honeyTokenDashboard.trips","Trips")}),e.jsx("th",{children:i("honeyTokenDashboard.lastTripped","Last Tripped")}),e.jsx("th",{children:i("honeyTokenDashboard.status","Status")}),e.jsx("th",{children:i("honeyTokenDashboard.actions","Actions")})]})}),e.jsx("tbody",{children:w.map(t=>e.jsxs("tr",{className:t.tripCount>0?"nice-honey-token-dashboard__row--tripped":"",children:[e.jsx("td",{children:t.name}),e.jsx("td",{children:i(`honeyTokenDashboard.tokenType.${t.type}`,$[t.type])}),e.jsx("td",{children:e.jsx("span",{className:"nice-honey-token-dashboard__severity",style:{color:I[t.severity]},children:i(`honeyTokenDashboard.${t.severity}`,t.severity)})}),e.jsx("td",{children:e.jsx("code",{children:t.location})}),e.jsx("td",{children:t.tripCount}),e.jsx("td",{children:t.lastTripped??"—"}),e.jsx("td",{children:e.jsx("span",{className:`nice-honey-token-dashboard__status--${t.active?"active":"inactive"}`,children:t.active?i("honeyTokenDashboard.active","Active"):i("honeyTokenDashboard.inactive","Inactive")})}),e.jsxs("td",{children:[N&&e.jsx("button",{onClick:()=>N(t.id,!t.active),children:t.active?i("honeyTokenDashboard.disable","Disable"):i("honeyTokenDashboard.enable","Enable")}),T&&e.jsx("button",{onClick:()=>T(t.id),children:i("honeyTokenDashboard.delete","Delete")})]})]},t.id))})]})]}),u.length>0&&e.jsxs("div",{className:"nice-honey-token-dashboard__events",children:[e.jsx("h3",{children:i("honeyTokenDashboard.recentEvents","Recent Events ({count})").replace("{count}",String(u.length))}),e.jsx("div",{className:"nice-honey-token-dashboard__event-list",children:u.map(t=>e.jsxs("div",{className:`nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${t.severity}`,children:[e.jsxs("div",{className:"nice-honey-token-dashboard__event-header",children:[e.jsx("strong",{children:t.tokenName}),e.jsx("span",{className:"nice-honey-token-dashboard__severity",style:{color:I[t.severity]},children:i(`honeyTokenDashboard.${t.severity}`,t.severity)}),e.jsx("time",{children:t.timestamp})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__event-details",children:[e.jsx("span",{children:i("honeyTokenDashboard.ip","IP: {ip}").replace("{ip}",t.sourceIp)}),t.userId&&e.jsx("span",{children:i("honeyTokenDashboard.user","User: {user}").replace("{user}",t.userId)}),t.details&&e.jsx("span",{children:t.details})]}),v&&e.jsx("button",{className:"nice-honey-token-dashboard__dismiss",onClick:()=>v(t.id),children:i("honeyTokenDashboard.dismiss","Dismiss")})]},t.id))})]})]})});exports.FeatureGate=G;exports.NiceAdminAuditLog=K;exports.NiceAdminDashboard=O;exports.NiceAdminNotifications=W;exports.NiceAdminRoles=V;exports.NiceAdminSettings=J;exports.NiceAdminUsers=B;exports.NiceFeatureFlags=Q;exports.NiceFeatureGate=G;exports.NiceFeatureGateProvider=Z;exports.NiceHoneyTokenDashboard=ee;exports.NiceImportExport=X;exports.useFeatureGate=P;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("@nice2dev/ui"),i=require("react"),O=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{widgets:v,columns:T=4,title:N,headerActions:b,onWidgetClick:d,className:A,style:k}=g,n=N??s("adminDashboard.title","Dashboard");return e.jsxs("div",{ref:_,className:`nice-admin-dashboard ${A??""}`,style:k,children:[e.jsxs("div",{className:"nice-admin-dashboard__header",children:[e.jsx("h2",{children:n}),b&&e.jsx("div",{className:"nice-admin-dashboard__actions",children:b})]}),e.jsx("div",{className:"nice-admin-dashboard__grid",style:{gridTemplateColumns:`repeat(${T}, 1fr)`},children:v.map(h=>e.jsxs("div",{className:`nice-admin-dashboard__widget nice-admin-dashboard__widget--${h.type}`,style:{gridColumn:h.colSpan?`span ${h.colSpan}`:void 0,gridRow:h.rowSpan?`span ${h.rowSpan}`:void 0},onClick:()=>d==null?void 0:d(h),onKeyDown:d?S=>{(S.key==="Enter"||S.key===" ")&&d(h)}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,children:[e.jsxs("div",{className:"nice-admin-dashboard__widget-header",children:[h.icon&&e.jsx("span",{className:"nice-admin-dashboard__widget-icon",children:e.jsx(C.NiceIcon,{name:h.icon,size:16})}),e.jsx("span",{className:"nice-admin-dashboard__widget-title",children:h.title})]}),h.type==="stat"&&e.jsxs("div",{className:"nice-admin-dashboard__stat",children:[e.jsx("span",{className:"nice-admin-dashboard__stat-value",children:h.value}),h.change&&e.jsx("span",{className:`nice-admin-dashboard__stat-change ${h.changePositive?"nice-admin-dashboard__stat-change--positive":"nice-admin-dashboard__stat-change--negative"}`,children:h.change})]}),h.type==="custom"&&h.render&&e.jsx("div",{className:"nice-admin-dashboard__custom",children:h.render()}),(h.type==="chart"||h.type==="table"||h.type==="list")&&h.render&&e.jsx("div",{className:"nice-admin-dashboard__content",children:h.render()})]},h.id))})]})}),q={active:"success",inactive:"secondary",suspended:"danger",pending:"warning"},B=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{users:v,availableRoles:T=[],onCreate:N,onEdit:b,onDelete:d,onToggleStatus:A,onChangeRoles:k,searchable:n=!0,title:h,className:S,style:R}=g,[x,D]=i.useState(""),y=i.useMemo(()=>x?v.filter(l=>l.status===x):v,[v,x]),o=i.useMemo(()=>{const l=[{field:"name",header:s("adminUsers.user","User"),sortable:!0,render:(c,p)=>e.jsxs("span",{className:"nice-admin-users__user-cell",children:[e.jsx(C.NiceAvatar,{src:p.avatarUrl,name:p.name,size:"sm"}),e.jsx("span",{children:p.name})]})},{field:"email",header:s("adminUsers.email","Email"),sortable:!0,render:c=>e.jsx("span",{className:"nice-admin-users__email",children:String(c??"")})},{field:"roles",header:s("adminUsers.roles","Roles"),render:(c,p)=>k?e.jsx("select",{multiple:!0,value:p.roles,onChange:f=>{const w=Array.from(f.target.selectedOptions,u=>u.value);k(p.id,w)},className:"nice-admin-users__roles-select","aria-label":s("adminUsers.rolesFor","Roles for {name}").replace("{name}",p.name),children:T.map(f=>e.jsx("option",{value:f,children:f},f))}):e.jsx("span",{className:"nice-admin-users__roles",children:p.roles.map(f=>e.jsx(C.NiceTag,{size:"sm",children:f},f))})},{field:"status",header:s("adminUsers.status","Status"),sortable:!0,render:(c,p)=>{const f=e.jsx(C.NiceBadge,{variant:q[p.status],size:"sm",children:s(`adminUsers.userStatus.${p.status}`,p.status)});if(!A)return e.jsx("span",{className:"nice-admin-users__status-badge",children:f});const w=p.status==="active"?"suspended":"active";return e.jsx("button",{type:"button",className:"nice-admin-users__status-badge nice-admin-users__status-badge--toggle",onClick:()=>A(p.id,w),"aria-label":s("adminUsers.toggleStatusFor","Toggle status for {name}").replace("{name}",p.name),children:f})}},{field:"createdAt",header:s("adminUsers.created","Created"),dataType:"date",sortable:!0},{field:"lastLoginAt",header:s("adminUsers.lastLogin","Last Login"),dataType:"date",sortable:!0,render:c=>c?String(c):"—"}];return(b||d)&&l.push({field:"__actions",header:s("adminUsers.actions","Actions"),align:"right",render:(c,p)=>e.jsxs("span",{className:"nice-admin-users__actions",children:[b&&e.jsx(C.NiceButton,{size:"sm",variant:"ghost",ariaLabel:s("adminUsers.editUser","Edit {name}").replace("{name}",p.name),onClick:()=>b(p),children:e.jsx(C.NiceIcon,{name:"edit"})}),d&&e.jsx(C.NiceButton,{size:"sm",variant:"ghost",ariaLabel:s("adminUsers.deleteUser","Delete {name}").replace("{name}",p.name),onClick:()=>d(p.id),children:e.jsx(C.NiceIcon,{name:"trash"})})]})}),l},[T,k,d,b,A,s]),a=i.useMemo(()=>{if(d)return[{key:"delete",label:s("adminUsers.delete","Delete"),variant:"danger",icon:e.jsx(C.NiceIcon,{name:"trash"}),onClick:l=>l.forEach(c=>d(c))}]},[d,s]),r=e.jsxs("div",{className:"nice-admin-users__toolbar",children:[e.jsx(C.NiceSelect,{value:x,onChange:l=>D(l??""),title:s("adminUsers.filterByStatus","Filter by status"),options:[{value:"",label:s("adminUsers.allStatuses","All statuses")},{value:"active",label:s("adminUsers.userStatus.active","Active")},{value:"inactive",label:s("adminUsers.userStatus.inactive","Inactive")},{value:"suspended",label:s("adminUsers.userStatus.suspended","Suspended")},{value:"pending",label:s("adminUsers.userStatus.pending","Pending")}],size:"sm"}),N&&e.jsxs(C.NiceButton,{size:"sm",variant:"primary",onClick:N,children:[e.jsx(C.NiceIcon,{name:"plus"}),e.jsx("span",{children:s("adminUsers.addUser","Add User")})]})]});return e.jsxs("div",{ref:_,className:`nice-admin-users ${S??""}`,style:R,children:[h!=null&&e.jsxs("div",{className:"nice-admin-users__header",children:[e.jsx("h3",{children:h}),e.jsx("span",{className:"nice-admin-users__count",children:s("adminUsers.count","{count} users").replace("{count}",String(v.length))})]}),e.jsx(C.NiceDataGrid,{columns:o,data:y,keyField:"id",searchable:n,searchPlaceholder:s("adminUsers.searchUsers","Search users…"),selectable:!!d,bulkActions:a,striped:!0,toolbar:r,emptyText:s("adminUsers.noUsers","No users found.")})]})});function H(E){let g=0;for(const _ of Object.values(E.permissions))g+=_.length;return g}const V=i.forwardRef(function(g,_){var m;const{t:s}=C.useNiceTranslation(),{roles:v,actions:T,resources:N,onPermissionChange:b,onCreate:d,onDelete:A,onRename:k,title:n,className:h,style:S}=g,[R,x]=i.useState(((m=v[0])==null?void 0:m.id)??null),[D,y]=i.useState(!1),[o,a]=i.useState(""),[r,l]=i.useState(""),[c,p]=i.useState(null),f=v.find(t=>t.id===R),w=i.useCallback(()=>{!o.trim()||!d||(d(o.trim(),r.trim()),a(""),l(""),y(!1))},[o,r,d]),u=(t,j,F)=>{var U;return((U=t.permissions[j])==null?void 0:U.includes(F))??!1},L=i.useMemo(()=>[{field:"name",header:s("adminRoles.role","Role"),sortable:!0,render:(t,j)=>e.jsxs("span",{className:"nice-admin-roles__name-cell",children:[j.color&&e.jsx("span",{className:"nice-admin-roles__color-dot",style:{background:j.color},"aria-hidden":"true"}),e.jsx("span",{children:j.name}),j.isSystem&&e.jsx(C.NiceIcon,{name:"lock",size:"sm",title:s("adminRoles.systemRole","System role"),className:"nice-admin-roles__system-icon"})]})},{field:"description",header:s("adminRoles.description","Description"),sortable:!0,render:(t,j)=>j.description??"—"},{field:"permissionCount",header:s("adminRoles.permissions","Permissions"),align:"right",dataType:"number",sortable:!0,render:(t,j)=>H(j)},{field:"userCount",header:s("adminRoles.users","Users"),align:"right",dataType:"number",sortable:!0,render:(t,j)=>j.userCount??0}],[s]);return e.jsxs("div",{ref:_,className:`nice-admin-roles ${h??""}`,style:S,children:[e.jsx(C.NicePromptDialog,{open:c!==null,title:s("adminRoles.newRoleName","New role name"),defaultValue:c==null?void 0:c.name,onSubmit:t=>{c&&t&&(k==null||k(c.id,t)),p(null)},onCancel:()=>p(null)}),(n||d)&&e.jsxs("div",{className:"nice-admin-roles__header",children:[n&&e.jsx("h3",{children:n}),d&&e.jsx("button",{onClick:()=>y(!D),children:s("adminRoles.newRole","+ New Role")})]}),D&&e.jsxs("div",{className:"nice-admin-roles__create-form",children:[e.jsx("input",{type:"text",value:o,onChange:t=>a(t.target.value),placeholder:s("adminRoles.roleName","Role name")}),e.jsx("input",{type:"text",value:r,onChange:t=>l(t.target.value),placeholder:s("adminRoles.description","Description")}),e.jsx("button",{onClick:w,disabled:!o.trim(),children:s("adminRoles.create","Create")}),e.jsx("button",{onClick:()=>y(!1),children:s("adminRoles.cancel","Cancel")})]}),e.jsx(C.NiceDataGrid,{className:"nice-admin-roles__grid",columns:L,data:v,keyField:"id",searchable:!0,striped:!0,size:"sm",selectable:!1,onRowClick:t=>x(t.id)}),f&&e.jsxs("div",{className:"nice-admin-roles__matrix-wrap",children:[f.description&&e.jsx("p",{className:"nice-admin-roles__description",children:f.description}),e.jsxs("table",{className:"nice-admin-roles__matrix",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("adminRoles.resource","Resource")}),T.map(t=>e.jsx("th",{title:t.description,children:t.label},t.id))]})}),e.jsx("tbody",{children:N.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:t.label}),T.map(j=>{const F=u(f,t.id,j.id);return e.jsx("td",{children:e.jsx("input",{type:"checkbox",checked:F,onChange:()=>b==null?void 0:b(f.id,t.id,j.id,!F),disabled:f.isSystem})},j.id)})]},t.id))})]}),!f.isSystem&&e.jsxs("div",{className:"nice-admin-roles__role-actions",children:[k&&e.jsx("button",{onClick:()=>p(f),children:s("adminRoles.rename","Rename")}),A&&e.jsx("button",{onClick:()=>A(f.id),children:s("adminRoles.deleteRole","Delete Role")})]})]})]})}),Y={info:{color:"var(--nice-color-info, #3b82f6)",label:"INFO",icon:"info"},warning:{color:"var(--nice-color-warning, #eab308)",label:"WARN",icon:"warning"},error:{color:"var(--nice-color-danger, #ef4444)",label:"ERROR",icon:"error"},critical:{color:"var(--nice-color-danger, #dc2626)",label:"CRIT",icon:"error"}},K=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{entries:v,onEntryClick:T,onLoadMore:N,hasMore:b=!1,searchable:d=!0,showSeverityFilter:A=!0,title:k,className:n,style:h}=g,[S,R]=i.useState(""),[x,D]=i.useState(""),y=i.useMemo(()=>{let a=v;if(x&&(a=a.filter(r=>r.severity===x)),S.trim()){const r=S.toLowerCase();a=a.filter(l=>{var c;return l.actorName.toLowerCase().includes(r)||l.action.toLowerCase().includes(r)||l.resource.toLowerCase().includes(r)||((c=l.details)==null?void 0:c.toLowerCase().includes(r))})}return a},[v,x,S]),o=i.useMemo(()=>[{field:"timestamp",header:s("adminAuditLog.timestamp","Timestamp"),sortable:!0,width:170},{field:"severity",header:s("adminAuditLog.severity","Severity"),sortable:!0,width:120,render:(a,r)=>{const l=Y[r.severity];return e.jsxs("span",{className:"nice-admin-audit-log__severity",style:{color:l.color},children:[e.jsx(C.NiceIcon,{name:l.icon,size:14}),s(`adminAuditLog.short.${r.severity}`,l.label)]})}},{field:"actorName",header:s("adminAuditLog.actor","Actor"),sortable:!0},{field:"action",header:s("adminAuditLog.action","Action"),sortable:!0},{field:"resource",header:s("adminAuditLog.resource","Resource"),sortable:!0,render:(a,r)=>e.jsxs(e.Fragment,{children:[r.resource,r.resourceId?` #${r.resourceId}`:""]})},{field:"ipAddress",header:"IP",width:130,render:a=>a??"—"},{field:"details",header:s("adminAuditLog.details","Details"),render:a=>e.jsx("span",{className:"nice-admin-audit-log__details",children:a??"—"})}],[s]);return e.jsxs("div",{ref:_,className:`nice-admin-audit-log ${n??""}`,style:h,children:[k&&e.jsx("div",{className:"nice-admin-audit-log__header",children:e.jsx("h3",{children:k})}),e.jsxs("div",{className:"nice-admin-audit-log__toolbar",children:[d&&e.jsx("input",{type:"text",value:S,onChange:a=>R(a.target.value),placeholder:s("adminAuditLog.searchAuditLog","Search audit log…"),className:"nice-admin-audit-log__search"}),A&&e.jsxs("select",{value:x,onChange:a=>D(a.target.value),className:"nice-admin-audit-log__severity-filter",children:[e.jsx("option",{value:"",children:s("adminAuditLog.allSeverities","All severities")}),e.jsx("option",{value:"info",children:s("adminAuditLog.info","Info")}),e.jsx("option",{value:"warning",children:s("adminAuditLog.warning","Warning")}),e.jsx("option",{value:"error",children:s("adminAuditLog.error","Error")}),e.jsx("option",{value:"critical",children:s("adminAuditLog.critical","Critical")})]})]}),e.jsx(C.NiceDataGrid,{columns:o,data:y,keyField:"id",striped:!0,size:"sm",emptyText:s("adminAuditLog.noEntries","No audit log entries found."),onRowClick:T?a=>T(a):void 0}),b&&N&&e.jsx("button",{className:"nice-admin-audit-log__load-more",onClick:N,children:s("adminAuditLog.loadMore","Load more")})]})}),J=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{settings:v,onSave:T,onChange:N,onReset:b,saving:d=!1,title:A,className:k,style:n}=g,h=A??s("adminSettings.title","Settings"),[S,R]=i.useState(()=>{const a={};for(const r of v)a[r.key]=r.value;return a}),x=i.useCallback((a,r)=>{R(l=>({...l,[a]:r})),N==null||N(a,r)},[N]),D=i.useCallback(()=>{T==null||T(S)},[T,S]),y=new Map;for(const a of v){const r=a.section??s("adminSettings.general","General");y.has(r)||y.set(r,[]),y.get(r).push(a)}const o=a=>{var l;const r=S[a.key];switch(a.type){case"boolean":return e.jsxs("label",{className:"nice-admin-settings__toggle",children:[e.jsx("input",{type:"checkbox",checked:!!r,onChange:c=>x(a.key,c.target.checked)}),a.label]});case"select":return e.jsx("select",{value:String(r??""),onChange:c=>x(a.key,c.target.value),className:"nice-admin-settings__select",children:(l=a.options)==null?void 0:l.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))});case"textarea":return e.jsx("textarea",{value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__textarea",rows:4});case"number":return e.jsx("input",{type:"number",value:r!=null?Number(r):"",onChange:c=>x(a.key,parseFloat(c.target.value)||0),placeholder:a.placeholder,className:"nice-admin-settings__input"});case"color":return e.jsx("input",{type:"color",value:String(r??"#000000"),onChange:c=>x(a.key,c.target.value),className:"nice-admin-settings__color"});case"password":return e.jsx("input",{type:"password",value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__input",autoComplete:"new-password"});default:return e.jsx("input",{type:"text",value:String(r??""),onChange:c=>x(a.key,c.target.value),placeholder:a.placeholder,className:"nice-admin-settings__input"})}};return e.jsxs("div",{ref:_,className:`nice-admin-settings ${k??""}`,style:n,children:[e.jsx("div",{className:"nice-admin-settings__header",children:e.jsx("h3",{children:h})}),Array.from(y.entries()).map(([a,r])=>e.jsxs("fieldset",{className:"nice-admin-settings__section",children:[e.jsx("legend",{children:a}),r.map(l=>e.jsxs("div",{className:"nice-admin-settings__field",children:[l.type!=="boolean"&&e.jsxs("label",{className:"nice-admin-settings__label",children:[l.label,l.required&&e.jsx("span",{className:"nice-admin-settings__required",children:"*"})]}),l.description&&e.jsx("p",{className:"nice-admin-settings__description",children:l.description}),o(l)]},l.key))]},a)),e.jsxs("div",{className:"nice-admin-settings__actions",children:[e.jsx("button",{className:"nice-admin-settings__save-btn",onClick:D,disabled:d,children:d?s("adminSettings.saving","Saving…"):s("adminSettings.saveSettings","Save Settings")}),b&&e.jsx("button",{className:"nice-admin-settings__reset-btn",onClick:b,children:s("adminSettings.resetToDefaults","Reset to Defaults")})]})]})}),W=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{notifications:v,availableChannels:T=["email","push","sms","in-app","webhook"],onToggle:N,onEdit:b,onTest:d,onCreate:A,onDelete:k,title:n,className:h,style:S}=g,R=i.useMemo(()=>{const D=[{field:"enabled",header:s("adminNotifications.enabled","Enabled"),align:"center",width:90,sortable:!0,render:(y,o)=>e.jsx("input",{type:"checkbox",checked:o.enabled,onChange:()=>N==null?void 0:N(o.id,!o.enabled),"aria-label":s("adminNotifications.toggle","Toggle {name}").replace("{name}",o.name)})},{field:"name",header:s("adminNotifications.name","Name"),sortable:!0,render:(y,o)=>e.jsxs("div",{className:"nice-admin-notifications__name",children:[e.jsx("strong",{children:o.name}),o.description&&e.jsx("small",{className:"nice-admin-notifications__description",children:o.description})]})},{field:"event",header:s("adminNotifications.event","Event"),sortable:!0,render:(y,o)=>e.jsx("code",{children:o.event})},{field:"channels",header:s("adminNotifications.channels","Channels"),render:(y,o)=>o.channels.join(", ")},{field:"lastSentAt",header:s("adminNotifications.lastSent","Last Sent"),sortable:!0,render:(y,o)=>o.lastSentAt??"—"},{field:"sentCount",header:s("adminNotifications.sent","Sent"),align:"right",dataType:"number",sortable:!0,render:(y,o)=>o.sentCount??0}];return(b||d||k)&&D.push({field:"__actions",header:s("adminNotifications.actions","Actions"),align:"right",sortable:!1,render:(y,o)=>e.jsxs("div",{className:"nice-admin-notifications__actions",children:[b&&e.jsx("button",{type:"button",onClick:()=>b(o),children:s("adminNotifications.edit","Edit")}),d&&e.jsx("button",{type:"button",onClick:()=>d(o.id),children:s("adminNotifications.test","Test")}),k&&e.jsx("button",{type:"button",onClick:()=>k(o.id),children:s("adminNotifications.delete","Delete")})]})}),D},[N,b,d,k,s]),x=A?e.jsx("button",{type:"button",onClick:A,className:"nice-admin-notifications__create",children:s("adminNotifications.newNotification","New Notification")}):void 0;return e.jsxs("div",{ref:_,className:`nice-admin-notifications ${h??""}`,style:S,children:[n&&e.jsx("div",{className:"nice-admin-notifications__header",children:e.jsx("h3",{children:n})}),e.jsx(C.NiceDataGrid,{data:v,columns:R,keyField:"id",searchable:!0,striped:!0,emptyText:s("adminNotifications.noNotifications","No notifications found."),toolbar:x})]})}),Q=i.forwardRef(function(g,_){const{t:s}=C.useNiceTranslation(),{flags:v,environmentNames:T=["development","staging","production"],onToggle:N,onPercentageChange:b,onCreate:d,onDelete:A,onEdit:k,title:n,className:h,style:S}=g,R=n??s("featureFlags.title","Feature Flags"),[x,D]=i.useState(""),[y,o]=i.useState(!1),[a,r]=i.useState(""),[l,c]=i.useState(""),[p,f]=i.useState(""),w=i.useMemo(()=>{if(!x.trim())return v;const m=x.toLowerCase();return v.filter(t=>{var j,F;return t.key.toLowerCase().includes(m)||t.name.toLowerCase().includes(m)||((j=t.description)==null?void 0:j.toLowerCase().includes(m))||((F=t.tags)==null?void 0:F.some(U=>U.toLowerCase().includes(m)))})},[v,x]),u=i.useCallback(()=>{!a.trim()||!l.trim()||!d||(d(a.trim(),l.trim(),p.trim()),r(""),c(""),f(""),o(!1))},[a,l,p,d]),L=(m,t)=>m.environments.find(j=>j.name===t);return e.jsxs("div",{ref:_,className:`nice-feature-flags ${h??""}`,style:S,children:[e.jsxs("div",{className:"nice-feature-flags__header",children:[e.jsx("h3",{children:R}),e.jsx("span",{className:"nice-feature-flags__count",children:s("featureFlags.count","{count} flags").replace("{count}",String(v.length))}),d&&e.jsx("button",{onClick:()=>o(!y),children:s("featureFlags.newFlag","+ New Flag")})]}),y&&e.jsxs("div",{className:"nice-feature-flags__create-form",children:[e.jsx("input",{type:"text",value:a,onChange:m=>r(m.target.value),placeholder:"flag_key"}),e.jsx("input",{type:"text",value:l,onChange:m=>c(m.target.value),placeholder:s("featureFlags.displayName","Display name")}),e.jsx("input",{type:"text",value:p,onChange:m=>f(m.target.value),placeholder:s("featureFlags.description","Description")}),e.jsx("button",{onClick:u,disabled:!a.trim()||!l.trim(),children:s("featureFlags.create","Create")}),e.jsx("button",{onClick:()=>o(!1),children:s("featureFlags.cancel","Cancel")})]}),e.jsx("input",{type:"text",value:x,onChange:m=>D(m.target.value),placeholder:s("featureFlags.searchFlags","Search flags…"),className:"nice-feature-flags__search"}),w.length===0?e.jsx("p",{className:"nice-feature-flags__empty",children:s("featureFlags.noFeatureFlagsFound","No feature flags found.")}):e.jsxs("table",{className:"nice-feature-flags__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("featureFlags.flag","Flag")}),T.map(m=>e.jsx("th",{children:m},m)),e.jsx("th",{children:s("featureFlags.tags","Tags")}),e.jsx("th",{children:s("featureFlags.updated","Updated")}),e.jsx("th",{children:s("featureFlags.actions","Actions")})]})}),e.jsx("tbody",{children:w.map(m=>{var t;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("div",{className:"nice-feature-flags__flag-info",children:[e.jsx("strong",{children:m.name}),e.jsx("code",{className:"nice-feature-flags__key",children:m.key}),m.description&&e.jsx("small",{children:m.description})]})}),T.map(j=>{const F=L(m,j);return e.jsxs("td",{className:"nice-feature-flags__env-cell",children:[e.jsx("input",{type:"checkbox",checked:(F==null?void 0:F.enabled)??!1,onChange:()=>N==null?void 0:N(m.id,j,!((F==null?void 0:F.enabled)??!1))}),(F==null?void 0:F.percentage)!=null&&e.jsx("input",{type:"number",min:0,max:100,value:F.percentage,onChange:U=>b==null?void 0:b(m.id,j,parseInt(U.target.value,10)||0),className:"nice-feature-flags__percentage",title:s("featureFlags.rollout","Rollout %")})]},j)}),e.jsx("td",{children:((t=m.tags)==null?void 0:t.join(", "))||"—"}),e.jsx("td",{children:m.updatedAt??m.createdAt}),e.jsxs("td",{className:"nice-feature-flags__actions",children:[k&&e.jsx("button",{onClick:()=>k(m),children:s("featureFlags.edit","Edit")}),A&&e.jsx("button",{onClick:()=>A(m.id),children:s("featureFlags.delete","Delete")})]})]},m.id)})})]})]})}),X=i.forwardRef(function(g,_){var w;const{t:s}=C.useNiceTranslation(),{entities:v,formats:T=["json","csv","xlsx"],jobs:N=[],onImport:b,onExport:d,onDownload:A,title:k,className:n,style:h}=g,S=k??s("importExport.title","Import / Export"),[R,x]=i.useState("export"),[D,y]=i.useState(((w=v[0])==null?void 0:w.id)??""),[o,a]=i.useState(T[0]??"json"),[r,l]=i.useState(null),c=i.useCallback(()=>{!b||!r||!D||(b(D,o,r),l(null))},[b,D,o,r]),p=i.useCallback(()=>{!d||!D||d(D,o)},[d,D,o]),f=u=>{var L;l(((L=u.target.files)==null?void 0:L[0])??null)};return e.jsxs("div",{ref:_,className:`nice-import-export ${n??""}`,style:h,children:[e.jsx("div",{className:"nice-import-export__header",children:e.jsx("h3",{children:S})}),e.jsxs("div",{className:"nice-import-export__tabs",children:[e.jsx("button",{className:`nice-import-export__tab ${R==="import"?"nice-import-export__tab--active":""}`,onClick:()=>x("import"),children:s("importExport.import","Import")}),e.jsx("button",{className:`nice-import-export__tab ${R==="export"?"nice-import-export__tab--active":""}`,onClick:()=>x("export"),children:s("importExport.export","Export")})]}),e.jsxs("div",{className:"nice-import-export__form",children:[e.jsxs("label",{children:[s("importExport.entity","Entity"),e.jsx("select",{value:D,onChange:u=>y(u.target.value),children:v.map(u=>e.jsx("option",{value:u.id,children:u.label},u.id))})]}),e.jsxs("label",{children:[s("importExport.format","Format"),e.jsx("select",{value:o,onChange:u=>a(u.target.value),children:T.map(u=>e.jsx("option",{value:u,children:u.toUpperCase()},u))})]}),R==="import"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:[s("importExport.file","File"),e.jsx("input",{type:"file",onChange:f,accept:`.${o}`})]}),e.jsx("button",{className:"nice-import-export__action-btn",onClick:c,disabled:!r,children:s("importExport.startImport","Start Import")})]}),R==="export"&&e.jsx("button",{className:"nice-import-export__action-btn",onClick:p,children:s("importExport.startExport","Start Export")})]}),N.length>0&&e.jsxs("div",{className:"nice-import-export__jobs",children:[e.jsx("h4",{children:s("importExport.recentJobs","Recent Jobs")}),e.jsxs("table",{className:"nice-import-export__jobs-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("importExport.type","Type")}),e.jsx("th",{children:s("importExport.format","Format")}),e.jsx("th",{children:s("importExport.status","Status")}),e.jsx("th",{children:s("importExport.progress","Progress")}),e.jsx("th",{children:s("importExport.errors","Errors")}),e.jsx("th",{children:s("importExport.created","Created")}),e.jsx("th",{})]})}),e.jsx("tbody",{children:N.map(u=>e.jsxs("tr",{children:[e.jsx("td",{children:u.type}),e.jsx("td",{children:u.format.toUpperCase()}),e.jsx("td",{children:e.jsx("span",{className:`nice-import-export__status nice-import-export__status--${u.status}`,children:u.status})}),e.jsx("td",{children:u.processedRows!=null&&u.totalRows?`${u.processedRows} / ${u.totalRows}`:"—"}),e.jsx("td",{children:u.errorCount??0}),e.jsx("td",{children:u.createdAt}),e.jsx("td",{children:u.type==="export"&&u.status==="completed"&&A&&e.jsx("button",{onClick:()=>A(u.id),children:s("importExport.download","Download")})})]},u.id))})]})]})]})}),M=i.createContext({flags:{}});function Z({config:E,children:g}){return e.jsx(M.Provider,{value:E,children:g})}function P(E){const g=i.useContext(M);return i.useMemo(()=>{const _=g.flags[E];return _===void 0?{enabled:!1}:typeof _=="boolean"?{enabled:_}:{enabled:_>0,percentage:_}},[g.flags,E])}function G({flag:E,fallback:g=null,children:_}){const{enabled:s}=P(E);return e.jsx(e.Fragment,{children:s?_:g})}const I={low:"#2196f3",medium:"#ff9800",high:"#f44336",critical:"#9c27b0"},$={field:"Hidden Field",endpoint:"Decoy Endpoint",file:"Canary File",credential:"Fake Credential",cookie:"Tracking Cookie"},ee=i.forwardRef(function({tokens:g,events:_,onCreate:s,onToggle:v,onDelete:T,onDismissEvent:N,title:b,className:d,style:A},k){const{t:n}=C.useNiceTranslation(),h=b??n("honeyTokenDashboard.title","Honey Tokens"),[S,R]=i.useState(""),[x,D]=i.useState(!1),[y,o]=i.useState(""),[a,r]=i.useState("field"),[l,c]=i.useState("medium"),[p,f]=i.useState(""),w=i.useMemo(()=>g.filter(t=>t.name.toLowerCase().includes(S.toLowerCase())||t.location.toLowerCase().includes(S.toLowerCase())),[g,S]),u=i.useMemo(()=>[..._].sort((t,j)=>new Date(j.timestamp).getTime()-new Date(t.timestamp).getTime()),[_]),L=i.useMemo(()=>{const t=g.filter(U=>U.active).length,j=g.reduce((U,z)=>U+z.tripCount,0),F=_.filter(U=>U.severity==="critical").length;return{activeCount:t,totalCount:g.length,totalTrips:j,criticalEvents:F}},[g,_]),m=()=>{y.trim()&&p.trim()&&s&&(s(y.trim(),a,l,p.trim()),o(""),f(""),D(!1))};return e.jsxs("div",{ref:k,className:`nice-honey-token-dashboard${d?` ${d}`:""}`,style:A,children:[e.jsxs("div",{className:"nice-honey-token-dashboard__header",children:[e.jsx("h2",{children:h}),e.jsxs("div",{className:"nice-honey-token-dashboard__stats",children:[e.jsx("span",{className:"nice-honey-token-dashboard__stat",children:n("honeyTokenDashboard.active2","Active: {activeCount}/{totalCount}").replace("{activeCount}",String(L.activeCount)).replace("{totalCount}",String(L.totalCount))}),e.jsx("span",{className:"nice-honey-token-dashboard__stat",children:n("honeyTokenDashboard.trips2","Trips: {totalTrips}").replace("{totalTrips}",String(L.totalTrips))}),L.criticalEvents>0&&e.jsx("span",{className:"nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical",children:n("honeyTokenDashboard.critical2","Critical: {criticalEvents}").replace("{criticalEvents}",String(L.criticalEvents))})]})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__toolbar",children:[e.jsx("input",{type:"text",className:"nice-honey-token-dashboard__search",placeholder:n("honeyTokenDashboard.searchTokens","Search tokens..."),value:S,onChange:t=>R(t.target.value)}),s&&e.jsx("button",{className:"nice-honey-token-dashboard__btn",onClick:()=>D(!x),children:x?n("honeyTokenDashboard.cancel","Cancel"):n("honeyTokenDashboard.newToken","+ New Token")})]}),x&&e.jsxs("div",{className:"nice-honey-token-dashboard__create",children:[e.jsx("input",{type:"text",placeholder:n("honeyTokenDashboard.tokenName","Token name"),value:y,onChange:t=>o(t.target.value)}),e.jsx("select",{value:a,onChange:t=>r(t.target.value),children:Object.entries($).map(([t,j])=>e.jsx("option",{value:t,children:n(`honeyTokenDashboard.tokenType.${t}`,j)},t))}),e.jsxs("select",{value:l,onChange:t=>c(t.target.value),children:[e.jsx("option",{value:"low",children:n("honeyTokenDashboard.low","Low")}),e.jsx("option",{value:"medium",children:n("honeyTokenDashboard.medium","Medium")}),e.jsx("option",{value:"high",children:n("honeyTokenDashboard.high","High")}),e.jsx("option",{value:"critical",children:n("honeyTokenDashboard.critical","Critical")})]}),e.jsx("input",{type:"text",placeholder:n("honeyTokenDashboard.locationEGApiAdmin","Location (e.g. /api/admin/secret)"),value:p,onChange:t=>f(t.target.value)}),e.jsx("button",{onClick:m,children:n("honeyTokenDashboard.create","Create")})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__tokens",children:[e.jsx("h3",{children:n("honeyTokenDashboard.tokens","Tokens ({filteredTokens})").replace("{filteredTokens}",String(w.length))}),e.jsxs("table",{className:"nice-honey-token-dashboard__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("honeyTokenDashboard.name","Name")}),e.jsx("th",{children:n("honeyTokenDashboard.type","Type")}),e.jsx("th",{children:n("honeyTokenDashboard.severity","Severity")}),e.jsx("th",{children:n("honeyTokenDashboard.location","Location")}),e.jsx("th",{children:n("honeyTokenDashboard.trips","Trips")}),e.jsx("th",{children:n("honeyTokenDashboard.lastTripped","Last Tripped")}),e.jsx("th",{children:n("honeyTokenDashboard.status","Status")}),e.jsx("th",{children:n("honeyTokenDashboard.actions","Actions")})]})}),e.jsx("tbody",{children:w.map(t=>e.jsxs("tr",{className:t.tripCount>0?"nice-honey-token-dashboard__row--tripped":"",children:[e.jsx("td",{children:t.name}),e.jsx("td",{children:n(`honeyTokenDashboard.tokenType.${t.type}`,$[t.type])}),e.jsx("td",{children:e.jsx("span",{className:"nice-honey-token-dashboard__severity",style:{color:I[t.severity]},children:n(`honeyTokenDashboard.${t.severity}`,t.severity)})}),e.jsx("td",{children:e.jsx("code",{children:t.location})}),e.jsx("td",{children:t.tripCount}),e.jsx("td",{children:t.lastTripped??"—"}),e.jsx("td",{children:e.jsx("span",{className:`nice-honey-token-dashboard__status--${t.active?"active":"inactive"}`,children:t.active?n("honeyTokenDashboard.active","Active"):n("honeyTokenDashboard.inactive","Inactive")})}),e.jsxs("td",{children:[v&&e.jsx("button",{onClick:()=>v(t.id,!t.active),children:t.active?n("honeyTokenDashboard.disable","Disable"):n("honeyTokenDashboard.enable","Enable")}),T&&e.jsx("button",{onClick:()=>T(t.id),children:n("honeyTokenDashboard.delete","Delete")})]})]},t.id))})]})]}),u.length>0&&e.jsxs("div",{className:"nice-honey-token-dashboard__events",children:[e.jsx("h3",{children:n("honeyTokenDashboard.recentEvents","Recent Events ({count})").replace("{count}",String(u.length))}),e.jsx("div",{className:"nice-honey-token-dashboard__event-list",children:u.map(t=>e.jsxs("div",{className:`nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${t.severity}`,children:[e.jsxs("div",{className:"nice-honey-token-dashboard__event-header",children:[e.jsx("strong",{children:t.tokenName}),e.jsx("span",{className:"nice-honey-token-dashboard__severity",style:{color:I[t.severity]},children:n(`honeyTokenDashboard.${t.severity}`,t.severity)}),e.jsx("time",{children:t.timestamp})]}),e.jsxs("div",{className:"nice-honey-token-dashboard__event-details",children:[e.jsx("span",{children:n("honeyTokenDashboard.ip","IP: {ip}").replace("{ip}",t.sourceIp)}),t.userId&&e.jsx("span",{children:n("honeyTokenDashboard.user","User: {user}").replace("{user}",t.userId)}),t.details&&e.jsx("span",{children:t.details})]}),N&&e.jsx("button",{className:"nice-honey-token-dashboard__dismiss",onClick:()=>N(t.id),children:n("honeyTokenDashboard.dismiss","Dismiss")})]},t.id))})]})]})});exports.FeatureGate=G;exports.NiceAdminAuditLog=K;exports.NiceAdminDashboard=O;exports.NiceAdminNotifications=W;exports.NiceAdminRoles=V;exports.NiceAdminSettings=J;exports.NiceAdminUsers=B;exports.NiceFeatureFlags=Q;exports.NiceFeatureGate=G;exports.NiceFeatureGateProvider=Z;exports.NiceHoneyTokenDashboard=ee;exports.NiceImportExport=X;exports.useFeatureGate=P;
|
package/dist/index.mjs
CHANGED
|
@@ -8,10 +8,10 @@ const oe = /* @__PURE__ */ z(function(_, y) {
|
|
|
8
8
|
title: N,
|
|
9
9
|
headerActions: v,
|
|
10
10
|
onWidgetClick: d,
|
|
11
|
-
className:
|
|
11
|
+
className: E,
|
|
12
12
|
style: S
|
|
13
13
|
} = _, s = N ?? t("adminDashboard.title", "Dashboard");
|
|
14
|
-
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-dashboard ${
|
|
14
|
+
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-dashboard ${E ?? ""}`, style: S, children: [
|
|
15
15
|
/* @__PURE__ */ n("div", { className: "nice-admin-dashboard__header", children: [
|
|
16
16
|
/* @__PURE__ */ e("h2", { children: s }),
|
|
17
17
|
v && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__actions", children: v })
|
|
@@ -72,7 +72,7 @@ const oe = /* @__PURE__ */ z(function(_, y) {
|
|
|
72
72
|
onCreate: N,
|
|
73
73
|
onEdit: v,
|
|
74
74
|
onDelete: d,
|
|
75
|
-
onToggleStatus:
|
|
75
|
+
onToggleStatus: E,
|
|
76
76
|
onChangeRoles: S,
|
|
77
77
|
searchable: s = !0,
|
|
78
78
|
title: h,
|
|
@@ -125,7 +125,7 @@ const oe = /* @__PURE__ */ z(function(_, y) {
|
|
|
125
125
|
sortable: !0,
|
|
126
126
|
render: (c, p) => {
|
|
127
127
|
const C = /* @__PURE__ */ e(Q, { variant: te[p.status], size: "sm", children: t(`adminUsers.userStatus.${p.status}`, p.status) });
|
|
128
|
-
if (!
|
|
128
|
+
if (!E)
|
|
129
129
|
return /* @__PURE__ */ e("span", { className: "nice-admin-users__status-badge", children: C });
|
|
130
130
|
const w = p.status === "active" ? "suspended" : "active";
|
|
131
131
|
return /* @__PURE__ */ e(
|
|
@@ -133,7 +133,7 @@ const oe = /* @__PURE__ */ z(function(_, y) {
|
|
|
133
133
|
{
|
|
134
134
|
type: "button",
|
|
135
135
|
className: "nice-admin-users__status-badge nice-admin-users__status-badge--toggle",
|
|
136
|
-
onClick: () =>
|
|
136
|
+
onClick: () => E(p.id, w),
|
|
137
137
|
"aria-label": t("adminUsers.toggleStatusFor", "Toggle status for {name}").replace(
|
|
138
138
|
"{name}",
|
|
139
139
|
p.name
|
|
@@ -187,7 +187,7 @@ const oe = /* @__PURE__ */ z(function(_, y) {
|
|
|
187
187
|
)
|
|
188
188
|
] })
|
|
189
189
|
}), o;
|
|
190
|
-
}, [x, S, d, v,
|
|
190
|
+
}, [x, S, d, v, E, t]), i = I(() => {
|
|
191
191
|
if (d)
|
|
192
192
|
return [
|
|
193
193
|
{
|
|
@@ -258,16 +258,16 @@ const de = /* @__PURE__ */ z(
|
|
|
258
258
|
resources: N,
|
|
259
259
|
onPermissionChange: v,
|
|
260
260
|
onCreate: d,
|
|
261
|
-
onDelete:
|
|
261
|
+
onDelete: E,
|
|
262
262
|
onRename: S,
|
|
263
263
|
title: s,
|
|
264
264
|
className: h,
|
|
265
265
|
style: T
|
|
266
266
|
} = _, [R, g] = A(((u = f[0]) == null ? void 0 : u.id) ?? null), [D, k] = A(!1), [l, i] = A(""), [r, o] = A(""), [c, p] = A(null), C = f.find((a) => a.id === R), w = M(() => {
|
|
267
267
|
!l.trim() || !d || (d(l.trim(), r.trim()), i(""), o(""), k(!1));
|
|
268
|
-
}, [l, r, d]), m = (a, b,
|
|
268
|
+
}, [l, r, d]), m = (a, b, F) => {
|
|
269
269
|
var $;
|
|
270
|
-
return (($ = a.permissions[b]) == null ? void 0 : $.includes(
|
|
270
|
+
return (($ = a.permissions[b]) == null ? void 0 : $.includes(F)) ?? !1;
|
|
271
271
|
}, U = I(
|
|
272
272
|
() => [
|
|
273
273
|
{
|
|
@@ -383,13 +383,13 @@ const de = /* @__PURE__ */ z(
|
|
|
383
383
|
/* @__PURE__ */ e("tbody", { children: N.map((a) => /* @__PURE__ */ n("tr", { children: [
|
|
384
384
|
/* @__PURE__ */ e("td", { children: a.label }),
|
|
385
385
|
x.map((b) => {
|
|
386
|
-
const
|
|
386
|
+
const F = m(C, a.id, b.id);
|
|
387
387
|
return /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
388
388
|
"input",
|
|
389
389
|
{
|
|
390
390
|
type: "checkbox",
|
|
391
|
-
checked:
|
|
392
|
-
onChange: () => v == null ? void 0 : v(C.id, a.id, b.id, !
|
|
391
|
+
checked: F,
|
|
392
|
+
onChange: () => v == null ? void 0 : v(C.id, a.id, b.id, !F),
|
|
393
393
|
disabled: C.isSystem
|
|
394
394
|
}
|
|
395
395
|
) }, b.id);
|
|
@@ -398,7 +398,7 @@ const de = /* @__PURE__ */ z(
|
|
|
398
398
|
] }),
|
|
399
399
|
!C.isSystem && /* @__PURE__ */ n("div", { className: "nice-admin-roles__role-actions", children: [
|
|
400
400
|
S && /* @__PURE__ */ e("button", { onClick: () => p(C), children: t("adminRoles.rename", "Rename") }),
|
|
401
|
-
|
|
401
|
+
E && /* @__PURE__ */ e("button", { onClick: () => E(C.id), children: t("adminRoles.deleteRole", "Delete Role") })
|
|
402
402
|
] })
|
|
403
403
|
] })
|
|
404
404
|
] });
|
|
@@ -416,7 +416,7 @@ const de = /* @__PURE__ */ z(
|
|
|
416
416
|
onLoadMore: N,
|
|
417
417
|
hasMore: v = !1,
|
|
418
418
|
searchable: d = !0,
|
|
419
|
-
showSeverityFilter:
|
|
419
|
+
showSeverityFilter: E = !0,
|
|
420
420
|
title: S,
|
|
421
421
|
className: s,
|
|
422
422
|
style: h
|
|
@@ -491,7 +491,7 @@ const de = /* @__PURE__ */ z(
|
|
|
491
491
|
className: "nice-admin-audit-log__search"
|
|
492
492
|
}
|
|
493
493
|
),
|
|
494
|
-
|
|
494
|
+
E && /* @__PURE__ */ n(
|
|
495
495
|
"select",
|
|
496
496
|
{
|
|
497
497
|
value: g,
|
|
@@ -530,10 +530,10 @@ const de = /* @__PURE__ */ z(
|
|
|
530
530
|
onChange: N,
|
|
531
531
|
onReset: v,
|
|
532
532
|
saving: d = !1,
|
|
533
|
-
title:
|
|
533
|
+
title: E,
|
|
534
534
|
className: S,
|
|
535
535
|
style: s
|
|
536
|
-
} = _, h =
|
|
536
|
+
} = _, h = E ?? t("adminSettings.title", "Settings"), [T, R] = A(() => {
|
|
537
537
|
const i = {};
|
|
538
538
|
for (const r of f)
|
|
539
539
|
i[r.key] = r.value;
|
|
@@ -659,7 +659,7 @@ const de = /* @__PURE__ */ z(
|
|
|
659
659
|
onToggle: N,
|
|
660
660
|
onEdit: v,
|
|
661
661
|
onTest: d,
|
|
662
|
-
onCreate:
|
|
662
|
+
onCreate: E,
|
|
663
663
|
onDelete: S,
|
|
664
664
|
title: s,
|
|
665
665
|
className: h,
|
|
@@ -728,7 +728,7 @@ const de = /* @__PURE__ */ z(
|
|
|
728
728
|
S && /* @__PURE__ */ e("button", { type: "button", onClick: () => S(l.id), children: t("adminNotifications.delete", "Delete") })
|
|
729
729
|
] })
|
|
730
730
|
}), D;
|
|
731
|
-
}, [N, v, d, S, t]), g =
|
|
731
|
+
}, [N, v, d, S, t]), g = E ? /* @__PURE__ */ e("button", { type: "button", onClick: E, className: "nice-admin-notifications__create", children: t("adminNotifications.newNotification", "New Notification") }) : void 0;
|
|
732
732
|
return /* @__PURE__ */ n("div", { ref: y, className: `nice-admin-notifications ${h ?? ""}`, style: T, children: [
|
|
733
733
|
s && /* @__PURE__ */ e("div", { className: "nice-admin-notifications__header", children: /* @__PURE__ */ e("h3", { children: s }) }),
|
|
734
734
|
/* @__PURE__ */ e(
|
|
@@ -752,7 +752,7 @@ const de = /* @__PURE__ */ z(
|
|
|
752
752
|
onToggle: N,
|
|
753
753
|
onPercentageChange: v,
|
|
754
754
|
onCreate: d,
|
|
755
|
-
onDelete:
|
|
755
|
+
onDelete: E,
|
|
756
756
|
onEdit: S,
|
|
757
757
|
title: s,
|
|
758
758
|
className: h,
|
|
@@ -763,8 +763,8 @@ const de = /* @__PURE__ */ z(
|
|
|
763
763
|
const u = g.toLowerCase();
|
|
764
764
|
return f.filter(
|
|
765
765
|
(a) => {
|
|
766
|
-
var b,
|
|
767
|
-
return a.key.toLowerCase().includes(u) || a.name.toLowerCase().includes(u) || ((b = a.description) == null ? void 0 : b.toLowerCase().includes(u)) || ((
|
|
766
|
+
var b, F;
|
|
767
|
+
return a.key.toLowerCase().includes(u) || a.name.toLowerCase().includes(u) || ((b = a.description) == null ? void 0 : b.toLowerCase().includes(u)) || ((F = a.tags) == null ? void 0 : F.some(($) => $.toLowerCase().includes(u)));
|
|
768
768
|
}
|
|
769
769
|
);
|
|
770
770
|
}, [f, g]), m = M(() => {
|
|
@@ -834,23 +834,23 @@ const de = /* @__PURE__ */ z(
|
|
|
834
834
|
u.description && /* @__PURE__ */ e("small", { children: u.description })
|
|
835
835
|
] }) }),
|
|
836
836
|
x.map((b) => {
|
|
837
|
-
const
|
|
837
|
+
const F = U(u, b);
|
|
838
838
|
return /* @__PURE__ */ n("td", { className: "nice-feature-flags__env-cell", children: [
|
|
839
839
|
/* @__PURE__ */ e(
|
|
840
840
|
"input",
|
|
841
841
|
{
|
|
842
842
|
type: "checkbox",
|
|
843
|
-
checked: (
|
|
844
|
-
onChange: () => N == null ? void 0 : N(u.id, b, !((
|
|
843
|
+
checked: (F == null ? void 0 : F.enabled) ?? !1,
|
|
844
|
+
onChange: () => N == null ? void 0 : N(u.id, b, !((F == null ? void 0 : F.enabled) ?? !1))
|
|
845
845
|
}
|
|
846
846
|
),
|
|
847
|
-
(
|
|
847
|
+
(F == null ? void 0 : F.percentage) != null && /* @__PURE__ */ e(
|
|
848
848
|
"input",
|
|
849
849
|
{
|
|
850
850
|
type: "number",
|
|
851
851
|
min: 0,
|
|
852
852
|
max: 100,
|
|
853
|
-
value:
|
|
853
|
+
value: F.percentage,
|
|
854
854
|
onChange: ($) => v == null ? void 0 : v(
|
|
855
855
|
u.id,
|
|
856
856
|
b,
|
|
@@ -866,7 +866,7 @@ const de = /* @__PURE__ */ z(
|
|
|
866
866
|
/* @__PURE__ */ e("td", { children: u.updatedAt ?? u.createdAt }),
|
|
867
867
|
/* @__PURE__ */ n("td", { className: "nice-feature-flags__actions", children: [
|
|
868
868
|
S && /* @__PURE__ */ e("button", { onClick: () => S(u), children: t("featureFlags.edit", "Edit") }),
|
|
869
|
-
|
|
869
|
+
E && /* @__PURE__ */ e("button", { onClick: () => E(u.id), children: t("featureFlags.delete", "Delete") })
|
|
870
870
|
] })
|
|
871
871
|
] }, u.id);
|
|
872
872
|
}) })
|
|
@@ -882,7 +882,7 @@ const de = /* @__PURE__ */ z(
|
|
|
882
882
|
jobs: N = [],
|
|
883
883
|
onImport: v,
|
|
884
884
|
onExport: d,
|
|
885
|
-
onDownload:
|
|
885
|
+
onDownload: E,
|
|
886
886
|
title: S,
|
|
887
887
|
className: s,
|
|
888
888
|
style: h
|
|
@@ -972,7 +972,7 @@ const de = /* @__PURE__ */ z(
|
|
|
972
972
|
/* @__PURE__ */ e("td", { children: m.processedRows != null && m.totalRows ? `${m.processedRows} / ${m.totalRows}` : "—" }),
|
|
973
973
|
/* @__PURE__ */ e("td", { children: m.errorCount ?? 0 }),
|
|
974
974
|
/* @__PURE__ */ e("td", { children: m.createdAt }),
|
|
975
|
-
/* @__PURE__ */ e("td", { children: m.type === "export" && m.status === "completed" &&
|
|
975
|
+
/* @__PURE__ */ e("td", { children: m.type === "export" && m.status === "completed" && E && /* @__PURE__ */ e("button", { onClick: () => E(m.id), children: t("importExport.download", "Download") }) })
|
|
976
976
|
] }, m.id)) })
|
|
977
977
|
] })
|
|
978
978
|
] })
|
|
@@ -1013,7 +1013,7 @@ const V = {
|
|
|
1013
1013
|
onDismissEvent: N,
|
|
1014
1014
|
title: v,
|
|
1015
1015
|
className: d,
|
|
1016
|
-
style:
|
|
1016
|
+
style: E
|
|
1017
1017
|
}, S) {
|
|
1018
1018
|
const { t: s } = P(), h = v ?? s("honeyTokenDashboard.title", "Honey Tokens"), [T, R] = A(""), [g, D] = A(!1), [k, l] = A(""), [i, r] = A("field"), [o, c] = A("medium"), [p, C] = A(""), w = I(
|
|
1019
1019
|
() => _.filter(
|
|
@@ -1024,8 +1024,8 @@ const V = {
|
|
|
1024
1024
|
() => [...y].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()),
|
|
1025
1025
|
[y]
|
|
1026
1026
|
), U = I(() => {
|
|
1027
|
-
const a = _.filter(($) => $.active).length, b = _.reduce(($, K) => $ + K.tripCount, 0),
|
|
1028
|
-
return { activeCount: a, totalCount: _.length, totalTrips: b, criticalEvents:
|
|
1027
|
+
const a = _.filter(($) => $.active).length, b = _.reduce(($, K) => $ + K.tripCount, 0), F = y.filter(($) => $.severity === "critical").length;
|
|
1028
|
+
return { activeCount: a, totalCount: _.length, totalTrips: b, criticalEvents: F };
|
|
1029
1029
|
}, [_, y]), u = () => {
|
|
1030
1030
|
k.trim() && p.trim() && t && (t(k.trim(), i, o, p.trim()), l(""), C(""), D(!1));
|
|
1031
1031
|
};
|
|
@@ -1034,25 +1034,20 @@ const V = {
|
|
|
1034
1034
|
{
|
|
1035
1035
|
ref: S,
|
|
1036
1036
|
className: `nice-honey-token-dashboard${d ? ` ${d}` : ""}`,
|
|
1037
|
-
style:
|
|
1037
|
+
style: E,
|
|
1038
1038
|
children: [
|
|
1039
1039
|
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__header", children: [
|
|
1040
1040
|
/* @__PURE__ */ e("h2", { children: h }),
|
|
1041
1041
|
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__stats", children: [
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
] }),
|
|
1052
|
-
U.criticalEvents > 0 && /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
|
|
1053
|
-
"Critical: ",
|
|
1054
|
-
U.criticalEvents
|
|
1055
|
-
] })
|
|
1042
|
+
/* @__PURE__ */ e("span", { className: "nice-honey-token-dashboard__stat", children: s("honeyTokenDashboard.active2", "Active: {activeCount}/{totalCount}").replace("{activeCount}", String(U.activeCount)).replace("{totalCount}", String(U.totalCount)) }),
|
|
1043
|
+
/* @__PURE__ */ e("span", { className: "nice-honey-token-dashboard__stat", children: s("honeyTokenDashboard.trips2", "Trips: {totalTrips}").replace(
|
|
1044
|
+
"{totalTrips}",
|
|
1045
|
+
String(U.totalTrips)
|
|
1046
|
+
) }),
|
|
1047
|
+
U.criticalEvents > 0 && /* @__PURE__ */ e("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: s("honeyTokenDashboard.critical2", "Critical: {criticalEvents}").replace(
|
|
1048
|
+
"{criticalEvents}",
|
|
1049
|
+
String(U.criticalEvents)
|
|
1050
|
+
) })
|
|
1056
1051
|
] })
|
|
1057
1052
|
] }),
|
|
1058
1053
|
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__toolbar", children: [
|
|
@@ -1114,11 +1109,10 @@ const V = {
|
|
|
1114
1109
|
/* @__PURE__ */ e("button", { onClick: u, children: s("honeyTokenDashboard.create", "Create") })
|
|
1115
1110
|
] }),
|
|
1116
1111
|
/* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__tokens", children: [
|
|
1117
|
-
/* @__PURE__ */
|
|
1118
|
-
"
|
|
1119
|
-
w.length
|
|
1120
|
-
|
|
1121
|
-
] }),
|
|
1112
|
+
/* @__PURE__ */ e("h3", { children: s("honeyTokenDashboard.tokens", "Tokens ({filteredTokens})").replace(
|
|
1113
|
+
"{filteredTokens}",
|
|
1114
|
+
String(w.length)
|
|
1115
|
+
) }),
|
|
1122
1116
|
/* @__PURE__ */ n("table", { className: "nice-honey-token-dashboard__table", children: [
|
|
1123
1117
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
1124
1118
|
/* @__PURE__ */ e("th", { children: s("honeyTokenDashboard.name", "Name") }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Nice2Dev Admin — Dashboard, user management, roles, audit log, settings, feature flags, import/export for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-dom": ">=17.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@nice2dev/ui": "^1.
|
|
66
|
+
"@nice2dev/ui": "^1.3.0",
|
|
67
67
|
"@testing-library/jest-dom": "^7.0.1",
|
|
68
68
|
"@testing-library/react": "^16.3.3",
|
|
69
69
|
"@types/react": "^19.2.18",
|