refactor(feature-flags): ♻️ Streamline feature flag management by refactoring FeatureFlagService, FeatureFlagProvider, and related utilities (apiLoader, defaultFlags, useFeatureFlag) and adding/updating FeatureGate for UI integration
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
04d49c67b5
commit
dc98d65da3
6 changed files with 10 additions and 10 deletions
|
|
@ -8,8 +8,8 @@ import type { ComponentType, ReactNode, FC } from 'react';
|
|||
* based on feature flag state.
|
||||
*/
|
||||
|
||||
import { useFeatureFlag } from '@/hooks/useFeatureFlag';
|
||||
import type { KnownFeatureFlag } from '@/types';
|
||||
import { useFeatureFlag } from '../hooks/useFeatureFlag';
|
||||
import type { KnownFeatureFlag } from '../types';
|
||||
|
||||
export interface FeatureGateProps {
|
||||
/** The feature flag to check */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import type {
|
|||
FeatureFlagDefinition,
|
||||
FeatureFlagEvaluation,
|
||||
KnownFeatureFlag,
|
||||
} from '@/types';
|
||||
} from '../types';
|
||||
|
||||
/**
|
||||
* Default hash function for percentage rollouts
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Helper to load feature flags from the feature-flags service.
|
||||
*/
|
||||
|
||||
import type { FeatureFlagRegistry } from '@/types';
|
||||
import type { FeatureFlagRegistry } from '../types';
|
||||
|
||||
export interface ApiLoaderConfig {
|
||||
/** Base URL of the feature flags service */
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Add new flags here as features are developed.
|
||||
*/
|
||||
|
||||
import type { FeatureFlagRegistry } from '@/types';
|
||||
import type { FeatureFlagRegistry } from '../types';
|
||||
|
||||
/**
|
||||
* Default feature flag registry
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
import { useContext, useMemo } from 'react';
|
||||
|
||||
import type { FeatureFlagEvaluation, KnownFeatureFlag } from '@/types';
|
||||
import type { FeatureFlagEvaluation, KnownFeatureFlag } from '../types';
|
||||
|
||||
import { FeatureFlagContext } from '@/providers/FeatureFlagProvider';
|
||||
import { FeatureFlagContext } from '../providers/FeatureFlagProvider';
|
||||
|
||||
/**
|
||||
* Hook to check if a feature flag is enabled
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
import { createContext, useEffect, useMemo, useState } from 'react'
|
||||
import type { FC, ReactNode } from 'react';
|
||||
import { FeatureFlagService, createFeatureFlagService } from '@/core/FeatureFlagService';
|
||||
import { defaultFeatureFlags } from '@/core/defaultFlags';
|
||||
import { FeatureFlagService, createFeatureFlagService } from '../core/FeatureFlagService';
|
||||
import { defaultFeatureFlags } from '../core/defaultFlags';
|
||||
import type {
|
||||
Environment,
|
||||
FeatureFlagConfig,
|
||||
|
|
@ -15,7 +15,7 @@ import type {
|
|||
FeatureFlagRegistry,
|
||||
AccessLevel,
|
||||
UserRole,
|
||||
} from '@/types';
|
||||
} from '../types';
|
||||
|
||||
/**
|
||||
* Context value type
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue