Skip to main content
This guide details steps to install Onboarding SDK 3, mount the embedded onboarding runtime into your page, and handle its lifecycle callbacks.

Prerequisites

Before you start, ensure that you have:
  • A valid invite token for the customer or applicant who is to be onboarded
  • Node.js and npm installed in your project
1

Install the SDK

Install the SDK package via npm:
2

Add a mount target

Add an empty element to your page wherein the onboarding flow should render. SDK 3 mounts directly into this element
3

Create the onboarding instance

Call createWorthOnboarding with your invite token and lifecycle callbacks:
Use apiBaseUrl only if you’re targeting a non-production or non-default Worth API environment:
4

Mount the SDK

mount() is asynchronous and accepts either a CSS selector string or an HTMLElement. It resolves once the onboarding flow has rendered into the target
Because mount() returns a promise, wrap it in a try/catch if you want to handle mount-time failures separately from runtime errors reported through onError
5

Clean up on unmount

Call unmount() when the containing route or component unloads. SDK 3 supports only one mounted instance at a time, so unmounting is required before mounting a new instance on the same page

Putting It Together

Using SDK 3 in a Framework

The example above is illustrative vanilla TypeScript. In component-based frameworks like React, create the instance once, mount it when the component mounts, and unmount it in your cleanup function:

Content Security Policy

SDK 3 injects its scoped runtime styles automatically during mount(). If your host page enforces a strict style-src Content Security Policy, pass your page’s request-level nonce with styleNonce:

Handling Errors

onError receives a WorthOnboardingError, which includes a code that you can branch on. See Error Handling for a complete list of error codes.

Next Steps


Support

For questions or issues, please contact your Worth Customer Success team or reach out to support@joinworth.com.