PageSourceSearch

https://stepily.com/assets/Authorize-CX38T9G2.js

js stepily.com collected 2026-09-24 14:53:21 UTC 4,896 bytes, 11 lines download raw bytes

1import{c as C,h as T,l as I,k as E,b9 as _,m as q,r as p,j as e,q as z,t as N,v as k,R as w,ba as v,x as f,w as L,s as j,Z as D}from"./index-BIfQh25H.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const U=C("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const F=C("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),$={extension:["chrome-extension://"],"seequence-desktop":["stepily://","http://localhost","http://127.0.0.1"]};function H(s,r){if(!s||!r)return!1;const i=$[s];if(!i)return!1;try{new URL(r)}catch{return!1}return i.some(c=>r.startsWith(c))}const B=()=>{const{t:s}=T(),[r]=I(),i=E(),c=_(),{user:u,loading:h}=q(),[x,g]=p.useState(!1),[b,A]=p.useState(!0),n=r.get("client_id"),a=r.get("redirect_uri"),l=r.get("state"),P=()=>s(n==="seequence-desktop"?"authorize.appNames.stepilyDesktop":"authorize.appNames.tutorialSidePanel"),y=()=>s(n==="seequence-desktop"?"authorize.appTypes.application":"authorize.appTypes.extension");p.useEffect(()=>{(async()=>{if(h)return;const{data:{session:o}}=await j.auth.getSession();if(o!=null&&o.access_token)A(!1);else{const d=`${c.pathname}${c.search}`;i(`/auth?next=${encodeURIComponent(d)}`,{replace:!0})}})()},[u,h,i,c.pathname,c.search]);const S=async()=>{if(!(!u||!a)){g(!0);try{const{data:{session:t}}=await j.auth.getSession();if(!(t!=null&&t.access_token))throw new Error("No valid session found");const{data:o,error:d}=await j.functions.invoke("create-extension-token",{body:{userId:u.id,clientId:n||"extension",redirectUri:a}});if(d)throw d;const m=new URL(a);m.searchParams.set("code",o.code),l&&m.searchParams.set("state",l),window.location.href=m.toString()}catch(t){console.error("Authorization error:",t),D.error(s("authorize.toasts.authorizeFailed")),g(!1)}}},R=()=>{if(!a){i("/");return}const t=new URL(a);t.searchParams.set("error","access_denied"),t.searchParams.set("error_description","User declined authorization"),l&&t.searchParams.set("state",l),window.location.href=t.toString()};return h||b?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-muted-foreground",children:s("authorize.loading")})})}):!n||!a||!H(n,a)?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsxs(z,{className:"w-full max-w-md",children:[e.jsx(N,{children:e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsx(U,{className:"h-5 w-5"}),e.jsx(k,{children:s("authorize.invalidRequestTitle")})]})}),e.jsx(w,{children:e.jsx("p",{className:"text-muted-foreground",children:s(!n||!a?"authorize.missingParameters":"authorize.redirectNotAuthorized")})}),e.jsx(v,{children:e.jsx(f,{onClick:()=>i("/"),variant:"outline",className:"w-full",children:s("authorize.returnHome")})})]})}):e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:e.jsxs(z,{className:"w-full max-w-md",children:[e.jsxs(N,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:e.jsx(F,{className:"h-6 w-6 text-primary"})}),e.jsx(k,{children:s("authorize.title")}),e.jsxs(L,{children:[s("authorize.descriptionPrefix"),e.jsx("strong",{children:P()}),s("authorize.descriptionSuffix",{appType:y()})]})]}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg bg-muted p-4",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:s("authorize.allowIntro",{appType:y()})}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("li",{children:["• ",s("authorize.permissions.viewTutorials")]}),e.jsxs("li",{children:["• ",s("authorize.permissions.accessContent")]}),e.jsxs("li",{children:["•"," ",s("authorize.permissions.displayIn",{location:s(n==="seequence-desktop"?"authorize.a
11ppTypes.application":"authorize.sidePanel")})]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("authorize.revokeNotice")})]}),e.jsxs(v,{className:"flex gap-3",children:[e.jsx(f,{onClick:R,variant:"outline",className:"flex-1",disabled:x,children:s("authorize.decline")}),e.jsx(f,{onClick:S,className:"flex-1",disabled:x,children:s(x?"authorize.authorizing":"authorize.approve")})]})]})})};export{B 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.