n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 5.68 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.13.4`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`0a93c543-4291-48c7-bcf2-c1879a94380a`,e._sentryDebugIdIdentifier=`sentry-dbid-0a93c543-4291-48c7-bcf2-c1879a94380a`)})()}catch{}import{$ as e,A as t,C as n,E as r,Ft as i,N as a,S as o,Sn as s,T as c,Wt as l,X as u,_n as d,bt as f,j as p,ot as m,w as h,yt as g}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as _}from"./_MapCache-CUJwh2qp.js";import{$ as v,$i as y,K as b,Qi as x,Yi as S,Zi as C}from"./src-wni2AGA3.js";import{t as w}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import"./sanitize-html-my1ogl5v.js";import{Tr as T,sl as E,vn as D}from"./users.store-BHWXXawf.js";import"./constants-CIP7tKq1.js";import"./merge-BqvKZ38d.js";import{d as O,j as k,r as A}from"./_baseOrderBy-CaKruttV.js";import"./dateformat-CYfyw486.js";import"./useDebounce-CTeIt-cH.js";import{a as j}from"./mcp.constants-1YI8b9Rg.js";async function M(e){return await O(e,`GET`,`/consent/details`)}async function N(e,t){return await O(e,`POST`,`/consent/approve`,{approved:t})}const P=k(E.CONSENT,()=>{let e=i(null),t=i(!1),n=i(null),r=A();return{fetchConsentDetails:async()=>{t.value=!0,n.value=null;try{return e.value=await M(r.restApiContext),e.value}catch(e){throw n.value=e instanceof Error?e.message:`Failed to load consent details`,e}finally{t.value=!1}},approveConsent:async e=>{t.value=!0,n.value=null;try{return await N(r.restApiContext,e)}catch(e){throw n.value=e instanceof Error?e.message:`Failed to process consent`,e}finally{t.value=!1}},resetState:()=>{e.value=null,t.value=!1,n.value=null},consentDetails:e,isLoading:t,error:n}});var F=w(a({__name:`OAuthConsentView`,setup(a){let w=[`claude`,`mcp inspector`],E=[`lovable`],O=P(),k=_(),A=D(),M=T(),N=i(!1),F=o(()=>O.error),I=o(()=>O.isLoading),L=o(()=>O.consentDetails),R=o(()=>{let e=L.value?.clientName?.toLowerCase()??``;return w.some(t=>e.includes(t))?`anthropic`:E.some(t=>e.includes(t))?`lovable`:`mcp`}),z=async()=>{try{let e=await O.approveConsent(!0);N.value=!0,window.location.href=e.redirectUrl}catch(e){M.showError(e,k.baseText(`oauth.consentView.error.allow`))}},B=async()=>{try{let e=await O.approveConsent(!1);window.location.href=e.redirectUrl}catch(e){M.showError(e,k.baseText(`oauth.consentView.error.deny`))}};return u(async()=>{A.set(k.baseText(`oauth.consentView.title`));try{await O.fetchConsentDetails()}catch(e){M.showError(e,k.baseText(`oauth.consentView.error.fetchDetails`))}}),(i,a)=>{let o=m(`n8n-html`);return e(),r(`div`,{class:d(i.$style.overlay)},[n(`div`,{class:d(i.$style[`consent-dialog`])},[n(`header`,{class:d(i.$style.header)},[n(`div`,{class:d([i.$style.logo,i.$style.n8n])},[p(l(v),{size:`small`,collapsed:!0,"release-channel":`stable`})],2),n(`div`,{class:d(i.$style.arrow)},[p(l(y),{icon:`arrow-right`,size:`large`,color:`text-light`})],2),n(`div`,{class:d(i.$style.logo)},[p(l(y),{icon:R.value,size:`xlarge`,color:`text-dark`},null,8,[`icon`])],2)],2),N.value?(e(),r(`div`,{key:0,class:d(i.$style.success),"data-test-id":`consent-success-screen`},[p(l(S),{tag:`h2`,size:`large`,bold:!0},{default:g(()=>[t(s(l(k).baseText(`oauth.consentView.success.title`)),1)]),_:1}),p(l(C),{color:`text-base`},{default:g(()=>[t(s(l(k).baseText(`oauth.consentView.success.description`)),1)]),_:1})],2)):(e(),r(`div`,{key:1,class:d(i.$style.content),"data-test-id":`consent-content`},[p(l(S),{tag:`h2`,size:`large`,bold:!0},{default:g(()=>[t(s(l(k).baseText(`oauth.consentView.heading`,{interpolate:{clientName:L.value?.clientName??``}})),1)]),_:1}),n(`div`,{class:d(i.$style[`text-content`])},[p(l(C),{color:`text-base`,size:`small`},{default:g(()=>[t(s(l(k).baseText(`oauth.consentView.description`,{interpolate:{clientName:L.value?.clientName??``}})),1)]),_:1}),n(`ul`,{class:d(i.$style[`permission-list`])},[n(`li`,null,s(l(k).baseText(`oauth.consentView.action.listWorkflows`)),1),n(`li`,null,s(l(k).baseText(`oauth.consentView.action.workflowDetails`)),1),n(`li`,null,s(l(k).baseText(`oauth.consentView.action.executeWorkflows`)),1)],2),n(`p`,{class:d(i.$style[`docs-link`])},[f(n(`span`,null,null,512),[[o,l(k).baseText(`oauth.consentView.readMore`,{interpolate:{docsUrl:l(j)}})]])],2)],2)],2)),N.value?c(``,!0):(e(),r(`footer`,{key:2,class:d(i.$style.footer)},[F.value?(e(),h(l(b),{key:0,theme:`danger`,"data-test-id":`consent-error-notice`,content:F.value},null,8,[`content`])):c(``,!0),n(`div`,{class:d(i.$style[`button-group`])},[p(l(x),{variant:`subtle`,"data-test-id":`consent-deny-button`,size:`large`,loading:I.value,disabled:I.value||F.value!==null,onClick:B},{default:g(()=>[t(s(l(k).baseText(`generic.deny`)),1)]),_:1},8,[`loading`,`disabled`]),p(l(x),{variant:`solid`,"data-test-id":`consent-allow-button`,size:`large`,loading:I.value,disabled:I.value||F.value!==null,onClick:z},{default:g(()=>[t(s(l(k).baseText(`generic.allow`)),1)]),_:1},8,[`loading`,`disabled`])],2)],2))],2)],2)}}}),[[`__cssModules`,{$style:{overlay:`_overlay_k3net_125`,"consent-dialog":`_consent-dialog_k3net_138`,header:`_header_k3net_151`,logo:`_logo_k3net_157`,n8n:`_n8n_k3net_166`,content:`_content_k3net_171`,success:`_success_k3net_178`,"text-content":`_text-content_k3net_187`,"permission-list":`_permission-list_k3net_193`,"docs-link":`_docs-link_k3net_205`,footer:`_footer_k3net_210`,"button-group":`_button-group_k3net_220`}}]]);export{F as default};
//# sourceMappingURL=OAuthConsentView--z23TEp6.js.map