UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 4.11 kB
(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]=`09e47f42-9c18-4b71-9200-e4e15352ed52`,e._sentryDebugIdIdentifier=`sentry-dbid-09e47f42-9c18-4b71-9200-e4e15352ed52`)})()}catch{}import{Ft as e,S as t}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{As as n,Ms as r,Tr as i,en as a,js as o,qr as s,r as c,sl as l,t as u}from"./users.store-BHWXXawf.js";import{$a as d,Hs as f,Vs as p,cc as m,xc as h}from"./constants-CIP7tKq1.js";import{j as g,r as _}from"./_baseOrderBy-CaKruttV.js";const 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=g(l.VERSIONS,()=>{let l=e({enabled:!1,whatsNewEnabled:!1,endpoint:``,whatsNewEndpoint:``,infoUrl:``}),g=e([]),y=e(),b=e({title:``,createdAt:new Date().toISOString(),updatedAt:null,calloutText:``,footer:``,items:[]}),x=e(),S=a(),{showToast:C,showMessage:w}=i(),T=c(),E=n(),D=u(),O=s(h),k=s(m),A=t(()=>E.settings.releaseChannel===`stable`&&g.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(()=>g.value[0]??y.value),N=t(()=>l.value.enabled),P=t(()=>l.value.infoUrl),F=t(()=>O.value?d(O.value,{fallbackValue:[]}):[]),I=t(()=>k.value?d(k.value,{fallbackValue:[]}):[]),L=t(()=>b.value.items),R=async()=>{try{let{enabled:e,endpoint:t}=l.value;if(e&&t){let e=_(),n=e.versionCli,r=e.instanceId;z({versions:await o(t,n,r),currentVersion:n})}}catch(e){console.error(`Failed to fetch versions:`,e)}},z=e=>{g.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}=l.value;if(e&&t&&n){let e=_(),t=e.versionCli,i=e.instanceId,a=await r(n,t,i);a.items?.length>0&&(B(a),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:f,data:{articleId:e}})},onClose:()=>{W()}})))}}catch(e){console.error(`Failed to fetch Whats New section:`,e)}};return{currentVersion:y,latestVersion:M,nextVersions:g,hasVersionUpdates:A,hasSignificantUpdates:j,areNotificationsEnabled:N,infoUrl:P,fetchVersions:R,setVersions:z,initialize:e=>{l.value=e},checkForNewVersions:async()=>{if(N.value&&(await Promise.all([R(),K()]),y.value&&y.value.hasSecurityIssue&&g.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(p)},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-CNV-esbv.js.map