fix(editor): Free AI credits experiment evaluation (no-changelog) (#12481)

This commit is contained in:
Ricardo Espinoza 2025-01-07 08:05:05 -05:00 committed by GitHub
parent 3d990eb555
commit adcedd1c2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -86,7 +86,7 @@ describe('FreeAiCreditsCallout', () => {
});
(usePostHog as any).mockReturnValue({
isFeatureEnabled: vi.fn().mockReturnValue(true),
getVariant: vi.fn().mockReturnValue('variant'),
});
(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 () => {
(usePostHog as any).mockReturnValue({
isFeatureEnabled: vi.fn().mockReturnValue(false),
getVariant: vi.fn().mockReturnValue('control'),
});
renderComponent(FreeAiCreditsCallout);

View file

@ -27,7 +27,7 @@ const showSuccessCallout = ref(false);
const claimingCredits = ref(false);
const settingsStore = useSettingsStore();
const postHogStore = usePostHog();
const posthogStore = usePostHog();
const credentialsStore = useCredentialsStore();
const usersStore = useUsersStore();
const ndvStore = useNDVStore();
@ -57,7 +57,7 @@ const userCanClaimOpenAiCredits = computed(() => {
return (
settingsStore.isAiCreditsEnabled &&
activeNodeHasOpenAiApiCredential.value &&
postHogStore.isFeatureEnabled(AI_CREDITS_EXPERIMENT.name) &&
posthogStore.getVariant(AI_CREDITS_EXPERIMENT.name) === AI_CREDITS_EXPERIMENT.variant &&
!userHasOpenAiCredentialAlready.value &&
!userHasClaimedAiCreditsAlready.value
);