Skip to content

Commit 7b4afbb

Browse files
committed
chore: revert browser changes
1 parent 0277ffa commit 7b4afbb

5 files changed

Lines changed: 102 additions & 393 deletions

File tree

packages/openfeature-browser-provider/README.md

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The OpenFeature SDK is required as peer dependency.
1515

1616
The minimum required version of `@openfeature/web-sdk` currently is `1.0`.
1717

18-
```shell
19-
npm install @openfeature/web-sdk @bucketco/openfeature-browser-provider
18+
```
19+
$ npm install @openfeature/web-sdk @bucketco/openfeature-browser-provider
2020
```
2121

2222
## Sample initialization
@@ -36,69 +36,13 @@ const client = OpenFeature.getClient();
3636

3737
// use client
3838
const boolValue = client.getBooleanValue("huddles", false);
39-
40-
// use more complex, dynamic config-enabled functionality.
41-
const feedbackConfig = client.getObjectValue("ask-feedback", {
42-
question: "How are you enjoying this feature?",
43-
});
4439
```
4540

41+
Bucket only supports boolean values.
42+
4643
Initializing the Bucket Browser Provider will
4744
also initialize [automatic feedback surveys](https://github.com/bucketco/bucket-javascript-sdk/tree/main/packages/browser-sdk#qualitative-feedback).
4845

49-
## Feature resolution methods
50-
51-
The Bucket OpenFeature Provider implements the OpenFeature evaluation interface for different value types. Each method handles the resolution of feature flags according to the OpenFeature specification.
52-
53-
### Common behavior
54-
55-
All resolution methods share these behaviors:
56-
57-
- Return default value with `PROVIDER_NOT_READY` if client is not initialized,
58-
- Return default value with `FLAG_NOT_FOUND` if flag doesn't exist,
59-
- Return default value with `ERROR` if there was a type mismatch,
60-
- Return evaluated value with `TARGETING_MATCH` on successful resolution.
61-
62-
### Type-Specific Methods
63-
64-
#### Boolean Resolution
65-
66-
```ts
67-
client.getBooleanValue("my-flag", false);
68-
```
69-
70-
Returns the feature's enabled state. This is the most common use case for feature flags.
71-
72-
#### String Resolution
73-
74-
```ts
75-
client.getStringValue("my-flag", "default");
76-
```
77-
78-
Returns the feature's remote config key (also known as "variant"). Useful for multi-variate use cases.
79-
80-
#### Number Resolution
81-
82-
```ts
83-
client.getNumberValue("my-flag", 0);
84-
```
85-
86-
Not directly supported by Bucket. Use `getObjectValue` instead for numeric configurations.
87-
88-
#### Object Resolution
89-
90-
```ts
91-
// works for any type:
92-
client.getObjectValue("my-flag", { defaultValue: true });
93-
client.getObjectValue("my-flag", "string-value");
94-
client.getObjectValue("my-flag", 199);
95-
```
96-
97-
Returns the feature's remote config payload with type validation. This is the most flexible method,
98-
allowing for complex configuration objects or simple types.
99-
100-
The object resolution performs runtime type checking between the default value and the feature payload to ensure type safety.
101-
10246
## Context
10347

10448
To convert the OpenFeature context to a Bucket appropriate context
@@ -117,18 +61,11 @@ const publishableKey = "<your-bucket-publishable-key>";
11761
const contextTranslator = (context?: EvaluationContext) => {
11862
return {
11963
user: {
120-
id: context.targetingKey ?? context["userId"],
121-
email: context["email"]?.toString(),
122-
name: context["name"]?.toString(),
123-
avatar: context["avatar"]?.toString(),
124-
country: context["country"]?.toString(),
125-
},
126-
company: {
127-
id: context["companyId"],
128-
name: context["companyName"]?.toString(),
129-
avatar: context["companyAvatar"]?.toString(),
130-
plan: context["companyPlan"]?.toString(),
64+
id: context["trackingKey"],
65+
name: context["name"],
66+
email: context["email"],
13167
},
68+
company: { id: context["orgId"], name: context["orgName"] },
13269
};
13370
};
13471

@@ -144,7 +81,7 @@ To update the context, call `OpenFeature.setContext(myNewContext);`
14481
await OpenFeature.setContext({ userId: "my-key" });
14582
```
14683

147-
## Tracking feature usage
84+
# Tracking feature usage
14885

14986
The Bucket OpenFeature Provider supports the OpenFeature tracking API
15087
natively.
@@ -166,7 +103,8 @@ const client = OpenFeature.getClient();
166103
client.track("huddles");
167104
```
168105

169-
## License
106+
# License
107+
108+
MIT License
170109

171-
> MIT License
172-
> Copyright (c) 2025 Bucket ApS
110+
Copyright (c) 2025 Bucket ApS

packages/openfeature-browser-provider/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bucketco/openfeature-browser-provider",
3-
"version": "0.4.0-alpha.0",
3+
"version": "0.3.1",
44
"packageManager": "yarn@4.1.1",
55
"license": "MIT",
66
"repository": {
@@ -35,7 +35,7 @@
3535
}
3636
},
3737
"dependencies": {
38-
"@bucketco/browser-sdk": "3.0.0-alpha.2"
38+
"@bucketco/browser-sdk": "2.4.0"
3939
},
4040
"devDependencies": {
4141
"@bucketco/eslint-config": "0.0.2",

0 commit comments

Comments
 (0)