@@ -27,28 +27,19 @@ const bucketClient = new BucketClient({ publishableKey, user, company });
2727
2828await bucketClient .initialize ();
2929
30- const {
31- isEnabled,
32- config : { payload : question },
33- track,
34- requestFeedback,
35- } = bucketClient .getFeature (" huddle" );
30+ const { isEnabled, track, requestFeedback } = bucketClient .getFeature (" huddle" );
3631
3732if (isEnabled ) {
38- // Show feature. When retrieving `isEnabled` the client automatically
33+ // show feature. When retrieving `isEnabled` the client automatically
3934 // sends a "check" event for the "huddle" feature which is shown in the
4035 // Bucket UI.
4136
4237 // On usage, call `track` to let Bucket know that a user interacted with the feature
4338 track ();
4439
45- // The `payload` is a user-supplied JSON in Bucket that is dynamically picked
46- // out depending on the user/company.
47- const question = payload ?.question ?? " Tell us what you think of Huddles" ;
48-
4940 // Use `requestFeedback` to create "Send feedback" buttons easily for specific
5041 // features. This is not related to `track` and you can call them individually.
51- requestFeedback ({ title: question });
42+ requestFeedback ({ title: " Tell us what you think of Huddles " });
5243}
5344
5445// `track` just calls `bucketClient.track(<featureKey>)` to send an event using the same feature key
@@ -147,7 +138,6 @@ To retrieve features along with their targeting information, use `getFeature(key
147138const huddle = bucketClient .getFeature (" huddle" );
148139// {
149140// isEnabled: true,
150- // config: { key: "zoom", payload: { ... } },
151141// track: () => Promise<Response>
152142// requestFeedback: (options: RequestFeedbackData) => void
153143// }
@@ -161,7 +151,6 @@ const features = bucketClient.getFeatures();
161151// huddle: {
162152// isEnabled: true,
163153// targetingVersion: 42,
164- // config: ...
165154// }
166155// }
167156```
@@ -170,35 +159,7 @@ const features = bucketClient.getFeatures();
170159by down-stream clients, like the React SDK.
171160
172161Note that accessing ` isEnabled ` on the object returned by ` getFeatures ` does not automatically
173- generate a ` check ` event, contrary to the ` isEnabled ` property on the object returned by ` getFeature ` .
174-
175- ### Remote config
176-
177- Similar to ` isEnabled ` , each feature has a ` config ` property. This configuration is managed from within Bucket.
178- It is managed similar to the way access to features is managed, but instead of the binary ` isEnabled ` you can have
179- multiple configuration values which are given to different user/companies.
180-
181- ``` ts
182- const features = bucketClient .getFeatures ();
183- // {
184- // huddle: {
185- // isEnabled: true,
186- // targetingVersion: 42,
187- // config: {
188- // key: "gpt-3.5",
189- // payload: { maxTokens: 10000, model: "gpt-3.5-beta1" }
190- // }
191- // }
192- // }
193- ```
194-
195- The ` key ` is always present while the ` payload ` is a optional JSON value for arbitrary configuration needs.
196- If feature has no configuration or, no configuration value was matched against the context, the ` config ` object
197- will be empty, thus, ` key ` will be ` undefined ` . Make sure to check against this case when trying to use the
198- configuration in your application.
199-
200- Just as ` isEnabled ` , accessing ` config ` on the object returned by ` getFeatures ` does not automatically
201- generate a ` check ` event, contrary to the ` config ` property on the object returned by ` getFeature ` .
162+ generate a ` check ` event, contrary to the ` isEnabled ` property on the object return from ` getFeature ` .
202163
203164### Tracking feature usage
204165
0 commit comments