Getting Started
Installation
To get started with the Versori Embedded SDK for React, you need to install the package. You can do this using npm or yarn:
Usage
Once you have installed the package, you can import the Embed
component from @versori/embed-react
and use it in your React application.
All of the components and hooks provided will need to be wrapped in the VersoriEmbeddedProvider
component.
VersoriEmbeddedProvider
The VersoriEmbeddedProvider
is a React component that initializes and provides the Versori Embedded Platform client to its children via context. It also allows customization of some default settings and validation messages.
Currently the only default setting is the default integration tile image.
Props
options
(required)
- Type:
InitOptions
- Description: Configuration options required to initialize the Versori Embedded Platform client.
- Required Properties:
orgId
: Your organisation ID.endUserAuth
: Authentication details for the end user, can only be of typejwt
right now. Must be an object that looks like this:
children
- Type:
ReactNode
- Description: The child components that will have access to the Versori Embedded context.
defaults
- Type:
Partial<VersoriEmbeddedDefaults>
- Description: Custom default settings to override the predefined defaults.
validation
- Type:
VersoriEmbeddedProviderValidation
- Description: Validation configuration, including custom locale messages for form validation.
VersoriEmbeddedProviderValidation
locale
: ALocaleObject
to customize validation messages. Defaults to:
Usage
Context
The VersoriEmbeddedProvider
provides the following context to its children:
client
: The initializedPlatformClient
instance.defaults
: The merged default settings.
Loading State
If the PlatformClient
is not yet initialized, the provider will render a loading spinner centered on the screen.