UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 2.37 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.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]=`469b9bf9-34fe-4990-86a0-2a4c65885060`,e._sentryDebugIdIdentifier=`sentry-dbid-469b9bf9-34fe-4990-86a0-2a4c65885060`)})()}catch{}import{at as e}from"./core-Bz5WjPxS.js";import{Ln as t,Nn as n,Ot as r,fr as i,t as a}from"./users.store-xP93bV7X.js";import{_ as o}from"./constants-DuQbSl-q.js";import{t as s}from"./settings.store-CAFiYCMH.js";import{t as c}from"./versions.store-DMbhywWy.js";async function l(){let n=r();if(!n.streaming)return!0;let{confirm:i}=t(),a=e();return await i(a.baseText(`aiAssistant.builder.upgradeWhileStreaming.message`),{title:a.baseText(`aiAssistant.builder.upgradeWhileStreaming.title`),type:`warning`,confirmButtonText:a.baseText(`aiAssistant.builder.upgradeWhileStreaming.confirmButtonText`),cancelButtonText:a.baseText(`aiAssistant.builder.upgradeWhileStreaming.cancelButtonText`),showClose:!0})===`confirm`?(n.abortStreaming(),!0):!1}function u(){let e=a(),t=n(),r=c(),u=i(),d=s(),f=async()=>{let n=r.infoUrl;e.isInstanceOwner&&d.isCloudDeployment&&(n=await t.generateCloudDashboardAutoLoginLink({redirectionPath:`/manage`})),location.href=n},p=async()=>{if(e.isInstanceOwner&&d.isCloudDeployment){let e=await t.generateCloudDashboardAutoLoginLink({redirectionPath:`/dashboard`});location.href=e}},m=async(e,n,r=`open`)=>{if(!await l())return;let{usageLeft:i,trialDaysLeft:a,userIsTrialing:o}=t,{executionsLeft:s,workflowsLeft:c}=i,f=d.deploymentType;u.track(`User clicked upgrade CTA`,{source:e,isTrial:o,deploymentType:f,trialDaysLeft:a,executionsLeft:s,workflowsLeft:c});let p=await h(e,n);r===`open`?window.open(p,`_blank`):location.href=p},h=async(n,r)=>{let i=o;e.isInstanceOwner&&d.isCloudDeployment&&(i=await t.generateCloudDashboardAutoLoginLink({redirectionPath:`/account/change-plan`}));let a=new URL(i);return r&&a.searchParams.set(`utm_campaign`,r),n&&a.searchParams.set(`source`,n),a.toString()};return{goToDashboard:p,goToVersions:f,goToUpgrade:m}}export{u as t}; //# sourceMappingURL=usePageRedirectionHelper-CC6sh9o0.js.map