-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(browser-sdk,react-sdk): extend the web SDKs to support the new config
option.
#285
feat(browser-sdk,react-sdk): extend the web SDKs to support the new config
option.
#285
Conversation
This update introduces a new `config` property for features, allowing optional, user-defined configuration payloads. The change includes implementation within SDKs, unit tests, and updates to version numbers. It maintains backward compatibility while enabling new configuration flexibility.
Simplified flag evaluation by introducing a generic `resolveFeature` method for type consistency and streamlined logic. Added extensive test cases for different flag types and scenarios. Updated `@bucketco/browser-sdk` dependency to version 2.6.0 for compatibility.
Introduced support for feature-specific configurations, enabling dynamic payloads for features based on user-defined rules. Enhanced fallback features to accept both string arrays and object records, providing more flexibility for feature initialization. Updated documentation and tests to reflect the new configuration capabilities and backwards-compatible fallback behavior.
…eb-sdks-to-expose-the-config # Conflicts: # packages/browser-sdk/src/client.ts # packages/browser-sdk/src/feature/features.ts
config
option.
Update package version to 0.4.0 to reflect changes and improvements made in the OpenFeature browser provider. This helps signify a new iteration with potential new features or fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
started reviewing this, but since we still need to get the key
stuff in I'll pause for now and revisit once that's updated. Looks like a good start though!
…enhance feature handling - Added a new "format" script to package.json for consistent code formatting. - Improved formatting in README.md files across browser-sdk, react-sdk, and openfeature-browser-provider for better readability. - Updated feature handling in features.ts and mocks/handlers.ts to ensure proper type usage and maintainability. - Adjusted test cases to reflect changes in feature access patterns. These changes enhance the developer experience and maintain code quality.
…documentation - Renamed "Feature toggles" section to "Remote config" in README.md for clarity. - Introduced a new type, `FeatureDynamicConfig`, to better represent dynamic feature configurations in client.ts. - Updated the `Feature` interface to use `FeatureDynamicConfig` instead of a generic `any` type for the `config` property. - Adjusted the handling of feature configurations in the `BucketClient` class to utilize a default `missingConfig`. - Enhanced the `FetchedFeature` type in features.ts to reflect the new configuration structure. - Updated test cases to align with the new configuration model, ensuring accurate feature representation. These changes enhance type safety and improve the overall developer experience when working with feature configurations.
- Introduced a new EMPTY_FEATURE_CONFIG constant to provide a default configuration for features. - Updated the useFeature hook to return a more structured Feature type, including isEnabled, isLoading, and config properties. - Modified requestFeedback function to use a more specific RequestFeedbackOptions type. - Adjusted test cases to validate the new feature configuration structure and ensure correct default values are returned. These changes improve type safety and enhance the developer experience when working with feature flags.
…e configuration handling and improve documentation - Updated feature configuration structure across browser-sdk and react-sdk to use `targetingVersion` and `value` instead of `version` and `payload`. - Refactored related types and interfaces to improve type safety and clarity in feature handling. - Enhanced README documentation to reflect changes in feature configuration and usage examples. - Adjusted test cases to validate the new configuration structure and ensure accurate feature representation. These changes improve the developer experience and maintainability of the SDKs.
config
option.config
option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good stuff! I will take this for a spin and try it in an application.
…pter - moving to a new PR
…ration - Changed the reference from `value` to `payload` in the README documentation to accurately describe the updated feature configuration structure. - Ensured that the example usage aligns with the latest implementation for better clarity and understanding. These updates improve the documentation and help developers understand the new configuration handling.
Simplified the feature remote config type by removing unnecessary properties and aligning with recent configuration changes. Minor refactoring of sendCheckEvent method to use shorthand property syntax.
config
option.config
option.
Cleaned up an unnecessary import of Features from a development-specific path in the main index file.
Update FallbackFeatureConfig type to support boolean and object overrides, allowing more flexible feature flag configuration. Modify feature fallback logic to handle both simple boolean flags and complex feature configurations.
Remove the .only modifier from the "caches response" test to ensure all tests are run during test execution.
Modify test assertions to reflect changes in feature configuration handling, including expected feature state and override behavior.
Update useFeature hook to create a reduced configuration object with only key and payload, streamlining config retrieval and aligning with recent configuration changes in the SDK.
Update README files for browser and react SDKs to provide more detailed explanations of remote configuration handling, including: - Clarifying optional payload behavior - Adding guidance on handling undefined config - Improving code examples for remote config usage
…eb-sdks-to-expose-the-config
…expose-the-config' into buc-3198-extend-the-web-sdks-to-expose-the-config
Add FallbackFeatureOverride to the exported types, extending the SDK's type exports for feature configuration
Update package versions and lock file to reflect the new alpha release, ensuring consistent versioning across SDKs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apart from the EmptyFeatureConfig stuff, this all look good 👍
…expose-the-config' into buc-3198-extend-the-web-sdks-to-expose-the-config
This PR introduces the
config
, which is an user-supplied JSON value that matches a given feature context (similar to targeting). The resolved configuration variant is then passed down to the client SDKs for use.