API Reference

The embed object will emit events when certain things occur in the app such as sign in/sign out

// type UserSignedInPayload = {
//   userId: string;
//   signInAccountId: string;
//   signInMethod: SignInType;
//   email?: string;
// };

embed.on(KazmEventType.USER_SIGNED_IN, (event: UserSignedInPayload) => {
  // Handle event
  
});

embed.on(KazmEventType.USER_SIGNED_OUT, (event) => {});

You can also enable the back button to show up at the root level and receive events when it is pressed. This can be useful if you are embedding the page and want to go to a separate page when they hit the top-level back button.

const sdk = new KazmSDK();
const embed = sdk.initializeEmbed({
  elementId: '<yourHtmlElementId>',
  // Can be found in the Kazm embed window
  formId: '<yourFormID>',
  options: {
    profileOptions: {
      enableRootBackButton: true,
    }
  }
});

embed.on(KazmEventType.ROOT_BACK_BUTTON_PRESSED, (event) => {
});