← Back
Editing: dashboard.min.js
(globalThis.itsecWebpackJsonP=globalThis.itsecWebpackJsonP||[]).push([[9414],{3075:e=>{e.exports=function(){return this.wp.i18n}()},8601:e=>{e.exports=function(){return this.wp.element}()},10424:e=>{e.exports=function(){return this.itsec.dashboard.dashboard}()},24740:e=>{e.exports=function(){return this.itsec.dashboard.api}()},31987:e=>{e.exports=function(){return this.wp.data}()},36022:e=>{e.exports=function(e){e.charAt&&"#"===e.charAt(0)&&(e=function(e){var t=e.split("");return t.shift(),t.join("")}(e)),3===e.length&&(e=function(e){return e.split("").reduce((function(e,t){return e.concat([t,t])}),[]).join("")}(e));var t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t]}},38125:e=>{e.exports=function(){return this.wp.plugins}()},39959:e=>{e.exports=function(){return this.wp.components}()},46627:e=>{e.exports=function(){return this.itsec.packages.data}()},47989:e=>{e.exports=function(){return this.wp.htmlEntities}()},51609:e=>{"use strict";e.exports=window.React},52485:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(51609),s=r(55933);const n=(0,a.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(s.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}))},53756:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(51609),s=r(55933);const n=(0,a.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(s.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"}))},55933:e=>{e.exports=function(){return this.wp.primitives}()},65672:(e,t,r)=>{"use strict";var a=r(51609),s=r(38125),n=r(3075),i=r(31987),o=r(47989),l=r(39959),d=r(53756),c=r(52485),u=r(53390),h=r(24740),m=r(66087),p=r(10424),g=r(8601),b=r(33520),E=r(81923),y=r(65943),f=r.n(y);const x=(0,E.A)(u.$n,{target:"etlee6110"})("&.components-button{background:",(({theme:e})=>e.colors.surface.primary),";border:1px solid ",(({theme:e})=>e.colors.border.input),";box-shadow:none;}&:active{background-color:",(({theme:e})=>e.colors.surface.tertiary),";}"),v=(0,E.A)("div",{target:"etlee619"})({name:"6p7o8o",styles:"display:flex;flex-grow:1;align-items:center;gap:0.5rem"}),w=(0,E.A)("div",{target:"etlee618"})({name:"1v38uti",styles:"display:flex;align-items:center;&>*{display:flex;margin-left:-1.5em;transition:all 300ms ease;&:first-child{margin-left:0;}&:hover{margin-right:.5em;}&:last-child:hover{margin-right:0;}&:hover+*{margin-left:0;}}"}),_=(0,E.A)("span",{target:"etlee617"})({name:"jtvuzj",styles:"display:flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem"}),D=(0,E.A)(_,{target:"etlee616"})("color:",(({theme:e,backgroundColor:t})=>"light"===f()(t)?e.colors.text.dark:e.colors.text.white),";background-color:",(({backgroundColor:e})=>e),";border-radius:50%;"),k=(0,E.A)("span",{target:"etlee615"})({name:"rkiwex",styles:"font-size:1rem"}),C=(0,E.A)("img",{target:"etlee614"})({name:"8477rn",styles:"height:2.25rem;width:2.25rem;border-radius:50%"}),A=(0,E.A)(u.$n,{target:"etlee613"})({name:"18c1yyk",styles:"padding:0;&:hover{box-shadow:none!important;}"}),I=(0,E.A)("div",{target:"etlee612"})("width:",(({isExpanded:e})=>e?"100%":"200px"),";display:flex;flex-direction:column;gap:0.5rem;"),L=(0,E.A)("header",{target:"etlee611"})({name:"a0377c",styles:"display:flex;align-items:center;gap:0.75rem"}),O=(0,E.A)("footer",{target:"etlee610"})({name:"2qga7i",styles:"text-align:right"}),N=(0,g.forwardRef)((function({avatar:e,label:t,slug:r},s){if(e)return(0,a.createElement)(_,{ref:s},(0,a.createElement)(C,{src:e,alt:""}));if(t){const e=b.ap[(e=>{let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r);return t})(r)%b.ap.length],n=t.split(" "),i=1===n.length?t.substring(0,2):n[0].substring(0,1).toUpperCase()+n[1].substring(0,1).toUpperCase();return(0,a.createElement)(D,{backgroundColor:e,ref:s},(0,a.createElement)(k,null,i))}return null}));function M({dashboardId:e}){const{dashboard:t}=(0,i.useSelect)((t=>({dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e)})),[e]),r=(0,m.get)(t,["_embedded","author",0]);return r?(0,a.createElement)(l.Tooltip,{text:r.name},(0,a.createElement)(N,{avatar:(0,p.getAvatarUrl)(r)})):null}var S=r(55933),z=r(89897),U=r(98616),j=r.n(U),R=r(85631),T=r.n(R),V=r(77172),P=r(47926);const $=(0,E.A)("form",{target:"e1m8toyd8"})("width:",(({isExpanded:e})=>e?"100%":"300px"),";padding:0.25rem 0.75rem;display:flex;flex-direction:column;gap:0.5rem;"),Y=(0,E.A)("header",{target:"e1m8toyd7"})({name:"p5tmle",styles:"display:flex;flex-direction:column;gap:0.5rem"}),H=(0,E.A)("section",{target:"e1m8toyd6"})({name:"vhphzh",styles:"display:flex;flex-direction:column;gap:0.5rem;margin-top:0.75rem"}),q=(0,E.A)("footer",{target:"e1m8toyd5"})("display:flex;justify-content:space-between;align-items:center;border-top:1px solid ",(({theme:e})=>e.colors.border.normal),";margin-top:1.5rem;padding-top:1.5rem;"),J=(0,E.A)(u.$n,{target:"e1m8toyd4"})({name:"1o3nkn",styles:"margin-left:auto"}),F=(0,E.A)("div",{target:"e1m8toyd3"})({name:"26en7y",styles:"display:flex;gap:0.5rem;align-items:center"}),B=(0,E.A)(P.DW,{target:"e1m8toyd2"})({name:"xer59f",styles:"flex-grow:1;input:focus{box-shadow:none;}"}),Z=(0,E.A)("section",{target:"e1m8toyd1"})({name:"p2oy12",styles:"display:flex;flex-direction:column;gap:0.25rem"}),G=(0,E.A)(u.EY,{target:"e1m8toyd0"})({name:"49aokf",styles:"display:contents"}),K=j()(((e=[])=>t=>new Promise(((r,a)=>{T()({path:(0,V.addQueryArgs)("/wp/v2/users",{search:t,per_page:100,exclude:e})}).then((e=>r(e.map((e=>({value:e.id,label:e.name,user:e})))))).catch(a)})))),W=j()(((e=[])=>[].concat(...e.map((e=>e.users||[])))));function Q({dashboardId:e,share:t={type:"user",users:[]},onChange:r}){const{suggested:s,dashboard:o}=(0,i.useSelect)((t=>({suggested:t("ithemes-security/dashboard").getSuggestedShareUsers(),dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e)})),[e]),d=W(o.sharing).concat(o.created_by),c=s.filter((e=>!d.includes(e.id)));return(0,a.createElement)(H,null,c.length>0&&(0,a.createElement)(Z,{as:"fieldset"},(0,a.createElement)(G,{as:"legend",text:(0,n.__)("Suggested Users","it-l10n-ithemes-security-pro")}),(0,a.createElement)(u.B8,null,c.map((e=>(0,a.createElement)(u.ck,{key:e.id},(0,a.createElement)(l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.name,checked:t.users.includes(e.id),onChange:a=>r(a?{...t,users:[...t.users,e.id]}:{...t,users:t.users.filter((t=>t!==e.id))})})))))),(0,a.createElement)(X,{share:t,onChange:r,suggested:s,exclude:d}))}function X({share:e,onChange:t,suggested:r,exclude:s}){const{receiveUser:o}=(0,i.useDispatch)("ithemes-security/dashboard"),[l,d]=(0,g.useState)(void 0),[c,h]=(0,g.useState)(""),m=e.users.filter((e=>!r.some((t=>t.id===e))));return(0,a.createElement)(Z,null,(0,a.createElement)(u.DZ,{level:4,size:u.$C.NORMAL,text:(0,n.__)("All Users","it-l10n-ithemes-security-pro")}),m.length>0&&(0,a.createElement)(u.B8,null,m.map((e=>(0,a.createElement)(ee,{key:e,userId:e})))),(0,a.createElement)(u.EY,{as:"label",htmlFor:"itsec-share-dashboard__add-users-select",text:(0,n.__)("Select a User","it-l10n-ithemes-security-pro")}),(0,a.createElement)(F,null,(0,a.createElement)(B,{className:"itsec-share-dashboard__add-users-select-dropdown",inputId:"itsec-share-dashboard__add-users-select",cacheOptions:!0,defaultOptions:!0,loadOptions:K(s),value:l,onChange:e=>d(e),inputValue:c,onInputChange:e=>h(e),maxMenuHeight:150,menuPlacement:"top"}),(0,a.createElement)(u.$n,{onClick:r=>{r.preventDefault(),l&&(o(l.user),t({...e,users:[...e.users,l.value]}),d(!1),h(""))},disabled:!l,text:(0,n.__)("Select","it-l10n-ithemes-security-pro"),variant:"tertiary"})))}function ee({userId:e}){const{user:t}=(0,i.useSelect)((t=>({user:t("ithemes-security/dashboard").getUser(e)})),[e]);return(0,a.createElement)(u.ck,{text:t.name})}const te=j()(((e,t)=>e.some((e=>"role"===e.type&&e.roles.includes(t)))));function re({dashboardId:e,share:t={type:"role",roles:[]},onChange:r}){const{dashboard:s,roles:o}=(0,i.useSelect)((t=>({dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e),roles:t("ithemes-security/core").getRoles()})),[e]),d=(0,m.pickBy)(o,((e,t)=>!te(s.sharing,t))),c=!(0,m.isEmpty)(d);return(0,a.createElement)(H,null,!c&&(0,a.createElement)(u.EY,{text:(0,n.__)("All roles already selected.","it-l10n-ithemes-security-pro"),variant:u.J3.MUTED}),c&&(0,a.createElement)(u.B8,null,(0,m.map)(d,((e,s)=>(0,a.createElement)(u.ck,{key:s},(0,a.createElement)(l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.label,checked:t.roles.includes(s),onChange:e=>r(e?{...t,roles:[...t.roles,s]}:{...t,roles:t.roles.filter((e=>s!==e))})}))))))}const ae=(0,m.once)((()=>[{name:"user",title:(0,n.__)("Users","it-l10n-ithemes-security-pro"),Component:Q,type:"button",count:e=>(0,n.sprintf)((0,n._n)("%d user","%d users",e.users.length,"it-l10n-ithemes-security-pro"),e.users.length)},{name:"role",title:(0,n.__)("Roles","it-l10n-ithemes-security-pro"),type:"button",Component:re,count:e=>(0,n.sprintf)((0,n._n)("%d role","%d roles",e.roles.length,"it-l10n-ithemes-security-pro"),e.roles.length)}]));function se({dashboardId:e,close:t}){const r=(0,z.useViewportMatch)("medium","<"),[s,o]=(0,g.useState)({}),{isSaving:l,dashboard:d}=(0,i.useSelect)((t=>({isSaving:t("ithemes-security/dashboard").isSavingDashboard(e),dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e)})),[e]),{saveDashboard:c}=(0,i.useDispatch)("ithemes-security/dashboard"),h=async e=>{e.preventDefault(),l||(await c({...d,sharing:[...d.sharing,...Object.values(s).filter((e=>e))]}),o({}),t())},p=ae(),b=p.reduce(((e,t)=>(s[t.name]&&e.push(t.count(s[t.name])),e)),[]);return(0,a.createElement)($,{onSubmit:h,isExpanded:r},(0,a.createElement)(Y,null,!r&&(0,a.createElement)(u.DZ,{level:3,size:u.$C.NORMAL,variant:u.J3.DARK,weight:u.uL.HEAVY,text:(0,n.__)("Share Dashboard","it-l10n-ithemes-security-pro")}),(0,a.createElement)(u.EY,{as:"p",text:(0,n.__)("Give select users read-only access to this dashboard. Great for building client portals.","it-l10n-ithemes-security-pro"),size:u.$C.SMALL,variant:u.J3.MUTED})),(0,a.createElement)(u.Kp,{tabs:p},(({name:t,Component:r=m.noop})=>(0,a.createElement)(r,{dashboardId:e,share:s[t],onChange:e=>o({...s,[t]:e})}))),(0,a.createElement)(q,null,b.length>0&&(0,a.createElement)(u.EY,{variant:u.J3.MUTED,text:(0,n.sprintf)((0,n.__)("%s selected","it-l10n-ithemes-security-pro"),b.join(", "))}),(0,a.createElement)(J,{variant:"primary",type:"submit",onClick:h,isBusy:l,disabled:l||(0,m.isEmpty)(s),text:(0,n.__)("Share","it-l10n-ithemes-security-pro")})))}function ne({dashboardId:e,userId:t,user:r}){const s=(0,z.useViewportMatch)("medium","<"),{dashboard:o}=(0,i.useSelect)((t=>({dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e)})),[e]),{saveDashboard:d}=(0,i.useDispatch)("ithemes-security/dashboard"),c=()=>{const e=[];for(const r of o.sharing)if("user"!==r.type)e.push(r);else if(r.users.includes(t)){const a={...r,users:r.users.filter((e=>e!==t))};e.push(a)}else e.push(r);d({...o,sharing:e})},h=r?r.name:(0,n.sprintf)((0,n.__)("User #%d","it-l10n-ithemes-security-pro"),t),m=(0,p.getAvatarUrl)(r);return(0,a.createElement)(l.Dropdown,{headerTitle:(0,n.sprintf)((0,n.__)("Share Settings for %s","it-l10n-ithemes-security-pro"),h),focusOnMount:"container",expandOnMobile:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,a.createElement)(l.Tooltip,{text:h},(0,a.createElement)(A,{"aria-pressed":e,"aria-label":h,onClick:t,variant:""},(0,a.createElement)(N,{avatar:m}))),renderContent:()=>(0,a.createElement)(I,{isExpanded:s},(0,a.createElement)(L,null,(0,a.createElement)(C,{src:m,alt:""}),(0,a.createElement)(u.DZ,{level:3,size:u.$C.LARGE,variant:u.J3.DARK,weight:u.uL.HEAVY,text:h})),(0,a.createElement)(O,null,(0,a.createElement)(u.$n,{variant:"tertiary",onClick:c,text:(0,n.__)("Remove","it-l10n-ithemes-security-pro")})))})}function ie({dashboardId:e,role:t}){const r=(0,z.useViewportMatch)("medium","<"),{dashboard:s,roles:o}=(0,i.useSelect)((t=>({dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e),roles:t("ithemes-security/core").getRoles()})),[e]),{saveDashboard:d}=(0,i.useDispatch)("ithemes-security/dashboard"),c=()=>{const e=[];for(const r of s.sharing)if("role"!==r.type)e.push(r);else if(r.roles.includes(t)){const a={...r,roles:r.roles.filter((e=>e!==t))};e.push(a)}else e.push(r);return d({...s,sharing:e})},h=(0,m.get)(o,[t,"label"],t);return(0,a.createElement)(l.Dropdown,{headerTitle:(0,n.sprintf)((0,n.__)("Share Settings for %s","it-l10n-ithemes-security-pro"),h),focusOnMount:"container",expandOnMobile:!0,renderToggle:({isOpen:e,onToggle:r})=>(0,a.createElement)(l.Tooltip,{text:h},(0,a.createElement)(A,{"aria-pressed":e,onClick:r,"aria-label":h,variant:""},(0,a.createElement)(N,{label:h,slug:t}))),renderContent:()=>(0,a.createElement)(I,{isExpanded:r},(0,a.createElement)(L,null,(0,a.createElement)(u.DZ,{level:3,variant:u.J3.DARK,size:u.$C.LARGE,weight:u.uL.HEAVY,text:h})),(0,a.createElement)(O,null,(0,a.createElement)(u.$n,{variant:"tertiary",onClick:c,text:(0,n.__)("Remove","it-l10n-ithemes-security-pro")})))})}function oe({dashboardId:e}){const{dashboard:t}=(0,i.useSelect)((t=>({dashboard:t("ithemes-security/dashboard").getDashboardForEdit(e)})),[e]);return(0,a.createElement)(v,null,(0,a.createElement)(l.Dropdown,{popoverProps:{position:"bottom right"},expandOnMobile:!0,focusOnMount:"container",headerTitle:(0,n.__)("Share with User","it-l10n-ithemes-security-pro"),renderToggle:({isOpen:e,onToggle:t})=>(0,a.createElement)(u.$n,{label:(0,n.__)("Share Dashboard","it-l10n-ithemes-security-pro"),"aria-pressed":e,onClick:t,icon:le,variant:"tertiary"}),renderContent:({onClose:t})=>(0,a.createElement)(se,{dashboardId:e,close:t})}),(0,a.createElement)(w,null,(0,m.get)(t,"sharing",[]).filter((e=>"user"===e.type)).map((r=>r.users.map((s=>{return(0,a.createElement)(ne,{share:r,userId:s,user:(n=s,(0,m.find)((0,m.get)(t,["_embedded","ithemes-security:shared-with"],[]),{id:n})),dashboardId:e,key:s});var n})))),(0,m.get)(t,"sharing",[]).filter((e=>"role"===e.type)).map((t=>t.roles.map((r=>(0,a.createElement)(ie,{share:t,role:r,dashboardId:e,key:r})))))))}const le=(0,a.createElement)(S.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(S.Path,{d:"M12 2.5L12 15.5M12 2.5L9 5.5M12 2.5L15 5.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.createElement)(S.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 9H7C5.89543 9 5 9.89543 5 11V18C5 19.1046 5.89543 20 7 20H17C18.1046 20 19 19.1046 19 18V11C19 9.89543 18.1046 9 17 9H15.5V10.5H17C17.2761 10.5 17.5 10.7239 17.5 11V18C17.5 18.2761 17.2761 18.5 17 18.5H7C6.72386 18.5 6.5 18.2761 6.5 18V11C6.5 10.7239 6.72386 10.5 7 10.5H8.5V9Z"}));var de=r(89959),ce=r(32196);const ue=(0,E.A)("div",{target:"eijzkqk10"})("padding:0.25rem 0.75rem;width:",(({isExpanded:e})=>e?"100%":"300px"),";display:flex;flex-direction:column;gap:0.5rem;"),he=(0,E.A)("header",{target:"eijzkqk9"})({name:"p5tmle",styles:"display:flex;flex-direction:column;gap:0.5rem"}),me=(0,E.A)("ul",{target:"eijzkqk8"})({name:"1chjzrs",styles:"display:flex;flex-direction:column;gap:0.5rem;margin:0"}),pe=(0,E.A)("footer",{target:"eijzkqk7"})({name:"zjik7",styles:"display:flex"}),ge=(0,E.A)(u.$n,{target:"eijzkqk6"})("flex:1;background-color:",(({theme:e})=>e.colors.surface.secondary),"!important;"),be=(0,ce.i7)({name:"1x91ro9",styles:"0%{opacity:.5;}25%{opacity:1;}60%{opacity:.5;}100%{opacity:.5;}"}),Ee=(0,E.A)(u.ui,{shouldForwardProp:e=>"isDeleting"!==e,target:"eijzkqk5"})("display:flex;flex-direction:column;gap:0.5rem;padding:0.75rem 0.5rem;margin:0;",(({isDeleting:e})=>e&&`animation: ${be} 3s ease-out infinite normal;`),";"),ye=(0,E.A)("header",{target:"eijzkqk4"})({name:"uq5ekw",styles:"display:flex;align-items:center;justify-content:flex-start;gap:0.75rem"}),fe=(0,E.A)(u.$n,{target:"eijzkqk3"})("font-weight:",u.uL.HEAVY,";"),xe=(0,E.A)("section",{target:"eijzkqk2"})({name:"p2oy12",styles:"display:flex;flex-direction:column;gap:0.25rem"}),ve=(0,E.A)("footer",{target:"eijzkqk1"})({name:"emb48o",styles:"display:flex;gap:0.5rem;justify-content:space-between"}),we=(0,E.A)(u.$n,{target:"eijzkqk0"})({name:"82a6rk",styles:"flex:1"});function _e({dashboard:e,currentUserId:t,close:r}){const{currentDashboard:s,isPrimary:l,isDeleting:d}=(0,i.useSelect)((t=>({currentDashboard:t("ithemes-security/dashboard").getViewingDashboardId(),isPrimary:t("ithemes-security/dashboard").getPrimaryDashboard()===e.id,isDeleting:t("ithemes-security/dashboard").isDeletingDashboard(e.id)})),[e.id]),{viewDashboard:c,setPrimaryDashboard:h,deleteDashboard:p}=(0,i.useDispatch)("ithemes-security/dashboard"),g=(0,o.decodeEntities)(e.label.rendered),b=e.id!==s&&!l&&t===e.created_by;return(0,a.createElement)(Ee,{as:"li",isDeleting:d,variant:u.ls.SECONDARY},(0,a.createElement)(ye,null,(0,a.createElement)(u.DZ,{level:4,size:u.$C.NORMAL,weight:u.uL.HEAVY},s===e.id?g:(0,a.createElement)(fe,{variant:"link",onClick:()=>{c(e.id),r()},text:g})),l&&(0,a.createElement)(u.EY,{variant:u.J3.MUTED,weight:u.uL.HEAVY,text:(0,n.__)("• Primary","it-l10n-ithemes-security-pro")})),(0,a.createElement)(xe,null,t!==e.created_by&&(0,a.createElement)(u.EY,{variant:u.J3.MUTED,text:(0,n.sprintf)((0,n.__)("Shared by %s","it-l10n-ithemes-security-pro"),(0,m.get)(e,["_embedded","author",0,"name"],(0,n.sprintf)((0,n.__)("User #%d","it-l10n-ithemes-security-pro"),e.created_by)))}),(0,a.createElement)(u.EY,{variant:u.J3.MUTED,text:(0,n.sprintf)((0,n.__)("Created on %s","it-l10n-ithemes-security-pro"),(0,de.dateI18n)("M j, Y",e.created_at))})),(!l||b)&&(0,a.createElement)(ve,null,!l&&(0,a.createElement)(we,{align:"center",variant:"tertiary",onClick:()=>h(e.id),text:(0,n.__)("Make Primary","it-l10n-ithemes-security-pro")}),b&&(0,a.createElement)(we,{align:"center",variant:"tertiary",isDestructive:!0,onClick:()=>p(e.id),text:(0,n.__)("Delete","it-l10n-ithemes-security-pro")})))}function De({close:e}){const t=(0,z.useViewportMatch)("medium","<"),{currentUserId:r,canCreate:s,dashboards:o}=(0,i.useSelect)((e=>({canCreate:e("ithemes-security/dashboard").canCreateDashboards(),dashboards:e("ithemes-security/dashboard").getAvailableDashboards(),currentUserId:e("ithemes-security/core").getCurrentUser()?.id||0})),[]),{viewCreateDashboard:l}=(0,i.useDispatch)("ithemes-security/dashboard");return(0,a.createElement)(ue,{isExpanded:t},(0,a.createElement)(he,null,!t&&(0,a.createElement)(u.DZ,{level:3,size:u.$C.NORMAL,variant:u.J3.DARK,weight:u.uL.HEAVY,text:(0,n.__)("Manage Dashboards","it-l10n-ithemes-security-pro")}),(0,a.createElement)(u.EY,{as:"p",size:u.$C.SMALL,variant:u.J3.MUTED,text:(0,n.__)("Switch, manage, or create new dashboards.","it-l10n-ithemes-security-pro")})),(0,a.createElement)(me,null,o.map((t=>(0,a.createElement)(_e,{key:t.id,dashboard:t,currentUserId:r,close:e})))),s&&(0,a.createElement)(pe,null,(0,a.createElement)(ge,{variant:"tertiary",align:"center",onClick:()=>{l(),e()},text:(0,n.__)("Create New Dashboard","it-l10n-ithemes-security-pro")})))}function ke(){const{canEdit:e,canCreate:t,dashboards:r,dashboard:s,dashboardId:m}=(0,i.useSelect)((e=>{const t=e("ithemes-security/dashboard").getViewingDashboardId();return{dashboardId:t,canEdit:t&&e("ithemes-security/dashboard").canEditDashboard(t),dashboard:t&&e("ithemes-security/dashboard").getDashboard(t),canCreate:e("ithemes-security/dashboard").canCreateDashboards(),dashboards:e("ithemes-security/dashboard").getAvailableDashboards()}}),[]),p=(0,a.createElement)(u.DZ,{level:1,size:u.$C.NORMAL,weight:u.uL.NORMAL},s?(0,o.decodeEntities)(s.label.rendered):(0,n.__)("No Dashboard Selected","it-l10n-ithemes-security-pro"));return(0,a.createElement)(h.AdminBarFill,{type:"primary"},m&&(0,a.createElement)(M,{dashboardId:m}),(0,a.createElement)("div",null,!t&&r.length<=1&&m?p:(0,a.createElement)(l.Dropdown,{popoverProps:{position:"bottom right"},headerTitle:(0,n.__)("Manage Dashboards","it-l10n-ithemes-security-pro"),expandOnMobile:!0,focusOnMount:"container",renderToggle:({isOpen:e,onToggle:t})=>(0,a.createElement)(x,{"aria-expanded":e,onClick:t,text:p,icon:e?d.A:c.A,iconPosition:"right"}),renderContent:({onClose:e})=>(0,a.createElement)(De,{dashboardId:m,close:e})})),s&&e&&(0,a.createElement)(oe,{dashboardId:m}))}function Ce(){return(0,a.createElement)(React.Fragment,null,(0,a.createElement)(ke,null))}r.p=window.itsecWebpackPublicPath,(0,n.setLocaleData)({"":{}},"it-l10n-ithemes-security-pro"),(0,s.registerPlugin)("itsec-pro-dashboard",{render:()=>(0,a.createElement)(Ce,null)})},65943:(e,t,r)=>{var a=r(36022);e.exports=function(e){var t=a(e);return Math.round((299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3)<=180?"dark":"light"}},66087:e=>{"use strict";e.exports=window.lodash},75795:e=>{"use strict";e.exports=window.ReactDOM},76154:e=>{"use strict";e.exports=window.moment},77172:e=>{e.exports=function(){return this.wp.url}()},79860:e=>{e.exports=function(){return this.wp.keycodes}()},85631:e=>{e.exports=function(){return this.wp.apiFetch}()},89897:e=>{e.exports=function(){return this.wp.compose}()},89959:e=>{e.exports=function(){return this.wp.date}()}},e=>{e.O(0,[9427,3390,2038,3733,8363,2932,3520,7926],(()=>e(e.s=65672)));var t=e.O();((window.itsec=window.itsec||{})["pro-dashboard"]=window.itsec["pro-dashboard"]||{}).dashboard=t}]);
Save File
Cancel