Add feature flag detection for profile redesign (#37472)
This commit is contained in:
parent
232b9e9cc6
commit
122b1592ed
@ -12,8 +12,21 @@ export function isProduction() {
|
|||||||
else return import.meta.env.PROD;
|
else return import.meta.env.PROD;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Features = 'fasp' | 'http_message_signatures';
|
export type ServerFeatures = 'fasp';
|
||||||
|
|
||||||
export function isFeatureEnabled(feature: Features) {
|
export function isServerFeatureEnabled(feature: ServerFeatures) {
|
||||||
return initialState?.features.includes(feature) ?? false;
|
return initialState?.features.includes(feature) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ClientFeatures = 'profile_redesign';
|
||||||
|
|
||||||
|
export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||||
|
try {
|
||||||
|
const features =
|
||||||
|
window.localStorage.getItem('experiments')?.split(',') ?? [];
|
||||||
|
return features.includes(feature);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Could not access localStorage to get client features', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user