Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/browser-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Basic client for Bucket.co. If you're using React, you'll be better off with the Bucket React SDK.

Bucket supports feature toggling, tracking feature usage, [collecting feedback](#qualitative-feedback) on features, and [remotely configuring features](#remote-config-beta).

## Install

First find your `publishableKey` under [environment settings](https://app.bucket.co/envs/current/settings/app-environments) in Bucket.
Expand Down Expand Up @@ -192,7 +194,7 @@ const override = bucketClient.getFeatureOverride("huddle"); // returns boolean |

Feature overrides are persisted in `localStorage` and will be restored when the page is reloaded.

### Remote config
### Remote config (beta)

Similar to `isEnabled`, each feature has a `config` property. This configuration is managed from within Bucket.
It is managed similar to the way access to features is managed, but instead of the binary `isEnabled` you can have
Expand Down
6 changes: 4 additions & 2 deletions packages/node-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Bucket Node.js SDK

Node.js, JavaScriptS/Typescript feature flag and tracking client for [Bucket.co](https://bucket.co).
Node.js, JavaScriptS/Typescript client for [Bucket.co](https://bucket.co).

Bucket supports feature toggling, tracking feature usage, collecting feedback on features, and [remotely configuring features](#remote-config-beta).

## Installation

Expand Down Expand Up @@ -224,7 +226,7 @@ const client = new BucketClient({
});
```

### Remote config
### Remote config (beta)

Similar to `isEnabled`, each feature has a `config` property. This configuration is managed from within Bucket.
It is managed similar to the way access to features is managed, but instead of the binary `isEnabled` you can have
Expand Down
46 changes: 33 additions & 13 deletions packages/react-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

React client side library for [Bucket.co](https://bucket.co)

Bucket supports feature toggling, tracking feature usage, [requesting feedback](#userequestfeedback) on features, and [remotely configuring features](#remote-config-beta).

## Install

Install via npm:
Expand Down Expand Up @@ -29,10 +31,6 @@ declare module "@bucketco/react-sdk" {
interface Features {
huddle: boolean;
recordVideo: boolean;
questionnaire?: {
showAll: boolean;
time: 600000;
};
}
}
```
Expand All @@ -58,7 +56,7 @@ import { BucketProvider } from "@bucketco/react-sdk";

### 3. Use `useFeature(<featureKey>)` to get feature status

Using the `useFeature` hook from your components lets you toggle features on/off and configure features through Remote Config:
Using the `useFeature` hook from your components lets you toggle features on/off and track feature usage:

**Example:**

Expand All @@ -79,13 +77,14 @@ function StartHuddleButton() {

`useFeature` can help you do much more. See a full example for `useFeature` [see below](#usefeature).

## Feature toggles
## Setting `user` and `company`

Bucket determines which features are active for a given `user`/`company`. The `user`/`company` are given in the `BucketProvider` as props.
Bucket determines which features are active for a given `user`, `company`, or `otherContext`.
You pass these to the `BucketProvider` as props.

If you supply `user` or `company` objects, they must include at least the `id` property otherwise they will be ignored in their entirety.
In addition to the `id`, you must also supply anything additional that you want to be able to evaluate feature targeting rules against.
The additional attributes are supplied using the `otherContext` prop.
Attributes which are not properties of the `user` or `company` can be supplied using the `otherContext` prop.

Attributes cannot be nested (multiple levels) and must be either strings, numbers or booleans.
A number of special attributes exist:
Expand All @@ -112,12 +111,33 @@ To retrieve features along with their targeting information, use `useFeature(key
Note that accessing `isEnabled` on the object returned by `useFeature()` automatically
generates a `check` event.

## Remote config
## Remote config (beta)

Similar to `isEnabled`, each feature accessed using `useFeature()` hook, has a `config` property. This configuration
is managed from within Bucket. It is managed similar to the way access to features is managed, but instead of the
In addition to toggling features on/off, Bucket supports remote configuration of features through Remote config.

Similar to `isEnabled`, each feature accessed using the `useFeature()` hook, has a `config` property. This configuration is managed from within Bucket. It is managed similar to the way access to features is managed, but instead of the
binary `isEnabled` you can have multiple configuration values which are given to different user/companies.

### Get started with Remote config

1. Update your feature definitions:

```typescript
import "@bucketco/react-sdk";

// Define your features by extending the `Features` interface in @bucketco/react-sdk
declare module "@bucketco/react-sdk" {
interface Features {
huddle: {
// change from `boolean` to an object which sets
// a type for the remote config for `questionnaire`
maxTokens: number;
model: string;
};
}
}
```

```ts
const {
isEnabled,
Expand All @@ -130,8 +150,8 @@ const {
```

The `key` is always present while the `payload` is a optional JSON value for arbitrary configuration needs.
If feature has no configuration or, no configuration value was matched against the context, the `config` object
will be empty, thus, `key` will be `undefined`. Make sure to check against this case when trying to use the
If a feature has no configuration or no configuration value was matched against the context, the config object will be empty.
Thus, `key` will be `undefined`. Make sure to check against this case when trying to use the
configuration in your application.

Note that, similar to `isEnabled`, accessing `config` on the object returned by `useFeature()` automatically
Expand Down