PageSourceSearch

https://andgo-platform.web.app/assets/OAuthConsent-Yr3DYJjT.js

js andgo-platform.web.app collected 2026-10-03 12:17:02 UTC 7,345 bytes, 1 lines download raw bytes

1import{j as e,n as G,c as T,_ as z}from"./vendor-ui-CKm7ZMyW.js";import{g as L,d as q,r,L as C}from"./vendor-react-BcgnEh9s.js";import{u as B,c as E,B as f}from"./index-10Bqe08t.js";import{P as R}from"./products-CQmN0gyX.js";import{C as D,c as Y,b as H}from"./card-BC9cEqZn.js";import{S as M}from"./SEO-BnpntjxQ.js";import"./vendor-firebase-C5C_sMp4.js";const V="oauth_return_to",F=["[email protected]"];function te(){const{user:a,loading:d}=B(),[o]=L(),l=q(),g=o.get("client_id"),c=o.get("redirect_uri"),b=o.get("code_challenge"),x=o.get("state"),[h,v]=r.useState(null),[i,y]=r.useState({}),[j,S]=r.useState(!1),[k,N]=r.useState(null);r.useEffect(()=>{d||a||(sessionStorage.setItem(V,window.location.pathname+window.location.search),l("/login",{replace:!0}))},[a,d,l]),r.useEffect(()=>{a&&E.get("/api/orgs/me/subscriptions").then(t=>{v(t.subscriptions??[])}).catch(()=>v([]))},[a]);const u=r.useMemo(()=>{if(!h)return[];if(a!=null&&a.email&&F.includes(a.email))return R;const t=h.filter(s=>s.status!=="canceled"&&s.plan!=="personal").map(s=>s.productId);return R.filter(s=>t.includes(s.id))},[h,a]);r.useEffect(()=>{u.length!==0&&y(t=>{const s={...t};for(const n of u)s[n.id]||(s[n.id]=["read"]);return s})},[u]);const A=(t,s)=>{y(n=>{const m=n[t]??[],p=m.includes(s)?m.filter(U=>U!==s):Array.from(new Set([...m,s]));return{...n,[t]:p}})},$=r.useMemo(()=>Object.values(i).some(t=>t.length>0),[i]),I=()=>{const t=new Set;for(const s of Object.values(i))for(const n of s)t.add(n);return Array.from(t)},O=async()=>{if(!g||!c||!b||!x){N("Missing OAuth parameters");return}S(!0),N(null);try{const t={};for(const[m,p]of Object.entries(i))p.length>0&&(t[m]=p);const s=await E.post("/api/oauth/code",{client_id:g,redirect_uri:c,code_challenge:b,state:x,scopes_granted:I(),product_scopes:t}),n=s.redirect_uri.includes("?")?"&":"?";window.location.href=`${s.redirect_uri}${n}code=${encodeURIComponent(s.code)}&state=${encodeURIComponent(s.state)}`}catch(t){N(t instanceof Error?t.message:"Authorization failed"),S(!1)}},_=()=>{if(c){const t=c.includes("?")?"&":"?";window.location.href=`${c}${t}error=access_denied&state=${encodeURIComponent(x??"")}`}else l("/",{replace:!0})};return!g||!c||!b||!x?e.jsxs(w,{children:[e.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Invalid request"}),e.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"This page can only be reached from a Model Context Protocol client. The required parameters are missing."}),e.jsx(C,{to:"/",className:"mt-6 inline-block text-sm text-[#0097b2] hover:underline",children:"Return to MyAndGo"})]}):d||!a||h===null?e.jsx(w,{children:e.jsx(G,{className:"h-6 w-6 text-[#0097b2] animate-spin"})}):u.length===0?e.jsxs(w,{children:[e.jsx(M,{title:"Authorize Claude",description:"Connect Claude to your AndGo workspace",noindex:!0}),e.jsx("h1",{className:"text-2xl font-bold text-slate-900 tracking-tight",children:"A paid plan is required"}),e.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"MCP access is available on Starter, Professional, Business, and Enterprise plans for any MyAndGo product. Free Personal plans don't include external AI assistant access."}),e.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row gap-3",children:[e.jsx(f,{onClick:()=>l("/subscriptions"),className:"bg-[#0097b2] hover:bg-[#007a91]",children:"View plans"}),e.jsx(f,{variant:"outline",onClick:_,children:"Cancel"})]})]}):e.jsxs("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4 py-12",children:[e.jsx(M,{title:"Authorize Claude",description:"Connect Claude to your AndGo workspace",noindex:!0}),e.jsxs(D,{className:"w-full max-w-2xl",children:[e.jsxs(Y,{className:"pb-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(T,{className:"h-6 w-6 text-[#0097b2]"}),e.jsx("h1",{className:"text-xl font-semibold text-slate-900 tracking-tight",children:"Connect Claude to your AndGo workspace"})]}),e.jsxs("p",{className:"mt-2 text-sm text-slate-600",children:["Signed in as ",e.jsx("span",{className:"font-medium text-slate-900",children:a.email}),". Choose which products and permissions Claude can access. You can revoke this any time from Settings."]})]}
1),e.jsxs(H,{className:"pt-6 space-y-4",children:[u.map(t=>e.jsx("div",{className:"rounded-xl border border-slate-200 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("img",{src:`/${t.id}-logo.png`,alt:"",className:"h-8 w-8 flex-shrink-0 rounded",onError:s=>{s.target.style.visibility="hidden"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-base font-semibold text-slate-900",children:t.name}),e.jsx("p",{className:"text-xs text-slate-500",children:t.tagline}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(P,{checked:(i[t.id]??[]).includes("read"),onChange:()=>A(t.id,"read"),title:`Read your ${t.name} data`,description:"Allow Claude to list and view"}),e.jsx(P,{checked:(i[t.id]??[]).includes("write"),onChange:()=>A(t.id,"write"),title:`Manage your ${t.name} data`,description:"Create, edit, upload, and delete. Leave off for view-only."}),(i[t.id]??[]).includes("read")&&!(i[t.id]??[]).includes("write")&&e.jsxs("p",{className:"rounded-md bg-amber-50 border border-amber-200 px-2.5 py-1.5 text-xs text-amber-800",children:["View-only: Claude can see your ",t.name," data but can't create, upload, or change anything. Tick ",e.jsx("span",{className:"font-semibold",children:"Manage"})," above if you want it to build folders, upload files, or make edits."]})]})]})]})},t.id)),e.jsx("div",{className:"rounded-xl bg-slate-50 border border-slate-200 p-4",children:e.jsxs("p",{className:"text-xs text-slate-600",children:["Claude will receive a token that expires in 30 days. Each tool call is audit-logged. You can revoke access immediately from",e.jsx(C,{to:"/settings",className:"ml-1 text-[#0097b2] hover:underline",children:"Settings"})," or learn more in the ",e.jsxs(C,{to:"/docs/ai-connectors",className:"text-[#0097b2] hover:underline inline-flex items-center gap-1",children:["connector docs ",e.jsx(z,{className:"h-3 w-3"})]}),"."]})}),k&&e.jsx("div",{className:"rounded-lg bg-red-50 border border-red-200 p-3 text-sm text-red-700",children:k}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[e.jsx(f,{onClick:O,disabled:!$||j,className:"bg-[#0097b2] hover:bg-[#007a91] flex-1",children:j?"Authorizing...":"Authorize"}),e.jsx(f,{variant:"outline",onClick:_,disabled:j,className:"flex-1",children:"Cancel"})]})]})]})]})}function P({checked:a,onChange:d,title:o,description:l}){return e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:d,className:"mt-0.5 h-4 w-4 rounded border-slate-300 text-[#0097b2] focus:ring-[#0097b2]"}),e.jsxs("span",{className:"text-sm leading-tight",children:[e.jsx("span",{className:"block font-medium text-slate-900 group-hover:text-[#0097b2]",children:o}),e.jsx("span",{className:"block text-xs text-slate-500",children:l})]})]})}function w({children:a}){return e.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center px-4",children:e.jsx("div",{className:"max-w-md w-full bg-white rounded-2xl border border-slate-200 p-8 text-center",children:a})})}export{te as OAuthConsent};

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.