Repository navigation
Expand file tree
/
Copy pathfeatureFlagStore.ts
More file actions
89 lines (85 loc) · 2.17 KB
/
Copy pathfeatureFlagStore.ts
File metadata and controls
89 lines (85 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { create } from 'zustand'
export type FeatureFlag =
| 'ai'
| 'auto_test_case_generation_ai'
| 'auto_story_generation_ai'
| 'retrospective'
| 'calendar'
| 'auth_password'
| 'auth_google'
| 'auth_github'
| 'github_integration'
| 'gitlab_integration'
| 'email_notifications'
| 'card_attachments'
| 'read_mcp'
| 'create_mcp'
| 'update_mcp'
| 'delete_mcp'
| 'report_mcp'
| 'ai_ceremony_digests'
| 'ai_writing_assist'
| 'ai_planning_assist'
| 'ai_project_chat'
| 'ai_usage_reporting'
export interface Features {
ai: boolean
auto_test_case_generation_ai: boolean
auto_story_generation_ai: boolean
retrospective: boolean
calendar: boolean
auth_password: boolean
auth_google: boolean
auth_github: boolean
github_integration: boolean
gitlab_integration: boolean
email_notifications: boolean
card_attachments: boolean
read_mcp: boolean
create_mcp: boolean
update_mcp: boolean
delete_mcp: boolean
report_mcp: boolean
ai_ceremony_digests: boolean
ai_writing_assist: boolean
ai_planning_assist: boolean
ai_project_chat: boolean
ai_usage_reporting: boolean
}
interface FeatureFlagState {
features: Features
loading: boolean
setFlags: (features: Features) => void
setLoading: (loading: boolean) => void
isEnabled: (flag: FeatureFlag) => boolean
}
export const useFeatureFlagStore = create<FeatureFlagState>((set, get) => ({
features: {
ai: false,
auto_test_case_generation_ai: false,
auto_story_generation_ai: false,
retrospective: false,
calendar: false,
auth_password: true,
auth_google: false,
auth_github: false,
github_integration: false,
gitlab_integration: false,
email_notifications: false,
card_attachments: false,
read_mcp: false,
create_mcp: false,
update_mcp: false,
delete_mcp: false,
report_mcp: false,
ai_ceremony_digests: false,
ai_writing_assist: false,
ai_planning_assist: false,
ai_project_chat: false,
ai_usage_reporting: false,
},
loading: true,
setFlags: (features) => set({ features, loading: false }),
setLoading: (loading) => set({ loading }),
isEnabled: (flag) => get().features[flag] === true,
}))