diff --git a/docs/reference/technologies/client/kotlin.mdx b/docs/reference/technologies/client/kotlin.mdx index 9b2727a9f..eace90080 100644 --- a/docs/reference/technologies/client/kotlin.mdx +++ b/docs/reference/technologies/client/kotlin.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk. Edits should be made here: https://github.com/open-feature/kotlin-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/client/swift.mdx b/docs/reference/technologies/client/swift.mdx index ed4ac92d6..1b796b476 100644 --- a/docs/reference/technologies/client/swift.mdx +++ b/docs/reference/technologies/client/swift.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk. Edits should be made here: https://github.com/open-feature/swift-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/client/web/angular.mdx b/docs/reference/technologies/client/web/angular.mdx index 37e4f3edb..d86fc7429 100644 --- a/docs/reference/technologies/client/web/angular.mdx +++ b/docs/reference/technologies/client/web/angular.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk. Edits should be made here: https://github.com/open-feature/js-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:44 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:07 GMT+0000 (Coordinated Universal Time) -->

@@ -18,8 +18,8 @@ Last updated at Thu Mar 27 2025 19:59:44 GMT+0000 (Coordinated Universal Time) Specification - - Release + + Release
@@ -40,21 +40,22 @@ In addition to the features provided by the [web sdk](/docs/reference/technologi - [Overview](#overview) - [Quick start](#quick-start) - - [Requirements](#requirements) - - [Install](#install) - - [npm](#npm) - - [yarn](#yarn) - - [Required peer dependencies](#required-peer-dependencies) - - [Usage](#usage) - - [Module](#module) - - [Minimal Example](#minimal-example) - - [How to use](#how-to-use) - - [Boolean Feature Flag](#boolean-feature-flag) - - [Number Feature Flag](#number-feature-flag) - - [String Feature Flag](#string-feature-flag) - - [Object Feature Flag](#object-feature-flag) - - [Opting-out of automatic re-rendering](#opting-out-of-automatic-re-rendering) - - [Consuming the evaluation details](#consuming-the-evaluation-details) + - [Requirements](#requirements) + - [Install](#install) + - [npm](#npm) + - [yarn](#yarn) + - [Required peer dependencies](#required-peer-dependencies) + - [Usage](#usage) + - [Module](#module) + - [Minimal Example](#minimal-example) + - [How to use](#how-to-use) + - [Boolean Feature Flag](#boolean-feature-flag) + - [Number Feature Flag](#number-feature-flag) + - [String Feature Flag](#string-feature-flag) + - [Object Feature Flag](#object-feature-flag) + - [Opting-out of automatic re-rendering](#opting-out-of-automatic-re-rendering) + - [Consuming the evaluation details](#consuming-the-evaluation-details) + - [Setting Evaluation Context](#setting-evaluation-context) - [FAQ and troubleshooting](#faq-and-troubleshooting) - [Resources](#resources) @@ -152,7 +153,7 @@ This parameter is optional, if omitted, the `thenTemplate` will always be render The `domain` parameter is _optional_ and will be used as domain when getting the OpenFeature provider. The `updateOnConfigurationChanged` and `updateOnContextChanged` parameter are _optional_ and used to disable the -automatic re-rendering on flag value or context change. They are set to `true` by default. +automatic re-rendering on flag value or contex change. They are set to `true` by default. The template referenced in `else` will be rendered if the evaluated feature flag is `false` for the `booleanFeatureFlag` directive and if the `value` does not match evaluated flag value for all other directives. @@ -277,6 +278,63 @@ This can be used to just render the flag value or details without conditional re ``` +##### Setting evaluation context + +To set the initial evaluation context, you can add the `context` parameter to the `OpenFeatureModule` configuration. +This context can be either an object or a factory function that returns an `EvaluationContext`. + +> [!TIP] +> Updating the context can be done directly via the global OpenFeature API using `OpenFeature.setContext()` + +Here’s how you can define and use the initial client evaluation context: + +###### Using a static object + +```typescript +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { OpenFeatureModule } from '@openfeature/angular-sdk'; + +const initialContext = { + user: { + id: 'user123', + role: 'admin', + } +}; + +@NgModule({ + imports: [ + CommonModule, + OpenFeatureModule.forRoot({ + provider: yourFeatureProvider, + context: initialContext + }) + ], +}) +export class AppModule {} +``` + +###### Using a factory function + +```typescript +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { OpenFeatureModule, EvaluationContext } from '@openfeature/angular-sdk'; + +const contextFactory = (): EvaluationContext => loadContextFromLocalStorage(); + +@NgModule({ + imports: [ + CommonModule, + OpenFeatureModule.forRoot({ + provider: yourFeatureProvider, + context: contextFactory + }) + ], +}) +export class AppModule {} +``` + ## FAQ and troubleshooting > I can import things form the `@openfeature/angular-sdk`, `@openfeature/web-sdk`, and `@openfeature/core`; which should I use? @@ -287,4 +345,4 @@ Avoid importing anything from `@openfeature/web-sdk` or `@openfeature/core`. ## Resources - - [Example repo](https://github.com/open-feature/angular-test-app) +- [Example repo](https://github.com/open-feature/angular-test-app) diff --git a/docs/reference/technologies/client/web/index.mdx b/docs/reference/technologies/client/web/index.mdx index bc450e801..dcc1f9692 100644 --- a/docs/reference/technologies/client/web/index.mdx +++ b/docs/reference/technologies/client/web/index.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk. Edits should be made here: https://github.com/open-feature/js-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

@@ -169,7 +169,7 @@ await OpenFeature.setContext({ targetingKey: localStorage.getItem("targetingKey" ``` Context is global and setting it is `async`. -Providers may implement an `onContextChanged` method that receives the old and newer contexts. +Providers may implement an `onContextChange` method that receives the old and newer contexts. Given a context change, providers can use this method internally to detect if the flag values cached on the client are still valid. If needed, a request will be made to the provider with the new context in order to get the correct flag values. diff --git a/docs/reference/technologies/client/web/react.mdx b/docs/reference/technologies/client/web/react.mdx index a03ed0596..4abb6793f 100644 --- a/docs/reference/technologies/client/web/react.mdx +++ b/docs/reference/technologies/client/web/react.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk. Edits should be made here: https://github.com/open-feature/js-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/server/dotnet.mdx b/docs/reference/technologies/server/dotnet.mdx index 2939524c6..fccfafc9e 100644 --- a/docs/reference/technologies/server/dotnet.mdx +++ b/docs/reference/technologies/server/dotnet.mdx @@ -10,13 +10,13 @@ This content has been automatically generated from dotnet-sdk. Edits should be made here: https://github.com/open-feature/dotnet-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:05 GMT+0000 (Coordinated Universal Time) --> [![Specification](https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.7.0) [ - ![Release](https://img.shields.io/static/v1?label=release&message=v2.3.1&color=blue&style=for-the-badge) -](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.3.1) + ![Release](https://img.shields.io/static/v1?label=release&message=v2.3.2&color=blue&style=for-the-badge) +](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.3.2) [![Slack](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1) [![Codecov](https://codecov.io/gh/open-feature/dotnet-sdk/branch/main/graph/badge.svg?token=MONAVJBXUJ)](https://codecov.io/gh/open-feature/dotnet-sdk) diff --git a/docs/reference/technologies/server/go.mdx b/docs/reference/technologies/server/go.mdx index 4d4ebb62b..6870847cd 100644 --- a/docs/reference/technologies/server/go.mdx +++ b/docs/reference/technologies/server/go.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk. Edits should be made here: https://github.com/open-feature/go-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:05 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/server/java.mdx b/docs/reference/technologies/server/java.mdx index d4d9c6080..77245449f 100644 --- a/docs/reference/technologies/server/java.mdx +++ b/docs/reference/technologies/server/java.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk. Edits should be made here: https://github.com/open-feature/java-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:42 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:05 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/server/javascript/index.mdx b/docs/reference/technologies/server/javascript/index.mdx index 1af4d7896..df1b34f87 100644 --- a/docs/reference/technologies/server/javascript/index.mdx +++ b/docs/reference/technologies/server/javascript/index.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk. Edits should be made here: https://github.com/open-feature/js-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:42 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:05 GMT+0000 (Coordinated Universal Time) -->

@@ -18,8 +18,8 @@ Last updated at Thu Mar 27 2025 19:59:42 GMT+0000 (Coordinated Universal Time) Specification - - Release + + Release
diff --git a/docs/reference/technologies/server/javascript/nestjs.mdx b/docs/reference/technologies/server/javascript/nestjs.mdx index eae112431..0afd47475 100644 --- a/docs/reference/technologies/server/javascript/nestjs.mdx +++ b/docs/reference/technologies/server/javascript/nestjs.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk. Edits should be made here: https://github.com/open-feature/js-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:42 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:05 GMT+0000 (Coordinated Universal Time) -->

@@ -18,8 +18,8 @@ Last updated at Thu Mar 27 2025 19:59:42 GMT+0000 (Coordinated Universal Time) Specification - - Release + + Release
diff --git a/docs/reference/technologies/server/php.mdx b/docs/reference/technologies/server/php.mdx index 07be5cffc..dc9cf9ef6 100644 --- a/docs/reference/technologies/server/php.mdx +++ b/docs/reference/technologies/server/php.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk. Edits should be made here: https://github.com/open-feature/php-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/server/python.mdx b/docs/reference/technologies/server/python.mdx index 7956f8051..ad96812f6 100644 --- a/docs/reference/technologies/server/python.mdx +++ b/docs/reference/technologies/server/python.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk. Edits should be made here: https://github.com/open-feature/python-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:06 GMT+0000 (Coordinated Universal Time) -->

@@ -20,8 +20,8 @@ Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) - - Latest version + + Latest version @@ -54,13 +54,13 @@ Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) #### Pip install ```bash -pip install openfeature-sdk==0.8.0 +pip install openfeature-sdk==0.8.1 ``` #### requirements.txt ```bash -openfeature-sdk==0.8.0 +openfeature-sdk==0.8.1 ``` ```python diff --git a/docs/reference/technologies/server/ruby.mdx b/docs/reference/technologies/server/ruby.mdx index 5eabf7459..c316f6036 100644 --- a/docs/reference/technologies/server/ruby.mdx +++ b/docs/reference/technologies/server/ruby.mdx @@ -10,7 +10,7 @@ This content has been automatically generated from ruby-sdk. Edits should be made here: https://github.com/open-feature/ruby-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:43 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:07 GMT+0000 (Coordinated Universal Time) -->

diff --git a/docs/reference/technologies/server/rust.mdx b/docs/reference/technologies/server/rust.mdx index 888f13b7b..bf689f85b 100644 --- a/docs/reference/technologies/server/rust.mdx +++ b/docs/reference/technologies/server/rust.mdx @@ -9,7 +9,7 @@ This content has been automatically generated from rust-sdk. Edits should be made here: https://github.com/open-feature/rust-sdk Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs -Last updated at Thu Mar 27 2025 19:59:44 GMT+0000 (Coordinated Universal Time) +Last updated at Mon Apr 14 2025 08:11:07 GMT+0000 (Coordinated Universal Time) -->