UNPKG

react-native-unit-components

Version:

Unit React Native components

103 lines (86 loc) 2.67 kB
import type { UnitOnLoadResponseEvent } from './onLoadMessage'; import { BottomSheetNativePlaceType } from '../../types/internal/bottomSheet.types'; import { WebComponentType } from '../../types/internal/webComponent.types'; export enum UnitComponentsMessage { UNIT_REQUEST_RENDERING = 'unitRequestRendering', UNIT_REQUEST_REFRESH = 'unitRequestRefresh', UNIT_REQUEST_CLOSE_FLOW = 'unitRequestCloseFlow', UNIT_REQUEST_OPEN_LINK = 'unitRequestOpenLink', UNIT_ON_LOAD = 'unitOnLoad', UNIT_REQUEST_DOWNLOAD = 'unitRequestDownload', UNIT_REQUEST_EXTERNAL_SDK = 'unitRequestExternalSdk', UNIT_REQUEST_LEFT_TO_SPEND_DETAILS = 'unitRequestLeftToSpendDetails', UNIT_MULTI_FACTOR_AUTH_FINISHED = 'unitMultiFactorAuthFinished', UNIT_WHITE_LABEL_APP_ON_LOAD = 'unitWhiteLabelAppOnLoad', UNIT_UNAUTHORIZED_TOKEN = 'unitUnauthorizedToken', UNIT_EVENT_TO_CONTINUE = 'unitEventToContinue' } export enum UnitRequestRefreshEventTypes { REQUEST_REFRESH_EVENT = 'requestRefreshEvent' } export interface RequestRenderingEvent { data: RequestRenderingEventData; } export interface RequestRenderingEventData { actionType?: string, nativeComponentName?: WebComponentType, nativePlace: BottomSheetNativePlaceType, nativeComponent: string, } export interface RequestRefreshEvent { type: UnitRequestRefreshEventTypes.REQUEST_REFRESH_EVENT; refEvent?: string; dependencies: string[]; resourceId?: string; } export interface MultiFactorAuthenticationFinishedEvent { unitVerifiedCustomerTokenString: string; parentInstanceId?: string; eventToContinue?: string; } export interface RequestOpenLinkEvent { href: string; target: string; } export interface RequestDownloadEvent { url: string; accessToken: string; fileType: string; responseType: string; fileName: string; } export interface EventToContinueEvent { parentInstanceId?: string; eventToContinue?: string; } export interface PlaidTokenCreatedEvent { linkToken: PlaidLinkTokenData; } export interface PlaidLinkTokenData { type: string, attributes: PlaidLinkTokenAttributes } interface PlaidLinkTokenAttributes { linkToken: string, expiration: string } export type UNWhiteLabelAppResponseCustomerToken = { type: 'customerToken'; attributes: { customerToken: string; }; } export type UnitWhiteLabelAppEvent = | UNWhiteLabelAppResponseCustomerToken export interface RequestExternalSdkEvent { type: string; } export type UnitEvent = | RequestRenderingEvent | RequestRefreshEvent | RequestOpenLinkEvent | UnitOnLoadResponseEvent | RequestDownloadEvent | PlaidTokenCreatedEvent | RequestExternalSdkEvent | UnitWhiteLabelAppEvent