@finapi/finapi-js-loader
Version:
finAPI JS Loader
76 lines (75 loc) • 3.23 kB
TypeScript
import { Callbacks, Properties } from '../types';
export interface ModBaseWidgetProperties extends Properties {
/**
* Server URL where the static resources are hosted.
*
* Static resources are assets required to run the widget but are not included in the widget bundle itself, for example images or fonts.
*
* @default https://js-static-resources-finapi-general-live.finapi.io
*/
jsStaticResourcesServer?: string;
/**
* The widget will be embedded in a container that you provide. If
* `useContainedDialogs` is set to true, the dialogs and modal elements,
* along with the overlay, will be contained within the container. If it is
* set to false, the overlay and modals will cover the entire host page.
*
* @default true
*/
useContainedDialogs?: boolean;
/**
* `styleOverrides` enables you to supply the URL of a stylesheet which will
* be loaded in the widget scope using `<link rel="stylesheet"
* href={styleOverrides} type="text/css" />`. To find out which CSS classes
* are available for override, please refer to the widget class
* documentation.
*/
styleOverrides?: string;
/**
* Our theme extends the default Material UI theme, which can be found at
* [https://mui.com/material-ui/customization/default-theme/#main-content]().
* `themeOverrides` can be used to customize the theme settings for specific
* cases. If you need help with this, please contact our customer support for
* assistance.
*/
themeOverrides?: Record<string, unknown>;
/**
* The `theme` property enables you to select a predefined theme to be
* applied to the widget.
*
* @default finapi
*/
theme?: string;
scroll?: {
/**
* Upon setting this parameter to true window.history.scrollRestoration behaviour will be changed to manual in order for manual scroll to restore its position properly when navigating usign back/forward buttons.
*/
enabled?: number;
/**'
* Sets offset relative to widget element offset. Usually used for adding offset for the main menu.
*/
scrollYOffset?: number;
};
}
export interface ModBaseWidgetCallbacks extends Callbacks {
/**
* The `onNavigate` event is triggered when navigating to a different view.
* The event's payload is the route's path. For example, you can use this
* event to incorporate the widget's steps into your own stepper.
*/
onNavigate?: (location: string) => void;
/**
* When the widget has finished executing, the `onComplete` event is
* triggered. This event indicates that the widget has completed
* successfully, not that the widget's check has returned positive results.
* If the results of the widget's check are to be provided, then they should
* be sent as the payload of a separate event.
*/
onComplete?: (processToken: string) => void;
/**
* The `onError` event is triggered when a technical error occurs, such as an
* inaccessible API server, an incorrect widget configuration, or any other
* unexpected error.
*/
onError?: () => void;
}