Overview
The Suki Web SDK provides PlatformClient and PlatformClientProvider to help you integrate Suki Headless Web SDK functionality into your application. PlatformClient ThePlatformClient acts as the shared runtime object for the SDK within your app. You should create a single instance of this object and reuse it throughout your application to ensure consistency.
PlatformClientProvider
The PlatformClientProvider is a React wrapper that makes your PlatformClient instance available to all child components.
This allows you to use Suki hooks, such as useAuth, useAmbient, and useAmbientSession, to build your integration quickly.
PlatformClient
Import
Before you can use thePlatformClient, you need to import it into your application.
React
Creating an instance
Create the client once for your app (for example at module scope or outside your root component) so it is not recreated on every render.React
The object you pass to
new PlatformClient({ ... }) sets how that client behaves for your app.Configuration
These are the settings you pass when you callnew PlatformClient({ ... }) in your application.
The Suki environment the client targets. Examples in this documentation use
"staging".When
true, the client runs in a debug-oriented mode so you can troubleshoot during development. Use false when you do not want that behavior in production.The logging level for the client. Examples in this documentation use
"error".PlatformClientProvider
Before you can use thePlatformClientProvider, you need to import it into your application.
Wrap your app
Create a singlePlatformClient instance and wrap your application with PlatformClientProvider. Hooks such as useAuth, useAmbient, and useAmbientSession must run under this provider.
To use Headless Web SDK, you must wrap your app with
PlatformClientProvider above any component that calls Headless Web SDK hooks. Those hooks read the shared PlatformClient from React context that the provider supplies.Refer to the Quickstart for a full component tree and useAuth example.Next steps
Quickstart
Install, provider,
useAuth, and ambient flowTypes Overview
Index of all Headless Web SDK type reference pages
Authentication Hook
useAuth configuration and behaviorUseAuth Parameters
TypeScript shape for
useAuth options