From a94afa47b9f90a3173168b8024f222a438127ccf Mon Sep 17 00:00:00 2001 From: Rafin Akther Utshaw Date: Fri, 10 Mar 2023 20:57:40 +0600 Subject: [PATCH 1/5] Rename fullstack to feature experimentation --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e10224c5..90c2f668 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Optimizely React SDK -This repository houses the React SDK for use with Optimizely Full Stack and Optimizely Rollouts. +This repository houses the React SDK for use with Optimizely Feature Experimentation and Optimizely Rollouts. -Optimizely Full Stack is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs). +Optimizely Feature Experimentation is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs). Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at https://www.optimizely.com/rollouts/, or see the [documentation](https://docs.developers.optimizely.com/rollouts/docs). @@ -321,7 +321,7 @@ The following type definitions are used in the `ReactSDKClient` interface: - `VariableValuesObject : { [key: string]: any }` - `EventTags : { [key: string]: string | number | boolean; }` -`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely X Full Stack developer docs site](https://docs.developers.optimizely.com/full-stack/docs). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. +`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely X Feature Experimentation developer docs site](https://docs.developers.optimizely.com/full-stack/docs). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. - `onReady(opts?: { timeout?: number }): Promise` Returns a Promise that fulfills with an `onReadyResult` object representing the initialization process. The instance is ready when it has fetched a datafile and a user is available (via `setUser` being called with an object, or a Promise passed to `setUser` becoming fulfilled). If the `timeout` period happens before the client instance is ready, the `onReadyResult` object will contain an additional key, `dataReadyPromise`, which can be used to determine when, if ever, the instance does become ready. - `user: User` The current user associated with this client instance diff --git a/package.json b/package.json index 15d4cd2b..a5d91eff 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@optimizely/react-sdk", "version": "2.9.1", - "description": "React SDK for Optimizely Full Stack and Optimizely Rollouts", + "description": "React SDK for Optimizely Feature Experimentation and Optimizely Rollouts", "homepage": "https://github.com/optimizely/react-sdk", "license": "Apache-2.0", "module": "dist/react-sdk.es.js", From 8721f8ea55bd3a2bf897d00d5ab79d64f246165f Mon Sep 17 00:00:00 2001 From: Rafin Akther Utshaw Date: Fri, 10 Mar 2023 23:47:32 +0600 Subject: [PATCH 2/5] Update readme and package.json --- README.md | 112 ++++++++++++++++++++------------------------------- package.json | 2 +- 2 files changed, 44 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 90c2f668..569137ba 100644 --- a/README.md +++ b/README.md @@ -1,77 +1,24 @@ # Optimizely React SDK -This repository houses the React SDK for use with Optimizely Feature Experimentation and Optimizely Rollouts. +This repository houses the React SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy). -Optimizely Feature Experimentation is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs). +Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome). -Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at https://www.optimizely.com/rollouts/, or see the [documentation](https://docs.developers.optimizely.com/rollouts/docs). +Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap. -### Features +## Get Started -- Automatic datafile downloading -- User ID + attributes memoization -- Render blocking until datafile is ready via a React API -- Optimizely timeout (only block rendering up to the number of milliseconds you specify) -- Library of React components and hooks to use with [feature flags](https://docs.developers.optimizely.com/full-stack/v4.0/docs/create-feature-flags) +Refer to the [React SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-react-sdk) for detailed instructions on getting started with using the SDK. -### Compatibility - -The React SDK is compatible with `React 16.3.0 +` - -### Example - -```jsx -import { - createInstance, - OptimizelyProvider, - useDecision, -} from '@optimizely/react-sdk'; - -const optimizelyClient = createInstance({ - sdkKey: 'your-optimizely-sdk-key', -}); - -function MyComponent() { - const [decision] = useDecision('sort-algorithm'); - return ( - - - { decision.variationKey === 'relevant_first' && } - { decision.variationKey === 'recent_first' && } - - ); -} - -class App extends React.Component { - render() { - return ( - - - - ); - } -} -``` - -# Contents - -1. [Installation](#installation) -2. [Usage](#usage) -3. [Credits](#credits) -4. [Additional code](#additional-code) -5. [Contribute to this repo](#contribute-to-this-repo) - -# Installation +### Install the SDK ``` npm install @optimizely/react-sdk ``` -# Usage +## Use the React SDK + +### "Initialization" ## `createInstance` @@ -321,7 +268,7 @@ The following type definitions are used in the `ReactSDKClient` interface: - `VariableValuesObject : { [key: string]: any }` - `EventTags : { [key: string]: string | number | boolean; }` -`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely X Feature Experimentation developer docs site](https://docs.developers.optimizely.com/full-stack/docs). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. +`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely X Full Stack developer docs site](https://docs.developers.optimizely.com/full-stack/docs). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. - `onReady(opts?: { timeout?: number }): Promise` Returns a Promise that fulfills with an `onReadyResult` object representing the initialization process. The instance is ready when it has fetched a datafile and a user is available (via `setUser` being called with an object, or a Promise passed to `setUser` becoming fulfilled). If the `timeout` period happens before the client instance is ready, the `onReadyResult` object will contain an additional key, `dataReadyPromise`, which can be used to determine when, if ever, the instance does become ready. - `user: User` The current user associated with this client instance @@ -426,11 +373,7 @@ const optimizely = createInstance({ }); ``` -# Credits - -First-party code subject to copyrights held by Optimizely, Inc. and its contributors and licensed to you under the terms of the Apache 2.0 license. - -# Additional code +### Additional code This repository includes the following third party open source code: @@ -497,6 +440,37 @@ To regenerate the dependencies use by this package, run the following command: npx license-checker --production --json | jq 'map_values({ licenses, publisher, repository }) | del(.[][] | nulls)' ``` -# Contribute to this repo + +### Contributing Please see [CONTRIBUTING](./CONTRIBUTING.md) for more information. + +### Credits + +First-party code subject to copyrights held by Optimizely, Inc. and its contributors and licensed to you under the terms of the Apache 2.0 license. + +### Other Optimizely SDKs + +- Agent - https://github.com/optimizely/agent + +- Android - https://github.com/optimizely/android-sdk + +- C# - https://github.com/optimizely/csharp-sdk + +- Flutter - https://github.com/optimizely/optimizely-flutter-sdk + +- Go - https://github.com/optimizely/go-sdk + +- Java - https://github.com/optimizely/java-sdk + +- JavaScript - https://github.com/optimizely/javascript-sdk + +- PHP - https://github.com/optimizely/php-sdk + +- Python - https://github.com/optimizely/python-sdk + +- React - https://github.com/optimizely/react-sdk + +- Ruby - https://github.com/optimizely/ruby-sdk + +- Swift - https://github.com/optimizely/swift-sdk \ No newline at end of file diff --git a/package.json b/package.json index a5d91eff..ca34da8f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@optimizely/react-sdk", "version": "2.9.1", - "description": "React SDK for Optimizely Feature Experimentation and Optimizely Rollouts", + "description": "React SDK for Optimizely Optimizely Feature Experimentation and Optimizely Rollouts", "homepage": "https://github.com/optimizely/react-sdk", "license": "Apache-2.0", "module": "dist/react-sdk.es.js", From f7d27b0740bddd1e07d9614771356c1558f79180 Mon Sep 17 00:00:00 2001 From: Rafin Akther Utshaw Date: Sat, 11 Mar 2023 00:47:28 +0600 Subject: [PATCH 3/5] Fix pr --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 569137ba..f3140c96 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,58 @@ Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feat Refer to the [React SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-react-sdk) for detailed instructions on getting started with using the SDK. + +### Features + +- Automatic datafile downloading +- User ID + attributes memoization +- Render blocking until datafile is ready via a React API +- Optimizely timeout (only block rendering up to the number of milliseconds you specify) +- Library of React components and hooks to use with [feature flags](https://docs.developers.optimizely.com/full-stack/v4.0/docs/create-feature-flags) + +### Compatibility + +The React SDK is compatible with `React 16.3.0 +` + +### Example + +```jsx +import { + createInstance, + OptimizelyProvider, + useDecision, +} from '@optimizely/react-sdk'; + +const optimizelyClient = createInstance({ + sdkKey: 'your-optimizely-sdk-key', +}); + +function MyComponent() { + const [decision] = useDecision('sort-algorithm'); + return ( + + + { decision.variationKey === 'relevant_first' && } + { decision.variationKey === 'recent_first' && } + + ); +} + +class App extends React.Component { + render() { + return ( + + + + ); + } +} +``` + ### Install the SDK ``` @@ -18,7 +70,7 @@ npm install @optimizely/react-sdk ## Use the React SDK -### "Initialization" +### Initialization ## `createInstance` @@ -27,8 +79,8 @@ The `ReactSDKClient` client created via `createInstance` is the programmatic API _arguments_ - `config : object` Object with SDK configuration parameters. This has the same format as the object passed to the `createInstance` method of the core `@optimizely/javascript-sdk` module. For details on this object, see the following pages from the developer docs: - - [Instantiate](https://docs.developers.optimizely.com/full-stack/v4.0/docs/initialize-sdk-react) - - [JavaScript: Client-side Datafile Management](https://docs.developers.optimizely.com/full-stack/v4.0/docs/javascript-client-side-implementation) + - [Instantiate](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/initialize-sdk-react) + - [JavaScript: Client-side Datafile Management](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-client-side-implementation) _returns_ @@ -268,7 +320,7 @@ The following type definitions are used in the `ReactSDKClient` interface: - `VariableValuesObject : { [key: string]: any }` - `EventTags : { [key: string]: string | number | boolean; }` -`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely X Full Stack developer docs site](https://docs.developers.optimizely.com/full-stack/docs). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. +`ReactSDKClient` instances have the methods/properties listed below. Note that in general, the API largely matches that of the core `@optimizely/optimizely-sdk` client instance, which is documented on the [Optimizely Feature Experimentation developer docs site](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome). The major exception is that, for most methods, user id & attributes are **_optional_** arguments. `ReactSDKClient` has a current user. This user's id & attributes are automatically applied to all method calls, and overrides can be provided as arguments to these method calls if desired. - `onReady(opts?: { timeout?: number }): Promise` Returns a Promise that fulfills with an `onReadyResult` object representing the initialization process. The instance is ready when it has fetched a datafile and a user is available (via `setUser` being called with an object, or a Promise passed to `setUser` becoming fulfilled). If the `timeout` period happens before the client instance is ready, the `onReadyResult` object will contain an additional key, `dataReadyPromise`, which can be used to determine when, if ever, the instance does become ready. - `user: User` The current user associated with this client instance @@ -292,7 +344,7 @@ The following type definitions are used in the `ReactSDKClient` interface: ## Rollout or experiment a feature user-by-user -To rollout or experiment on a feature by user rather than by random percentage, you will use Attributes and Audiences. To do this, follow the documentation on how to [run a beta](https://docs.developers.optimizely.com/rollouts/docs/run-a-beta) using the React code samples. +To rollout or experiment on a feature by user rather than by random percentage, you will use Attributes and Audiences. To do this, follow the documentation on how to [run a beta](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/run-a-beta) using the React code samples. ## Server Side Rendering diff --git a/package.json b/package.json index ca34da8f..0bc8b7c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@optimizely/react-sdk", "version": "2.9.1", - "description": "React SDK for Optimizely Optimizely Feature Experimentation and Optimizely Rollouts", + "description": "React SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts", "homepage": "https://github.com/optimizely/react-sdk", "license": "Apache-2.0", "module": "dist/react-sdk.es.js", From 67b5b6bac222e76e0c345a2b28a8fe4836c484e6 Mon Sep 17 00:00:00 2001 From: Rafin Akther Utshaw Date: Sat, 11 Mar 2023 00:51:06 +0600 Subject: [PATCH 4/5] Cleanup --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f3140c96..1e6d7857 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feat Refer to the [React SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-react-sdk) for detailed instructions on getting started with using the SDK. - ### Features - Automatic datafile downloading @@ -492,7 +491,6 @@ To regenerate the dependencies use by this package, run the following command: npx license-checker --production --json | jq 'map_values({ licenses, publisher, repository }) | del(.[][] | nulls)' ``` - ### Contributing Please see [CONTRIBUTING](./CONTRIBUTING.md) for more information. From 91b35207435459612a224e54be1d45f887d1c486 Mon Sep 17 00:00:00 2001 From: Rafin Akther Utshaw Date: Sat, 11 Mar 2023 01:28:23 +0600 Subject: [PATCH 5/5] Update link in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e6d7857..b040333b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Refer to the [React SDK's developer documentation](https://docs.developers.optim - User ID + attributes memoization - Render blocking until datafile is ready via a React API - Optimizely timeout (only block rendering up to the number of milliseconds you specify) -- Library of React components and hooks to use with [feature flags](https://docs.developers.optimizely.com/full-stack/v4.0/docs/create-feature-flags) +- Library of React components and hooks to use with [feature flags](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/create-feature-flags) ### Compatibility