A JavaScript SDK implementing TPAStream's EasyEnrollment Platform

Usage no npm install needed!

<script type="module">
  import easyenrollsdk from 'https://cdn.skypack.dev/easyenrollsdk';


'Tpastream Logo'

JavaScript EasyEnrollment SDK


Go to the new repo here




This SDK is designed to implement the EasyEnrollment platform into our clients own hosted web-portals. We want to make it fit as seemlessly as possible with the current experience of their sites; because of this, we have provided functionality to add callbacks to the end of each of the necessary flows and we are as unopinionated as possible about the styling of the SDK's flow.

In the spirit of creating a seemless process we will also be forgoing the verification of emails for users using easyenrollment. Instead, we will be relying on the implementers to provide valid emails, first names, and last names in order to create an association of information to a user.

Client Usage

We have decided that the best possible way to implement this SDK is a simple config pattern. A prospective user will communicate with us to recieve an SDK apiToken as well as employer system keys.

A mock implementation might look something like the following:

Using TPAStream as a CDN

    <script src="https://app.tpastream.com/static/js/sdk.js"></script>
            el: '#react-hook', // This is where we nest all the pages for the form. You will pass in a selector.
            tenant: {
                systemKey: 'test',
                vendor: 'internal'
            employer: {
                systemKey: 'some-system-key',
                vendor: 'internal',
                name: 'some-employer-name'
            user: {
                firstName: 'Joe', 
                lastName: 'Sajor', 
                email: 'some-email@place.com' // You're going to need to provide This
            isDemo: false,
            apiToken: 'VeryLegitKey', // We'll provide this.
            realTimeVerification: true,
            doneChoosePayer: () => {},
            doneTermsOfService: () => {},
            doneCreatedForm: () => {},
            donePostCredentials: ({ params }) => {},
            doneRealTime: () => {},
            doneEasyEnroll: ({ employer, payer, tenant, policyHolder, user }) => {},
            donePopUp: () => {},
            handleFormErrors: (error, {response, request, config}) => {} // This is a callback which will basically act as a try catch for form issues
            userSchema: {} // This is advanced functionality for those who know react-jsonform-schema

As shown above the SDK is mounted by calling window.TPAStream_EasyEnroll({}) and passing in the desired parameters.

NPM package

// Install with NPM
npm i easyenrollsdk

import TPAStream_EasyEnroll from 'easyenrollsdk';

  el: '#react-hook',
  isDemo: true

The SDK currently supports the following parameters:

  • el (This is where the SDK will render)
  • tenant
    • systemKey
    • vendor (This will usually be 'internal')
  • employer
    • systemKey
    • vendor (This will usually be 'internal')
    • name
  • user
    • firstName
    • lastName
    • email
    • memberSystemKey (This key is your own identifier for members in your system)
    • phoneNumber
    • dateOfBirth
  • apiToken
  • isDemo (This will let you set it up without worrying about a user)
  • realTimeVerification
  • userSchema (This is an object {} following react-jsonschema-form pattern for making ui:schema)
  • doneChoosePayer*
  • doneTermsOfService*
  • doneCreatedForm*
  • donePostCredentials*
    • params (All submitted params to our API)
  • doneRealTime*
  • donePopUp*
  • doneEasyEnroll* (Below are args passed into the func)
    • employer
    • payer
    • policyHolder
    • user
    • tenant
  • handleFormErrors*
    • error
    • error_parts
      • response
      • request
      • config

(Required parameters are Highlighted)

Function (() => {}) paramters are Starred*


The SDK currently has the following flow:

  1. Mount Onto Page and Make initial request.
  2. From response data answer --> Do we have multiple payers?
    • Yes --> Proceed to Step 4
    • No --> Proceed to Step 3
  3. Render choose payer's page. Let user select payer to add their new credentials to.
  4. Render payer form.
    • This page will have Terms of Use, Acknowledgement, and any relevant form fields like Security Questions or DOB.
  5. Handle Realtime Validation
    • If Realtime validation is off proceed to Step 7
  6. Direct persons to re-enter credentials if they were found to be invalid or if valid proceed to Step 7
  7. Render finish form. Prompt if they would like to add more credentials.
    • If yes this will restart from Step 1

Here is what this flow looks like visually. Easy Enrollment Flow

Example Page