PageSourceSearch

https://webstashai.com/static/mupct99t/oauth.consent-9ttRCKxQ.js

js webstashai.com collected 2026-10-02 01:49:36 UTC 7,199 bytes, 1 lines download raw bytes

1import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./react-vendor-Cg1XyO4h.js";import{h as r,o as i}from"./components-Bffso2lS.js";import{n as a}from"./lib-4ztkj1n8.js";import{Mt as o}from"./icons-C1S_ERX3.js";import{r as s}from"./auth-context-BW0lRp0v.js";import{n as c}from"./ml-toast-B-Cujnos.js";import{a as l,d as u,i as d,n as f,r as p,s as m,u as h}from"./auth-primitives-CwUuYz7z.js";import{t as g}from"./password-setup-FnXsx17S.js";import{i as _,o as v}from"./ml-states-COdGuv4c.js";import{a as y,o as b}from"./use-mock-auth-BoTq16XY.js";var x=e(t(),1),S=n();function C(e,t){return e instanceof Error?e.message:t}function w(){let[e]=a(),t=e.get(`state`),{user:n,isLoading:i}=s(),u=r();(0,x.useEffect)(()=>{if(!i){if(!t){u(`/login?error=oauth_failed`,{replace:!0});return}n||u(`/login?oauth=true&state=${encodeURIComponent(t)}`,{replace:!0})}},[i,u,t,n]);let g=y(n?t:null),_=b(t),[w,O]=(0,x.useState)(null),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null),P=(0,x.useRef)({allow:null,deny:null});(0,x.useEffect)(()=>{M===null||_.isPending||(P.current[M]?.focus(),N(null))},[M,_.isPending]);async function F(e){j(null);try{let t=await _.mutateAsync(e);if(O(e),c.success(e===`allow`?`Connection allowed`:`Connection denied`),!v(t))throw Error(`Unsupported redirect URL`);window.location.href=t}catch(t){j(C(t,`Couldn’t record your answer`)),N(e)}}return w===null?(0,S.jsx)(h,{title:`Authorize app`,variant:`review`,children:(0,S.jsxs)(p,{children:[(0,S.jsx)(d,{title:`Allow connection`,description:`Review this request before WebstashAi connects your account to another app.`}),(0,S.jsxs)(`div`,{"data-slot":`auth-consent-body`,"aria-busy":g.isPending,children:[(0,S.jsx)(E,{loading:g.isPending,ready:g.data!==void 0}),g.isPending?(0,S.jsx)(D,{}):null,g.isError?(0,S.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,S.jsx)(l,{id:`mockup-consent-request-error`,children:C(g.error,`Couldn’t load this approval request`)}),(0,S.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>void g.refetch(),"data-slot":`auth-consent-retry`,children:`Try again`}),(0,S.jsx)(`p`,{className:`text-center`,children:(0,S.jsx)(m,{to:`/`,children:`Back to your library`})})]}):null,g.data?(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl bg-background-secondary-default px-3 py-1`,children:[(0,S.jsxs)(`div`,{"data-slot":`auth-consent-client`,className:`flex min-h-16 items-center gap-3 border-b border-separator-border py-3`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-button-primary text-headline-semibold text-text-white shadow-media-inset`,children:g.data.client_icon}),(0,S.jsx)(`div`,{className:`min-w-0`,children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:(0,S.jsx)(`p`,{className:`text-body-medium text-text-primary`,children:g.data.client_name})})})]}),(0,S.jsx)(T,{label:`Redirect destination`,value:g.data.redirect_host,detail:g.data.redirect_uri})]}),(0,S.jsxs)(`div`,{className:`rounded-2xl bg-background-secondary-default px-3 pt-3 pb-3.5`,children:[(0,S.jsx)(`p`,{className:`text-caption-1-medium text-text-primary/70`,children:`Access`}),(0,S.jsx)(`ul`,{className:`mt-2.5 flex flex-col gap-2.5`,children:g.data.scope_details.map(e=>(0,S.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-background-primary-default text-foreground-icon-secondary`,children:(0,S.jsx)(o,{className:`size-3`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-body-medium text-text-primary`,children:e.label}),(0,S.jsx)(`p`,{className:`mt-0.5 text-caption-1-regular text-text-primary/70`,children:e.description})]})]},e.value))})]}),A?(0,S.jsx)(l,{id:`mockup-consent-error`,children:A}):null,(0,S.jsx)(`p`,{className:`pt-1 text-caption-1-medium text-pretty text-text-primary/70`,children:`You can revoke this access any time from Settings.`}),(0,S.jsxs)(`div`,{"data-slot":`auth-consent-decisions`,className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsx)(f,{type:`button`,ref:e=>{P.current.allow=e},busy:_.isPending&&_.variables===`allow`,busyLabel:`Allowing…`,disabled:_.isPending,"data-slot":`auth-consent-allow`,onClick:()=>void F(`allow`),children:`Allow`}),(0,S.jsxs)(`p`,{className:`text-center text-caption-2-regular text-pretty text-text-primary/70`,children:[`You’ll be sent back to `,g.data.client_name,` — WebstashAi never sees their password.`]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsx)(f,{type:`button`,ref:e=>{P.current.deny=e},variant:`secondary`,busy:_.isPending&&_.variables===`deny`,busyLabel:`Denying…`,disabled:_.isPending,"data-slot":`auth-consent-deny`,onClick:()=>void F(`deny`),children:`Deny`}),(0,S.jsx)(`p`,{className:`text-center text-caption-2-regular text-text-primary/70`,children:`Nothing will be shared.`})]})]})]}):null]})]})}):(0,S.jsx)(h,{title:`Authorize app`,variant:`review-status`,children:(0,S.jsx)(k,{outcome:w,clientName:g.data?.client_name??`the app`})})}
1function T({label:e,value:t,detail:n}){return(0,S.jsxs)(`div`,{className:`py-3`,children:[(0,S.jsx)(`p`,{className:`text-caption-1-medium text-text-primary/70`,children:e}),(0,S.jsx)(`p`,{className:`mt-0.5 break-all text-body-medium text-text-primary`,children:t}),n?(0,S.jsx)(`p`,{className:`mt-0.5 break-all font-mono text-caption-1-regular text-text-primary/70`,children:n}):null]})}function E({loading:e,ready:t}){let[n,r]=(0,x.useState)(``);return(0,x.useEffect)(()=>{if(e){r(`Loading the approval request…`);return}r(t?`Approval request loaded.`:``)},[e,t]),(0,S.jsx)(`p`,{role:`status`,"data-slot":`auth-consent-status`,className:`sr-only`,children:n})}function D(){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-hidden":`true`,children:[(0,S.jsx)(_,{className:`h-[152px] rounded-2xl`}),(0,S.jsx)(_,{className:`h-[232px] rounded-2xl`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-6`,children:[(0,S.jsx)(_,{className:`h-9 rounded-2lg`}),(0,S.jsx)(_,{className:`h-9 rounded-2lg`})]})]})}var O={allow:{title:`Connection allowed`,description:`is connected to your WebstashAi account.`},deny:{title:`Connection denied`,description:`was not given access to your WebstashAi account. Nothing was shared.`}};function k({outcome:e,clientName:t}){let n=O[e];return(0,S.jsx)(p,{children:(0,S.jsxs)(`div`,{"data-slot":`consent-outcome`,"data-outcome":e,className:`flex flex-col`,children:[(0,S.jsx)(u,{kind:e===`allow`?`success`:`error`}),(0,S.jsx)(d,{after:`footer`,title:n.title,description:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`strong`,{className:`font-semibold text-text-primary`,children:t}),` `,n.description]})}),(0,S.jsx)(`p`,{className:`text-center text-body-regular`,children:(0,S.jsx)(m,{to:`/`,children:`Back to your library`})})]})})}function A(){return[{title:`Authorize App - WebstashAi`},{name:`robots`,content:`noindex`}]}var j=i(function(){return(0,S.jsx)(g,{children:(0,S.jsx)(w,{})})});export{j as default,A as meta};

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.