UNPKG

dreams-web-sdk

Version:
54 lines 3.02 kB
import { ShareEvent, IdTokenDidExpireEvent, AccountProvisionRequestedEvent, ExitRequestedEvent, InvestmentAccountProvisionRequestedEvent, InvestmentAccountProvisionRequestedMessage, InvestmentSellRequestedEvent, InvestmentSellRequestedMessage, Message, UpdateTokenMessage, TransferConsentRequestedEvent, TransferConsentRequestedMessage, AccountRequestedEvent } from './events'; type ClientCallbacks = { onIdTokenDidExpire?: (event: IdTokenDidExpireEvent) => Promise<any>; onAccountProvisionRequested?: (event: AccountProvisionRequestedEvent) => Promise<any>; onInvestmentAccountProvisionRequested?: (event: InvestmentAccountProvisionRequestedEvent) => Promise<InvestmentAccountProvisionRequestedMessage>; onInvestmentSellRequested?: (event: InvestmentSellRequestedEvent) => Promise<InvestmentSellRequestedMessage>; onShare?: (event: ShareEvent) => Promise<any>; onExitRequested: (event: ExitRequestedEvent) => Promise<any>; onTransferConsentRequested?: (event: TransferConsentRequestedEvent) => Promise<TransferConsentRequestedMessage | undefined>; onAccountRequested?: (event: AccountRequestedEvent) => Promise<any>; }; declare class MessageHandler { iframe: HTMLIFrameElement; apiUrl: string; callbacks: ClientCallbacks; constructor(iframe: HTMLIFrameElement, apiUrl: string, callbacks: ClientCallbacks); listen: () => void; onMessage: (message: any) => Promise<void>; /** * You can use this method if you need to manually update the token. */ postUpdateToken: (message: UpdateTokenMessage) => void; /** * You can use this method if you need to manually inform the dreams app that account provision has been initiated. */ postAccountProvisionInitiated: (message: Message) => void; /** * You can use this method if you need to manually inform the dreams app that investment account provision has been initiated. * AccountId is a shared id of a newly provisioned account. Whenever dreams will make a request to transfer money * to/from an account it will use this value to refer to that account. */ postInvestmentAccountProvisionInitiated: (message: InvestmentAccountProvisionRequestedMessage) => void; private postTransferConsentRequestSucceeded; private postTransferConsentRequestCancelled; private postAccountRequestFailed; private postAccountRequestSucceeded; /** * @param location the part of the dreams app where you want to take the user to. You have to only pass the path. */ navigateTo: (location: string) => void; private onIdTokenDidExpire; private onAccountProvisionRequested; private onInvestmentAccountProvisionRequested; private onInvestmentSellRequested; private onShare; private onTransferConsentRequested; private onAccountRequested; private postMessage; private parseEvent; private validateParams; } export default MessageHandler; export { ClientCallbacks }; //# sourceMappingURL=messageHandler.d.ts.map