UNPKG

hp-app-bundle-sdk

Version:

A comprehensive SDK for building mini-applications.

85 lines 2.37 kB
import { MiniApp } from "./MiniApp"; export type LogLevel = "debug" | "info" | "warn" | "error"; export interface PlatformOverrides { android?: { intentHandling?: "native" | "webview"; backButtonBehavior?: "default" | "custom"; encryptionLevel?: "none" | "software" | "hardware"; }; ios?: { statusBarStyle?: "light" | "dark"; modalPresentationStyle?: "fullScreen" | "pageSheet"; biometricAuth?: "none" | "touchID" | "faceID"; }; web?: { storageType?: "localStorage" | "sessionStorage" | "indexedDB" | "cookies"; authRedirectStrategy?: "popup" | "redirect"; offlineSupport?: boolean; }; } export interface ApiEndpoints { auth: string; payment: string; storage: string; [key: string]: string; } export interface BaseUrls { authService: string; paymentService: string; apiGateway: string; [key: string]: string; } export interface Timeouts { apiRequest: number; authTokenRefresh: number; [key: string]: number; } export interface Features { enableExperimental: boolean; useLegacyAuth: boolean; [key: string]: boolean; } export interface MiniAppSDKConfig { core?: { autoInitialize?: boolean; logLevel?: LogLevel; platformOverrides?: PlatformOverrides; enableAnalytics?: boolean; apiEndpoints?: ApiEndpoints; }; constants?: { baseUrls?: BaseUrls; timeouts?: Timeouts; features?: Features; }; } export interface BridgeMessage { name: string; params: Record<string, any>; result?: string; } export interface EventDetail<T = unknown> { data?: T; error?: unknown; } export type TypedEventListener<T = unknown> = (event: CustomEvent<EventDetail<T>>) => void; export interface MiniAppModule<T, C = any> { name: string; defaultConfig?: C; install: (miniapp: MiniApp, config: C) => T; } declare global { interface Window { Hamropatro_MiniApp_Interface?: any; Hamropatro_AppBundle_Interface?: any; webkit?: { messageHandlers?: { Hamropatro_MiniApp_Interface?: any; Hamropatro_AppBundle_Interface?: any; }; }; miniapp?: MiniApp; } } export declare const myEventTarget: EventTarget; //# sourceMappingURL=types.d.ts.map