Reference
Interfaces
CheckEvent
Event representing checking the feature flag evaluation result
Properties
action
"check-is-enabled"
| "check-config"
check-is-enabled
means isEnabled
was checked, check-config
means config
was checked.
key
string
Feature key.
missingContextFields?
string
[]
Missing context fields.
ruleEvaluationResults?
boolean
[]
Rule evaluation results.
value?
| boolean
| { key
: string
; payload
: any
; }
Result of feature flag or configuration evaluation.
If action
is check-is-enabled
, this is the result of the feature flag evaluation and value
is a boolean.
If action
is check-config
, this is the result of the configuration evaluation.
version?
number
Version of targeting rules.
CompanyContext
Context is a set of key-value pairs. Id should always be present so that it can be referenced to an existing company.
Indexable
Properties
id
undefined
| string
| number
Company id
name?
string
Company name
Feature<TConfig>
Describes a feature
Type Parameters
TConfig
extends FeatureType
["config"
]
Properties
isEnabled
boolean
If the feature is enabled.
isLoading
boolean
If the feature is loading.
key
string
The key of the feature.
Methods
track()
Track feature usage in Bucket.
Returns
| undefined
| Promise
<
| undefined
| Response
>
Features
UserContext
Indexable
Properties
email?
string
User email
id
undefined
| string
| number
User id
name?
string
User name
Type Aliases
BucketProps
Props for the BucketProvider.
Type declaration
children
?
ReactNode
Children to be rendered.
debug
?
boolean
Whether to enable debug mode (optional).
loadingComponent
?
ReactNode
Loading component to be rendered while features are loading.
newBucketClient
?
(...args
: ConstructorParameters
<typeof BucketClient
>) => BucketClient
Internal
New BucketClient constructor.
EmptyFeatureRemoteConfig
Type declaration
key
undefined
payload
undefined
FeatureKey
FeatureRemoteConfig
A remotely managed configuration value for a feature.
Type declaration
{key
: string
;payload
: any
;
}
key
string
The key of the matched configuration value.
payload
any
The optional user-supplied payload data.
FeatureType
Type declaration
config
?
{payload
: any
;
}
config.payload
any
RawFeatures
RequestFeedbackOptions
TrackEvent
Type declaration
TypedFeatures
Describes a collection of evaluated feature.
Remarks
This types falls back to a generic Record<string, Feature> if the Features interface has not been extended.
Functions
BucketProvider()
Provider for the BucketClient.
Parameters
__namedParameters
Returns
Element
useClient()
Returns the current BucketClient
used by the BucketProvider
.
This is useful if you need to access the BucketClient
outside of the BucketProvider
.
Returns
undefined
| BucketClient
useFeature()
Returns the state of a given feature for the current context, e.g.
Type Parameters
TKey
extends string
Parameters
key
TKey
Returns
TypedFeatures
[TKey
]
useRequestFeedback()
Returns a function to open up the feedback form
Note: When calling useRequestFeedback
, user/company must already be set.
See link for more information
Returns
Function
Parameters
options
Returns
undefined
| void
useSendFeedback()
Returns a function to manually send feedback collected from a user.
Note: When calling useSendFeedback
, user/company must already be set.
See link for more information
Returns
Function
Parameters
Returns
| undefined
| Promise
<
| undefined
| Response
>
useTrack()
Returns a function to send an event when a user performs an action
Note: When calling useTrack
, user/company must already be set.
Returns
Function
Parameters
eventName
string
attributes
?
| null
| Record
<string
, any
>
Returns
| undefined
| Promise
<
| undefined
| Response
>
useUpdateCompany()
Returns a function to update the current company's information. For example, if the company changed plan or opted into a beta-feature.
The method returned is a function which returns a promise that resolves when after the features have been updated as a result of the company update.
Returns
Function
Parameters
opts
{}
Returns
| undefined
| Promise
<void
>
useUpdateOtherContext()
Returns a function to update the "other" context information. For example, if the user changed workspace, you can set the workspace id here.
The method returned is a function which returns a promise that resolves when after the features have been updated as a result of the update to the "other" context.
Returns
Function
Parameters
opts
{}
Returns
| undefined
| Promise
<void
>
useUpdateUser()
Returns a function to update the current user's information. For example, if the user changed role or opted into a beta-feature.
The method returned is a function which returns a promise that resolves when after the features have been updated as a result of the user update.
Returns
Function
Parameters
opts
{}
Returns
| undefined
| Promise
<void
>
Last updated
Was this helpful?