@blocklet/payment-react
Version:
Reusable react components for payment kit v2
34 lines (33 loc) • 1.01 kB
TypeScript
import { NavigateFunction } from 'react-router-dom';
export interface LinkInfo {
url: string;
external: boolean;
path: string;
}
/**
* Check if currently running inside Payment Kit
*/
export declare function isInPaymentKit(): boolean;
/**
* Create link information object
* @param path Path or URL
* @param external Force external link behavior
*/
export declare function createLink(path: string, external?: boolean): LinkInfo;
/**
* Get HTML attributes for a link
* @param link Link information
* @param target Link target (default: _self)
*/
export declare function getLinkProps(link: LinkInfo, target?: string): Record<string, any>;
/**
* Handle link navigation
* @param e Click event
* @param link Link information
* @param navigate React Router navigate function
* @param options Navigation options
*/
export declare function handleNavigation(e: React.MouseEvent, link: LinkInfo, navigate?: NavigateFunction, options?: {
replace?: boolean;
target?: string;
}): void;