@openfeature/web-sdk 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,8 +16,8 @@
16
16
  <img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
17
17
  </a>
18
18
  <!-- x-release-please-start-version -->
19
- <a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.3.0">
20
- <img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.0&color=blue&style=for-the-badge" />
19
+ <a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.3.1">
20
+ <img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.1&color=blue&style=for-the-badge" />
21
21
  </a>
22
22
  <!-- x-release-please-end -->
23
23
  <br/>
@@ -64,7 +64,7 @@ npm install --save @openfeature/web-sdk
64
64
  yarn add @openfeature/web-sdk @openfeature/core
65
65
  ```
66
66
 
67
- > [!NOTE]
67
+ > [!NOTE]
68
68
  > `@openfeature/core` contains common components used by all OpenFeature JavaScript implementations.
69
69
  > Every SDK version has a requirement on a single, specific version of this dependency.
70
70
  > For more information, and similar implications on libraries developed with OpenFeature see [considerations when extending](#considerations).
@@ -102,6 +102,7 @@ See [here](https://open-feature.github.io/js-sdk/modules/_openfeature_web_sdk.ht
102
102
  | ✅ | [Logging](#logging) | Integrate with popular logging packages. |
103
103
  | ✅ | [Domains](#domains) | Logically bind clients with providers. |
104
104
  | ✅ | [Eventing](#eventing) | React to state changes in the provider or flag management system. |
105
+ | ✅ | [Tracking](#tracking) | Associate user actions with feature flag evaluations, particularly for A/B testing. |
105
106
  | ✅ | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
106
107
  | ✅ | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |
107
108
 
@@ -281,6 +282,21 @@ client.addHandler(ProviderEvents.Error, (eventDetails) => {
281
282
  });
282
283
  ```
283
284
 
285
+ ### Tracking
286
+
287
+ The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
288
+ This is essential for robust experimentation powered by feature flags.
289
+ For example, a flag enhancing the appearance of a UI component might drive user engagement to a new feature; to test this hypothesis, telemetry collected by a [hook](#hooks) or [provider](#providers) can be associated with telemetry reported in the client's `track` function.
290
+
291
+ ```ts
292
+ // flag is evaluated
293
+ client.getBooleanValue('new-feature', false);
294
+
295
+ // new feature is used and track function is called recording the usage
296
+ useNewFeature();
297
+ client.track('new-feature-used');
298
+ ```
299
+
284
300
  ### Shutdown
285
301
 
286
302
  The OpenFeature API provides a close function to perform a cleanup of all registered providers.
@@ -339,7 +355,7 @@ class MyProvider implements Provider {
339
355
  }
340
356
 
341
357
  // implement with "new OpenFeatureEventEmitter()", and use "emit()" to emit events
342
- events?: ProviderEventEmitter<AnyProviderEvent> | undefined;
358
+ events?: ProviderEventEmitter<AnyProviderEvent> | undefined;
343
359
 
344
360
  initialize?(context?: EvaluationContext | undefined): Promise<void> {
345
361
  // code to initialize your provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeature/web-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "OpenFeature SDK for Web",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "files": [