🚩(frontend) add Analytics feature flag on Blocknote AI
We want to have a fine grained control over the Blocknote AI feature. By adding the feature Analytics feature flag, we can enable or disable this feature for specific users or groups without deploying new code. This allows us to test the feature in a controlled environment and gather feedback before a full rollout.
This commit is contained in:
@@ -24,7 +24,9 @@ import { useConfig } from '@/core';
|
||||
import { useCunninghamTheme } from '@/cunningham';
|
||||
import { Doc, useProviderStore } from '@/docs/doc-management';
|
||||
import { avatarUrlFromName, useAuth } from '@/features/auth';
|
||||
import { useAnalytics } from '@/libs/Analytics';
|
||||
|
||||
import { AI_FEATURE_FLAG } from '../conf';
|
||||
import {
|
||||
useHeadings,
|
||||
useSaveDoc,
|
||||
@@ -105,9 +107,11 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
|
||||
|
||||
const { uploadFile, errorAttachment } = useUploadFile(doc.id);
|
||||
const conf = useConfig().data;
|
||||
const { isFeatureFlagActivated } = useAnalytics();
|
||||
const aiBlockNoteAllowed = !!(
|
||||
conf?.AI_FEATURE_ENABLED &&
|
||||
conf?.AI_FEATURE_BLOCKNOTE_ENABLED &&
|
||||
isFeatureFlagActivated(AI_FEATURE_FLAG) &&
|
||||
doc.abilities?.ai_proxy
|
||||
);
|
||||
const aiExtension = useAI?.(doc.id, aiBlockNoteAllowed);
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export const ANALYZE_URL = 'media-check';
|
||||
export const AI_FEATURE_FLAG = 'ai_blocknote';
|
||||
|
||||
Reference in New Issue
Block a user