UNPKG

@proveanything/smartlinks-auth-ui

Version:

Lightweight React authentication UI components with bearer token support and Smartlinks SDK integration

65 lines 1.74 kB
/** * Smartlinks SDK Integration * Wraps @proveanything/smartlinks for authenticated API calls */ import type { AuthUser } from './types'; interface SmartlinksConfig { apiEndpoint: string; bearerToken?: string; clientId?: string; } /** * Initialize Smartlinks SDK wrapper * This provides authenticated API calls using the bearer token from auth */ export declare class SmartlinksClient { private config; private sdk; constructor(config: SmartlinksConfig); /** * Set authentication token for subsequent API calls */ setToken(token: string): void; /** * Clear authentication token */ clearToken(): void; /** * Get current bearer token */ getToken(): string | null; /** * Make authenticated API request to Smartlinks backend */ request<T>(endpoint: string, method?: string, body?: any, headers?: Record<string, string>): Promise<T>; /** * Get current user profile from Smartlinks */ getCurrentUser(): Promise<AuthUser>; /** * Update user profile */ updateProfile(updates: Partial<AuthUser>): Promise<AuthUser>; /** * Get user's account data */ getAccountData(): Promise<Record<string, any>>; /** * Update account data */ updateAccountData(updates: Record<string, any>): Promise<Record<string, any>>; /** * Refresh authentication token */ refreshToken(): Promise<string>; /** * Logout and invalidate token on server */ logout(): Promise<void>; } /** * Create Smartlinks client instance */ export declare function createSmartlinksClient(config: SmartlinksConfig): SmartlinksClient; export {}; //# sourceMappingURL=smartlinks.d.ts.map