PageSourceSearch

https://chat.lindy.ai/assets/restViews-CgL03MUZ.js

js lindy.ai collected 2026-09-24 18:02:49 UTC 17,010 bytes, 3 lines download raw bytes

1import{r as a,j as e,b as q}from"./entry-BCe1jibU.js";import{e as J,g3 as Q}from"./graphql-4Y3Cu4kt.js";import{a as j}from"./pathPrefix-DU8I2oCO.js";import{b as H,c as X,d as Z,e as K,f as ee,g as ae,h as se,i as te,j as le,k as ne,l as ie,m as re}from"./admin-CNoMlLPj.js";import{c as oe}from"./identity-X0DTFeA9.js";import{T as ce,S as G,v as de,t as ue}from"./icons-B6i7AQrN.js";import{o as me}from"./onFreshnessTick-B3VScl3Y.js";import{s as E}from"./toast-Blm9fZ-n.js";import{T as M}from"./toolIcon-DkFE-dA4.js";import{A as I}from"./adminLayout-OU-AekOj.js";import{A as he}from"./adminTable-LC-gvNan.js";import{g as V}from"./helpers-Dec8kFOQ.js";import{u as S,g as A,T,n as U,F as _,P as xe,S as pe,J as P,c as fe}from"./shared-iYkel3Mz.js";import{a as be}from"./authHelpers-TcdcUMOr.js";import{A as D,a as R,c as N}from"./adminView-DkbsldBq.js";import{R as ge,B as je,C as we,X as ye,Y as ve,T as ke,L as Ne,a as Ce}from"./BarChart-CfwlFOVJ.js";import"./types-CjJu7saM.js";import"./Identity-QN8NXWkM.js";import"./billing-XWNTP5pu.js";import"./EvalCloneMarker-DeoTUGFR.js";import"./speechToText-BOPKEWM6.js";import"./types-CLw4uLQj.js";import"./models-DiMb92RR.js";import"./types-CcG5mtI4.js";import"./authStep-Vc6mlF9x.js";import"./types-9eUqxxwr.js";import"./parsePhoneNumber-DJPI2TOO.js";import"./normalizeArguments-DLwglSfj.js";import"./types-BLuqObM8.js";import"./lindyTool-CidTJeMk.js";import"./hostedMcpProviders-R1ropXKE.js";import"./NativeButton-DgYgvC9L.js";import"./buttonStyles-DgzPUjES.js";import"./bundle-mjs-CSqCgoPn.js";import"./index-pNUg2pyP.js";import"./Scrollable-BvCr7Sb1.js";import"./XMarkIcon-CqPeZFAz.js";import"./InformationCircleIcon-DCmSqGbl.js";import"./auth-Bzq-__dq.js";import"./ExhaustiveSwitchError-Dwg2PnPx.js";import"./lindyAssistant-BUov6hLE.js";import"./auth-CgkXDIO7.js";import"./operations-Dn0xY-u2.js";import"./session-C75oaowB.js";import"./shellCache-Br8NUPQk.js";import"./clsx-B-dksMZM.js";import"./diverging-C1SZqrmz.js";import"./string-DIqgPFIh.js";import"./index-CIHqNa-X.js";import"./index-Chjiymov.js";async function w(s){const r=await s;if(r.error)throw new Error(A(r.error));return r.data}function Na(){const[s,r]=a.useState(""),[l,c]=a.useState(null),[m,d]=a.useState(!1),g=a.useCallback(()=>w(j.call(H,{})),[]),{data:h,error:p,loading:f,setData:i}=S(g),u=a.useCallback(async()=>{if(s){d(!0);try{const n=await w(j.call(X,{body:{url:s}}));c(n.signingKey),i(t=>({webhooks:[...t?.webhooks??[],{id:n.id,url:n.url}]}))}catch(n){E({label:A(n),level:"danger"})}finally{d(!1)}}},[i,s]),v=a.useCallback(async n=>{const t=h?.webhooks.find(o=>o.id===n)?.url;if(!(!t||!window.confirm(`Are you sure you want to remove the following webhook?
2${t}
3This cannot be undone, and this list contains the global list of webhooks!`))){d(!0);try{await w(j.call(Z,{query:{id:String(n)}})),i(o=>o&&{webhooks:o.webhooks.filter(x=>x.id!==n)})}catch(o){E({label:A(o),level:"danger"})}finally{d(!1)}}},[h?.webhooks,i]);return f?e.jsx(D,{}):p?e.jsx(R,{message:p}):e.jsx(I,{title:"Carbon webhooks",children:e.jsxs("div",{className:"mx-auto grid w-full max-w-screen-xl space-x-4 md:grid-cols-2",children:[e.jsxs("div",{className:"my-5 w-full",children:[e.jsx("h3",{className:"mb-8 text-lg font-bold dark:text-white",children:"Existing webhooks"}),h&&h.webhooks.length>0?e.jsx("ul",{children:h.webhooks.map(n=>e.jsxs("li",{className:"flex list-none items-center justify-between",children:[e.jsx("p",{children:n.url})," ",e.jsxs(N,{"data-id":n.id,disabled:m,level:"danger",onClick:()=>v(n.id),size:"sm",children:[e.jsx("span",{className:"flex size-5 items-center justify-center",children:e.jsx(ce,{className:"size-5"})}),"Delete"]})]},n.id))}):null,h&&h.webhooks.length===0?e.jsx("p",{children:"No webhooks..."}):null]}),e.jsxs("div",{className:"my-5 w-full",children:[e.jsx("h3",{className:"mb-8 text-lg font-bold dark:text-white",children:"Add webhook"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{onChange:n=>r(n.target.value),placeholder:"Webhook URL",type:"url",value:s}),e.jsx(N,{disabled:m,onClick:u,type:"submit",children:"Add"})]}),l?e.jsxs("div",{className:"mt-4",children:[e.jsxs("p",{children:["Signing Key: ",l]}),e.jsxs("p",{children:["Add it to the .env file of the environment using the key"," ",e.jsx("strong",{children:"CARBON_API_WEBHOOK_SIGNING_KEY"})]})]}):null]})]})})}function Se({data:s}){return s.length===0?null:e.jsx("div",{className:"mt-4 text-sm",children:e.jsx(ge,{width:"100%",minHeight:225,children:e.jsxs(je,{width:500,height:300,data:s,children:[e.jsx(we,{strokeDasharray:"3 3"}),e.jsx(ye,{dataKey:"occupation"}),e.jsx(ve,{}),e.jsx(ke,{}),e.jsx(Ne,{}),e.jsx(Ce,{dataKey:"count",fill:"#8884d8"})]})})})}function Ca(){const[s,r]=a.useState(0),[l,c]=a.useState(""),[m,d]=a.use
3State("");a.useEffect(()=>{const t=window.setTimeout(()=>d(l),1e3);return()=>window.clearTimeout(t)},[l]);const g=a.useCallback(()=>w(j.call(K,{query:{limit:"20",searchTerm:m||void 0,skip:String(s*20)}})),[m,s]),h=a.useCallback(()=>w(j.call(oe,{})),[]),{data:p,error:f,loading:i}=S(g),{data:u}=S(h),v=a.useMemo(()=>{const t=l.toLowerCase();return(p??[]).filter(o=>o.name.toLowerCase().includes(t))},[p,l]),n=[{header:"Occupation",key:"occupation",render:t=>e.jsx("a",{className:"text-indigo-400 hover:text-indigo-300",href:`/admin/occupations/${t._id}`,children:t.name}),sorter:(t,o)=>t.name.localeCompare(o.name)},{header:"Paywall",key:"paywall",render:t=>t.paywall?"Enabled":"Not enabled",sorter:(t,o)=>Number(t.paywall)-Number(o.paywall)}];return i?e.jsx(D,{}):f?e.jsx(R,{message:`Error loading occupations: ${f}`}):e.jsxs(I,{title:"Occupations",children:[e.jsx("div",{className:"mb-4 flex justify-end",children:e.jsx("a",{className:"text-indigo-10 hover:underline",href:"/admin/occupations/create",children:"+ New Occupation"})}),e.jsx("div",{className:"rounded-md border dark:border-white/20",children:e.jsxs("div",{className:"grid grid-cols-12 p-4",children:[e.jsx("dd",{className:"col-span-12 mb-4 rounded-md border dark:border-white/20",children:e.jsx(Se,{data:u?.userGroupedByOccupation??[]})}),e.jsxs("dt",{className:"col-span-12 flex flex-col gap-3 pb-4 font-bold sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("button",{className:"mx-6 text-indigo-400 disabled:cursor-not-allowed disabled:text-slate-11",disabled:s===0||l.length>0,onClick:()=>{c(""),r(t=>Math.max(t-1,0))},children:"< Previous"}),e.jsx("button",{className:"text-indigo-400 disabled:cursor-not-allowed disabled:text-slate-11",disabled:(p?.length??0)<20||l.length>0,onClick:()=>{c(""),r(t=>t+1)},children:"Next >"})]}),e.jsx(T,{autoFocus:!0,className:"w-full font-medium sm:w-64",id:"input",onChange:t=>c(t.target.value),placeholder:"Search by occupation",type:"text",value:l})]}),e.jsx("dd",{className:"col-span-12 overflow-x-auto rounded-md border dark:border-white/20",children:e.jsx(he,{columns:n,data:v,rowKey:t=>t._id})})]})})]})}function Sa(){const s=V("/admin/occupations/")??"create",r=s==="create",[l,c]=a.useState(""),[m,d]=a.useState({landTemplate:"",lindyStoreDefaultCategory:"",recommendedLindyStoreTemplates:[],redirectionBehavior:"lindyStore",userPreinstalledTemplates:[]}),[g,h]=a.useState(!1),[p,f]=a.useState(!1),i=a.useCallback(async()=>{if(r)return null;const y=(await w(j.call(K,{query:{id:s}})))[0];if(!y)throw new Error("Occupation not found");return y},[r,s]),{data:u,error:v,loading:n}=S(i);a.useEffect(()=>{u&&(c(u.name),d({landTemplate:u.landTemplate,lindyStoreDefaultCategory:u.lindyStoreDefaultCategory,recommendedLindyStoreTemplates:u.recommendedLindyStoreTemplates,redirectionBehavior:u.redirectionBehavior,userPreinstalledTemplates:u.userPreinstalledTemplates}),h(u.paywall))},[u]);const t=a.useCallback(async()=>{f(!0);const x={...m,name:l,paywall:g};try{r?await w(j.call(ee,{body:x})):await w(j.call(ae,{body:{...x,_id:s}})),U("/admin/occupations")}catch(y){E({label:A(y),level:"danger"})}finally{f(!1)}},[r,m,l,s,g]),o=a.useCallback(async()=>{if(window.confirm("Are you sure you want to delete this occupation?")){f(!0);try{await w(j.call(se,{body:{id:s}})),U("/admin/occupations")}catch(x){E({label:A(x),level:"danger"}),f(!1)}}},[s]);return n?e.jsx(D,{}):v?e.jsx(R,{message:v}):e.jsx(I,{title:"Occupations",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-6",children:[e.jsx(_,{label:"New Occupation name",children:e.jsx(T,{id:"new-occupation-name",name:"new-occupation-name",onChange:x=>c(x.target.value),value:l})}),e.jsxs("label",{className:"flex items-center justify-between gap-4",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Paywall"}),e.jsx("span",{className:"text-sm text-slate-9",children:"Check this option if you want to enable the paywall for this occupation. User will not be able to use free lindy if this option is enabled."})]}),e.jsx("input",{checked:g,className:"h-5 w-5",onChange:x=>h(x.target.checked),type:"checkbox"})]}),r?e.jsx(N,{disabled:p||!l,onClick:t,children:"Create new occupation"}):e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(N,{disabled:p,onClick:t,children:"Update occupation"}),e.jsx(N,{disabled:p,level:"danger",onClick:o,children:"Delete occupation"})]})]})})}function W({children:s=null}){const r=a.useCallback(()=>w(j.call(re,{})),[]),{data:l,error:c,loading:m}=S(r);return e.jsxs("div",{className:"flex size-full flex-col overflow-hidden text-slate-12",children:[e.jsx("div",{className:"flex h-12 shrink-0 items-center border-b border-slate-8 px-4",children:e.jsx("h1",{className:"text-lg font-semibold",children:"OAuth Applications"})}),e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden md:flex-row md:items-center",children:[e.jsxs("div",{className:"flex max-h-64 w-full shrink-0 flex-col overflow-auto border-b border-slate-8 md:h-full md:max-h-none md:w-80 md:border-b-0 md:border-r",children:[m?e.jsx(G,{className:"size-10","aria-label":"Loading"}):null,c?e.jsx("p",{className:"p-4 text-sm text-red-11",children:c}):null,l?.map(d=>e.jsxs("a",{className:"flex w-full gap-2 border-b border-slate-4 p-4 hover:bg-slate-2 md:w-80",href:`/admin/oauth-applications/${d.key}`,children:[e.jsx(M,{className:"size-10 shrink-0",tool:d.icon??d.key}),e.jsxs("div",{className:"flex flex-col justify-center gap-2",children:[e.jsx("div",{className:"font-medium",children:d.displayName}),d.hasCredentials?null:e.jsxs("div",{className:"flex gap-2 text-red-600 dark:text-red-400",children:[e.jsx(ue,{className:"size-5"}),e.jsx("div",{className:"text-sm",children:"Missing credentials"})]})]})]},d.key))]}),e.jsx("div",{className:"flex min-h-0 w-full grow overflow-hidden",children:s})]})]})}function Aa(){return e.jsx(W,{})}function Ea(){const s=V("/admin/oauth-applications/"),[r,l]=a.useState(""),[c,m]=a.useState(""),[d,g]=a.useState(!1),[h,p]=a.use
3State(!1),f=a.useCallback(()=>s?w(j.call(ne,{params:{key:s}})):Promise.reject(new Error("OAuth application not found")),[s]),{data:i,error:u,loading:v,setData:n}=S(f);a.useEffect(()=>{l(""),m(""),g(!1)},[s]),a.useEffect(()=>{u&&U("/admin/oauth-applications")},[u]);const t=a.useCallback(async()=>{if(!s||!r||!c)return;const y=i;p(!0),n(k=>k&&{...k,hasCredentials:!0}),l(""),m(""),g(!1);try{const k=await w(j.call(ie,{body:{clientId:r,clientSecret:c},params:{key:s}}));n(k)}catch(k){n(y),E({label:A(k),level:"danger"})}finally{p(!1)}},[r,c,i,s,n]),o=d||!!(i&&!i.hasCredentials),x=i?`${q.apiOrigin}/api/oauth2/${i.key}/callback`:"";return e.jsx(W,{children:e.jsx("div",{className:"flex h-full flex-col overflow-hidden",children:v||!i?e.jsx(G,{className:"size-10","aria-label":"Loading"}):e.jsxs("div",{className:"flex flex-col gap-2 overflow-auto p-4",children:[e.jsx("div",{className:"text-2xl font-medium",children:i.displayName}),i.hasCredentials?null:e.jsxs("div",{className:"my-2 flex flex-col gap-2 rounded border border-red-400 bg-red-1 p-2 text-sm text-red-700 dark:text-red-400",children:[e.jsx("div",{className:"font-medium",children:"Missing credentials"}),e.jsx("div",{children:"You must configure the Client ID and Client Secret before this authentication method can be used."}),i.description?e.jsx("pre",{className:"whitespace-pre-wrap font-sans text-sm font-medium",children:i.description}):null]}),e.jsx("div",{className:"text-sm font-medium",children:"Tokenization URL"}),e.jsx("div",{children:i.tokenUrl}),e.jsx("div",{className:"text-sm font-medium",children:"Authorization URL"}),e.jsx("div",{children:i.authorizationUrl}),e.jsx("div",{className:"text-sm font-medium",children:"Callback URL"}),e.jsxs("div",{className:"flex w-min items-center gap-1 rounded border bg-slate-2 p-1 pl-2 font-mono text-sm",children:[x,e.jsx("button",{"aria-label":"Copy OAuth callback URL",onClick:()=>fe(x),title:"Copy OAuth callback URL",type:"button",children:e.jsx(de,{className:"size-4"})})]}),e.jsxs("div",{className:"flex w-[500px] max-w-full flex-col gap-2",children:[e.jsx(_,{label:"Client ID",children:e.jsx(T,{disabled:!o,id:"id",onChange:y=>l(y.target.value),value:o?r:"•••••••••••••••••••••••"})}),e.jsx(_,{label:"Client secret",children:e.jsx(T,{disabled:!o,id:"secret",onChange:y=>m(y.target.value),value:o?c:"•••••••••••••••••••••••"})}),e.jsx("div",{className:"mt-2 flex flex-col",children:o?e.jsxs("div",{className:"flex grow gap-2",children:[i.hasCredentials?e.jsx(N,{level:"outline",onClick:()=>g(!1),children:"Cancel"}):null,e.jsx(N,{className:"grow",disabled:h||!r||!c,onClick:t,children:"Save Changes"})]}):e.jsx(N,{level:"outline",onClick:()=>g(!0),children:"Edit"})})]})]})})})}const Ae=Q;function Ta(){const[s,r]=a.useState(""),[l,c]=a.useState(null),[m,d]=a.useState(null),[g,h]=a.useState(!1),[p,f]=a.useState(null),[i,u]=a.useState(null),[v,n]=a.useState(!1),t=a.useCallback(()=>J(Ae),[]),{data:o,error:x,loading:y,reload:k}=S(t),z=(o?.me.auth??[]).filter(b=>b.provider==="airtableAuth"),C=z.find(b=>b.id===s),L=C!==void 0&&!C.isConnected,B=["schema.bases:read","data.records:read","data.records:write"],O=C!==void 0&&B.some(b=>!C.scopes?.includes(b)),F=be({authId:L||O?C.id:void 0,provider:"airtableAuth",scopes:B,workspaceId:""});a.useEffect(()=>me(k,{minGapMs:0}),[k]);const Y=a.useCallback(async()=>{if(s){h(!0),c(null),d(null);try{c(await w(j.call(te,{body:{authId:s}})))}catch(b){d(b)}finally{h(!1)}}},[s]),$=a.useCallback(async()=>{if(l){n(!0),f(null),u(null);try{f(await w(j.call(le,{body:{authId:s,confirmedPlan:l}})))}catch(b){u(b)}finally{n(!1)}}},[s,l]);return y?e.jsx(D,{}):x?e.jsx(R,{message:x}):e.jsx(I,{title:"Admin",children:e.jsx("div",{className:"flex w-full grow flex-col items-center overflow-auto",children:e.jsxs(xe,{className:"my-16 w-full max-w-xl",children:[e.jsxs("h1",{className:"flex items-baseline gap-2",children:[e.jsx(M,{tool:"airtable",className:"size-8"}),"Sync Tool List to Airtable"]}),e.jsxs("p",{children:["Sync the list of Triggers and Actions from the codebase to the"," ",e.jsx("a",{href:"https://airtable.com/appcJEmWQ4Mt8TjVj/tblTw2kz5dYr0xa3R/viwouRIYSBeth6m5t",target:"_blank",rel:"noreferrer",children:"Airtable Integration List"}),"."]}),e.jsx("h2",{children:"1. Connect your Airtable account"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(pe,{onChange:b=>{r(b.target.value),c(null),d(null),f(null),u(null)},value:s,children:[e.jsx("option",{value:"",children:"Select an Airtable account"}),z.map(b=>e.jsx("option",{value:b.id,children:b.label},b.id))]}),e.jsx("a",{className:"inline-flex h-9 w-fit items-center justify-center rounded-md border border-slate-7 bg-white px-3 text-sm font-medium text-slate-12 hover:bg-slate-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-8 dark:bg-slate-2",href:F,rel:"noreferrer",target:"_blank",children:L?"Reconnect account":O?"Authorize account":"Connect new account"})]}),e.jsx("h2",{children:"2. Plan a sync"}),e.jsx(N,{disabled:!C||L||O,loading:g,onClick:Y,children:"Generate Plan"}),l?e.jsxs("div",{className:"flex flex-col rounded-md bg-green-3 p-4 text-sm",children:[e.jsx("p",{className:"mt-0 font-semibold",children:"Plan generated. Ready to sync."}),e.jsx(P,{value:l})]}):m?e.jsxs("div",{className:"flex flex-col rounded-md bg-red-3 p-4 text-sm",children:[e.jsx("p",{className:"mt-0 font-semibold",children:"Error generating plan"}),e.jsx(P,{value:m})]}):null,e.jsx("h2",{children:"3. Verify and execute sync"}),e.jsx(N,{disabled:!C||L||O||!l,loading:v,onClick:$,children:"Execute Sync"}),p?e.jsxs("div",{className:"flex flex-col rounded-md bg-green-3 p-4 text-sm",children:[e.jsx("p",{className:"mt-0 font-semibold",children:"Sync executed successfully"}),e.jsx(P,{value:p})]}):i?e.jsxs("div",{className:"flex flex-col rounded-md bg-red-3 p-4 text-sm",children:[e.jsx("p",{className:"mt-0 font-semibold",children:"Error executing sync"}),e.jsx(P,{value:i})]}):null]})})})}export{Ta as AirtableListView,Na as CarbonWebhooksView,Ea as OAuthApplicationDetailVie
3w,Aa as OAuthApplicationsView,Sa as OccupationDetailView,Ca as OccupationsView};

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.