# Persona Inquiry React SDK

The official React bindings for the Persona Inquiry JavaScript SDK.

## [Demo](https://ccq8nh.csb.app/)

## Table of Contents

- Persona Inquiry React SDK
  - [Documentation](#documentation)
  - [Getting Started](#getting-started)
  - [Contributing](#contributing)
  - [License](#license)

## Documentation

The module provides React bindings for the Persona embedded flow.

- [React integration documentation](https://docs.withpersona.com/inlined-flow).
- [Vue integration documentation](https://docs.withpersona.com/inlined-vue-flow).
- [Changelog](https://docs.withpersona.com/docs/inlined-react-changelog).

## Getting Started

```bash
npm install persona-react
```

To open the flow you must create a `Client` object.

```javascript
import React from 'react';
import PersonaReact from 'persona-react';

const MyComponent = () => {
  return (
    <PersonaReact
      // This refers to a production demo template owned by Persona
      templateId='itmpl_Ygs16MKTkA6obnF8C3Rb17dm'
      environment='sandbox'
      onComplete={({ inquiryId, status, fields }) => console.log('onComplete')}
      onCancel={({ inquiryId, sessionToken }) => console.log('onCancel')}
      onError={(error) => console.log(error)}
    />
  );
};
```

## Contributing

Please see [Contributing](../../CONTRIBUTING.md) for guidelines and instructions for local development.

## License

[MIT](LICENSE)
