feat: self-serve signup Phase 2 (frontend cutover) (#162)
Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
This commit was merged in pull request #162.
This commit is contained in:
16
frontend/src/hooks/useFeature.ts
Normal file
16
frontend/src/hooks/useFeature.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useBillingStore } from '@/store/billingStore'
|
||||
|
||||
/**
|
||||
* Returns whether a feature flag is enabled for the current account.
|
||||
*
|
||||
* Reads from `useBillingStore.enabledFeatures`, which is populated by
|
||||
* `GET /billing/state`. Returns `false` when the flag is absent (closed-by-default).
|
||||
*
|
||||
* The hook subscribes to the store so updates from `refetch()` propagate
|
||||
* without manual refetch in the component.
|
||||
*/
|
||||
export function useFeature(flagKey: string): boolean {
|
||||
return useBillingStore((state) => Boolean(state.enabledFeatures[flagKey]))
|
||||
}
|
||||
|
||||
export default useFeature
|
||||
Reference in New Issue
Block a user