3.3.0 • Published 9 months ago

@formsort/react-embed v3.3.0

Weekly downloads
144
License
ISC
Repository
github
Last release
9 months ago

@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>
);
3.3.0

9 months ago

3.2.4

1 year ago

3.2.2

2 years ago

3.2.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.3

3 years ago

3.0.0

3 years ago

2.0.4

3 years ago

2.1.0

3 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.9

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago