n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 5.58 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.16.1`}}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]=`72074508-51e6-4a27-ae37-9b16a03de266`,e._sentryDebugIdIdentifier=`sentry-dbid-72074508-51e6-4a27-ae37-9b16a03de266`)})()}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-C3C09Zii.js";import{at as _}from"./core-Bz5WjPxS.js";import{Ji as v,K as y,Qi as b,R as x,Xi as S,Zi as C}from"./src-XqE2yCpG.js";import{t as w}from"./_plugin-vue_export-helper-CIL7EULb.js";import{Pn as T,Rt as E}from"./users.store-xP93bV7X.js";import{T as D,c as O,t as k}from"./useRootStore-XEREVjMN.js";import{An as A}from"./settings.store-CAFiYCMH.js";import{r as j}from"./mcp.constants-CL3iQXDk.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})}var P=D(A.CONSENT,()=>{let e=i(null),t=i(!1),n=i(null),r=k();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}}),F=a({__name:`OAuthConsentView`,setup(a){let w=[`claude`,`mcp inspector`],D=[`lovable`],O=P(),k=_(),A=E(),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`:D.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(y),{size:`small`,collapsed:!0,"release-channel":`stable`})],2),n(`div`,{class:d(i.$style.arrow)},[p(l(b),{icon:`arrow-right`,size:`large`,color:`text-light`})],2),n(`div`,{class:d(i.$style.logo)},[p(l(b),{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(v),{tag:`h2`,size:`large`,bold:!0},{default:g(()=>[t(s(l(k).baseText(`oauth.consentView.success.title`)),1)]),_:1}),p(l(S),{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(v),{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(S),{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(x),{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(C),{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(C),{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)}}}),I=`_overlay_k3net_125`,L=`_header_k3net_151`,R=`_logo_k3net_157`,z=`_n8n_k3net_166`,B=`_content_k3net_171`,V=`_success_k3net_178`,H=`_footer_k3net_210`,U=w(F,[[`__cssModules`,{$style:{overlay:I,"consent-dialog":`_consent-dialog_k3net_138`,header:L,logo:R,n8n:z,content:B,success:V,"text-content":`_text-content_k3net_187`,"permission-list":`_permission-list_k3net_193`,"docs-link":`_docs-link_k3net_205`,footer:H,"button-group":`_button-group_k3net_220`}}]]);export{U as default};
//# sourceMappingURL=OAuthConsentView-BLmNugkg.js.map