ChemPal Documentation - v1.18.0
    Preparing search index...

    Module helpers/priceAlerts

    The price alert watchlist, and the rules for what counts as a price drop. Price changes themselves are logged in the price history; an alert only remembers the latest prices.

    Price Alerts - Helpers

    PriceSnapshot

    A price as the supplier lists it. Kept in the native currency, so a change in exchange rate can't look like a drop.

    PriceDrop

    One price that went down.

    PriceAlert

    A watched product.

    PriceComparison

    The result of comparing fresh prices with an alert's last known ones.

    isPriceAlertKey

    Whether a storage key holds a price alert, for change listeners.

    loadPriceAlerts

    Reads every price alert.

    addPriceAlert

    Starts watching a product. Storage is called before anything is awaited, so the write survives the popup closing right after.

    updatePriceAlert

    Applies changes to an alert, unless it was removed in the meantime.

    getUnseenDrops

    Picks the alerts with a drop the user hasn't seen.

    markDropsSeen

    Marks products' latest drops as seen, so the badge stops counting them.

    removePriceAlerts

    Stops watching products.

    resolvePriceAlertSettings

    The price alert settings, with defaults and limits applied.

    collectNativePrices

    Collects a product's prices by price-history series: each size, plus the headline when no size has its price. Sizes that can't be told apart are left out, since their order may change.

    dropPercent

    How far a price went down.

    detectPriceDrops

    Compares fresh prices with an alert's last known ones.