'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);
    };
}

/**
 * Filter types Klevu support
 */
exports.KlevuFilterType = void 0;
(function (KlevuFilterType) {
    KlevuFilterType["Options"] = "OPTIONS";
    KlevuFilterType["Slider"] = "SLIDER";
    KlevuFilterType["Rating"] = "RATING";
})(exports.KlevuFilterType || (exports.KlevuFilterType = {}));

exports.KlevuSearchSorting = void 0;
(function (KlevuSearchSorting) {
    /**
     * This is the default sort order, which uses a combination of Klevu A.I. and
     * your own merchandising configuration to determine the order of the results.
     * Please read this article for more information about how Klevu ranks and
     * orders the results.
     */
    KlevuSearchSorting["Relevance"] = "RELEVANCE";
    /**
     * Sort the results by the salePrice value of each record.
     */
    KlevuSearchSorting["PriceAsc"] = "PRICE_ASC";
    /**
     * Sort the results by the salePrice value of each record.
     */
    KlevuSearchSorting["PriceDesc"] = "PRICE_DESC";
    /**
     * Sort the results by the name of each record, in alphabetical order.
     */
    KlevuSearchSorting["NameAsc"] = "NAME_ASC";
    /**
     * Sort the results by the name of each record, in alphabetical order.
     */
    KlevuSearchSorting["NameDesc"] = "NAME_DESC";
    /**
     * Sort the results by each record's average rating, if this data has been
     * indexed in your store.
     */
    KlevuSearchSorting["RatingAsc"] = "RATING_ASC";
    /**
     * Sort the results by each record's average rating, if this data has been
     * indexed in your store.
     */
    KlevuSearchSorting["RatingDesc"] = "RATING_DESC";
    /**
     * Sort your records based on their published date. Please see support article
     * for important information about sorting by newness.
     */
    KlevuSearchSorting["NewArrivalAsc"] = "NEW_ARRIVAL_ASC";
    /**
     * Sort your records based on their published date. Please see support article
     * for important information about sorting by newness.
     */
    KlevuSearchSorting["NewArrivalDesc"] = "NEW_ARRIVAL_DESC";
    /**
     * Advanced sorting method that requires list of keys to be sorted with. Recommended use `advancedSorting()` modifier instead of specifying this
     */
    KlevuSearchSorting["AdvancedSorting"] = "ADVANCED_SORT";
})(exports.KlevuSearchSorting || (exports.KlevuSearchSorting = {}));

exports.KlevuListenDomEvent = KlevuListenDomEvent;

//# sourceMappingURL=KlevuSearchSorting-3cce1bed.js.map