@bucketco/react-sdk
Advanced tools
@@ -8,3 +8,2 @@ import { default as React, ReactNode } from 'react'; | ||
export type FeatureKey = keyof MaterializedFeatures; | ||
export type FeatureConfig<TKey extends FeatureKey> = MaterializedFeatures[TKey] extends boolean ? never : MaterializedFeatures[TKey]; | ||
/** | ||
@@ -38,12 +37,13 @@ * Props for the BucketProvider. | ||
type RequestFeedbackOptions = Omit<RequestFeedbackData, "featureKey" | "featureId">; | ||
type EmptyConfig = { | ||
key: undefined; | ||
payload: undefined; | ||
}; | ||
type Feature<TKey extends FeatureKey> = { | ||
isEnabled: boolean; | ||
isLoading: boolean; | ||
config: { | ||
config: MaterializedFeatures[TKey] extends boolean ? EmptyConfig : { | ||
key: string; | ||
payload: FeatureConfig<TKey>; | ||
} | { | ||
key: undefined; | ||
payload: undefined; | ||
}; | ||
payload: MaterializedFeatures[TKey]; | ||
} | EmptyConfig; | ||
track: () => void; | ||
@@ -63,3 +63,3 @@ requestFeedback: (opts: RequestFeedbackOptions) => void; | ||
*/ | ||
export declare function useFeature<TKey extends FeatureKey>(key: TKey): Feature<TKey>; | ||
export declare function useFeature<TKey extends FeatureKey>(key: TKey): Feature<typeof key>; | ||
/** | ||
@@ -84,3 +84,3 @@ * Returns a function to send an event when a user performs an action | ||
* bucket.requestFeedback({ | ||
* featureId: "bucket-feature-id", | ||
* featureKey: "file-uploads", | ||
* title: "How satisfied are you with file uploads?", | ||
@@ -100,3 +100,3 @@ * }); | ||
* sendFeedback({ | ||
* featureId: "fe2323223";; | ||
* featureKey: "huddle"; | ||
* question: "How did you like the new huddle feature?"; | ||
@@ -103,0 +103,0 @@ * score: 5; |
{ | ||
"name": "@bucketco/react-sdk", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
776551
0.27%4507
0.27%