feat: [Nt 2734] merge both use personalization and use analytics into use optimization#178
Merged
Lotfi Anwar L Arif (Lotfi-Arif) merged 4 commits intomainfrom Mar 19, 2026
Conversation
- Update hooks and providers to use the new context shape, add useAnalytics and usePersonalization helpers, and introduce OptimizationSdk type for improved type safety.
Collaborator
There was a problem hiding this comment.
These types all seem redundant. I'm thinking we should figure out how to eliminate the need for this file altogether. And if we need a type for something that is defined concretely, we can simply say typeof Something, unless that something isn't intended to be inlined in the generated bundle at all, but I think that's not likely for these types here.
Collaborator
|
Make sure to fix those linter issues |
Move all personalization components and tests to a new optimized-entry directory. Update imports and types to reference OptimizationContext instead of the removed types module. Remove legacy Personalization test files and types. Refactor personalization components to optimized-entry directory Move OptimizedEntry and related files from personalization to optimized-entry. Update imports and types to reference new location. Remove obsolete tests and types.
Charles Hudson (phobetron)
approved these changes
Mar 19, 2026
Collaborator
Charles Hudson (phobetron)
left a comment
There was a problem hiding this comment.
I think the tests (and test setup/utils) could use a lot of trimming, but other than that, everything looks great!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligned the React web SDK API with the intended SDK surface by making useOptimization() the main high-level hook for tracking and entry resolution, while adding useOptimizationContext() for readiness/error state and useOptimizedEntry() as the public personalization hook. Also updated OptimizationProvider to support injected SDK instances, refactored OptimizedEntry onto the new hook, refreshed docs/tests, and verified format, lint, typecheck, and unit tests all pass.