PageSourceSearch

https://proudnotproud.com/assets/oauth-authorize-CC04XynE.js

js proudnotproud.com collected 2026-10-02 01:41:35 UTC 6,317 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-motion-CWthwBHV.js";import{u as b,H as j,b2 as w}from"./session-card-DfDogMnt.js";import"./index-UQ4Qr5Bx.js";import"./vendor-radix-XKDS9LlS.js";import"./api-base-B8hCG6H6.js";import"./vendor-query-CIlvkMVG.js";import"./vendor-charts-DVgyNbFy.js";const N={"voice:log":"Log proud check-ins on your behalf"};function v(){const o=window.location.search,a=new URLSearchParams(o);return{client_id:a.get("client_id")??"",redirect_uri:a.get("redirect_uri")??"",scope:a.get("scope")??"voice:log",state:a.get("state")??"",response_type:a.get("response_type")??"code"}}const p=window.location.origin;function A(){const{user:o,isLoaded:a}=b(),{openSignIn:f}=j(),s=v(),[n,h]=l.useState(null),[d,i]=l.useState(null),[g,u]=l.useState(!0),[c,m]=l.useState(!1);l.useEffect(()=>{if(!s.client_id){i("Missing client_id"),u(!1);return}const r=new URLSearchParams({client_id:s.client_id,redirect_uri:s.redirect_uri,scope:s.scope,response_type:s.response_type});fetch(`${p}/api/oauth/client?${r}`).then(t=>t.json()).then(t=>{t.error?i(t.message??t.error):h(t)}).catch(()=>i("Could not load client info")).finally(()=>u(!1))},[s.client_id]);function x(){if(!s.redirect_uri)return;const r=new URL(s.redirect_uri);r.searchParams.set("error","access_denied"),s.state&&r.searchParams.set("state",s.state),window.location.href=r.toString()}async function y(){m(!0);try{const t=await(await fetch(`${p}/api/oauth/approve`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({client_id:s.client_id,redirect_uri:s.redirect_uri,scope:s.scope,state:s.state})})).json();t.redirectUrl?window.location.href=t.redirectUrl:i(t.message??t.error??"Authorization failed")}catch{i("Something went wrong. Please try again.")}finally{m(!1)}}return g?e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"#faf8f5"},children:e.jsx(w,{size:"lg",label:"Loading authorization"})}):d?e.jsx("div",{className:"min-h-screen flex items-center justify-center px-4",style:{background:"#faf8f5"},children:e.jsxs("div",{className:"max-w-sm w-full rounded-3xl p-8 text-center space-y-3",style:{background:"#fff",border:"1px solid rgba(58,28,0,0.08)"},children:[e.jsx("p",{className:"text-2xl",children:"⚠️"}),e.jsx("h1",{className:"font-semibold text-base",style:{color:"#3a1c00"},children:"Authorization error"}),e.jsx("p",{className:"text-sm",style:{color:"rgba(58,28,0,0.5)"},children:d})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center px-4 py-12",style:{background:"#faf8f5"},children:e.jsxs("div",{className:"max-w-sm w-full rounded-3xl overflow-hidden",style:{background:"#fff",border:"1px solid rgba(58,28,0,0.08)",boxShadow:"0 4px 32px rgba(58,28,0,0.06)"},children:[e.jsxs("div",{className:"px-8 pt-8 pb-6 text-center space-y-4",style:{borderBottom:"1px solid rgba(58,28,0,0.06)"},children:[e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center text-2xl font-bold",style:{background:"linear-gradient(135deg, #ff6b35 0%, #ff4500 100%)",color:"#fff"},children:"P"}),e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M4 10h12M10 4l6 6-6 6",stroke:"rgba(58,28,0,0.2)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),n?.iconUrl?e.jsx("img",{src:n.iconUrl,alt:n?.name,className:"w-14 h-14 rounded-2xl object-cover"}):e.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center text-xl font-bold",style:{background:"rgba(58,28,0,0.06)",color:"rgba(58,28,0,0.4)"},children:n?.name?.[0]?.toUpperCase()??"?"})]}),e.jsx("div",{children:e.jsxs("h1",{className:"text-lg font-semibold",style:{color:"#3a1c00"},children:[e.jsx("span",{style:{color:"rgba(58,28,0,0.55)"},children:n?.name})," wants to connect to your ProudNotProud account"]})})]}),e.jsxs("div",{className:"px-8 py-5",style:{borderBottom:"1px solid rgba(58,28,0,0.06)"},children:[e.jsxs("p",{className:"text-xs font-semibold mb-3",style:{color:"rgba(58,28,0,0.4)",letterSpacing:"0.05em",textTransform:"uppercase"},children:["This will allow ",n?.name," to:"]}),e.jsx("ul",{className:"space-y-2",children:n?.grantedScopes.map(r=>e.jsxs("li",{className:"flex items-start gap-2.5 text-sm",style:{color:"#3a1c00"},children:[e.jsx("span",{className:"mt-0.5 text-green-500 flex-shrink-0",children:"✓"}),N[r]??r]},r))})]}
1),e.jsx("div",{className:"px-8 py-6 space-y-3",children:a?o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl px-3 py-2.5 mb-1",style:{background:"rgba(58,28,0,0.04)"},children:[o.imageUrl&&e.jsx("img",{src:o.imageUrl,alt:"",className:"w-6 h-6 rounded-full"}),e.jsxs("span",{className:"text-sm",style:{color:"rgba(58,28,0,0.6)"},children:["Signed in as ",e.jsx("strong",{style:{color:"#3a1c00"},children:o.primaryEmailAddress?.emailAddress??o.username})]})]}),e.jsx("button",{onClick:y,disabled:c,className:"w-full h-11 rounded-xl font-semibold text-sm transition-opacity hover:opacity-90 disabled:opacity-60",style:{background:"#ff4500",color:"#fff"},children:c?"Connecting…":`Allow ${n?.name}`}),e.jsx("button",{onClick:x,disabled:c,className:"w-full h-11 rounded-xl font-medium text-sm transition-opacity hover:opacity-70",style:{background:"transparent",color:"rgba(58,28,0,0.45)"},children:"Deny"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-center",style:{color:"rgba(58,28,0,0.5)"},children:"Sign in to ProudNotProud to continue"}),e.jsx("button",{onClick:()=>f({redirectUrl:window.location.href}),className:"w-full h-11 rounded-xl font-semibold text-sm transition-opacity hover:opacity-90",style:{background:"#3a1c00",color:"#fff"},children:"Sign in to continue"}),e.jsx("button",{onClick:x,className:"w-full h-11 rounded-xl font-medium text-sm transition-opacity hover:opacity-70",style:{background:"transparent",color:"rgba(58,28,0,0.45)"},children:"Cancel"})]}):e.jsx("div",{className:"h-11 rounded-xl animate-pulse",style:{background:"rgba(58,28,0,0.06)"}})}),e.jsx("div",{className:"px-8 pb-6 text-center",children:e.jsx("p",{className:"text-xs",style:{color:"rgba(58,28,0,0.3)"},children:"ProudNotProud will never share your data without your permission."})})]})})}export{A 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.