stere-insurance-sdk
v0.2.21
Published
SDK to embed insurance in less than 15 mins
Readme
stere-insurance-sdk
This package provides utilities for creating embedded insurance UI
Steps to use the Iframe solution :
- Create a container with a unique id attribute to contain the element. (parentContainerId)
- Choose a unique id to identify the element. (iframeId)
- Create the config object. (clientConfig)
- Import the "createIframe" method from our package.
- Invoke this method with 3 mandatory parameters (parentContainerId, iframeId, clientConfig)
- If you want to apply some styles to the element, create a css class for it and send the name of the class. (iframeStylesClassName) Please note this is an optional property.
If you have followed the steps correctly, you should now see the iframe loaded on the page.
Auth configuration
Legacy X-API-KEY mode
Legacy mode. Still supported for existing clients. New integrations should use embed session mode.
createIframe("container", "stere-iframe", {
auth: {
"X-API-KEY": "existing-client-api-key",
applicant_id: "user-123",
product_selection: ["GL"]
},
clientUrl: "https://partner.example.com",
styles: {}
}, "us", "staging");Embed session mode
New integrations should use embed session mode. embed_key is a public bootstrap key, not a secret. It should only be used by hosted-insurance to request a short-lived Stere iframe session. Real application, quote, and payment API calls must later use the short-lived token generated by quote-api.
createIframe("container", "stere-iframe", {
auth: {
auth_mode: "embed_session",
client_id: "allianz",
embed_key: "emb_live_xxxxx",
applicant_id: "optional-user-id",
product_selection: ["PRODUCT_CODE"]
},
clientUrl: "https://www.allianz-trade.com",
styles: {}
}, "us", "production");CamelCase aliases are also accepted and normalized before the config is sent to hosted-insurance:
auth: {
authMode: "embed_session",
clientId: "allianz",
embedKey: "emb_live_xxxxx"
}Existing X-API-KEY mode remains supported temporarily for backward compatibility.
Installation
npm install stere-insturance-sdkPublishing to NPM
- Get your npm account added to org
- git clone https://github.com/stere-io/stere-insurance-sdk
- git pull
- npm login
- npm run build
- npm run prepublish
- npm publish
