n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 4.14 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]=`09695939-cf41-42a1-a841-5456b4641a66`,e._sentryDebugIdIdentifier=`sentry-dbid-09695939-cf41-42a1-a841-5456b4641a66`)})()}catch{}import{Ft as e,S as t}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{Pn as n,fr as r,r as i,t as a,vr as o}from"./users.store-xP93bV7X.js";import{Ds as s,Es as c,Ra as l,oc as u,qs as d}from"./constants-DuQbSl-q.js";import{T as f,t as p}from"./useRootStore-XEREVjMN.js";import{An as m,c as h,s as g,t as _}from"./settings.store-CAFiYCMH.js";var v=/^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,y=f(m.VERSIONS,()=>{let f=e({enabled:!1,whatsNewEnabled:!1,endpoint:``,whatsNewEndpoint:``,infoUrl:``}),m=e([]),y=e(),b=e({title:``,createdAt:new Date().toISOString(),updatedAt:null,calloutText:``,footer:``,items:[]}),x=e(),S=r(),{showToast:C,showMessage:w}=n(),T=i(),E=_(),D=a(),O=o(u),k=o(d),A=t(()=>E.settings.releaseChannel===`stable`&&m.value.length>0),j=t(()=>{if(!A.value||!y.value||!M.value)return!1;if(y.value.hasSecurityIssue)return!0;let e=y.value.name.match(v),t=M.value.name.match(v);if(!e?.groups||!t?.groups)return!1;if(Number(e.groups.major)!==Number(t.groups.major))return!0;let n=Number(e.groups.minor);return Number(t.groups.minor)-n>=2}),M=t(()=>m.value[0]??y.value),N=t(()=>f.value.enabled),P=t(()=>f.value.infoUrl),F=t(()=>O.value?l(O.value,{fallbackValue:[]}):[]),I=t(()=>k.value?l(k.value,{fallbackValue:[]}):[]),L=t(()=>b.value.items),R=async()=>{try{let{enabled:e,endpoint:t}=f.value;if(e&&t){let e=p(),n=e.versionCli,r=e.instanceId;z({versions:await g(t,n,r),currentVersion:n})}}catch(e){console.error(`Failed to fetch versions:`,e)}},z=e=>{m.value=e.versions.filter(t=>t.name!==e.currentVersion),y.value=e.versions.find(t=>t.name===e.currentVersion)},B=e=>{b.value=e},V=e=>{F.value.includes(e)||(O.value=JSON.stringify([...F.value,e]))},H=e=>F.value.includes(e),U=()=>{x.value?.close(),x.value=void 0},W=()=>{k.value=JSON.stringify(L.value.map(e=>e.id))},G=()=>{let e=D.currentUser?.createdAt,t=!1;if(e){let n=new Date(e).getTime();t=L.value.some(e=>(e.updatedAt?new Date(e.updatedAt).getTime():0)>n)}else t=!0;let n=L.value.every(e=>I.value.includes(e.id));return t&&!n},K=async()=>{try{let{enabled:e,whatsNewEnabled:t,whatsNewEndpoint:n}=f.value;if(e&&t&&n){let e=p(),t=e.versionCli,r=e.instanceId,i=await h(n,t,r);i.items?.length>0&&(B(i),G()&&(x.value=w({title:b.value.title,message:b.value.calloutText,duration:0,position:`bottom-left`,customClass:`clickable whats-new-notification`,onClick:()=>{let e=b.value.items[0]?.id??0;S.track(`User clicked on what's new notification`,{article_id:e}),T.openModalWithData({name:s,data:{articleId:e}})},onClose:()=>{W()}})))}}catch(e){console.error(`Failed to fetch Whats New section:`,e)}};return{currentVersion:y,latestVersion:M,nextVersions:m,hasVersionUpdates:A,hasSignificantUpdates:j,areNotificationsEnabled:N,infoUrl:P,fetchVersions:R,setVersions:z,initialize:e=>{f.value=e},checkForNewVersions:async()=>{if(N.value&&(await Promise.all([R(),K()]),y.value&&y.value.hasSecurityIssue&&m.value.length)){let e=y.value.securityIssueFixVersion,t=`Please update to latest version.`;e&&(t=`Please update to version ${e} or higher.`),t=`${t} <a class="primary-color">More info</a>`,C({title:`Critical update available`,message:t,onClick:()=>{T.openModal(c)},closeOnClick:!0,customClass:`clickable`,type:`warning`,duration:0})}},fetchWhatsNew:K,whatsNew:b,whatsNewArticles:L,isWhatsNewArticleRead:H,setWhatsNewArticleRead:V,closeWhatsNewCallout:U,shouldShowWhatsNewCallout:G,dismissWhatsNewCallout:W}});export{y as t};
//# sourceMappingURL=versions.store-DMbhywWy.js.map