import { type DeepPartial } from './deep-catalogue.js'; import type { CatalogPackage, PackageCategory, PackageFilter, PackageProduct } from '../types.js'; export interface Catalog { msisdn: string; categories: PackageCategory[]; packages: CatalogPackage[]; subCategoriesByCategory: Record; fetchedAt: string; fromCache: boolean; /** Upstream calls made while building this catalogue. */ requestCount: number; /** * Whether every subcategory group came back under the upstream cap. False means * at least one group was still full after every partition axis was spent, so * `packages.length` is a floor rather than a count — see `partial`. */ complete: boolean; /** Bands that stayed at the cap, with the groups that were still full. */ partial: DeepPartial[]; /** * True when the exhaustive walk ran. False when it was switched off, in which * case the catalogue is whatever one capped listing per category returned. */ exhaustive: boolean; } /** Attach catalogue provenance and the durable ref to a raw API product. */ export declare function toCatalogPackage(product: PackageProduct, group: string, isRecommended: boolean, category: string): CatalogPackage; /** * Fetch the whole personalised catalogue for a number: every package category, * every package inside it, and each category's subcategory labels. * * One listing per category is not the catalogue. The endpoint returns at most * twelve products per subcategory group — measured 2026-10-18: a flat fetch saw * 315 distinct packages while the same endpoint, partitioned, yielded 600. So the * default path walks the price range until every group is under the cap * (`deep-catalogue.ts`) and says in `complete` whether it got there. That costs * a few hundred calls, which is why the result is cached per number for * `TSEL_CACHE_TTL_MS` (default 30 minutes). Pass `refresh: true` to bypass the * cache, and `flat: true` or `TSEL_DEEP_CATALOGUE=0` for the capped listing. */ export declare function getCatalog(msisdn: string, options?: { refresh?: boolean; flat?: boolean; budget?: number; }): Promise; export declare function clearCatalogCache(msisdn?: string): void; export declare function catalogCacheInfo(): Array<{ msisdn: string; packages: number; complete: boolean; expiresAt: string; }>; /** Friendly sort names mapped onto the API's own `packageOrder` values. */ export declare const SORT_ALIASES: Record; /** Quota buckets the site itself offers, plus their human labels. */ export declare const QUOTA_BUCKETS: Array<{ value: string; label: string; }>; export declare function makeFilter(overrides?: Partial): PackageFilter; /** * Text search across the fields a person would recognise. * * `longdesc` is the field that actually describes a package, and leaving it out * was the single biggest cause of empty results: measured across the live * catalogue, searching it takes "video" from 4 matches to 64, "tethering" from 0 * to 19, and "youtube" from 1 to 10. It is also what the `region` filter has * always searched, so the omission was inconsistent as well as costly. * * `terms` is deliberately excluded. It is 333 KB across the catalogue and only * 30% distinct — the same legal boilerplate repeated on nearly every package. * Searching it raises hit counts through text that says nothing about the * product: "hemat" goes from 3 matches to 15, none of them because the package * has anything to do with saving money. It stays retrievable by naming the field. */ /** * The text a text query is matched against, and the same text BM25 ranks on. * * Both read this one projection so membership and ordering cannot drift apart: * a package must never be ranked on words that did not qualify it. */ export declare function searchableText(pkg: PackageProduct & { group?: string; category?: string; ribbonText?: string; typeOffer?: string; }): string; export declare function matchesQuery(pkg: PackageProduct & { group?: string; category?: string; ribbonText?: string; typeOffer?: string; }, query: string): boolean;