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

    Interface UserSettings

    Application configuration settings that control various features and behaviors. Used to store user preferences and feature flags.

    const userSettings: UserSettings = {
    showHelp: true,
    caching: true,
    currency: "USD",
    location: "US",
    suppliers: ["supplier1", "supplier2"],
    theme: "light"
    };
    interface UserSettings {
        showHelp?: boolean;
        caching?: CacheSettings;
        priceTracking?: PriceTracking;
        noCacheStatusCodes?: number[];
        supplierSearchTimeBudgetSec?: number;
        currencyRate?: number;
        currency?: string;
        location?: string;
        country?: string;
        language?: string;
        display?: DisplaySettings;
        search?: SearchSettings;
        results?: ResultsSettings;
        shareUsageData?: boolean;
        suppliers?: SupplierSettings;
        priceMin?: number;
        priceMax?: number;
        fuzzScorerOverride?: string;
        fuzzyFilteringDisabled?: boolean;
    }
    Index

    Properties

    showHelp?: boolean

    Controls visibility of help tooltips throughout the application. Defaults to false.

    caching?: CacheSettings

    Query-cache configuration, grouping the master switch, empty-result handling, and TTL. When enabled (the default), supplier query results are cached; doNotCacheEmptyResults skips caching zero-result queries so a previously-out-of-stock supplier can surface fresh results next time; ttlMinutes evicts entries older than the given age on read (0 disables TTL expiration, leaving entries to LRU/version eviction). Defaults to { enabled: true, doNotCacheEmptyResults: true, ttlMinutes: 7200 }.

    const caching = { enabled: true, doNotCacheEmptyResults: true, ttlMinutes: 7200 };
    
    priceTracking?: PriceTracking

    Price-history tracking, grouping the master switch and the retention cap. When enabled (the default), each search records every product's and variant's standardized USD price into the priceHistory IndexedDB store, appending a point only when the price changes — letting users see whether a product got cheaper or more expensive since they last checked. maxDataPoints bounds each series (oldest points dropped past the cap); 0 means unlimited. Defaults to { enabled: true, maxDataPoints: 5 }. Independent of caching.

    const priceTracking = { enabled: true, maxDataPoints: 5 };
    
    noCacheStatusCodes?: number[]

    HTTP status codes that, when hit while fetching a product's detail/enrichment data, prevent that product's data from being cached — so a later search retries it instead of serving the incomplete cached entry. The product is still listed either way. Defaults to [429] (Too Many Requests); set to an empty array to cache regardless of status. Not exposed in the settings UI — configured via stored settings only.

    [429, 503]
    
    supplierSearchTimeBudgetSec?: number

    Overrides each supplier's per-class search-time budget (in seconds). Once a supplier's search exceeds this, its outstanding detail requests are aborted and only the products collected so far are shown. Leave unset to use the config default (search.supplierSearchTimeBudgetSec); set to 0 to disable the limit entirely. Exposed in the Advanced settings section.

    60
    
    currencyRate?: number

    Currency rate for the user's currency

    1.0
    
    currency?: string

    Selected currency code for price display

    "USD"
    
    location?: string

    User's geographical location (two-letter country code) for shipping calculations. Kept in sync with country whenever it changes.

    "US"
    
    country?: string

    Full country name derived from location via country-list-js. Updated automatically whenever location is set; suppliers that need a country name (e.g. Ambeed's country cookie) read this rather than the code.

    "United States"
    
    language?: string

    Preferred language locale. Defaults to chrome.i18n.getUILanguage() on first run. Used to pick the right-language document (e.g. Ambeed SDS sheets).

    "en-US"
    
    display?: DisplaySettings

    UI presentation, grouping the theme, font-size scale, and toolbar-icon behavior. theme selects light/dark; fontSize controls the root html font-size so every rem-based style scales proportionally; openInTab (default false) makes the toolbar icon open the full-tab view instead of the popup — the service worker enforces it by clearing the action popup (chrome.action.setPopup) and handling chrome.action.onClicked.

    const display = { theme: 'light', fontSize: 'medium', openInTab: false };
    

    Search behavior, grouping variant handling and restricted-product filtering. groupProductVariants (default true) groups a product's variants under its single results-table row (off gives each variant its own row so sorting and filtering apply across all variants); hideRestrictedProducts (default true) hides products the user cannot buy — not shipped to their location, or restricted to business/government/professional buyers; suggestAdvancedQuery (default false) suggests an advanced OR query of alternative names when a basic search finds nothing.

    const search = { groupProductVariants: true, hideRestrictedProducts: true };
    
    results?: ResultsSettings

    Results-table display config. autoHideEmpty (default true) auto-hides hideable columns with no data in the current result set (across all rows and variants) and restores them once a later search populates them; hidden lists the column ids hidden by default.

    const results = { autoHideEmpty: true, hidden: ['cas', 'formula'] };
    
    shareUsageData?: boolean

    When true (the default), ChemPal sends anonymous usage and error statistics (searches, result counts, render errors) to PostHog, an independent analytics provider, to help guide improvements. Set to false to opt out; nothing is then sent to analytics.

    true
    
    suppliers?: SupplierSettings

    Supplier deny-list and limits. disabled names are excluded from every search and hidden from the filter menu; excludeNonShipping (default true) drops suppliers that don't ship to the user's location; resultLimit caps results requested per supplier. (The live "which suppliers to search" selection is session-scoped, not stored here.)

    const suppliers = { disabled: [], excludeNonShipping: true, resultLimit: 5 };
    
    priceMin?: number

    Minimum price (in the user's selected currency) to include in results. Applied by useSearch.passesSearchFilters after suppliers return. Undefined disables the lower bound.

    0
    
    priceMax?: number

    Maximum price (in the user's selected currency) to include in results. Applied by useSearch.passesSearchFilters after suppliers return. Undefined disables the upper bound.

    100
    
    fuzzScorerOverride?: string

    Optional global override for the fuzz-match scorer used by each supplier. When set, fuzzyFilter uses this scorer instead of each supplier class's default fuzzScorer. Value is the exported function name from fuzzball (e.g. "ratio", "token_set_ratio", "WRatio").

    Surfaced via the "Advanced" drawer accordion — hidden unless showAdvancedSettings is true in config.json.

    "token_set_ratio"
    
    fuzzyFilteringDisabled?: boolean

    When true, suppliers skip fuzzball fuzzy-match scoring. A plain query then shows the raw results the supplier returned; an advanced (AND/OR/NOT) query is filtered only by the boolean predicate using case-insensitive substring matching. Leave unset/false to keep fuzzy filtering on (the default).

    Surfaced via the "Advanced" drawer accordion, beside the fuzz-scorer override.

    true