UNPKG

@explorins/pers-sdk

Version:

Platform-agnostic SDK for PERS (Phygital Experience Rewards System)

57 lines (49 loc) 1.87 kB
/** * Core SDK interfaces based on actual PERS Tourism Loyalty App patterns * These interfaces reflect the real DDD architecture with Lazy Facade pattern */ // Core HTTP abstractions matching the app's ApiService patterns export interface CoreHttpClient { get<T>(url: string, options?: any): Observable<T>; post<T>(url: string, body: any, options?: any): Observable<T>; put<T>(url: string, body: any, options?: any): Observable<T>; delete<T>(url: string, options?: any): Observable<T>; } // Base facade interface reflecting the app's LazyClass pattern export interface CoreFacade { [key: string]: any; } // Environment configuration interface based on LoyaltyEnvironment export interface CoreEnvironment { production: boolean; version: string; apiVersion: string apiRoot: string; apiProjectKey?: string; } // State management interface reflecting the app's Signal-based patterns export interface CoreStateManager<T> { state$: Observable<T>; updateState(partialState: Partial<T>): void; resetState(): void; } // Event system interface for cross-platform communication export interface CoreEventEmitter<T = any> { emit(eventName: string, data?: T): void; on(eventName: string, callback: (data?: T) => void): void; off(eventName: string, callback?: (data?: T) => void): void; } // Service factory interface for platform-specific implementations export interface CoreServiceFactory { createHttpClient(): CoreHttpClient; createStateManager<T>(initialState: T): CoreStateManager<T>; createEventEmitter<T>(): CoreEventEmitter<T>; } // Observable type for platform-agnostic reactive programming export interface Observable<T> { subscribe(observer: { next?: (value: T) => void; error?: (error: any) => void; complete?: () => void; }): { unsubscribe(): void }; }