diff --git a/README.md b/README.md index 316cac3..c736b21 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,21 @@ ReactDOM.render( | onFlagsChange | function | false | Handler for flag change | | loadingComponent | Component | false | Loading component / string | +The `user` object can have any of the following properties: + +| Prop | Type | Description | +|------------------|-----------|-----------------------------------------------| +| key | String | A unique string identifying the user context | +| name | String | The name given to the user context | +| firstName | String | User's first name | +| lastName | String | User's last name | +| email | String | User's email address | +| avatar | String | URL to user's avatar image | +| ip | String | IP address of user | +| country | String | User country | +| anonymous | Boolean | If true, hide the context in LaunchDarkly | +| custom | Object | Custom metadata of the user | + ### Flags All `Flags` components get the _ldClient_ instance thanks to the `FlagsProvider` component. diff --git a/package.json b/package.json index cde2436..c4d8bab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lectra/ld-react-feature-flags", - "version": "1.3.0", + "version": "1.4.0", "description": "Integrate Launch Darkly in your React app in a breeze", "contributors": [ { @@ -8,6 +8,9 @@ }, { "name": "Romain Durand Saint Omer" + }, + { + "name": "Craig Bailey" } ], "license": "MIT", diff --git a/src/FlagsProvider.js b/src/FlagsProvider.js index bfb825b..034f01c 100644 --- a/src/FlagsProvider.js +++ b/src/FlagsProvider.js @@ -9,6 +9,14 @@ export default class FlagsProvider extends Component { children: PropTypes.any, user: PropTypes.shape({ key: PropTypes.string, + name: PropTypes.string, + firstName: PropTypes.string, + lastName: PropTypes.string, + email: PropTypes.string, + avatar: PropTypes.string, + ip: PropTypes.string, + country: PropTypes.string, + anonymous: PropTypes.bool, custom: PropTypes.object }).isRequired, clientkey: PropTypes.string.isRequired, @@ -37,8 +45,7 @@ export default class FlagsProvider extends Component { clientkey, { kind: 'user', - key: user.key, - ...user.custom + ...user }, bootstrap );