# @theorchard/suite-identity

Provides a unified integration of the user identity on the organization.

# Usage

## `useIdentity`

React hook that returns the current identity.

```jsx
import React from 'react';
import { useIdentity } from '@orchard/identity';

const LoggedInUserComponent = () => {
    const identity = useIdentity();

    return (
        <span>
            `${identity.firstName} ${identity.lastName}`
        </span>
    );
};
```

---

## Feature flags

The identity object has a helper function to help out with feature flags.

```jsx
import React from 'react';
import { useIdentity } from '@theorchard/suite-identity';

import SubComponentV2 from './subComponentV2';
import SubComponent from './subComponent';

const SomeComponent = () => {
    const identity = useIdentity();

    if (identity.hasFeature('version_v2')) return <SubComponentV2 />;

    return <SubComponent />;
};
```
