Version 2 (deprecated)

Requirements

  • The ability to include JS scripts in your software
  • A client key and secret provided by the PulseLife Pro team
  • A modern web based software and modern browser client (Chrome, Firefox, Safari, Opera)

Getting started

Copy and paste the following code in the HTML head section of your web app and replace CLIENT_API_KEY with the client key provided by the PulseLife Pro team.

<head>
    ...
    <script src="https://sdk.pulselife.com/lib/pulsepro-sdk-v2.js"></script>
    <script>
        (async () => {
            const options = {
                clientId: 'CLIENT_API_KEY',
                clientDomain: 'your.domain.com',
                ...
            }

            // for modern browsers
            // display widget
            const pulse = await PulseProSDK.init('my-widget', options)

            // or interract with widget features (open search, etc, docs to come)
            // pulse.app.widgetMethod(...)
            
            // use promises for old browsers (IE < Edge, etc)
            // PulseProSDK.init(...).then(pulse => ...).catch(...)
        })()
    </script>
</head>
<body>
    <div id="my-widget"></div>
</body>

Note: it does not matter where the div element is located in your page. The SDK will use fixed position to show a floating widget at the bottom right of the screen.

Configuration options

const widgetOptions = {
    // default: ''
    clientKey: '',

    // widget height and width (defaults recommmended)
    width: '440px',
    height: '610px',
    
    // enables quick pulse keyword search directory in your webpage
    // default: true
    inlineSearch: true,
    
    // if true, a default service user will used
    // WARNING: user experience will be downgraded if logged out
    // default: false 
    allowAnonymousUsage: false,
    maxAnonymousSearches: 10,
}

...
// display widget
await PulseProSDK.init('my-widget', options)

Options

width and height

The maximum widget width and height when visible and expanded.

inlineSearch

Enable or disable the ability for the user to select text on the page and instantly launch a search within the widget.

allowAnonymousUsage

If set to false, the user will be asked to login to his PulseLife (free) account before accessing any features. If true, the user will be able to test a maxAnonymousSearches number of search requests before being gracefully invited to login. Search requests will use a default general practitioner service account until the user logs in.

maxAnonymousSearches

The number of search requests on behalf of the default service account before a login invitation is prompted if allowAnonymousUsage is set to true. Has no effect if allowAnonymousUsage is set to false

Notes

Anonymous usage

To provide a satisfying onboarding experience, the SDK uses a default service account to perform a limited amout of search requests (if the options allowAnonymousUsage is enabled), and displays a warning encouraging the user to login.

The default anonymous account is a non-expert general practitioner, search results will be customized according to this profile.


Copyright © PulseLife. Generated with Github page.