/** The metatag the Online page opens with when the account toggle is on. */ export const HOT_ORDER = "order:hot"; export type HotDefaultAction = "set-hot" | "clear-hot" | "keep"; /** * Decide what the Online default should do for a given search. * * `order:hot` on its own is the default, not a deliberate search: it is * applied when the toggle is on and removed when the account turns it off * (so a reload of an old URL follows the new setting). Any other search is * left untouched. */ export function hotDefaultAction( tags: string, hotDefaultOn: boolean, ): HotDefaultAction { const trimmed = tags.trim(); if (trimmed === HOT_ORDER) return hotDefaultOn ? "keep" : "clear-hot"; if (!trimmed) return hotDefaultOn ? "set-hot" : "keep"; return "keep"; }