/** * @traffical/svelte - Pure resolution helpers * * Rune-free, side-effect-free helpers shared by the `useTraffical` hook. Kept * in a plain `.ts` module (not `.svelte.ts`) so they can be unit-tested under * `bun test` without the Svelte compiler, and so the CSR resolution contract is * covered by a regression test independent of the runes runtime. */ import type { ConfigBundle, Context, DecisionResult, ParameterValue } from "@traffical/core"; import type { TrafficalClient } from "@traffical/js-client"; /** * The reactive sources a hook resolves against. `bundle` is the provider's * locally-tracked config (updated after the client's fetch); `client` is the * live SDK client. */ export interface ParamSources { client: TrafficalClient | null; bundle: ConfigBundle | null; initialParams?: Record; getContext: () => Context; } /** * Resolve parameters for a call site. * * The key CSR fix: once a `client` exists we ALWAYS trust `client.getParams`, * regardless of the provider's locally-tracked `bundle`. The client falls back * to its own `localConfig` / freshly-fetched bundle / the supplied defaults * internally, so a client-side render that mounts without an `initialBundle` * still resolves real params after the first fetch — the previous * `client && bundle` gate stranded params at defaults because `bundle` started * null and was never updated. */ export declare function computeParamsFrom>(sources: ParamSources, options: { defaults: T; context?: Context; }): T; /** * Make a decision for a call site, or `null` when decisions shouldn't be * tracked / no config is available yet. Decisions are gated on a usable config * (`bundle`) so we never emit a decision event that resolved purely against * defaults; the provider keeps `bundle` in sync via the client's config-update * hook, so this becomes non-null as soon as the first config lands. */ export declare function computeDecisionFrom>(sources: ParamSources, options: { defaults: T; context?: Context; shouldTrackDecision: boolean; }): DecisionResult | null; //# sourceMappingURL=resolve.d.ts.map