mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Free AI credits experiment evaluation (no-changelog) (#12481)
This commit is contained in:
parent
3d990eb555
commit
adcedd1c2b
|
@ -86,7 +86,7 @@ describe('FreeAiCreditsCallout', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
(usePostHog as any).mockReturnValue({
|
(usePostHog as any).mockReturnValue({
|
||||||
isFeatureEnabled: vi.fn().mockReturnValue(true),
|
getVariant: vi.fn().mockReturnValue('variant'),
|
||||||
});
|
});
|
||||||
|
|
||||||
(useProjectsStore as any).mockReturnValue({
|
(useProjectsStore as any).mockReturnValue({
|
||||||
|
@ -150,7 +150,7 @@ describe('FreeAiCreditsCallout', () => {
|
||||||
|
|
||||||
it('should not be able to claim credits if user it is not in experiment', async () => {
|
it('should not be able to claim credits if user it is not in experiment', async () => {
|
||||||
(usePostHog as any).mockReturnValue({
|
(usePostHog as any).mockReturnValue({
|
||||||
isFeatureEnabled: vi.fn().mockReturnValue(false),
|
getVariant: vi.fn().mockReturnValue('control'),
|
||||||
});
|
});
|
||||||
|
|
||||||
renderComponent(FreeAiCreditsCallout);
|
renderComponent(FreeAiCreditsCallout);
|
||||||
|
|
|
@ -27,7 +27,7 @@ const showSuccessCallout = ref(false);
|
||||||
const claimingCredits = ref(false);
|
const claimingCredits = ref(false);
|
||||||
|
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
const postHogStore = usePostHog();
|
const posthogStore = usePostHog();
|
||||||
const credentialsStore = useCredentialsStore();
|
const credentialsStore = useCredentialsStore();
|
||||||
const usersStore = useUsersStore();
|
const usersStore = useUsersStore();
|
||||||
const ndvStore = useNDVStore();
|
const ndvStore = useNDVStore();
|
||||||
|
@ -57,7 +57,7 @@ const userCanClaimOpenAiCredits = computed(() => {
|
||||||
return (
|
return (
|
||||||
settingsStore.isAiCreditsEnabled &&
|
settingsStore.isAiCreditsEnabled &&
|
||||||
activeNodeHasOpenAiApiCredential.value &&
|
activeNodeHasOpenAiApiCredential.value &&
|
||||||
postHogStore.isFeatureEnabled(AI_CREDITS_EXPERIMENT.name) &&
|
posthogStore.getVariant(AI_CREDITS_EXPERIMENT.name) === AI_CREDITS_EXPERIMENT.variant &&
|
||||||
!userHasOpenAiCredentialAlready.value &&
|
!userHasOpenAiCredentialAlready.value &&
|
||||||
!userHasClaimedAiCreditsAlready.value
|
!userHasClaimedAiCreditsAlready.value
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue