@quartal/bridge-client
Version:
Universal client library for embedding applications with URL-configurable transport support (iframe, postMessage) and framework adapters for Angular and Vue
182 lines • 5.22 kB
TypeScript
import { BaseClient } from '../core/base-client';
import { TransportAdapter } from '../transports/transport-adapter';
import { ChildClientConfig, ChildClientState, FastAction, FastActionCallbackResponse, QuartalAlert, QuartalUser, AppSettings, CustomEntity } from '../types';
export interface ChildCallbacks {
onInited?: (config: ChildClientConfig) => void;
onFastAction?: (action: FastAction) => void;
onFastActionCallback?: (callback: FastActionCallbackResponse) => void;
onLogout?: () => void;
onReload?: () => void;
onClearCache?: (cacheName: string) => void;
onClearStorage?: (request: any) => void;
onOpenUrl?: (url: string) => void;
onRedirect?: (url: string[]) => void;
onOpenAction?: (action: FastAction) => void;
onFetchedData?: (request: any) => void;
onAppSettingsUpdate?: (appSettings: any) => void;
}
export declare class ChildClient extends BaseClient {
protected config: ChildClientConfig;
private state;
private callbacks;
private adapters;
constructor(config: ChildClientConfig, callbacks?: ChildCallbacks, transport?: TransportAdapter);
/**
* Initialize transport for child-parent communication
*/
protected initializeTransport(): Promise<void>;
/**
* Set up child-specific event handlers
*/
protected setupEventListeners(): void;
/**
* Handle connection established
*/
protected onConnect(): void;
/**
* Handle disconnection
*/
protected onDisconnect(): void;
/**
* Handle parent ready event
*/
private handleParentReady;
/**
* Send init event to parent
*/
private sendInit;
/**
* Send inited event to parent with version information
*/
sendInited(data: {
inited: boolean;
version: string;
}): void;
/**
* Send available user specific (child's) fast actions to parent
*/
sendFastActions(actions: FastAction[]): void;
/**
* Send request to open fast action in parent
*/
sendOpenFastAction(action: FastAction): void;
/**
* Send fast action callback to parent
*/
sendFastActionCallback(callback: FastActionCallbackResponse): void;
/**
* Send URL change to parent
*/
sendUrlChange(url: string): void;
/**
* Send height change to parent
*/
sendHeightChange(height: number): void;
/**
* Send alert to parent
*/
sendAlert(alert: QuartalAlert): void;
/**
* Send title change to parent
*/
sendTitleChange(title: string): void;
/**
* Send mouse click to parent
*/
sendMouseClick(): void;
/**
* Send make payment request to parent
*/
sendMakePayment(payment: any): void;
/**
* Send error to parent
*/
sendError(error: Error): void;
/**
* Send fetch data request to parent
*/
sendFetchDataRequest(callbackMethod: string, parameter: any, transactionId: string): void;
/**
* Send pending request status to parent
*/
sendPendingRequest(pending: boolean): void;
/**
* Send dialog state change to parent
*/
sendDialogChanged(opened: boolean): void;
/**
* Send data change notification to parent
*/
sendDataChanged(key: string, value: string): void;
/**
* Send user notifications to parent
*/
sendUserNotifications(notifications: any): void;
/**
* Set adapters for framework integration
*/
setAdapters(adapters: {
router?: any;
userService?: any;
}): void;
/**
* Get current user
*/
getCurrentUser(): QuartalUser | null;
/**
* Navigate to a route
*/
navigate(route: string[] | string): void;
/**
* Get current URL
*/
getCurrentUrl(): string;
/**
* Get Quartal child interface (for backward compatibility)
*/
getQuartalChild(): {
sendInited: (data: {
inited: boolean;
version: string;
}) => void;
sendOpenFastAction: (action: FastAction) => void;
sendFastActionCallback: (callback: FastActionCallbackResponse) => void;
sendUrlChange: (url: string) => void;
sendHeightChange: (height: number) => void;
sendAlert: (alert: QuartalAlert) => void;
sendTitleChange: (title: string) => void;
sendError: (error: Error) => void;
getCurrentUser: () => QuartalUser | null;
navigate: (route: string[] | string) => void;
getCurrentUrl: () => string;
};
/**
* Get current app settings
*/
getAppSettings(): AppSettings;
/**
* Get current custom entities
*/
getCustomEntities(): CustomEntity[];
/**
* Get current fast actions
*/
getFastActions(): FastAction[];
/**
* Check if client is ready
*/
isReady(): boolean;
/**
* Check if client is connected
*/
isConnected(): boolean;
/**
* Get current state (required by BaseClient)
*/
getState(): ChildClientState;
/**
* Update callbacks
*/
updateCallbacks(callbacks: Partial<ChildCallbacks>): void;
}
//# sourceMappingURL=child-client.d.ts.map