README
JavaScript EasyEnrollment SDK
WARNING THIS REPO IS DEPRECATED
Version
0.3.3
Philosophy
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>
<script>
window.TPAStream_EasyEnroll({
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
})
</script>
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';
TPAStream_EasyEnroll({
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 makingui: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*
Functionality
The SDK currently has the following flow:
- Mount Onto Page and Make initial request.
- From response data answer -->
Do we have multiple payers?
Yes
--> Proceed to Step 4No
--> Proceed to Step 3
- Render choose payer's page. Let user select payer to add their new credentials to.
- Render payer form.
- This page will have Terms of Use, Acknowledgement, and any relevant form fields like
Security Questions
orDOB
.
- This page will have Terms of Use, Acknowledgement, and any relevant form fields like
- Handle Realtime Validation
- If Realtime validation is off proceed to Step 7
- Direct persons to re-enter credentials if they were found to be invalid or if valid proceed to Step 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.