mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Show claim free ai credits modal on credentials (#19241)
Co-authored-by: konstantintieber <konstantin.tieber@n8n.io>
This commit is contained in:
@@ -11,6 +11,12 @@ import { computed, ref } from 'vue';
|
||||
import { OPEN_AI_API_CREDENTIAL_TYPE } from 'n8n-workflow';
|
||||
import { N8nCallout, N8nText } from '@n8n/design-system';
|
||||
|
||||
type Props = {
|
||||
credentialTypeName?: string;
|
||||
};
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const LANGCHAIN_NODES_PREFIX = '@n8n/n8n-nodes-langchain.';
|
||||
|
||||
const N8N_NODES_PREFIX = '@n8n/n8n-nodes.';
|
||||
@@ -42,6 +48,10 @@ const userHasOpenAiCredentialAlready = computed(
|
||||
).length,
|
||||
);
|
||||
|
||||
const isEditingOpenAiCredential = computed(
|
||||
() => props.credentialTypeName && props.credentialTypeName === OPEN_AI_API_CREDENTIAL_TYPE,
|
||||
);
|
||||
|
||||
const userHasClaimedAiCreditsAlready = computed(
|
||||
() => !!usersStore.currentUser?.settings?.userClaimedAiCredits,
|
||||
);
|
||||
@@ -55,7 +65,7 @@ const activeNodeHasOpenAiApiCredential = computed(
|
||||
const userCanClaimOpenAiCredits = computed(() => {
|
||||
return (
|
||||
settingsStore.isAiCreditsEnabled &&
|
||||
activeNodeHasOpenAiApiCredential.value &&
|
||||
(activeNodeHasOpenAiApiCredential.value || isEditingOpenAiCredential.value) &&
|
||||
!userHasOpenAiCredentialAlready.value &&
|
||||
!userHasClaimedAiCreditsAlready.value
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user