/* eslint-disable @typescript-eslint/no-extraneous-class */
import { TelemetryEventTypes } from './TelemetryEventTypes.js';
export class TelemetryEvents {
    /**
     * Sends application screen view event
     * @param target A node on which to dispatch the event
     * @param screenName The screen name
     * @param info Analytics base configuration
     */
    static view(screenName, target = window, info = {}) {
        const detail = {
            ...info,
            screenName,
        };
        const e = new CustomEvent(TelemetryEventTypes.view, {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail,
        });
        target.dispatchEvent(e);
    }
    /**
     * Sends a Google Analytics event information
     * @param target A node on which to dispatch the event
     * @param detail The event configuration
     */
    static event(detail, target = window) {
        const e = new CustomEvent(TelemetryEventTypes.event, {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail,
        });
        target.dispatchEvent(e);
    }
    /**
     * Sends a Google Analytics exception information
     * @param target A node on which to dispatch the event
     * @param description The exception description
     * @param fatal Whether the exception was fatal to the application
     * @param info Analytics base configuration
     */
    static exception(description, fatal, target = window, info = {}) {
        const detail = { ...info, description, fatal };
        const e = new CustomEvent(TelemetryEventTypes.exception, {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail,
        });
        target.dispatchEvent(e);
    }
    /**
     * Sends a Google Analytics social share information
     * @param target A node on which to dispatch the event
     * @param network The network where the shared content is shared
     * @param action The share action, eg. 'Share'
     * @param url The share url
     * @param info Analytics base configuration
     */
    static social(network, action, url, target = window, info = {}) {
        const detail = { ...info, network, action, target: url };
        const e = new CustomEvent(TelemetryEventTypes.social, {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail,
        });
        target.dispatchEvent(e);
    }
    /**
     * Sends a Google Analytics application timing information
     * @param target A node on which to dispatch the event
     * @param category The timing category
     * @param variable The timing variable
     * @param value The timing value
     * @param label The timing label
     * @param info Analytics base configuration
     */
    static timing(category, variable, value, label, target = window, info = {}) {
        const detail = { ...info, category, variable, value, label };
        const e = new CustomEvent(TelemetryEventTypes.timing, {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail,
        });
        target.dispatchEvent(e);
    }
    static get State() {
        return StateEvents;
    }
}
class StateEvents {
    /**
     * Dispatched when the user made the initial telemetry settings.
     * The application can check for the sate of the telemetry in the corresponding configuration.
     *
     * @param target The node on which to dispatch the event.
     */
    static set(target = window) {
        const e = new Event(TelemetryEventTypes.State.set, {
            composed: true,
            cancelable: true,
            bubbles: true,
        });
        target.dispatchEvent(e);
    }
}
//# sourceMappingURL=TelemetryEvents.js.map