UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 2.29 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]=`44c3b88b-e5e5-45f8-a405-112b6e8f7a76`,e._sentryDebugIdIdentifier=`sentry-dbid-44c3b88b-e5e5-45f8-a405-112b6e8f7a76`)})()}catch{}import{Ft as e,S as t}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{lt as n}from"./src-XqE2yCpG.js";import{Nn as r,fr as i,hr as a,it as o,s}from"./users.store-xP93bV7X.js";import{Ic as c,Qo as l,n as u}from"./constants-DuQbSl-q.js";import{T as d}from"./useRootStore-XEREVjMN.js";import{An as f}from"./settings.store-CAFiYCMH.js";function p(e){return typeof e==`object`&&!!e&&`nodes`in e&&Array.isArray(e.nodes)}var m=d(f.EXPERIMENT_EMPTY_STATE_BUILDER_PROMPT,()=>{let d=a(),f=r(),m=s(),h=o(),g=n(),_=i();function v(e){if(e?.nodes){for(let t of e.nodes)if(t.credentials)for(let[e,n]of Object.entries(t.credentials))typeof n==`string`||n.id===null||h.getCredentialById(n.id)||delete t.credentials[e]}}let y=e(null),b=t(()=>d.getVariant(c.name)),x=t(()=>b.value===c.variantBuilderPrompt),S=t(()=>f.userIsTrialing&&x.value);async function C(e,t,n){_.track(`User submitted empty state builder prompt`,{prompt_length:e.length}),y.value=e;let r=await m.createNewWorkflow({name:u,nodes:[],connections:{},projectId:t,parentFolderId:n});await g.push({name:l.WORKFLOW,params:{name:r.id}})}function w(){let e=y.value;return y.value=null,e}async function T(e,t,n){if(!p(e))throw Error(`Invalid workflow data`);v(e),_.track(`User imported workflow from empty state`,{node_count:e.nodes?.length??0});let r=await m.createNewWorkflow({name:e.name??`My workflow`,nodes:e.nodes??[],connections:e.connections??{},settings:e.settings,pinData:e.pinData,meta:e.meta,projectId:t,parentFolderId:n});await g.push({name:l.WORKFLOW,params:{name:r.id}})}return{currentVariant:b,isFeatureEnabled:S,pendingPrompt:t(()=>y.value),createWorkflowWithPrompt:C,consumePendingPrompt:w,createWorkflowFromImport:T}});export{m as t}; //# sourceMappingURL=emptyStateBuilderPrompt.store-B6Wyp6iR.js.map