import type { VisualQaCategory, VisualQaItemIdentity } from './types'; /** Categories whose render route can be pointed at a candidate version. */ export declare const CANDIDATE_CATEGORIES: ReadonlySet; export declare const usesTrial: (category: VisualQaCategory) => boolean; export interface CandidateRequest { packageVersion?: string | null; vehiclePackage?: Record | null; } /** Flag-level checks that need no network (the category checks run once the item is resolved). */ export declare function validateCandidateFlags(req: { packageVersion?: string | null; vehiclePackageFile?: string | null; submitHosted?: boolean; }): string | null; /** Parse the `--vehicle-package` file used to render a candidate Vehicle Package Version. */ export declare function parseVehiclePackage(text: string, file: string): Record; /** Category-level checks, once the item and its pin are known. Returns a refusal message, or null. */ export declare function candidateRefusal(category: VisualQaCategory, pin: { packageId?: string | null; version?: string | null; } | null, req: CandidateRequest): string | null; /** What the browser layer needs to point the runtime at the candidate. */ export interface CandidateConfig { itemId: string; packageVersion: string; vehiclePackage?: Record | null; /** Rewrite the Try Now session POST (vehicles, avatars). */ trial: boolean; /** Rewrite the customiser's add-ons list (add-ons, wearables). */ previewAddOns: boolean; /** Rewrite the item's own detail read (also the prop/Device viewer's only candidate read). */ previewItem: boolean; /** Bearer token for the rewritten item read when the page itself is not signed in (props). */ token?: string; /** The only origin to which that bearer token may be sent. */ apiOrigin?: string; /** The only page origin allowed to initiate a creator-authenticated candidate read. */ webOrigin?: string; /** The candidate's pin. The customiser stages an OWNED add-on from the viewer's inventory row (not the add-ons list) * and resolves that row's pin through the public Continuum resolver, so the row's pin is rewritten to this. */ pin?: { packageId: string; version: string; manifestCid: string; } | null; /** Called with each Try Now session response's `trial.candidate` (or null when it carried none). */ onCandidate?: (candidate: TrialCandidate | null, raw: unknown) => void; /** Called with each rewritten customiser response (`add-ons` list or the add-on's own `item`), so the version it was * built from can be checked. */ onPreview?: (kind: 'add-ons' | 'item' | 'inventory', url: string, ok: boolean, body: unknown) => void; } /** The World session mint. The shell sends it through its first-party guest proxy (`/api/world-guest//session`, which * forwards the bearer to the backend's `/api/v1/instant-worlds//session`); the backend path itself is what a shell * on another host (and older shells) still call. Missing the proxy path meant a candidate run never saw its Try Now * session ("no Try Now session was requested"), so the version it rendered was never the candidate. */ export declare const SESSION_URL_RE: RegExp; export declare const ADD_ONS_URL_RE: RegExp; export declare const INVENTORY_URL_RE: RegExp; /** Never expose a creator-authenticated candidate response to a foreign frame or origin. */ export declare function candidateItemOriginAllowed(requestUrl: string, frameUrl: string, originHeader: string | undefined, refererHeader: string | undefined, config: Pick): boolean; /** * Point every copy of the candidate item in a JSON response (an inventory row's nested `item`, a card) at the * candidate pin. Display-only and client-side: the public resolver serves any sealed version, and nothing is written. * Returns how many pins were replaced and the versions they named before, so the caller can prove the swap happened. */ export declare function rewriteCandidatePins(json: unknown, itemId: string, pin: { packageId: string; version: string; manifestCid: string; }): { replaced: number; from: string[]; }; /** * Rewrite a Try Now session POST body so it asks for the candidate. Returns the new body, or null when the request is * not a trial of this item (left untouched). A legacy `{ trialItemId }` body becomes `{ trial: { itemId, … } }`: the * backend refuses both together, and only the `trial` form carries a version. */ export declare function patchSessionBody(body: string | null | undefined, cand: Pick): string | null; /** The add-on's own item read (`GET …/universal-items/`, no sub-path). */ export declare const itemUrlRe: (itemId: string) => RegExp; /** Append `previewPackageVersion` to the add-on's own item read. */ export declare function addItemPreviewParam(url: string, cand: Pick): string; /** The exact pin an item read answers with (the endpoint wraps it as `{ item }`). */ export declare function itemPin(body: unknown): { packageId: string; version: string; manifestCid: string; } | null; /** Legacy add-on preview reads may name only the version; Props and Devices require the full pin above. */ export declare function itemPinVersion(body: unknown): string | null; /** Append the customiser preview params to an add-ons list URL (replacing any already there). */ export declare function addPreviewParams(url: string, cand: Pick): string; /** `trial.candidate` of a Try Now session response. */ export interface TrialCandidate { packageId: string; packageVersion: string; packageVersionId: string; manifestCid: string; vehicleChecksum?: string | null; modelCid?: string | null; } /** A safe one-line account of a session response that carried no candidate: never the body (it holds a live world * session token), only its status and the shape of its trial. */ export declare function describeSessionMiss(raw: unknown): string; /** Read `trial.candidate` from a session response (the endpoint sometimes wraps its payload as `{ item: … }`). */ export declare function candidateFromSessionResponse(json: unknown): TrialCandidate | null; /** * Bind the bundle identity to what the server says it served. Mutates `identity` (the object the routes and the bundle * share) and returns every disagreement with the sealed version that was resolved; any entry fails the run closed. */ export declare function applyTrialCandidate(identity: VisualQaItemIdentity, modelCid: string | null, cand: TrialCandidate): string[]; /** * The add-on's own row in a customiser add-ons response, and the version it says it was built from, when the row * says. Null version = the row does not name one (nothing to check). */ export declare function addOnRowVersion(body: unknown, itemId: string): { found: boolean; version: string | null; };