'use strict';

/**
 * @category KlevuEvents
 * Global custom document events that @klevu/core sends
 */
exports.KlevuDomEvents = void 0;
(function (KlevuDomEvents) {
    /**
     * When list of last searched terms update
     */
    KlevuDomEvents["LastSearchUpdate"] = "klevu-last-search-update";
    /**
     * When filter manager selection has changed
     */
    KlevuDomEvents["FilterSelectionUpdate"] = "klevu-filter-selection-updates";
    /**
     * When filters have been applied from results
     */
    KlevuDomEvents["FiltersApplied"] = "klevu-filters-applied";
    /**
     * When any click event has been fired on the page
     */
    KlevuDomEvents["ClickEventSent"] = "klevu-click-event-sent";
})(exports.KlevuDomEvents || (exports.KlevuDomEvents = {}));
/**
 * Helper function to listen Klevu Dom events
 *
 * @example ```ts
 * import { KlevuDomEvents, KlevuListenDomEvent } from '@klevu/core'
 *
 * // Event to listen
 * const stopListen = KlevuListenDomEvent(KlevuDomEvents.LastSearchUpdate, (event) => {
 *   console.log('last search updated!', event.detail)
 * })
 *
 * // stop listening
 * stopListen();
 * ```
 *
 * @category KlevuEvents
 * @param klevuDomEvent What event to listen
 * @param callback What to do when event is fired
 * @returns Function to stop listening
 */
function KlevuListenDomEvent(klevuDomEvent, callback) {
    document.addEventListener(klevuDomEvent, callback);
    return () => {
        document.removeEventListener(klevuDomEvent, callback);
    };
}

exports.KlevuListenDomEvent = KlevuListenDomEvent;

//# sourceMappingURL=KlevuDomEvents-f5b92150.js.map