PageSourceSearch

https://console.dojops.ai/_next/static/chunks/app/settings/licenses/page-af824e0fe660ce1f.js

js dojops.ai collected 2026-10-05 15:21:13 UTC 35,863 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9091],{3125:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var r=s(8579),a=s(1987),n=s(3936),l=s(8940),i=s(5066),o=s(5826),c=s(6656),d=s(2242),x=s(6563),m=s(1686),b=s(7650),h=s(8652),u=s(2843),p=s(381),g=s(6258),f=s(7764),y=s(4046),j=s(5573),N=s(8464),v=s(7445),w=s(3114);let k=/^DOJOPS-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/,X=["checkout.stripe.com","billing.stripe.com"];function A(e){try{let t=new URL(e);return"https:"===t.protocol&&X.some(e=>t.hostname===e||t.hostname.endsWith(".".concat(e)))}catch(e){return!1}}function C(){let e=(0,n.useSearchParams)().get("checkout"),[t,s]=(0,a.useState)([]),[N,v]=(0,a.useState)(!0),[w,X]=(0,a.useState)("MONTHLY"),[C,I]=(0,a.useState)(null),[L,D]=(0,a.useState)(!1),[F,T]=(0,a.useState)(!1),[R,U]=(0,a.useState)(""),[Y,J]=(0,a.useState)(""),[_,M]=(0,a.useState)(null),[q,V]=(0,a.useState)(""),[H,z]=(0,a.useState)(""),[G,Z]=(0,a.useState)(""),[B,W]=(0,a.useState)(!1),$=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/sa-licenses");if(e.ok){let t=await e.json();s(t.licenses||[])}}catch(e){}finally{v(!1)}},[]);async function K(e,t,s){if("OFFLINE"===t&&!s){U(""),J(""),T(!0);return}I("".concat(e,"_").concat(t));try{let r={plan:e,period:w,mode:t};s&&(r.serverId=s);let a=await fetch("/api/sa-licenses/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await a.json();a.ok&&n.url&&A(n.url)&&(window.location.href=n.url)}catch(e){}finally{I(null)}}async function Q(){if(_){if(!k.test(q))return void Z("Invalid format. Use: DOJOPS-XXXX-XXXX-XXXX-XXXX");W(!0),Z("");try{let e=await fetch("/api/sa-licenses/offline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseId:_.licenseId,serverId:q})}),t=await e.json();e.ok?(z(t.offlineToken),$()):Z(t.error||"Failed to generate offline token.")}catch(e){Z("Connection failed.")}finally{W(!1)}}}async function ee(){let e=await fetch("/api/sa-licenses/portal"),t=await e.json();e.ok&&t.url&&A(t.url)&&(window.location.href=t.url)}(0,a.useEffect)(()=>{$()},[$]);let[et,es]=(0,a.useState)(null),[er,ea]=(0,a.useState)(!1),[en,el]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(!1);async function ex(e){ea(!0);try{(await fetch("/api/sa-licenses/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseId:e})})).ok&&(es(null),el(!0),setTimeout(()=>el(!1),5e3),$())}catch(e){}finally{ea(!1)}}async function em(e){eo(e);try{(await fetch("/api/sa-licenses/reactivate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseId:e})})).ok&&(ed(!0),setTimeout(()=>ed(!1),5e3),$())}catch(e){}finally{eo(null)}}let eb=t.filter(e=>"ACTIVE"===e.status),eh=eb.filter(e=>"ONLINE"===e.mode).length,eu=eb.filter(e=>"OFFLINE"===e.mode).length,ep=eb.some(e=>"DEMO"===e.plan),eg=eb.some(e=>"PRO"===e.plan&&"ONLINE"===e.mode),ef=eb.some(e=>"PRO"===e.plan&&"OFFLINE"===e.mode);return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-bold text-text-primary sm:text-2xl",children:"Super Agent licenses"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-text-secondary",children:"Manage your dojops-sa license keys, subscribe to plans, and generate offline tokens."})]}),t.length>0&&(0,r.jsxs)("button",{onClick:ee,className:"inline-flex items-center gap-2 rounded-xl border border-border-primary bg-bg-card px-4 py-2.5 text-xs font-medium text-text-secondary hover:text-text-primary hover:bg-bg-card-hover hover:border-border-secondary transition-all cursor-pointer active:scale-[0.98]",children:[(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Billing portal"}),(0,r.jsx)("span",{className:"sm:hidden",children:"Billing"})]})]}),"success"===e&&(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-2xl bg-success-bg border border-success-fg/20 px-4 py-3 text-sm text-success-fg animate-scale-in",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 shrink-0"}
1),"Subscription activated. Your license key is ready."]}),"cancel"===e&&(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-2xl bg-warning-bg border border-warning-fg/20 px-4 py-3 text-sm text-warning-fg animate-scale-in",children:[(0,r.jsx)(o.A,{className:"h-4 w-4 shrink-0"}),"Checkout was cancelled. No charges were made."]}),en&&(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-2xl bg-info-bg border border-info-fg/20 px-4 py-3 text-sm text-info-fg animate-scale-in",children:[(0,r.jsx)(c.A,{className:"h-4 w-4 shrink-0"}),"Subscription cancelled. Access continues until the end of the current billing period."]}),ec&&(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-2xl bg-success-bg border border-success-fg/20 px-4 py-3 text-sm text-success-fg animate-scale-in",children:[(0,r.jsx)(d.A,{className:"h-4 w-4 shrink-0"}),"Subscription reactivated. You will be charged at the next billing cycle."]}),!N&&t.length>0&&(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,r.jsx)(S,{label:"Total",value:t.length,icon:x.A}),(0,r.jsx)(S,{label:"Active",value:eb.length,icon:i.A,accent:!0}),(0,r.jsx)(S,{label:"Online",value:eh,icon:m.A}),(0,r.jsx)(S,{label:"Offline",value:eu,icon:b.A})]}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-text-tertiary uppercase tracking-wider",children:"Your keys"}),!N&&(0,r.jsxs)("button",{onClick:()=>{v(!0),$()},className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-text hover:text-accent rounded-xl hover:bg-accent/5 transition-all cursor-pointer",children:[(0,r.jsx)(h.A,{className:"h-3 w-3"}),"Refresh"]})]}),N&&(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-8 text-center",children:[(0,r.jsx)(u.A,{className:"h-6 w-6 text-accent animate-spin mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-xs text-text-secondary",children:"Loading licenses..."})]}),!N&&0===t.length&&(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-8 text-center shadow-[var(--shadow-sm)]",children:[(0,r.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500/15 to-blue-500/15 mx-auto mb-3",children:(0,r.jsx)(x.A,{className:"h-5 w-5 text-cyan-500"})}),(0,r.jsx)("p",{className:"text-sm text-text-primary font-medium mb-1",children:"No licenses yet"}),(0,r.jsx)("p",{className:"text-xs text-text-tertiary",children:"Subscribe below to get a dojops-sa license key."})]}),!N&&t.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,r.jsx)(O,{license:e,onCancel:()=>es(e.id),onReactivate:()=>em(e.id),reactivating:ei===e.id,onUpdatePayment:ee},e.id))})]}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-text-tertiary uppercase tracking-wider",children:"Choose a plan"}),(0,r.jsx)("p",{className:"text-xs text-text-tertiary mt-1",children:"Try with a free demo or subscribe to Pro for full access."})]}),(0,r.jsxs)("div",{className:"flex items-center bg-bg-secondary/80 border border-border-primary rounded-xl p-1",children:[(0,r.jsx)("button",{onClick:()=>X("MONTHLY"),className:"px-4 py-2 rounded-lg text-xs font-medium transition-all cursor-pointer ".concat("MONTHLY"===w?"bg-gradient-to-r from-cyan-500 to-blue-600 text-white shadow-sm":"text-text-secondary hover:text-text-primary"),children:"Monthly"}),(0,r.jsxs)("button",{onClick:()=>X("YEARLY"),className:"px-4 py-2 rounded-lg text-xs font-medium transition-all cursor-pointer ".concat("YEARLY"===w?"bg-gradient-to-r from-cyan-500 to-blue-600 text-white shadow-sm":"text-text-secondary hover:text-text-primary"),children:["Yearly"," ",(0,r.jsx)("span",{className:"text-[10px] font-bold ".concat("YEARLY"===w?"text-white/80":"text-success-fg"),children:"save 17%"})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-5 relative shadow-[var(--shadow-sm)] transition-all hover:shadow-[var(--shadow-md)] hover:border-border-secondary",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-amber-500/15 to-orange-500/15",children:(0,r.jsx)(p.A,{className:"h-[18px] w-[18px] text-amber-500"})}),(0,r.jsx)("h3",{className:"text-base font-bold text-text-primary",children:"Demo"})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("span",{className:"text-2xl font-bold text-text-primary",children:"Free"}),(0,r.jsx)("span",{className:"text-xs text-text-tertiary ml-1",children:"7 days"})]}),(0,r.jsx)("ul",{className:"space-y-2 mb-5",children:["Limited ticket processing","Community support","7-day trial period","All supported platforms"].map(e=>(0,r.jsxs)("li",{className:"flex items-start gap-2 text-xs text-text-secondary",children:[(0,r.jsx)(i.A,{className:"h-3.5 w-3.5 text-success-fg mt-0.5 shrink-0"}),e]},e))}),(0,r.jsx)("button",{onClick:()=>D(!0),disabled:ep,className:"w-full rounded-xl px-3 py-2.5 text-xs font-semibold bg-bg-secondary text-text-primary border border-border-primary hover:bg-bg-card-hover hover:border-border-secondary transition-all cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed active:scale-[0.98]",children:(0,r.jsxs)("span",{className:"flex items-center justify-center gap-1.5",children:[(0,r.jsx)(p.A,{className:"h-3 w-3"}),ep?"Demo active":"Request demo"]})})]}),(0,r.jsxs)("div",{className:"bg-bg-card border border-accent/40 ring-1 ring-accent/10 rounded-2xl p-5 relative shadow-[var(--shadow-sm)] transition-all hover:shadow-[var(--shadow-md)]",children:[(0,r.jsx)("span",{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-gradient-to-r from-cyan-500 to-blue-600 text-white text-[9px] font-bold uppercase px-3 py-0.5 rounded-full shadow-sm",children:"Popular"}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500/15 to-blue-500/15",children:(0,r.jsx)(g.A,{className:"h-[18px] w-[18px] text-cyan-500"})}),(0,r.jsx)("h3",{className:"text-base font-bold text-text-primary",children:"Pro"})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("span",{className:"text-2xl font-bold text-text-primary",children:"MONTHLY"===w?"$19.99":"$199.90"}),(0,r.jsx)("span",{className:"text-xs text-text-tertiary",children:"MONTHLY"===w?"/mo":"/yr"})]}),(0,r.jsx)("ul",{className:"space-y-2 mb-5",children:["Unlimited ticket processing","Priority support","All supported platforms","Online and offline modes"].map(e=>(0,r.jsxs)("li",{className:"flex items-start gap-2 text-xs text-text-secondary",children:[(0,r.jsx)(i.A,{className:"h-3.5 w-3.5 text-success-fg mt-0.5 shrink-0"}),e]},e))}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("button",{onClick:()=>K("PRO","ONLINE"),disabled:null!==C||eg,className:"w-full rounded-xl px-3 py-2.5 text-xs font-semibold bg-gradient-to-r from-cyan-500 to-blue-600 text-white shadow-lg shadow-cyan-500/20 hover:shadow-xl hover:shadow-cyan-500/30 hover:brightness-110 transition-all cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed active:scale-[0.98]",children:"PRO_ONLINE"===C?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Redirecting..."]}):(0,r.jsxs)("span",{className:"flex items-center justify-center gap-1.5",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),eg?"Online license active":"Online license"]})}),(0,r.jsx)("button",{onClick:()=>K("PRO","OFFLINE"),disabled:null!==C||ef,className:"w-full rounded-xl px-3 py-2.5 text-xs font-medium text-accent-text bg-accent/5 border border-accent/20 hover:bg-accent/10 transition-all cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed active:scale-[0.98]",children:"PRO_OFFLINE"===C?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Redirecting..."]}):(0,r.jsxs)("span",{className:"flex items-center justify-center gap-1.5",children:[(0,r.jsx)(b.A,{className:"h-3 w-3"}),ef?"Offline license active":"Offline license"]})})]})]})]})]}),(0,r.jsxs)("section",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-5 shadow-[var(--shadow-sm)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-blue-500/15 to-cyan-500/15",children:(0,r.jsx)(f.A,{className:"h-[18px] w-[18px] text-blue-500"})}),(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:"Online mode"})})]}),(0,r.jsx)("p",{className:"text-xs text-text-secondary leading-relaxed",children:"Token validated against the API on each use. Requires internet. Supports automatic renew
1al, usage tracking, and instant revocation. Can be converted to offline later."})]}),(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-5 shadow-[var(--shadow-sm)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500/15 to-purple-500/15",children:(0,r.jsx)(y.A,{className:"h-[18px] w-[18px] text-violet-500"})}),(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:"Offline mode"})})]}),(0,r.jsx)("p",{className:"text-xs text-text-secondary leading-relaxed",children:"Ed25519-signed token bound to a specific server ID. Works in air-gapped environments. Validated locally by dojops-sa using the embedded public key."})]})]}),_&&(0,r.jsx)(E,{tokenPrefix:_.tokenPrefix,serverId:q,setServerId:V,offlineToken:H,offlineError:G,offlineLoading:B,onGenerate:Q,onClose:()=>M(null)}),F&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>T(!1)}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative bg-bg-card border border-border-primary rounded-2xl p-6 w-full max-w-md 
1shadow-[var(--shadow-xl)] animate-scale-in",children:[(0,r.jsx)("button",{onClick:()=>T(!1),className:"absolute top-3 right-3 flex h-8 w-8 items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-bg-secondary rounded-lg transition-colors cursor-pointer","aria-label":"Close",children:(0,r.jsx)(j.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500/15 to-purple-500/15",children:(0,r.jsx)(b.A,{className:"h-[18px] w-[18px] text-violet-500"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-base font-bold text-text-primary",children:"Offline license"}),(0,r.jsx)("p",{className:"text-xs text-text-tertiary",children:"Enter your server ID to bind the license."})]})]}),(0,r.jsx)("label",{htmlFor:"offline-sub-sid",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"Server ID"}),(0,r.jsx)("input",{id:"offline-sub-sid",type:"text",value:R,onChange:e=>U(e.target.value.toUpperCase()),placeholder:"DOJOPS-XXXX-XXXX-XXXX-XXXX",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-3 text-xs font-mono text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20 mb-1.5"}),(0,r.jsxs)("p",{className:"text-[10px] text-text-tertiary mb-4",children:["Run"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:"dojops-sa server-id"})," ","to get this value."]}),Y&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-error-fg bg-error-bg border border-error-fg/20 rounded-xl px-3 py-2.5 mb-4 animate-scale-in",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 shrink-0"}),Y]}),(0,r.jsx)("button",{onClick:()=>{if(!k.test(R))return void J("Invalid format. Use: DOJOPS-XXXX-XXXX-XXXX-XXXX");T(!1),K("PRO","OFFLINE",R)},disabled:null!==C||!R,className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 text-white py-3 text-xs font-semibold shadow-lg shadow-cyan-500/20 hover:shadow-xl hover:shadow-cyan-500/30 hover:brightness-110 transition-all disabled:opacity-50 disabled:shadow-none cursor-pointer active:scale-[0.98]",children:"PRO_OFFLINE"===C?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Redirecting to Stripe..."]}):"Continue to checkout"})]})]}),et&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>es(null)}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative bg-bg-card border border-border-primary rounded-2xl p-6 w-full max-w-sm shadow-[var(--shadow-xl)] animate-scale-in",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-error-bg",children:(0,r.jsx)(c.A,{className:"h-[18px] w-[18px] text-error-fg"})}),(0,r.jsx)("h3",{className:"text-base font-bold text-text-primary",children:"Cancel subscription"})]}),(0,r.jsx)("p",{className:"text-xs text-text-secondary mb-5 leading-relaxed",children:"Your subscription will remain active until the end of the current billing period. After that, your license will expire and you will not be charged again."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:()=>es(null),className:"flex-1 rounded-xl px-3 py-2.5 text-xs font-medium bg-bg-secondary text-text-primary border border-border-primary hover:bg-bg-card-hover transition-all cursor-pointer active:scale-[0.98]",children:"Keep subscription"}),(0,r.jsx)("button",{onClick:()=>ex(et),disabled:er,className:"flex-1 rounded-xl px-3 py-2.5 text-xs font-semibold bg-error-fg text-white hover:brightness-110 transition-all cursor-pointer disabled:opacity-50 active:scale-[0.98]",children:er?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Cancelling..."]}):"Cancel subscription"})]})]})]}),L&&(0,r.jsx)(P,{onClose:()=>D(!1)})]})}function S(e){let{label:t,value:s,icon:a,accent:n}=e;return(0,r.jsxs)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-4 shadow-[var(--shadow-sm)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,r.jsx)(a,{className:"h-3.5 w-3.5 ".concat(n?"text-accent":"text-text-tertiary")}),(0,r.jsx)("p",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-wider",children:t})]}),(0,r.jsx)("p",{className:"text-2xl font-bold ".concat(n?"text-accent":"text-text-primary"),children:s})]})}function O(e){let{license:t,onCancel:s,onReactivate:n,reactivating:i,onUpdatePayment:o}=e,[x,h]=(0,a.useState)(!1),p=new Date(t.expiresAt)<new Date,g=p&&"ACTIVE"===t.status?"EXPIRED":t.status,f={ACTIVE:"text-success-fg bg-success-bg",EXPIRED:"text-error-fg bg-error-bg",CANCELLED:"text-text-tertiary bg-bg-secondary",SUSPENDED:"text-warning-fg bg-warning-bg"};return(0,r.jsx)("div",{className:"bg-bg-card border border-border-primary rounded-2xl p-4 shadow-[var(--shadow-sm)] hover:border-border-secondary transition-all",children:(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsxs)("code",{className:"text-xs font-mono text-text-primary bg-bg-secondary px-2 py-1 rounded-lg",children:[t.tokenPrefix,"..."]}),(0,r.jsx)("span",{className:"text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ".concat(f[g]||f.CANCELLED),children:g}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold uppercase px-2 py-0.5 rounded-full ".concat("ONLINE"===t.mode?"text-info-fg bg-info-bg":"text-accent-text bg-accent/5"),children:["ONLINE"===t.mode?(0,r.jsx)(m.A,{className:"h-2.5 w-2.5"}):(0,r.jsx)(b.A,{className:"h-2.5 w-2.5"}),t.mode]}),(0,r.jsx)("span",{className:"text-[10px] font-bold uppercase px-2 py-0.5 rounded-full text-text-tertiary bg-bg-secondary",children:t.plan})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-text-tertiary flex-wrap",children:[(0,r.jsx)("span",{children:"MONTHLY"===t.billingPeriod?"Monthly":"Yearly"}),(0,r.jsx)("span",{className:"text-border-secondary",children:"|"}),(0,r.jsxs)("span",{children:["Expires"," ",new Date(t.expiresAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]}),t.serverId&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-border-secondary",children:"|"}),(0,r.jsx)("span",{className:"font-mono text-accent-text",children:t.serverId})]}),t.lastUsedAt&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-border-secondary",children:"|"}),(0,r.jsxs)("span",{children:["Used"," ",new Date(t.lastUsedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]}),t.cancelAtPeriodEnd&&"ACTIVE"===t.status&&(0,r.jsxs)("p",{className:"text-[11px] text-warning-fg",children:["Subscription cancelled. Access until"," ",new Date(t.expiresAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),"."]}),"SUSPENDED"===t.status&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-error-fg bg-error-bg border border-error-fg/20 rounded-lg px-2.5 py-1.5",children:[(0,r.jsx)(N.A,{className:"h-3 w-3 shrink-0"}),"Payment failed. Please update your payment method to re-enable your license."]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsx)("button",{onClick:function(){navigator.clipboard.writeText(t.tokenPrefix).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},className:"inline-flex items-center gap-1.5 text-xs font-medium text-accent-text bg-accent/5 border border-accent/20 rounded-xl px-3 py-2 hover:bg-accent/10 transition-all cursor-pointer active:scale-[0.98]",children:x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{className:"h-3 w-3 text-success-fg"}),"Copied"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.A,{className:"h-3 w-3"}),"Copy"]})}),"ACTIVE"===t.status&&t.stripeSubId&&!t.cancelAtPeriodEnd&&(0,r.jsxs)("button",{onClick:s,className:"inline-flex items-center gap-1.5 text-xs font-medium text-error-fg bg-error-bg border border-error-fg/20 rounded-xl px-3 py-2 hover:bg-error-fg/15 transition-all cursor-pointer active:scale-[0.98]",children:[(0,r.jsx)(c.A,{className:"h-3 w-3"}),"Cancel"]}),"ACTIVE"===t.status&&t.cancelAtPeriodEnd&&!p&&(0,r.jsxs)("button",{onClick:n,disabled:i,className:"inline-flex items-center gap-1.5 text-xs font-medium text-success-fg bg-success-bg border border-success-fg/20 rounded-xl px-3 py-2 hover:bg-success-fg/15 transition-all cursor-pointer disabled:opacity-50 active:scale-[0.98]",children:[i?(0,r.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,r.jsx)(d.A,{className:"h-3 w-3"}),"Re-enable"]}),"SUSPENDED"===t.status&&(0,r.jsxs)("button",{onClick:o,className:"inline-flex items-center gap-1.5 text-xs font-semibold text-white bg-error-fg rounded-xl px-3 py-2 hover:brightness-110 transition-all cursor-pointer active:scale-[0.98]",children:[(0,r.jsx)(l.A,{className:"h-3 w-3"}
1),"Update payment"]})]})]})})}function E(e){let{tokenPrefix:t,serverId:s,setServerId:n,offlineToken:l,offlineError:i,offlineLoading:c,onGenerate:d,onClose:x}=e,[m,b]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&x()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]),(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:x}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"offline-dialog-title",className:"relative bg-bg-card border border-border-primary rounded-2xl p-6 w-full max-w-md shadow-[var(--shadow-xl)] animate-scale-in",children:[(0,r.jsx)("button",{onClick:x,className:"absolute top-3 right-3 flex h-8 w-8 items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-bg-secondary rounded-lg transition-colors cursor-pointer","aria-label":"Close dialog",children:(0,r.jsx)(j.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500/15 to-purple-500/15",children:(0,r.jsx)(y.A,{className:"h-[18px] w-[18px] text-violet-500"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{id:"offline-dialog-title",className:"text-base font-bold text-text-primary",children:"Generate offline token"}),(0,r.jsxs)("p",{className:"text-xs text-text-tertiary",children:["License:"," ",(0,r.jsxs)("code",{className:"bg-bg-secondary px-1.5 py-0.5 rounded-md",children:[t,"..."]})]})]})]}),l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"bg-warning-bg border border-warning-fg/20 rounded-xl p-4 mb-4",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-warning-fg mb-2",children:"Copy now. This token will not be shown again"}),(0,r.jsx)("code",{className:"block text-xs font-mono text-accent-text break-all leading-relaxed select-all",children:l})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(l),b(!0),setTimeout(()=>b(!1),2e3)},className:"flex-1 inline-flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 text-white py-3 text-xs font-semibold shadow-lg shadow-cyan-500/20 hover:shadow-xl hover:shadow-cyan-500/30 hover:brightness-110 transition-all cursor-pointer active:scale-[0.98]",children:m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{className:"h-3.5 w-3.5"})," Copied!"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.A,{className:"h-3.5 w-3.5"})," Copy token"]})}),(0,r.jsx)("button",{onClick:x,className:"rounded-xl bg-bg-secondary text-text-primary border border-border-primary px-4 py-3 text-xs font-medium hover:bg-bg-card-hover transition-colors cursor-pointer",children:"Done"})]}),(0,r.jsxs)("p",{className:"text-xs text-text-tertiary mt-4 leading-relaxed",children:["Set"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:"DOJOPS_SA_LICENSE"})," ","env var or pass via"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:"dojops-sa --license <token>"}),". Bound to server"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:s}),"."]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{htmlFor:"server-id",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"Server ID"}),(0,r.jsx)("input",{id:"server-id",type:"text",value:s,onChange:e=>n(e.target.value.toUpperCase()),placeholder:"DOJOPS-XXXX-XXXX-XXXX-XXXX",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-3 text-xs font-mono text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20 mb-1.5"}),(0,r.jsxs)("p",{className:"text-[10px] text-text-tertiary mb-4",children:["Run"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:"dojops-sa server-id"})," ","to get this value."]}),i&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-error-fg bg-error-bg border border-error-fg/20 rounded-xl px-3 py-2.5 mb-4 animate-scale-in",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 shrink-0"}),i]}),(0,r.jsx)("button",{onClick:d,disabled:c||!s,className:"w-full rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 text-white py-3 text-xs font-semibold shadow-lg shadow-cyan-500/20 hover:shadow-xl hover:shadow-cyan-500/30 hover:brightness-110 transition-all disabled:opacity-50 disabled:shadow-none cursor-pointer active:scale-[0.98]",children:c?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Generating..."]}):"Generate token"})]})]})]})}function P(e){let{onClose:t}=e,[s,n]=(0,a.useState)(""),[l,c]=(0,a.useState)(""),[d,x]=(0,a.useState)(""),[m,b]=(0,a.useState)(""),[h,g]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[N,v]=(0,a.useState)(""),[w,X]=(0,a.useState)(!1);async function A(){if(!s||!l||!m||!h)return void v("All fields except company are required.");
1if(!k.test(h))return void v("Invalid server ID. Use: DOJOPS-XXXX-XXXX-XXXX-XXXX");y(!0),v("");try{let e=await fetch("/api/sa-licenses/demo-request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({firstName:s,lastName:l,email:m,company:d||void 0,serverId:h})}),t=await e.json();e.ok?X(!0):v(t.error||"Failed to submit request.")}catch(e){v("Connection failed.")}finally{y(!1)}}return(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&t()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]),(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"demo-dialog-title",className:"relative bg-bg-card border border-border-primary rounded-2xl p-6 w-full max-w-md shadow-[var(--shadow-xl)] animate-scale-in",children:[(0,r.jsx)("button",{onClick:t,className:"absolute top-3 right-3 flex h-8 w-8 items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-bg-secondary rounded-lg transition-colors cursor-pointer","aria-label":"Close dialog",children:(0,r.jsx)(j.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-amber-500/15 to-orange-500/15",children:(0,r.jsx)(p.A,{className:"h-[18px] w-[18px] text-amber-500"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{id:"demo-dialog-title",className:"text-base font-bold text-text-primary",children:"Request demo license"}),(0,r.jsx)("p",{className:"text-xs text-text-tertiary",children:"Free 7-day trial, reviewed by our team"})]})]}),w?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-2xl bg-success-bg border border-success-fg/20 px-4 py-3 text-sm text-success-fg mb-4 animate-scale-in",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 shrink-0"}),"Request submitted. We will review and get back to you."]}),(0,r.jsx)("button",{onClick:t,className:"w-full rounded-xl bg-bg-secondary text-text-primary border border-border-primary px-4 py-3 text-xs font-medium hover:bg-bg-card-hover transition-colors cursor-pointer",children:"Close"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"demo-first",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"First name"}),(0,r.jsx)("input",{id:"demo-first",type:"text",value:s,onChange:e=>n(e.target.value),placeholder:"Jane",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-2.5 text-xs text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"demo-last",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"Last name"}),(0,r.jsx)("input",{id:"demo-last",type:"text",value:l,onChange:e=>c(e.target.value),placeholder:"Doe",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-2.5 text-xs text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"demo-email",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"Email"}),(0,r.jsx)("input",{id:"demo-email",type:"email",value:m,onChange:e=>b(e.target.value),placeholder:"[email protected]",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-2.5 text-xs text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"demo-company",className:"block text-xs font-medium text-text-secondary mb-1.5",children:["Company ",(0,r.jsx)("span",{className:"text-text-tertiary",children:"(optional)"})]}),(0,r.jsx)("input",{id:"demo-company",type:"text",value:d,onChange:e=>x(e.target.value),placeholder:"Acme Inc",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-2.5 text-xs text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"demo-server",className:"block text-xs font-medium text-text-secondary mb-1.5",children:"Server ID"}),(0,r.jsx)("input",{id:"demo-server",type:"text",value:h,onChange:e=>g(e.target.value.toUpperCase()),placeholder:"DOJOPS-XXXX-XXXX-XXXX-XXXX",className:"w-full rounded-xl border border-border-secondary bg-bg-secondary/50 px-3 py-2.5 text-xs font-mono text-text-primary placeholder:text-text-tertiary transition-all focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"}),(0,r.jsxs)("p",{className:"text-[10px] text-text-tertiary mt-1",children:["Run"," ",(0,r.jsx)("code",{className:"bg-bg-secondary px-1.5 rounded-md text-accent-text",children:"dojops-sa server-id"})," ","to get this value."]})]})]}),N&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-error-fg bg-error-bg border border-error-fg/20 rounded-xl px-3 py-2.5 mt-3 animate-scale-in",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 shrink-0"}),N]}),(0,r.jsx)("button",{onClick:A,disabled:f,className:"w-full rounded-xl bg-gradient-to-r from-amber-500 to-orange-500 text-white py-3 text-xs font-semibold shadow-lg shadow-amber-500/20 hover:shadow-xl hover:shadow-amber-500/30 hover:brightness-110 transition-all disabled:opacity-50 disabled:shadow-none cursor-pointer active:scale-[0.98] mt-4",children:f?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 animate-spin"})," Submitting..."]}):"Submit request"})]})]})]})}},5247:(e,t,s)=>{Promise.resolve().then(s.bind(s,3125))}},e=>{e.O(0,[4637,1606,4243,7358],()=>e(e.s=5247)),_N_E=e.O()}]);

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.