The `persona` package offers the official JavaScript SDK for integrating Persona's identity verification Inquiry Flow into web applications. As of version 5.8.0, it provides a robust client library designed to embed and manage the entire inquiry process directly within the user's browser environment. Key functionalities include configuring inquiry templates, selecting runtime environments (e.g., sandbox, production), and handling critical lifecycle events through callbacks for completion, cancellation, and errors. The SDK abstracts away the complexities of direct API interaction, offering a streamlined integration experience for front-end developers. It ships with built-in TypeScript types, enhancing developer experience and type safety. Persona maintains an active development pace, regularly releasing updates and fixes, and explicitly recommends staying up-to-date. Its primary differentiation lies in being the official, fully supported client for Persona services, ensuring compatibility with the latest features and security standards.
npm install personaVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize the Persona `Client` for an embedded inquiry flow, configure its environment, and set up essential event callbacks for `onReady`, `onComplete`, `onCancel`, and `onError` to manage the user journey.
If using React, install `persona-react` and change `import { Inquiry } from 'persona'` to `import Inquiry from 'persona-react'`.Update your `onComplete` callback function signature to accept destructuring `({ inquiryId, status, fields }) => { ... }` and migrate any logic from `onFail` into `onComplete` by checking the `status` parameter.Replace `onStart` with the `onEvent` callback (listening for `Event.Start`), rename `onExit` to `onCancel` and `client.exit()` to `client.cancel()`, and update references of `accessToken` to `sessionToken` in callback arguments.
Migrate to using the `fields` parameter for prefilling and attribute locking, and rely on template-level configuration for themes. Remove any usage of `InquiryAttributes` type.
Uninstall `@types/persona` if it is present in your project. The types are included directly with the `persona` package.
If using React, install `persona-react` (`npm install persona-react`) and update your import to `import Inquiry from 'persona-react'`.
Update your `onComplete` callback to use destructuring keyword arguments: `onComplete: ({ inquiryId, status, fields }) => { ... }`.For CommonJS, use `const { Client } = require('persona');`. Ensure your build setup correctly handles ES Modules if you intend to use `import` statements.Ensure the `templateId` property is correctly provided in the `Client` constructor options, for example: `templateId: 'your_template_id'`.
No dependency data recorded yet.