@ekko-earth/ekko-js
Version:
A framework-agnostic web SDK for displaying carbon impact.
36 lines (35 loc) • 1.56 kB
TypeScript
import { ErrorCode } from "../enums/errors.enum";
export declare abstract class BaseImpactPayElement extends HTMLElement {
protected shadow: ShadowRoot;
protected container: HTMLDivElement;
protected iframeWrapper: HTMLDivElement;
protected iframe: HTMLIFrameElement;
protected redirectUrl: string | null;
protected mode: string | null;
protected locale: string | null;
protected clientSecret: string | null;
protected impactpaySessionId: string | null;
protected iframeLoadTimeout: ReturnType<typeof setTimeout> | null;
protected hasIframeResponded: boolean;
protected maxTimeout: number;
protected hasRedirected: boolean;
protected datadogInitialized: boolean;
protected abstract get elementName(): string;
protected abstract get iframePath(): string;
constructor();
protected logInfo(message: string, context?: Record<string, any>): void;
protected logError(error: unknown, context?: Record<string, any>): void;
protected initDatadog(): void;
protected createContainer(): HTMLDivElement;
protected createIframeWrapper(): HTMLDivElement;
protected createIframe(): HTMLIFrameElement;
protected loadIframe(finalUrl: string): void;
protected setupIframeMessageHandler(): void;
private emitCustomEvent;
private acknowledgeIframeResponse;
protected buildQueryParams(): string;
connectedCallback(): Promise<void>;
disconnectedCallback(): void;
protected abstract applyStyles(): void;
protected handleSdkError(code: ErrorCode): void;
}