0.1.0 • Published 10 months ago

sharecare-onboarding-sdk v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Embedded Onboarding Module SDK

The name of the npm module to be imported is sharecare-onboarding-sdk. Install this module in your project using npm, like this:

npm install sharecare-onboarding-sdk --save

This is a commonJS type of module that exports the following:

embed function

function embed(options, element, onEvent)

Call this function to embed the module into a specified DOM element. This will add an iframe tag to the DOM node as the only child of the passed element. The embed module will be configured by Sharecare to validate the domain of the website with a provider specified url.

Note: If the element passed to this method is ever removed from the DOM, adding it back will reload the embedded module. If this happens the subsequent behavior of this API is undefined.

Params

  • options - parameters to configure the behavior of the embedded module. It has these fields:
    • className - string that if given will be passed as the className of the iframe element.
    • clientId - this is the subdomain of the client portal. For example, if the portal is would be accessed at ‘genera.sharecare.com’ the clientId is ‘genera’.
    • locale - this is the locale to use for translating strings. If not specified or not supported, it will default to "en-US-u-ms-ussystem"
    • autoResize – if true, the iframe will automatically resize when the iframe content changes in size.
  • element - A DOM element that will contain the embedded module.
  • onEvent – this is a function that is called when an important event happens in the registration flow.
    • loaded – this event is fired when the iframe has been loaded and ready to use.
    • completed – this event is fired when the user has finished the registration process.
    • resize – this event is fired when the iframe content changes in size.

Example

    connect(params) {
        var options = {
            className: 'demo-embed',
            clientId: 'genera',
            params: params,
            autoResize: true,
        }

        embed(options, this.embedRef.current, this.callback.bind(this));
    }

Embed React Component (still in development)

This module exports a React component that can be directly included in a React application.

<Embed/>

Use this component to embed the module into into your document. This will add an iframe tag to the DOM node as the only child of the passed element. The embed module will be configured by Sharecare to validate the domain of the website with a provider specified url.

This component has the following properties:

Properties

  • clientId - this is the subdomain of the client portal. For example, if the portal would be accessed at ‘genera.sharecare.com’ the clientId is ‘genera’. This property is mandatory.
  • locale - this is the locale to use for translating strings. If not specified or not supported, it will default to "en-US-u-ms-ussystem".
  • autoResize - if true, the iframe will automatically resize when the iframe content changes in size.
  • onEvent - this is a function that is called when an important event happens in the registration flow. These events are defined:
    • loaded – this event is fired when the iframe has been loaded and ready to use.
    • completed – this event is fired when the user has finished the registration process.
    • resize – this event is fired when the iframe content changes in size.
0.1.0

10 months ago