/** * The short denial codes carried on a `"blocked"` grant. Use these to branch on * WHY a shopper was denied (e.g. distinct copy for "never cleared the drop" vs. * "grant expired"). * * REACHABLE VIA THE GATE (the client-only verifier this hook wires): * - `"no_grant"` — no grant was ever recorded (the shopper never cleared the drop). * - `"grant_expired"` — the recorded grant's `expiresAt` is in the past, compared * against `Date.now()`. CLOCK-SKEW CAVEAT: a fast client clock can mark a still- * server-valid grant expired here. This is a defense-in-depth client pre-check * only — `claim()` re-validates the grant server-side, so a skewed client cannot * grant access it shouldn't, only deny access it might have had. * - `"verify_failed"` — the client-only verifier threw while reading the grant. * * NOT reachable via the gate — surfaced by `claim()` and by the SDK's internal * reserve verifier, which drive the app proxy: * - `"no_checkout_context"` — no live checkout context (no credential/cart yet — * the storefront is not ready to check out / reserve). * - `"verify_unreachable"` — the proxy request threw / timed out (transport * failure); the proxy could not be reached. * - `"dedicated_cart_required"` — the admission is priced and needs a cart that * holds nothing but its line; claim again on the cart `createDedicatedCart()` * returns. * - `"admission_bound_to_other_cart"` — the admission is already bound to another * cart; the verifier's result carries `boundCart` when the server named it. * - `` `proxy_${number}` `` — a non-2xx proxy response, templated on the HTTP * status (e.g. `"proxy_403"`, `"proxy_500"`). DYNAMIC, so it is not * exhaustively enumerable — match it with `reason?.startsWith("proxy_")`, * not an equality case. * * The string fallback keeps this open for a future verifier that denies with a * code not listed here; the literal members exist so an editor can autocomplete * the known codes and so a `switch` over them is meaningful. */ export type FanfareDenialReason = "no_grant" | "grant_expired" | "verify_failed" | "no_checkout_context" | "verify_unreachable" | "dedicated_cart_required" | "admission_bound_to_other_cart" | `proxy_${number}` | (string & {}) | undefined; /** The shopper's access state for the gated drop. */ export interface FanfareGrantState { /** * `"checking"` while verifying; `"allowed"` once a valid grant is confirmed; * `"blocked"` when there is no valid grant. */ state: "checking" | "allowed" | "blocked"; /** * A short denial code from the verifier when `state === "blocked"`. See * `FanfareDenialReason` for the canonical codes (note `proxy_*` is dynamic). */ reason?: FanfareDenialReason; } export declare function useFanfareGrant(): FanfareGrantState;