@quartal/bridge-client
Version:
Universal client library for embedding applications with URL-configurable transport support (iframe, postMessage) and framework adapters for Angular and Vue
137 lines • 4.11 kB
TypeScript
import { BaseClient } from '../core/base-client';
import { TransportAdapter } from '../transports/transport-adapter';
import { ClearStorageRequest, CustomNotificationGroup, FastAction, FastActionCallbackResponse, ParentClientConfig, ParentClientState, ParentDataResponse, QuartalAlert, QuartalVersion } from '../types';
export interface ParentCallbacks {
onInited?: (data: {
inited: boolean;
version: string;
}) => void;
onFastActions?: (actions: FastAction[]) => void;
onFastActionCallback?: (callback: FastActionCallbackResponse) => void;
onUrlChange?: (url: string) => void;
onHeightChange?: (height: number) => void;
onTitleChange?: (title: string) => void;
onAlert?: (alert: QuartalAlert) => void;
onError?: (error: Error) => void;
onMouseClick?: (request: any) => void;
onFetchData?: (request: any) => void;
onPendingRequest?: (pending: boolean) => void;
onDialogChanged?: (dialogState: any) => void;
onDataChanged?: (data: any) => void;
onUserNotifications?: (notifications: any[]) => void;
onCustomAction?: (action: string, data: any) => void;
}
export declare class ParentClient extends BaseClient {
protected config: ParentClientConfig;
private state;
private callbacks;
private iframeElement;
constructor(config: ParentClientConfig, callbacks?: ParentCallbacks, transport?: TransportAdapter);
/**
* Initialize transport for parent-child communication
*/
protected initializeTransport(): Promise<void>;
/**
* Set up parent-specific event handlers
*/
protected setupEventListeners(): void;
/**
* Handle connection established
*/
protected onConnect(): void;
/**
* Handle disconnection
*/
protected onDisconnect(): void;
/**
* Send initial data to child
*/
private sendInitialData;
/**
* Handle fast action from child
*/
private handleFastAction;
/**
* Find custom action by key
*/
private findCustomAction;
/**
* Execute custom action
*/
private executeCustomAction;
/**
* Update the iframe element reference (useful after navigation)
*/
updateIframeElement(newIframeElement: HTMLIFrameElement): void;
/**
* Handle reconnection failure by falling back to full reinitialization
*/
private handleReconnectionFailure;
/**
* Open a URL in the child iframe
*/
openUrl(url: string): void;
/**
* Open a fast action in the child
*/
openAction(action: FastAction): void;
/**
* Redirect the child to a new route
*/
redirect(route: string[]): void;
/**
* Clear cache in the child
*/
clearCache(cacheName: string): void;
/**
* Clear storage in the child
*/
clearStorage(request: ClearStorageRequest): void;
/**
* Logout the child
*/
logout(): void;
/**
* Set fast actions for the child
*/
setFastActions(actions: FastAction[]): void;
/**
* Set custom notification groups
*/
setCustomNotificationGroups(groups: CustomNotificationGroup[]): void;
/**
* Set Quartal version
*/
setQuartalVersion(version: QuartalVersion): void;
/**
* Send fetch data response to child
*/
sendFetchDataResponse(response: ParentDataResponse): void;
/**
* Get Quartal parent interface (for backward compatibility)
*/
getQuartalParent(): {
openAction: (action: FastAction) => void;
redirect: (route: string[]) => void;
clearCache: (cacheName: string) => void;
clearStorage: (request: ClearStorageRequest) => void;
logout: () => void;
};
/**
* Check if client is ready
*/
isReady(): boolean;
/**
* Get current fast actions
*/
getFastActions(): FastAction[];
/**
* Get current state
*/
getState(): ParentClientState;
/**
* Update callbacks
*/
updateCallbacks(callbacks: Partial<ParentCallbacks>): void;
}
//# sourceMappingURL=parent-client.d.ts.map