UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 1.6 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]=`c490b2ae-452d-4c40-8932-5f26d4b269d5`,e._sentryDebugIdIdentifier=`sentry-dbid-c490b2ae-452d-4c40-8932-5f26d4b269d5`)})()}catch{}import{Ft as e,S as t}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as n}from"./_MapCache-CUJwh2qp.js";import{As as r,Ft as i,Tr as a,at as o,en as s,t as c}from"./users.store-BHWXXawf.js";import{Lo as l}from"./constants-CIP7tKq1.js";function u(){let u=o(),d=i(),f=r(),p=c(),m=s(),h=a(),g=n(),_=e(!1),v=t(()=>f.isAiCreditsEnabled),y=t(()=>f.aiCreditsQuota),b=t(()=>u.allCredentials.some(e=>e.type===l)),x=t(()=>!!p.currentUser?.settings?.userClaimedAiCredits),S=t(()=>v.value&&!b.value&&!x.value);async function C(e){if(!S.value)return!1;_.value=!0;try{return await u.claimFreeAiCredits(d.currentProject?.id),p?.currentUser?.settings&&(p.currentUser.settings.userClaimedAiCredits=!0),m.track(`User claimed OpenAI credits`,{source:e}),!0}catch(e){return h.showError(e,g.baseText(`freeAi.credits.showError.claim.title`),g.baseText(`freeAi.credits.showError.claim.message`)),!1}finally{_.value=!1}}return{isAiCreditsEnabled:v,aiCreditsQuota:y,userCanClaimOpenAiCredits:S,claimingCredits:_,claimCredits:C}}export{u as t}; //# sourceMappingURL=useFreeAiCredits-oLq3Ynnl.js.map