PageSourceSearch

https://www.planet.com/account/assets/WorkspaceDetailPage-CZuvQrDd.js

js planet.com collected 2026-09-24 09:19:58 UTC 10,476 bytes, 2 lines download raw bytes

1import{ai as se,r as o,a9 as le,ab as H,bZ as oe,b_ as ie,ae as ue,R as e,aj as ce,ak as me,l as Z,al as de,am as ge,j as P,i as s,T as _,I as Ee,B as w,a8 as pe,ar as ee,ag as be,as as ve,x as F,N as ye,ac as he,g as fe,P as m,q as Ae,u as Ce,h as Te,b as Ie,o as Re,s as _e,d as Pe,ad as ke,H as xe,b$ as Ne,aL as we,a6 as Se,a7 as d,C as qe,aF as De,y as x,e as Le,A as Me,au as Ue}from"./index-9Wgw656h.js";import{M as Oe}from"./MoreVert-C-O-FSXR.js";import{P as We}from"./validation-DzuFF1XS.js";import{r as G}from"./quota-Dn7m8qmn.js";import{T as je,a as J}from"./ToggleButtonGroup-CTimANY-.js";import{n as Be,s as Ve,E as N}from"./entitlements-CXKZyyty.js";import{d as Y}from"./dates-B1eCd1nJ.js";import{u as ze}from"./useCustomerAccount-CuQB-z7s.js";import{u as Fe}from"./useProductAccesses-DUGRpjNZ.js";import{T as Ge,a as Qe,b as K,c as Xe}from"./TableRow-CfQ-GldV.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="fd483979-95ad-4e24-9e73-d256524fe65d",t._sentryDebugIdIdentifier="sentry-dbid-fd483979-95ad-4e24-9e73-d256524fe65d")}catch{}})();const $e=t=>{const n=t??{};return JSON.stringify(n,Object.keys(n).sort())},He=t=>{const n=se(),l=o.useRef({fingerprint:null,key:null});return le(i=>{const b=$e(i);return l.current.fingerprint!==b&&(l.current={fingerprint:b,key:oe()}),ie(t,i,l.current.key)},{onSuccess:()=>{n.invalidateQueries(["productAccesses"]),n.invalidateQueries(["productAccessUsage",t]),n.invalidateQueries(["productAccessLedgerEntries",t]),H("Usage adjustment applied",{productAccessId:t})},onError:i=>{H("Usage adjustment error",{productAccessId:t,message:i?.message})}})},Je=["Accidental Usage","Converting Quota To Another Product","E&R Complimentary Reset","Pending Renewal","Planeeter Usage","Tasked Imagery Dispute Resolution","Tasking With Manual Tesselation","Technical Issue","Other"],te=({open:t,onClose:n,productAccess:l})=>{const[i,b]=o.useState("reverse"),[h,S]=o.useState(""),[v,q]=o.useState(""),[y,D]=o.useState(""),[g,Q]=o.useState(""),[E,L]=o.useState(""),[M,f]=o.useState(""),[U,A]=o.useState(null),p=l.quota_units,C=l.quota_used===null||l.quota_used===void 0?null:Number(l.quota_used),a=h===""?null:Number(h),k=a!==null&&isNaN(a),T=a!==null&&!isNaN(a)&&!Number.isInteger(a),c=a!==null&&a<=0,u=a===null||k?null:i==="reverse"?-Math.abs(a):Math.abs(a),O=v===""?null:Number(v),j=O!==null&&Number.isInteger(O)&&O>0,B=We.test(g.trim()),V=ue.test(E.trim()),I=M.trim().length,X=I>=5&&I<=500,ae=u!==null&&!T&&!c&&j&&!!y&&B&&V&&X,{mutate:ne,isLoading:R}=He(l.id),z=()=>{R||n()},re=()=>{A(null),ne({amount:u,line_item_id:O,reason:y,note:M.trim(),support_ticket_ref:E.trim(),pl_number:g.trim()},{onSuccess:()=>n(),onError:r=>A(he(fe(r)))})},$=C!==null&&u!==null&&!c?Math.max(0,C+u):null;return e.createElement(e.Fragment,null,e.createElement(ce,{open:t,onClose:(r,W)=>{W!=="backdropClick"&&z()},maxWidth:"sm",fullWidth:!0},e.createElement(me,null,"Usage Reversal",e.createElement(Z,{"aria-label":"close",onClick:z,disabled:R,sx:{position:"absolute",right:8,top:8}},e.createElement(de,null))),e.createElement(ge,null,e.createElement(P,{spacing:3,sx:{mt:1}},e.createElement(s,{variant:"body2",color:"text.secondary"},"Adjusts recorded usage for"," ",e.createElement("strong",null,l.title||l.name)," on the Usage API. Applies at the bucket level and shows as a usage adjustment on customer reporting."),e.createElement(je,{exclusive:!0,color:"primary",value:i,onChange:(r,W)=>W&&b(W),size:"small",fullWidth:!0},e.createElement(J,{value:"reverse","data-qa-id":"usage-reverse"},"Reverse (reduce usage)"),e.createElement(J,{value:"add","data-qa-id":"usage-add"},"Add usage")),e.createElement(_,{label:"Line item ID",type:"number",value:v,onChange:r=>{q(r.target.value),A(null)},inputProps:{min:1,step:1},error:v!==""&&!j,helperText:v!==""&&!j?"Enter a positive whole number.":"The line item this adjustment applies to.",fullWidth:!0,required:!0,"data-qa-id":"usage-line-item-id"}),e.createElement(_,{label:"Amount",type:"number",value:h,onChange:r=>{S(r.target.value),A(null)},InputProps:{endAdornment:p?e.createElement(Ee,{position:"end"},p):void 0},error:k||T||c,helperText:k?"Enter a valid number.":T?"Enter a whole number.":c?"Enter a positive amount.":"Amount to apply, as a positive number.",fullWidth:!0,required:!0}),e.createElement(w,{sx:r=>({borderRadius:1,border:`1px solid ${r.palette.divider}`,p:2,bgcolor:"grey.50"})}
1,e.createElement(s,{variant:"subtitle2",display:"block",mb:1},"Usage preview"),e.createElement(P,{spacing:.5},e.createElement(P,{direction:"row",justifyContent:"space-between"},e.createElement(s,{variant:"body2",color:"text.secondary"},"Recorded usage (this product)"),e.createElement(s,{variant:"body2"},C!==null?G(C,p):"Unavailable")),e.createElement(P,{direction:"row",justifyContent:"space-between"},e.createElement(s,{variant:"body2",color:"text.secondary"},"Change"),e.createElement(s,{variant:"body2",color:u===null||c?"text.primary":u<0?"success.main":"warning.main"},u===null||c?"—":`${u>0?"+":""}${u.toLocaleString()} ${p??""}`)),e.createElement(pe,{sx:{my:.5}}),e.createElement(P,{direction:"row",justifyContent:"space-between"},e.createElement(s,{variant:"body2",fontWeight:600},"Projected usage"),e.createElement(s,{variant:"body2",fontWeight:600},$!==null?G($,p):"—")))),e.createElement(_,{select:!0,label:"Reason",value:y,onChange:r=>D(r.target.value),fullWidth:!0,required:!0,"data-qa-id":"usage-reason"},Je.map(r=>e.createElement(ee,{key:r,value:r},r))),e.createElement(_,{label:"Opportunity ID",value:g,onChange:r=>Q(r.target.value),placeholder:"PL-1234567",error:!!g.trim()&&!B,helperText:g.trim()&&!B?be:"Format: PL-XXXXXXX, PL-OTHER or PL-OVERAGE",fullWidth:!0,required:!0}),e.createElement(_,{label:"Support ticket ref",value:E,onChange:r=>L(r.target.value),placeholder:"CGO-1234",error:!!E.trim()&&!V,helperText:E.trim()&&!V?"Must match format PROJECT-1234 (e.g. CGO-1234)":"Format: PROJECT-1234 (e.g. CGO-1234)",fullWidth:!0,required:!0}),e.createElement(_,{label:"Notes",value:M,onChange:r=>f(r.target.value),multiline:!0,minRows:3,error:I>0&&!X,helperText:I>500?"Notes must be 500 characters or fewer.":I>0&&I<5?"Notes must be at least 5 characters.":" ",inputProps:{maxLength:500},fullWidth:!0,required:!0}),U&&e.createElement(s,{color:"error",variant:"body2"},U))),e.createElement(ve,null,e.createElement(F,{onClick:z,variant:"outlined",disabled:R},"Cancel"),e.createElement(F,{color:"primary",onClick:re,variant:"contained",disabled:!ae||R},R?"Saving…":"Apply adjustment"))),e.createElement(ye,{open:R,message:"Applying usage adjustment…",progress:!0}))};te.propTypes={onClose:m.func.isRequired,open:m.bool.isRequired,productAccess:m.shape({id:m.oneOfType([m.string,m.number]).isRequired,title:m.string,name:m.string,quota_units:m.string,quota_used:m.number}).isRequired};const Ye={[N.ACTIVE]:"Active",[N.PENDING]:"Pending",[N.EXPIRED]:"Expired",[N.INACTIVE]:"Inactive",[N.ERROR]:"Error"},Ke=t=>{const n=Be(t);return{label:Ye[n]??n,color:Ve[n]}},Ze=t=>["active","pending"].includes((t.state||"").toLowerCase()),ct=()=>{const{accountId:t,workspaceId:n}=Ae(),l=Ce(),i=Te(l,[Le.planet_admin]),{showUsageReversal:b}=Ie(),[h,S]=o.useState(null),[v,q]=o.useState(null),[y,D]=o.useState(null),g=()=>{S(null),q(null)},E=ze(t,{keepPreviousData:!0,enabled:i&&!!t}).data?.name,L=Re({queryKey:["workspaces-for-ca",t],queryFn:()=>Ue(t),enabled:i&&!!t}),f=o.useMemo(()=>(L.data?.workspaces??[]).find(a=>a.workspace_id===n),[L.data,n])?.name||"Workspace",{data:U,isLoading:A}=Fe({customerAccountId:t,workspaceId:n,limit:200,state:[x.ACTIVE,x.PENDING,x.INACTIVE,x.DEACTIVATED,x.EXPIRED]},{enabled:i&&!!t&&!!n}),p=U?.results??[],C=o.useMemo(()=>[{label:"All Accounts",url:_e},{label:E??"...",url:Pe(Me,{accountId:t})},{label:f}],[E,t,f]);return i?e.createElement(w,{sx:{paddingBottom:8}},e.createElement(xe,{name:f,breadcrumbs:C,helmetTitle:f},e.createElement(F,{variant:"outlined",size:"small",component:"a",href:`${Ne}
1#/workspaces/${n}/info`,target:"_blank",rel:"noopener noreferrer",endIcon:e.createElement(we,{fontSize:"small"})},"Open in Account Manager")),e.createElement(w,{sx:{mt:2}},e.createElement(s,{variant:"caption",color:"text.secondary"},"Workspace ID"),e.createElement(s,{variant:"body2",sx:{fontFamily:"monospace"}},n)),e.createElement(w,{sx:{mt:4}},e.createElement(s,{variant:"subtitle1",fontWeight:700,sx:{mb:1}},"Products"),A?e.createElement(P,{direction:"row",spacing:1,alignItems:"center",sx:{p:2}},e.createElement(Se,{size:16}),e.createElement(s,{variant:"body2",color:"text.secondary"},"Loading products…")):p.length===0?e.createElement(s,{variant:"body2",color:"text.secondary",sx:{p:2}},"No products allocated to this workspace."):e.createElement(Ge,{size:"small"},e.createElement(Qe,null,e.createElement(K,null,e.createElement(d,null,"Product"),e.createElement(d,null,"Status"),e.createElement(d,null,"Remaining"),e.createElement(d,null,"Term"),b&&e.createElement(d,{align:"right"},"Actions"))),e.createElement(Xe,null,p.map(a=>{const{label:k,color:T}=Ke(a.state),c=!Ze(a);return e.createElement(K,{key:a.id},e.createElement(d,null,e.createElement(s,{variant:"body2",fontWeight:600,color:c?"text.secondary":void 0},a.title||a.name)),e.createElement(d,null,e.createElement(qe,{label:k,size:"small",variant:"outlined",color:T,sx:{height:20,fontSize:"0.65rem",...T?{}:{color:"text.secondary",borderColor:"divider"}}})),e.createElement(d,null,e.createElement(s,{variant:"body2",color:c?"text.secondary":void 0},a.unlimited_quota?"Unlimited":a.quota_total===null||a.quota_total===void 0?"N/A":G(a.quota_total-(a.quota_used??0),a.quota_units))),e.createElement(d,null,e.createElement(s,{variant:"body2",color:c?"text.secondary":void 0},a.term_start_date?`${Y(a.term_start_date)} — ${Y(a.term_end_date)}`:"—")),b&&e.createElement(d,{align:"right"},a.billable_id?e.createElement(Z,{size:"small","aria-label":"Product actions",onClick:u=>{S(u.currentTarget),q(a)}},e.createElement(Oe,{fontSize:"small"})):null))})))),e.createElement(De,{anchorEl:h,open:!!h,onClose:g},e.createElement(ee,{onClick:()=>{D(v),g()}},"Usage Reversal")),y&&e.createElement(te,{open:!!y,onClose:()=>D(null),productAccess:y})):e.createElement(w,{sx:{p:3}},e.createElement(ke,{severity:"error"},"You do not have permission to view this page."))};export{ct as default};
2//# sourceMappingURL=WorkspaceDetailPage-CZuvQrDd.js.map

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.