import * as blitz from 'blitz'; import { RouteUrlObject, Ctx } from 'blitz'; import * as bad_behavior from 'bad-behavior'; import { UrlObject } from 'url'; import React, { ComponentType, ComponentPropsWithoutRef } from 'react'; import { P as PublicData, C as ClientSession, A as AuthenticatedClientSession, E as EmptyPublicData } from './global-d37928f1.js'; declare const TOKEN_SEPARATOR = ";"; declare const HANDLE_SEPARATOR = ":"; declare const SESSION_TYPE_OPAQUE_TOKEN_SIMPLE = "ots"; declare const SESSION_TYPE_ANONYMOUS_JWT = "ajwt"; declare const SESSION_TOKEN_VERSION_0 = "v0"; declare const COOKIE_ANONYMOUS_SESSION_TOKEN: () => string; declare const COOKIE_SESSION_TOKEN: () => string; declare const COOKIE_REFRESH_TOKEN: () => string; declare const COOKIE_CSRF_TOKEN: () => string; declare const COOKIE_PUBLIC_DATA_TOKEN: () => string; declare const HEADER_CSRF = "anti-csrf"; declare const HEADER_PUBLIC_DATA_TOKEN = "public-data-token"; declare const HEADER_SESSION_CREATED = "session-created"; declare const HEADER_CSRF_ERROR = "csrf-error"; declare const LOCALSTORAGE_PREFIX = "_blitz-"; declare const LOCALSTORAGE_CSRF_TOKEN: () => string; declare const LOCALSTORAGE_PUBLIC_DATA_TOKEN: () => string; declare const parsePublicDataToken: (token: string) => { publicData: { userId: unknown; role?: unknown; }; }; declare class PublicDataStore { private eventKey; readonly observable: { next: (n: { userId: unknown; role?: unknown; } | EmptyPublicData) => void; subscribe: (fn: bad_behavior.ISubscriber<{ userId: unknown; role?: unknown; } | EmptyPublicData>) => { unsubscribe(): void; }; }; constructor(); updateState(value?: PublicData | EmptyPublicData, opts?: { suppressEvent: boolean; }): void; clear(): void; getData(): { userId: unknown; role?: unknown; }; private getToken; } declare const getPublicDataStore: () => PublicDataStore; declare const backupAntiCSRFTokenToLocalStorage: () => void; declare const getAntiCSRFToken: () => any; interface UseSessionOptions { initialPublicData?: PublicData; suspense?: boolean | null; } declare const useSession: (options?: UseSessionOptions) => ClientSession; declare const useAuthorizeIf: (condition?: boolean, role?: string | Array) => void; declare const useAuthorize: () => void; declare const useAuthenticatedSession: (options?: UseSessionOptions) => AuthenticatedClientSession; declare const useRedirectAuthenticated: (to: UrlObject | string) => void; type RedirectAuthenticatedTo = string | RouteUrlObject | false; type RedirectAuthenticatedToFnCtx = { session: Ctx["session"]["$publicData"]; }; type RedirectAuthenticatedToFn = (args: RedirectAuthenticatedToFnCtx) => RedirectAuthenticatedTo; type BlitzPage

= React.ComponentType

& { getLayout?: (component: React.JSX.Element) => React.JSX.Element; authenticate?: boolean | { redirectTo?: string | RouteUrlObject; role?: string | Array; }; suppressFirstRenderFlicker?: boolean; redirectAuthenticatedTo?: RedirectAuthenticatedTo | RedirectAuthenticatedToFn; }; declare function getAuthValues(Page: ComponentType | BlitzPage, props: ComponentPropsWithoutRef): { authenticate?: undefined; redirectAuthenticatedTo?: undefined; } | { authenticate: boolean | { redirectTo?: string | RouteUrlObject | undefined; role?: string | string[] | undefined; } | undefined; redirectAuthenticatedTo: RedirectAuthenticatedTo | RedirectAuthenticatedToFn | undefined; }; interface AuthPluginClientOptions { cookiePrefix: string; } declare const AuthClientPlugin: (options: AuthPluginClientOptions) => blitz.ClientPlugin<{ useSession: (options?: UseSessionOptions) => ClientSession; useAuthorize: () => void; useAuthorizeIf: (condition?: boolean, role?: string | Array) => void; useRedirectAuthenticated: (to: UrlObject | string) => void; useAuthenticatedSession: (options?: UseSessionOptions) => AuthenticatedClientSession; getAntiCSRFToken: () => any; }>; export { AuthPluginClientOptions as A, BlitzPage as B, COOKIE_ANONYMOUS_SESSION_TOKEN as C, HANDLE_SEPARATOR as H, LOCALSTORAGE_PREFIX as L, RedirectAuthenticatedTo as R, SESSION_TYPE_OPAQUE_TOKEN_SIMPLE as S, TOKEN_SEPARATOR as T, UseSessionOptions as U, getAntiCSRFToken as a, backupAntiCSRFTokenToLocalStorage as b, useAuthorizeIf as c, useAuthorize as d, useAuthenticatedSession as e, useRedirectAuthenticated as f, getPublicDataStore as g, RedirectAuthenticatedToFnCtx as h, RedirectAuthenticatedToFn as i, getAuthValues as j, AuthClientPlugin as k, SESSION_TYPE_ANONYMOUS_JWT as l, SESSION_TOKEN_VERSION_0 as m, COOKIE_SESSION_TOKEN as n, COOKIE_REFRESH_TOKEN as o, parsePublicDataToken as p, COOKIE_CSRF_TOKEN as q, COOKIE_PUBLIC_DATA_TOKEN as r, HEADER_CSRF as s, HEADER_PUBLIC_DATA_TOKEN as t, useSession as u, HEADER_SESSION_CREATED as v, HEADER_CSRF_ERROR as w, LOCALSTORAGE_CSRF_TOKEN as x, LOCALSTORAGE_PUBLIC_DATA_TOKEN as y };