Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formsort/react-embed

Package Overview
Dependencies
Maintainers
6
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formsort/react-embed

Embed formsort flows in react components

  • 3.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

@formsort/react-embed

Embed Formsort flows within react components.

This is a handy wrapper around @formsort/web-embed-api.

Important note: This package is intended for use in React web applications. If you're looking to embed Formsort flows in React Native applications, please see React native embed guide.

Installation

Add @formsort/react-embed to your project by executing yarn add @formsort/react-embed or npm install @formsort/react-embed.

Usage

Here's an example of basic usage:

import React from 'react';
import EmbedFlow from '@formsort/react-embed';

const EmbedFlowExample: React.FunctionComponent = () => (
  <div>
    <EmbedFlow
      clientLabel="formsort"
      flowLabel="onboarding"
      variantLabel="main"
      embedConfig={{
        style: {
          width: '100%',
          height: '100%',
        },
      }}
    />
  </div>
);

Events

You can add event listeners to flows like Flowloaded, redirect etc. See all event listeners

Props

Prop nameDescriptionRequiredExample values
clientLabelclient nameyesformsort
flowLabelflow nameyesonboarding
variantLabelvariant namenomain
responderUuidresponder uuid to load existing answers fornoe4923baa-dc2d-4555-813c-a166952292fa
formsortEnvformsort integrations environment label, if not using productionnostaging
queryParamsadditional query params, to pre-populate answers in the formno[['name', 'Olivia'], ['age', '3']]
embedConfigconfig passed to the underlying FormsortWebEmbedno{ style: { height: '100%' } }
onFlowLoadedevent listenerno() => { console.log('flow loaded') }
onFlowClosedevent listenerno() => { console.log('flow closed') }
onFlowFinalizedevent listenerno() => { console.log('flow finalized') }
onStepLoadedevent listenerno() => { console.log('step loaded') }
onStepCompletedevent listenerno() => { console.log('step loaded') }
onRedirectevent listenerno(url: string) => { console.log('redirecting to:', url) }
onUnauthorizedevent listenerno() => { console.log('ID token is missing or invalid.') }

Loading a specific variant revision

You can use query parameters to load a specific variant revision. Don't use it if you want to show latest variant.

import React from 'react';
import EmbedFlow from '@formsort/react-embed';

const EmbedFlowExample: React.FunctionComponent = () => (
  <div>
    <EmbedFlow
      clientLabel="formsort"
      flowLabel="onboarding"
      variantLabel="main"
      queryParams={['variantRevisionUuid', '<uuidv4>']}
    />
  </div>
);

Keywords

FAQs

Package last updated on 19 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc