Skip to content

Commit

Permalink
fix free AI credits experiment evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoE105 committed Jan 7, 2025
1 parent f609371 commit 6fdace1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('FreeAiCreditsCallout', () => {
});

(usePostHog as any).mockReturnValue({
isFeatureEnabled: vi.fn().mockReturnValue(true),
getVariant: vi.fn().mockReturnValue('variant'),
});

(useProjectsStore as any).mockReturnValue({
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/FreeAiCreditsCallout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
);
Expand Down

0 comments on commit 6fdace1

Please sign in to comment.