breezi-js
Version:
Vanilla JavaScript SDK for Breezi PayPal integration
66 lines • 1.69 kB
TypeScript
interface BreeziWidgetConfig {
environment: 'sandbox' | 'production';
providers: {
paypal: {
clientId: string;
};
};
debug?: boolean;
}
interface PaymentOptions {
amount: number;
currency: string;
description?: string;
onSuccess?: (payment: any) => void;
onError?: (error: any) => void;
onCancel?: () => void;
}
declare global {
interface Window {
paypal?: any;
}
}
/**
* Vanilla JavaScript Breezi Widget
*/
export declare class BreeziWidget {
private config;
private sdkLoaded;
private logger;
constructor(config: BreeziWidgetConfig);
private validateConfig;
private createError;
/**
* Load PayPal SDK
*/
private loadPayPalSDK;
/**
* Render PayPal button in the specified container
*/
renderPayPalButton(containerId: string, options: PaymentOptions): Promise<void>;
/**
* Create a simple payment button with custom styling
*/
createPaymentButton(containerId: string, options: PaymentOptions & {
buttonText?: string;
buttonStyle?: Partial<CSSStyleDeclaration>;
}): void;
/**
* Get current configuration
*/
getConfig(): BreeziWidgetConfig;
/**
* Update configuration
*/
updateConfig(newConfig: Partial<BreeziWidgetConfig>): void;
}
export declare function createBreeziWidget(config: BreeziWidgetConfig): BreeziWidget;
declare global {
interface Window {
BreeziConfig?: BreeziWidgetConfig;
BreeziWidget?: typeof BreeziWidget;
createBreeziWidget?: typeof createBreeziWidget;
}
}
export default BreeziWidget;
//# sourceMappingURL=widget.d.ts.map