PageSourceSearch

https://founder-spark-63.lovable.app/assets/OAuthConsent-CH8Y0lkh.js

js founder-spark-63.lovable.app collected 2026-10-03 03:32:32 UTC 3,536 bytes, 1 lines download raw bytes

1import{j as e}from"./query-_koPiPsI.js";import{h as k,r as o}from"./react-vendor-h1rQ_Bae.js";import{s as b,C as f,o as j,p as g,G as E,q as w,n as y,L as N,P as I,B as C}from"./index-Dq2zLArw.js";import"./ui-radix-CKwvnS8F.js";import"./supabase-DL6nu9mS.js";import"./charts-Xu79y1bN.js";import"./motion-nVmI7L5T.js";const d=()=>b.auth.oauth;function L(){const[v]=k(),t=v.get("authorization_id")??"",[u,A]=o.useState(null),[h,r]=o.useState(null),[c,l]=o.useState(!1);o.useEffect(()=>{let i=!0;return(async()=>{if(!t){r("Missing authorization_id — this link is incomplete.");return}const{data:n}=await b.auth.getSession();if(!n.session){const z=window.location.pathname+window.location.search;window.location.href=`/auth?tab=signin&redirect=${encodeURIComponent(z)}`;return}const{data:s,error:a}=await d().getAuthorizationDetails(t);if(!i)return;if(a){r(a.message);return}const p=s?.redirect_url??s?.redirect_to;if(p&&!s?.client){window.location.href=p;return}A(s)})(),()=>{i=!1}},[t]);const m=async i=>{l(!0);const{data:n,error:s}=i?await d().approveAuthorization(t):await d().denyAuthorization(t);if(s){l(!1),r(s.message);return}const a=n?.redirect_url??n?.redirect_to;if(!a){l(!1),r("No redirect returned by the authorization server.");return}window.location.href=a};if(h)return e.jsx("main",{className:"min-h-screen flex items-center justify-center p-6",children:e.jsxs(f,{className:"max-w-md w-full",children:[e.jsxs(j,{children:[e.jsxs(g,{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5 text-destructive"}),"Authorization failed"]}),e.jsx(w,{children:h})]}),e.jsx(y,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Close this window and try connecting again from your AI client."})})]})});if(!u)return e.jsx("main",{className:"min-h-screen flex items-center justify-center p-6",children:e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(N,{className:"h-4 w-4 animate-spin"}),"Loading authorization request…"]})});const x=u.client?.name??"an AI client";return e.jsx("main",{className:"min-h-screen flex items-center justify-center p-6",children:e.jsxs(f,{className:"max-w-md w-full",children:[e.jsxs(j,{children:[e.jsxs(g,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-5 w-5 text-primary"}),"Connect ",x," to ThoughtForge"]}),e.jsxs(w,{children:[x," is asking to use ThoughtForge as you."]})]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"This will let it:"}),e.jsxs("ul",{className:"list-disc list-inside text-muted-foreground space-y-1",children:[e.jsx("li",{children:"Read your tracked brands and their AI visibility scores"}),e.jsx("li",{children:"Run brand health scans and read leakage points"}),e.jsx("li",{children:"Read your articles and their GEO gaps"}),e.jsx("li",{children:"Rewrite articles, generate FAQs and tables, and schedule posts"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"It only ever sees your own data — the same rules that apply in the ThoughtForge app apply here. You can revoke access at any time."}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(C,{className:"flex-1",disabled:c,onClick:()=>m(!0),children:[c&&e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Approve"]}),e.jsx(C,{variant:"outline",className:"flex-1",disabled:c,onClick:()=>m(!1),children:"Deny"})]})]})]})})}export{L 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.