@quartal/bridge-client
Version:
Universal client library for embedding applications with URL-configurable transport support (iframe, postMessage) and framework adapters for Angular and Vue
212 lines • 7.19 kB
TypeScript
export declare const QUARTAL_EVENTS: {
readonly CHILD_PARENT_READY: "quartal:child:parent:ready";
readonly CHILD_PARENT_FAST_ACTIONS: "quartal:child:parent:fast-actions";
readonly CHILD_PARENT_FAST_ACTION_CALLBACK: "quartal:child:parent:fast-action-callback";
readonly CHILD_PARENT_LOGOUT: "quartal:child:parent:logout";
readonly CHILD_PARENT_REDIRECT: "quartal:child:parent:redirect";
readonly CHILD_PARENT_RELOAD: "quartal:child:parent:reload";
readonly CHILD_PARENT_CLEAR_CACHE: "quartal:child:parent:clear-cache";
readonly CHILD_PARENT_CLEAR_STORAGE: "quartal:child:parent:clear-storage";
readonly CHILD_PARENT_OPEN_URL: "quartal:child:parent:open-url";
readonly CHILD_PARENT_OPEN_ACTION: "quartal:child:parent:open-action";
readonly CHILD_PARENT_FETCH_DATA_RESPONSE: "quartal:child:parent:fetch-data-response";
readonly PARENT_CHILD_READY: "quartal:parent:child:ready";
readonly PARENT_CHILD_INIT: "quartal:parent:child:init";
readonly PARENT_CHILD_FAST_ACTIONS: "quartal:parent:child:fast-actions";
readonly PARENT_CHILD_OPEN_FAST_ACTION: "quartal:parent:child:open-fast-action";
readonly PARENT_CHILD_FAST_ACTION_CALLBACK: "quartal:parent:child:fast-action-callback";
readonly PARENT_CHILD_URL_CHANGE: "quartal:parent:child:url-change";
readonly PARENT_CHILD_HEIGHT_CHANGE: "quartal:parent:child:height-change";
readonly PARENT_CHILD_TITLE_CHANGE: "quartal:parent:child:title-change";
readonly PARENT_CHILD_ALERT: "quartal:parent:child:alert";
readonly PARENT_CHILD_ERROR: "quartal:parent:child:error";
readonly PARENT_CHILD_MOUSE_CLICK: "quartal:parent:child:mouse-click";
readonly PARENT_CHILD_FETCH_DATA: "quartal:parent:child:fetch-data";
readonly PARENT_CHILD_MAKE_PAYMENT: "quartal:parent:child:make-payment";
readonly PARENT_CHILD_PENDING_REQUEST: "quartal:parent:child:pending-request";
readonly PARENT_CHILD_DIALOG_CHANGED: "quartal:parent:child:dialog-changed";
readonly PARENT_CHILD_DATA_CHANGED: "quartal:parent:child:data-changed";
readonly PARENT_CHILD_USER_NOTIFICATIONS: "quartal:parent:child:user-notifications";
};
export declare const INTERNAL_EVENTS: {
readonly PARENT_CHILD_ALERT: "PARENT_CHILD_ALERT";
readonly PARENT_CHILD_DIALOG_CHANGED: "PARENT_CHILD_DIALOG_CHANGED";
readonly PARENT_CHILD_PENDING_REQUEST: "PARENT_CHILD_PENDING_REQUEST";
readonly PARENT_CHILD_TITLE_CHANGE: "PARENT_CHILD_TITLE_CHANGE";
readonly PARENT_CHILD_MOUSE_CLICK: "PARENT_CHILD_MOUSE_CLICK";
readonly PARENT_CHILD_HEIGHT_CHANGE: "PARENT_CHILD_HEIGHT_CHANGE";
};
export interface QuartalUser {
id: string;
name: string;
email: string;
}
export interface QuartalVersion {
version: string;
build?: string;
timestamp?: string;
}
export interface QuartalAlert {
type: 'success' | 'error' | 'warning' | 'info';
message: string;
title?: string;
duration?: number;
data?: any;
}
export interface FastAction {
key?: string;
action?: string;
link?: string;
defaultRoute?: string;
data?: any;
callback?: FastActionCallbackRequest;
localizedText?: any;
name?: string;
}
export interface FastActionCallbackRequest {
onSuccess?: string;
onError?: string;
data?: any;
}
export interface FastActionCallbackResponse {
action: string;
data?: any;
}
export interface CustomAction {
name: string;
key?: string;
action?: string;
link?: string;
}
export interface CustomActions {
customerSummary?: CustomAction[];
[key: string]: CustomAction[] | undefined;
}
export interface CustomTab {
key: string;
name: string;
icon?: string;
link?: string;
}
export interface CustomTabs {
ownTabs?: CustomTab[];
companySettingTabs?: CustomTab[];
userSettingTabs?: CustomTab[];
[key: string]: CustomTab[] | undefined;
}
export interface CustomTable {
key: string;
name: string;
callbackMethod: string;
dtOptions: any;
search: any;
customUrl?: string;
multiSelect?: boolean;
data: any[];
}
export interface CustomTables {
customerSummary?: CustomTable[];
[key: string]: CustomTable[] | undefined;
}
export interface CustomEntity {
key: string;
name: string;
icon?: string;
defaultRoute?: string;
}
export interface CustomNotification {
name: string;
link: string;
icon?: any;
}
export interface CustomNotificationGroup {
name: string;
totalCount: number;
notifications: CustomNotification[];
}
export interface ParentDataResponse {
transactionId: string;
data?: any;
}
export interface ClearStorageRequest {
dataTables?: boolean;
everything?: boolean;
[key: string]: boolean | undefined;
}
export interface AppSettings {
navigation?: boolean;
topnavbar?: boolean;
footer?: boolean;
showLoading?: boolean;
showMessages?: boolean;
envTitle?: string;
[key: string]: any;
}
export interface BaseClientConfig {
debug?: boolean;
trace?: boolean;
appPrefix?: string;
autoConnect?: boolean;
autoNotifyUrlChanges?: boolean;
}
export interface ParentClientConfig extends BaseClientConfig {
iframeElement: HTMLIFrameElement;
user?: QuartalUser;
customActions?: CustomActions;
customEntities?: CustomEntity[];
customTabs?: CustomTabs;
customTables?: CustomTables;
listenCaches?: string[];
showNavigation?: boolean;
showTopNavbar?: boolean;
showFooter?: boolean;
showLoading?: boolean;
showMessages?: boolean;
}
export interface ChildClientConfig extends BaseClientConfig {
user?: QuartalUser;
fastActions?: FastAction[];
customActions?: CustomActions;
customEntities?: CustomEntity[];
customTabs?: CustomTabs;
customTables?: CustomTables;
}
export type EventHandler<T = any> = (data: T) => void;
export type ErrorHandler = (error: Error) => void;
export interface RouterAdapter {
navigate(route: string[] | string): Promise<boolean> | void;
getCurrentUrl(): string;
onUrlChange(callback: (url: string) => void): () => void;
}
export interface UserServiceAdapter {
getCurrentUser(): QuartalUser | null;
onUserChange(callback: (user: QuartalUser | null) => void): () => void;
}
export interface ParentClientState {
isConnected: boolean;
isReady: boolean;
fastActions: FastAction[];
fastActionCallback: FastActionCallbackResponse | null;
quartalVersion: QuartalVersion | null;
customNotificationGroups: CustomNotificationGroup[];
lastError: Error | null;
}
export interface ChildClientState {
isConnected: boolean;
isReady: boolean;
hasInitedSent: boolean;
appSettings: AppSettings;
customEntities: CustomEntity[];
fastAction: FastAction | null;
fastActionCallback: FastActionCallbackResponse | null;
parentData: ParentDataResponse | null;
fastActions: FastAction[];
lastError: Error | null;
}
export interface QuartalEvent {
type: QuartalEventType;
data?: QuartalEventData;
}
export type QuartalEventType = typeof QUARTAL_EVENTS[keyof typeof QUARTAL_EVENTS];
export type QuartalEventData = any;
//# sourceMappingURL=index.d.ts.map