1import{a as fe}from"./chunk-WHSJJMOJ.js";import{c as de,e as ce,f as me,g as pe}from"./chunk-TK4DKRWU.js";import{a as ue}from"./chunk-XNJ5BSKT.js";import"./chunk-UMFSKVZM.js";import{a as _e}from"./chunk-YCRDECOZ.js";import{a as ne,d as oe,e as ae}from"./chunk-4FJXWWPT.js";import{d as re,e as le}from"./chunk-FJJQCU44.js";import{b as Y,j as Z,k as ee}from"./chunk-A422LJYW.js";import{E as X,c as H,g as J,k as K}from"./chunk-I2ZQPYHJ.js";import{b as te,c as ie}from"./chunk-4ENPQIEB.js";import"./chunk-BBBJXA35.js";import"./chunk-COGEBLKE.js";import{a as xe,b as ge}from"./chunk-ZLHHNCJA.js";import"./chunk-HMLD3BCZ.js";import{a as se}from"./chunk-A4AA4XKW.js";import{e as G}from"./chunk-WQ76NSOS.js";import"./chunk-V6B32SJW.js";import{G as Q,w as z}from"./chunk-EVRR4WXF.js";import{Aa as h,Ac as y,Ba as v,Db as x,Hb as p,Jb as F,Lc as j,Ob as _,Qb as D,Rb as S,Sb as k,Tb as i,Ub as o,Vb as f,Zb as E,dc as w,ea as M,fc as c,ib as l,ka as C,lc as V,mc as $,nc as R,pa as q,pc as r,qc as b,rc as u,sc as A,tc as L,vc as P,wc as B,xc as U,y as N,zc as W}from"./chunk-OXBTZIQQ.js";import"./chunk-XAWEAAUQ.js";var he=(()=>{let s=class s{constructor(){this._http=C(Q),this._url=se.apiUrl+"/subscription/admin/upgrade-requests"}pending(){return this._http.get(this._url)}approve(a,n){return this._http.post(`${this._url}/${a}/approve`,{note:n?.trim()||null})}deny(a,n){return this._http.post(`${this._url}/${a}/deny`,{note:n?.trim()||null})}};s.\u0275fac=function(n){return new(n||s)},s.\u0275prov=M({token:s,factory:s.\u0275fac,providedIn:"root"});let e=s;return e})();var be=["decisionDialog"],ve=(e,s)=>s.id,Ee=()=>["../organizations"],I=()=>["../users"];function ye(e,s){if(e&1){let t=E();i(0,"div",2),f(1,"mat-icon",5),i(2,"span"),r(3),o(),i(4,"button",6),w("click",function(){h(t);let n=c();return v(n.notice="")}),f(5,"mat-icon",7),o()()}if(e&2){let t=c();l(),p("svgIcon","heroicons_outline:check-circle"),l(2),b(t.notice),l(2),p("svgIcon","heroicons_outline:x-mark")}}function Se(e,s){if(e&1&&(i(0,"div",3),f(1,"mat-icon",5),i(2,"span"),r(3),o()()),e&2){let t=c();l(),p("svgIcon","heroicons_outline:exclamation-triangle"),l(2),b(t.loadError)}}function ke(e,s){e&1&&(i(0,"div",4),f(1,"mat-progress-spinner",8),i(2,"span",9),r(3,"Loading the console\u2026"),o()())}function Ae(e,s){if(e&1&&r(0),e&2){let t=c(2);A(" ",t.requests.length," ",t.requests.length===1?"upgrade request":"upgrade requests"," to decide ")}}function Ie(e,s){e&1&&r(0," Nothing to decide ")}function Te(e,s){e&1&&f(0,"mat-progress-spinner",16)}function Oe(e,s){e&1&&f(0,"mat-icon",7),e&2&&p("svgIcon","heroicons_outline:arrow-path")}function Ne(e,s){e&1&&(i(0,"div",17),f(1,"mat-icon",25),i(2,"span"),r(3,"No open upgrade requests."),o()()),e&2&&(l(),p("svgIcon","heroicons_outline:check-circle"))}function Me(e,s){if(e&1&&(i(0,"span",31),r(1),o()),e&2){let t=c().$implicit,a=c(3);l(),u(" waiting ",a.waitingFor(t)," ")}}function qe(e,s){if(e&1&&(i(0,"span"),r(1),o()),e&2){let t=c().$implicit,a=c(3);l(),u(" \xB7 waiting ",a.waitingFor(t),"")}}function Fe(e,s){if(e&1&&(i(0,"blockquote",34),r(1),o()),e&2){let t=c().$implicit;l(),u(" ",t.requestNote," ")}}function De(e,s){if(e&1){let t=E();i(0,"li",26)(1,"div",27)(2,"div",28)(3,"span",29),r(4),o(),i(5,"span",30),r(6," wants Enterprise "),o(),x(7,Me,2,1,"span",31),o(),i(8,"p",32),r(9),i(10,"span",33),r(11),o(),x(12,qe,2,1,"span"),o(),x(13,Fe,2,1,"blockquote",34),o(),i(14,"div",35)(15,"button",36),w("click",function(){let n=h(t).$implicit,m=c(3);return v(m.open(n,"deny"))}),r(16," Decline "),o(),i(17,"button",37),w("click",function(){let n=h(t).$implicit,m=c(3);return v(m.open(n,"approve"))}),r(18," Approve "),o()()()}if(e&2){let t=s.$implicit,a=c(3);l(4),u(" ",t.organisationName||"Unnamed organisation"," "),l(3),_(a.isStale(t)?7:-1),l(2),u(" Asked by ",t.requestedByEmail||"someone"," "),l(),p("matTooltip",a.formatInstant(t.requestedAt)),l(),u(" on ",a.formatDate(t.requestedAt),""),l(),_(!a.isStale(t)&&a.waitingFor(t)?12:-1),l(),_(t.requestNote?13:-1)}}function Ve(e,s){if(e&1&&(i(0,"ul",18),S(1,De,19,7,"li",26,ve),o()),e&2){let t=c(2);l(),k(t.requests)}}function $e(e,s){if(e&1&&r(0),e&2){let t=c(2);A(" ",t.warnCount," ",t.warnCount===1?"thing needs":"things need"," attention ")}}function Re(e,s){e&1&&r(0," Nothing needs attention ")}function Le(e,s){e&1&&(i(0,"div",17),f(1,"mat-icon",25),i(2,"span"),r(3,"No access-model or account problems found."),o()()),e&2&&(l(),p("svgIcon","heroicons_outline:check-circle"))}function Pe(e,s){if(e&1&&(i(0,"li",42),r(1),o()),e&2){let t=s.$implicit;l(),u(" ",t," ")}}function Be(e,s){if(e&1&&(i(0,"li",38),f(1,"mat-icon",39),i(2,"div",27)(3,"p",29),r(4),i(5,"span",40),r(6),o()(),i(7,"p",32),r(8),o(),i(9,"ul",41),S(10,Pe,2,1,"li",42,D),o()()()),e&2){let t=s.$implicit;l(),F("text-amber-600",t.severity==="warn")("text-[#898989]",t.severity==="info"),p("svgIcon",t.severity==="warn"?"heroicons_outline:exclamation-triangle":"heroicons_outline:information-circle"),l(3),u(" ",t.title," "),l(2),u("\xB7 ",t.accounts.length,""),l(2),b(t.detail),l(2),k(t.accounts)}}function Ue(e,s){if(e&1&&(i(0,"ul",18),S(1,Be,12,8,"li",38,ve),o()),e&2){let t=c(2);l(),k(t.findings)}}function We(e,s){if(e&1){let t=E();i(0,"section",10)(1,"div",11)(2,"div",12)(3,"h2",13),r(4," Waiting on you "),o(),i(5,"p",14),x(6,Ae,1,2)(7,Ie,1,0),o()(),i(8,"button",15),w("click",function(){h(t);let n=c();return v(n.load(!0))}),x(9,Te,1,0,"mat-progress-spinner",16)(10,Oe,1,1,"mat-icon",7),o()(),x(11,Ne,4,1,"div",17)(12,Ve,3,0,"ul",18),o(),i(13,"section",10)(14,"div",19)(15,"h2",13),r(16," Findings "),o(),i(17,"p",14),x(18,$e,1,2)(19,Re,1,0),o()(),x(20,Le,4,1,"div",17)(21,Ue,3,0,"ul",18),o(),i(22,"section",20)(23,"a",21)(24,"p",22),r(25," Organisations "),o(),i(26,"p",23),r(27),o(),i(28,"p",24),r(29),o()(),i(30,"a",21)(31,"p",22),r(32," Customer accounts "),o(),i(33,"p",23),r(34),o(),i(35,"p",24),r(36,"excludes Symbol staff"),o()(),i(37,"a",21)(38,"p",22),r(39," Symbol staff "),o(),i(4
10,"p",23),r(41),o(),i(42,"p",24),r(43,"outside the customer plan model"),o()(),i(44,"a",21)(45,"p",22),r(46," Pending email "),o(),i(47,"p",23),r(48),o(),i(49,"p",24),r(50,"signed up, cannot sign in yet"),o()()()}if(e&2){let t=c();l(6),_(t.requests.length?6:7),l(2),p("disabled",t.refreshing),l(),_(t.refreshing?9:10),l(2),_(t.requests.length?12:11),l(7),_(t.warnCount?18:19),l(2),_(t.findings.length?21:20),l(3),p("routerLink",y(17,Ee)),l(4),u(" ",t.counts.organisations," "),l(2),L(" ",t.counts.byPlan.enterprise," enterprise \xB7 ",t.counts.byPlan.trial," trial \xB7 ",t.counts.byPlan.public," public "),l(),p("routerLink",y(18,I)),l(4),u(" ",t.counts.users," "),l(3),p("routerLink",y(19,I)),l(4),u(" ",t.counts.staff," "),l(3),p("routerLink",y(20,I)),l(4),u(" ",t.counts.pendingVerification," ")}}function je(e,s){if(e&1&&(i(0,"p",9),r(1," Move "),i(2,"b",49),r(3),o(),r(4," to "),i(5,"b",49),r(6,"Enterprise"),o(),r(7," and close this request. "),o(),i(8,"p",50),r(9," Everyone in the organisation gets the new ceiling. They pick it up on their next token \u2014 a signed-in user may need to sign in again. "),o()),e&2){let t=c(3);l(3),b(t.pending.request.organisationName||"this organisation")}}function ze(e,s){if(e&1&&(i(0,"p",9),r(1," Decline the request from "),i(2,"b",49),r(3),o(),r(4,". "),o(),i(5,"p",50)(6,"b"),r(7,"Nothing is taken away."),o(),r(8," A declined upgrade does not end a trial or change what they have today \u2014 asking must never cost them something. "),o()),e&2){let t=c(3);l(3),b(t.pending.request.organisationName||"this organisation")}}function Qe(e,s){e&1&&r(0," Saving\u2026 ")}function Ge(e,s){if(e&1&&r(0),e&2){let t=c(3);u(" ",t.pending.action==="approve"?"Approve":"Decline"," ")}}function He(e,s){if(e&1){let t=E();i(0,"h2",43),r(1),o(),i(2,"mat-dialog-content"),x(3,je,10,1)(4,ze,9,1),i(5,"mat-form-field",44)(6,"mat-label"),r(7,"Note (optional)"),o(),i(8,"input",45),U("ngModelChange",function(n){h(t);let m=c(2);return B(m.decisionNote,n)||(m.decisionNote=n),v(n)}),o()()(),i(9,"mat-dialog-actions",46)(10,"button",47),w("click",function(){h(t);let n=c(2);return v(n.close())}),r(11,"Cancel"),o(),i(12,"button",48),w("click",function(){h(t);let n=c(2);return v(n.confirm())}),x(13,Qe,1,0)(14,Ge,1,1),o()()}if(e&2){let t=c(2);l(),u(" ",t.pending.action==="approve"?"Approve upgrade":"Decline upgrade"," "),l(2),_(t.pending.action==="approve"?3:4),l(5),P("ngModel",t.decisionNote),l(2),p("disabled",t.saving),l(2),p("disabled",t.saving),l(),_(t.saving?13:14)}}function Je(e,s){if(e&1&&x(0,He,15,6),e&2){let t=c();_(t.pending?0:-1)}}var Ce=(()=>{let s=class s{constructor(){this._upgrades=C(he),this._subscriptions=C(fe),this._users=C(_e),this._dialog=C(de),this.loading=!0,this.refreshing=!1,this.loadError="",this.notice="",this.requests=[],this.organisations=[],this.users=[],this.findings=[],this.counts={organisations:0,users:0,staff:0,pendingVerification:0,byPlan:{public:0,trial:0,enterprise:0}},this.pending=null,this.decisionNote="",this.saving=!1}ngOnInit(){this.load()}load(a=!1){a?this.refreshing=!0:this.loading=!0,this.loadError="",N({requests:this._upgrades.pending(),organisations:this._subscriptions.organisations(),users:this._users.getAllUsers()}).subscribe({next:({requests:n,organisations:m,users:g})=>{this.requests=n??[],this.organisations=m??[],this.users=g??[],this.recompute(),this.loading=!1,this.refreshing=!1},error:n=>{console.error("Failed to load the admin overview:",n),this.loadError="Could not load the console overview.",this.loading=!1,this.refreshing=!1}})}recompute(){this.counts={organisations:this.organisations.length,users:this.users.filter(d=>!this.isStaff(d)).length,staff:this.users.filter(d=>this.isStaff(d)).length,pendingVerification:this.users.filter(d=>(d.status??"").toUpperCase()==="EMAIL_VERIFICATION").length,byPlan:{public:this.organisations.filter(d=>d.plan==="public").length,trial:this.organisations.filter(d=>d.plan==="trial").length,enterprise:this.organisations.filter(d=>d.plan==="enterprise").length}};let a=[],n=this.users.filter(d=>this.isStaff(d)&&!!d.organisation).map(d=>d.email);n.length&&a.push({id:"misplaced-staff",severity:"warn",title:"Symbol staff inside a customer organisation",detail
1:"These accounts inherit that customer\u2019s plan ceiling, so they see the customer\u2019s product rather than ours. Move them out of the organisation.",accounts:n});let m=this.users.filter(d=>!this.isStaff(d)&&!d.functionalRole).map(d=>d.email);m.length&&a.push({id:"no-functional-role",severity:"warn",title:"Accounts with no functional role",detail:"A missing functional role is read as write-nothing, so these people can see their screens and change nothing \u2014 whatever plan they are on.",accounts:m});let g=new Set(this.users.filter(d=>(d.orgRole??"").toUpperCase()==="ORG_OWNER").map(d=>d.organisation?.id).filter(d=>d!=null)),T=this.organisations.filter(d=>d.memberCount>0&&!g.has(d.id)).map(d=>d.name??`Organisation ${d.id}`);T.length&&a.push({id:"no-owner",severity:"warn",title:"Organisations with no owner",detail:"Administration is gated on ORG_OWNER, so nobody inside these can invite anyone or manage roles \u2014 and nobody inside can fix it either.",accounts:T});let O=this.users.filter(d=>(d.status??"").toUpperCase()==="EMAIL_VERIFICATION").map(d=>d.email);O.length&&a.push({id:"pending-verification",severity:"info",title:"Accounts waiting on email verification",detail:"Signed up but have not followed the activation link, so they cannot sign in yet. Normal for a recent signup; worth a look if it is old.",accounts:O}),this.findings=a}isStaff(a){let n=(a.role?.role??"").toUpperCase();return n==="ADMIN"||n==="SUPER_ADMIN"}get warnCount(){return this.findings.filter(a=>a.severity==="warn").length}formatDate(a){if(!a)return"\u2014";let n=new Date(a);return Number.isNaN(n.getTime())?"\u2014":n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}formatInstant(a){if(!a)return"Not recorded";let n=new Date(a);return Number.isNaN(n.getTime())?"Not recorded":n.toLocaleString()}waitingFor(a){if(!a.requestedAt)return"";let n=new Date(a.requestedAt).getTime();if(Number.isNaN(n))return"";let m=Math.floor((Date.now()-n)/864e5);return m<=0?"today":m===1?"1 day":`${m} days`}isStale(a){if(!a.requestedAt)return!1;let n=new Date(a.requestedAt).getTime();return!Number.isNaN(n)&&Date.now()-n>3*864e5}open(a,n){this.pending={request:a,action:n},this.decisionNote="",this._dialog.open(this.decisionDialog,{width:"520px"})}confirm(){if(!this.pending)return;let{request:a,action:n}=this.pending;this.saving=!0,(n==="approve"?this._upgrades.approve(a.id,this.decisionNote):this._upgrades.deny(a.id,this.decisionNote)).subscribe({next:()=>{this.saving=!1,this.pending=null,this._dialog.closeAll();let g=a.organisationName??"That organisation";this.notice=n==="approve"?`${g} is now on Enterprise.`:`The request from ${g} was declined. Nothing was taken away.`,this.load(!0)},error:g=>{console.error(`Failed to ${n} the upgrade request:`,g),this.saving=!1,this.loadError=`Could not ${n} that request.`,this.pending=null,this._dialog.closeAll()}})}close(){this.pending=null,this._dialog.closeAll()}};s.\u0275fac=function(n){return new(n||s)},s.\u0275cmp=q({type:s,selectors:[["app-admin-overview"]],viewQuery:function(n,m){if(n&1&&V(be,5),n&2){let g;$(g=R())&&(m.decisionDialog=g.first)}},standalone:!0,features:[W],decls:7,vars:3,consts:[["decisionDialog",""],[1,"flex","min-w-0","flex-auto","flex-col","gap-6","p-6","sm:p-8"],["role","status",1,"flex","items-center","gap-2","rounded-xl","bg-green-50","px-4","py-3","text-green-800","dark:bg-green-900/20","dark:text-green-200"],["role","alert",1,"flex","items-center","gap-2","rounded-xl","bg-red-50","px-4","py-3","text-red-800","dark:bg-red-900/20","dark:text-red-200"],[1,"flex","items-center","gap-3","px-2","py-12"],[1,"icon-size-5","text-current",3,"svgIcon"],["mat-icon-button","","aria-label","Dismiss",1,"ml-auto",3,"click"],[1,"icon-size-5",3,"svgIcon"],["diameter","24","mode","indeterminate"],[1,"text-[#898989]"],[1,"overflow-hidden","rounded-2xl","bg-white","shadow","dark:bg-[#121212]"],[1,"flex","flex-col","gap-3","border-b","bg-[#E5E5E5]","p-6","dark:bg-[#000000]","sm:flex-row","sm:items-center","sm:justify-between"],[1,"flex","min-w-0","flex-col"],[1,"text-lg","font-semibold","text-[#000000]","dark:text-[#E5E5E5]"],[1,"text-sm","text-[#898989]"],["mat-icon-button","","matTooltip","Refresh","aria-label","Refresh",3,"click","disabled"],["diameter","20","mode","indeterminate"],[1,"flex","items-center","gap-3","px-6","py-8","text-[#898989]"],[1,"divi
1de-y"],[1,"flex","flex-col","gap-1","border-b","bg-[#E5E5E5]","p-6","dark:bg-[#000000]"],[1,"grid","grid-cols-2","gap-4","lg:grid-cols-4"],[1,"rounded-2xl","bg-white","p-5","shadow","transition","hover:shadow-md","dark:bg-[#121212]",3,"routerLink"],[1,"text-xs","font-semibold","uppercase","tracking-wide","text-[#898989]"],[1,"mt-1","text-3xl","font-bold","tabular-nums","text-[#000000]","dark:text-[#E5E5E5]"],[1,"mt-2","text-xs","text-[#898989]"],[1,"icon-size-6","text-green-600",3,"svgIcon"],[1,"flex","flex-col","gap-4","p-6","lg:flex-row","lg:items-start","lg:justify-between"],[1,"min-w-0","flex-1"],[1,"flex","flex-wrap","items-center","gap-2"],[1,"font-medium","text-[#000000]","dark:text-[#E5E5E5]"],[1,"rounded-full","bg-amber-100","px-2","py-0.5","text-xs","font-semibold","text-amber-800","dark:bg-amber-900/30","dark:text-amber-300"],["matTooltip","This has been waiting more than three days",1,"rounded-full","bg-red-100","px-2","py-0.5","text-xs","font-semibold","text-red-800","dark:bg-red-900/30","dark:text-red-300"],[1,"mt-1","text-sm","text-[#898989]"],[3,"matTooltip"],[1,"mt-3","border-l-2","border-[#F83D1D]","pl-3","text-sm","italic","text-[#898989]"],[1,"flex","shrink-0","items-center","gap-2"],["mat-stroked-button","",1,"rounded-md",3,"click"],["mat-flat-button","",1,"rounded-md",2,"background-color","#f83d1d","color","white",3,"click"],[1,"flex","gap-4","p-6"],[1,"icon-size-6","mt-0.5","shrink-0",3,"svgIcon"],[1,"font-normal","text-[#898989]"],[1,"mt-2","flex","flex-wrap","gap-2"],[1,"rounded-full","bg-[#E5E5E5]","px-2","py-0.5","text-xs","text-[#000000]","dark:bg-[#000000]","dark:text-[#E5E5E5]"],["mat-dialog-title",""],["subscriptSizing","dynamic",1,"mt-4","w-full"],["matInput","","autocomplete","off","placeholder","Why, for whoever reads this later",3,"ngModelChange","ngModel"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",1,"rounded-md",2,"background-color","#f83d1d","color","white",3,"click","disabled"],[1,"text-[#000000]","dark:text-[#E5E5E5]"],[1,"mt-2","text-sm","text-[#898989]"]],template:function(n,m){n&1&&(i(0,"div",1),x(1,ye,6,3,"div",2)(2,Se,4,2,"div",3)(3,ke,4,0,"div",4)(4,We,51,21),o(),x(5,Je,1,1,"ng-template",null,0,j)),n&2&&(l(),_(m.notice?1:-1),l(),_(m.loadError?2:-1),l(),_(m.loading?3:4))},dependencies:[z,X,H,J,K,G,ae,ne,oe,pe,me,ce,ee,Z,Y,ie,te,le,re,ge,xe,ue],encapsulation:2});let e=s;return e})();var kt=[{path:"",component:Ce}];export{kt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.