UNPKG

dreams-web-sdk

Version:
34 lines 2.58 kB
import MessageHandler, { ClientCallbacks } from './messageHandler'; import { IdTokenDidExpireEvent, AccountProvisionRequestedEvent, AccountRequestedEvent, AccountRequestedFailedMessage, AccountRequestedSucceededMessage, InvestmentAccountProvisionRequestedEvent, InvestmentSellRequestedEvent, ExitRequestedEvent, ShareEvent, DreamsEvent, Message, ShareMessage, TransferConsentRequestedEvent, InvestmentAccountProvisionRequestedMessage, InvestmentSellRequestedMessage, UpdateTokenMessage, NavigateToEvent, AccountProvisionInitiatedEvent, InvestmentAccountProvisionInitiatedEvent, UpdateTokenEvent, PartnerEvent } from './events'; /** * DreamSDK is an utility class responsible for setting up and listening * to messages being exchanged between the your context and Dreams iframe. * * ```typescript * const sdk = new DreamsSDK('https://dreams.api.endpoint'); * sdk.setup(callbacks); * sdk.start(jwk_token, locale); * ``` */ export default class DreamsSDK { apiUrl: string; form?: HTMLFormElement; iframe?: HTMLIFrameElement; messageHandler?: MessageHandler; constructor(apiUrl: string); /** * @param callbacks as time goes this object might contain more keys. Think about that when writing your code. * @param containerId you are free to specify your value if that's needed. Otherwise, leave the default. * @param iframeClassName if you want the iframe to have a specific class, you can do it via this param. */ setup(callbacks: ClientCallbacks, containerId?: string, iframeClassName?: string): MessageHandler; /** * @param token jwk token for the user * @param locale determines the localization configuration that will be applied. * @param location path to which the user will be redirected to after the token is verified * @param theme determines the color theme that will be applied to the app */ start(token: string, locale: string, location?: string, theme?: string): void; } export { MessageHandler, IdTokenDidExpireEvent, AccountProvisionRequestedEvent, AccountRequestedEvent, AccountRequestedFailedMessage, AccountRequestedSucceededMessage, InvestmentAccountProvisionRequestedEvent, InvestmentSellRequestedEvent, ExitRequestedEvent, ShareEvent, DreamsEvent, Message, ShareMessage, InvestmentAccountProvisionRequestedMessage, InvestmentSellRequestedMessage, UpdateTokenMessage, NavigateToEvent, AccountProvisionInitiatedEvent, InvestmentAccountProvisionInitiatedEvent, TransferConsentRequestedEvent, UpdateTokenEvent, PartnerEvent, ClientCallbacks, }; //# sourceMappingURL=main.d.ts.map