///
import type { Connector, ConnectorType, CountryCode, Item, ProductType } from 'pluggy-js';
import { ZoidComponent } from 'zoid/dist/zoid.frameworks.frame';
import { AdaptedPluggyConnectProps } from './utils/props';
export declare type ConnectEventPayload = {
timestamp: number;
} & ({
event: 'SUBMITTED_CONSENT' | 'SUBMITTED_LOGIN' | 'SUBMITTED_MFA';
} | {
event: 'SELECTED_INSTITUTION';
connector: Connector | null;
} | {
event: 'LOGIN_SUCCESS' | 'LOGIN_MFA_SUCCESS' | 'LOGIN_STEP_COMPLETED' | 'ITEM_RESPONSE';
item: Item;
});
export declare type ConnectEventType = ConnectEventPayload['event'];
export declare type PluggyConnectProps = {
/*! if specified, this URL will be used to fetch the child component */
url?: string;
/*! client authorized API key */
connectToken: string;
/*! whether to include sandbox connectors or not */
includeSandbox?: boolean;
/*! If true, Connect can be minimized by the user to continue the connection with the component hidden */
allowConnectInBackground?: boolean;
/*! If set to false, Connect won't be displayed as fullscreen on small/mobile screens, it will be displayed as a modal instead. */
allowFullscreen?: boolean;
/*! If true, widens the modal to 80% of viewport width on desktop screens. Restricted to allowlisted clients (see internalFeatureFlags.ts) - has no effect otherwise. */
wideDesktopModal?: boolean;
/*! If defined, only connectors of specified connectorTypes will be listed */
connectorTypes?: ConnectorType[];
/*! If defined, only connectors of specified ids will be listed */
connectorIds?: number[];
/*! If defined, only connectors of specified countries will be listed */
countries?: CountryCode[];
/*! If specified, runs widget on Update Mode, which will update this specific item id only */
updateItem?: string;
/*! Language ISO string, to specify which language should the widget be displayed on. If invalid or unsupported, will use browser language (falling back to 'en'). */
language?: string;
/*! If defined and connector is present, after accepting terms, it'll navigate to Connector login form directly, skipping selection step. */
selectedConnectorId?: number;
/*! whether to select light or dark theme for Connect UI */
theme?: 'light' | 'dark';
/*! object with CPF and CNPJ for Open Finance connectors only, the form will be pre-filled with these values */
openFinanceParameters?: {
cpf?: string;
cnpj?: string;
};
/*! Move Security request data, as a JSON string. If specified, the Item created will only include MOVE_SECURITY product. */
moveSecurityData?: string;
/*! If defined, only the products specified in this array will be executed in the item creation (in order to be executed, you should have them enabled in your team subscription). */
products?: ProductType[];
/*! If defined, the Oauth popup will be forced to be opened in the systembrowser instead inside the app view */
forceOauthInBrowser?: boolean;
/*! If defined, the widget will ask for credentials even if item is successfully connected */
forceAskForCredentials?: boolean;
/*! If true, connectors will be sorted alphabetically (A-Z) instead of by usage */
connectorSortAlphabetically?: boolean;
/*! on 'success' event handler */
onSuccess?: (data: {
item: Item;
}) => void | Promise;
/*! on 'error' event handler */
onError?: (error: {
message: string;
data?: {
item: Item;
};
}) => void | Promise;
/*! on 'close' modal event handler */
onClose?: () => void | Promise;
/*! On 'hide' modal event handler (note: the onHide prop it will be call if the user closes the widget and the prop allowConnectInBackground is true) */
onHide?: () => void | Promise;
/*! on 'open' modal event handler */
onOpen?: () => void | Promise;
/*! on custom 'event' handler, to track specific user interactions */
onEvent?: (payload: ConnectEventPayload) => void | Promise;
};
export declare type PluggyConnectPropsExtended = PluggyConnectProps & {
sdkVersion: string[];
_runningInCordova?: boolean;
_parentContainerContext?: {
containerWidth: number;
containerHeight: number;
parentViewportWidth: number;
parentViewportHeight: number;
usedDefaultContainer: boolean;
};
};
declare type PluggyConnectZoidComponent = ZoidComponent;
/**
* Method to be executed from both the child and parent components, to execute the
* handshake between both so the parent can render the child.
*
* @returns a singleton ZoidComponent reference, that will take care of
* wrapping and rendering the actual ZoidComponentInstance (this
* should be instantiated only once per page/context).
*/
export declare function initialize(): PluggyConnectZoidComponent;
export declare class PluggyConnect {
private readonly zoidComponent;
private readonly componentPropsExtendedAdapted;
private componentInstance;
constructor(props: PluggyConnectProps);
/**
* Render the component using the specified component props,
* as a modal with an iframe, appended to the page body (or the DOM uppermost element).
*
* @param containerElement - parent element where component should be rendered at. If not specified, will render at body root element.
* @returns promise that resolves when rendered successfully, or throws if failed.
*/
init(containerElement?: HTMLElement): Promise;
/**
* Manually cleanup the component.
* This is not recommended, you should create the component once
* and re-render it as needed each new time to save resources.
*/
destroy(): Promise;
/**
* If the component is minimized, re-open it.
* @retruns promise that resolves when re-opened successfully, or throws if failed.
*/
show(): Promise;
/**
* Minimize the component.
* Useful if you want to hide Connect widget after credentials have been submitted,
* and you want to just continue connecting in background while still listening to
* other callback events.
*/
hide(): Promise;
}
export default PluggyConnect;