import { ZitadelProject } from "@zitadel/api/config"; import { CreateFlow201Step, CreateFlow201StepComplete, CreateFlowBodyPurpose, CreateFlowBodyPurpose as CreateFlowBodyPurpose$1 } from "@zitadel/api/generated/model"; //#region src/types.d.ts /** * The SPA widget contract shared by every SPA SDK (`sdk-react`, `sdk-vue`, * `sdk-angular`, `sdk-solid`, `sdk-svelte`, `sdk-qwik`): the widget event detail * types plus the config/handler/props types derived from them. Each SPA SDK * re-exports these from its own public surface so consumers don't need a direct * `sdk-core` dependency. The middleware-layer types (`sdk-next`, `sdk-nuxt`) now * live in `@zitadel/sdk-core/middleware`. */ /** Payload of the `zitadel-flow-step` event. */ export interface ZitadelFlowStepDetail { readonly step: CreateFlow201Step; } /** Payload of the `zitadel-flow-input` event. */ export interface ZitadelFlowInputDetail { readonly name: string; readonly value: string; } /** * Carried by the events after which the widget navigates. A listener whose work * must finish first (an async handler, a lazily loaded callback) passes its * promise to `waitUntil`; the widget navigates once every promise has settled, * or after a short timeout. */ export interface ZitadelNavigationDetail { readonly waitUntil: (work: unknown) => void; } /** Payload of the `zitadel-flow-complete` event. */ export interface ZitadelFlowCompleteDetail extends ZitadelNavigationDetail { readonly behavior: CreateFlow201StepComplete; readonly redirect_uri?: string; readonly handoff_token?: string; readonly handoff_token_expires_at?: string; } /** * Payload of the `zitadel-flow-redirect` event — the widget is handing the * browser to an identity provider. Distinct from `zitadel-flow-complete`: * nobody is signed in yet, and the flow resumes when the provider returns. */ export interface ZitadelFlowRedirectDetail extends ZitadelNavigationDetail { readonly redirect_url: string; readonly step: CreateFlow201Step; } /** Payload of the `zitadel-flow-error` event. */ export interface ZitadelFlowErrorDetail { readonly message: string; } /** Payload of the `zitadel-signout` event. */ export interface ZitadelSignoutDetail extends ZitadelNavigationDetail { /** The signed-out user's display rendering ("" when none was resolved). */ readonly display: string; /** The signed-out user's login identifier ("" when none was resolved). */ readonly identifier: string; } /** Events emitted by ``, keyed to their detail payload. */ export interface ZitadelLoginEventMap { "zitadel-flow-step": ZitadelFlowStepDetail; "zitadel-flow-input": ZitadelFlowInputDetail; "zitadel-flow-complete": ZitadelFlowCompleteDetail; "zitadel-flow-redirect": ZitadelFlowRedirectDetail; "zitadel-flow-error": ZitadelFlowErrorDetail; } /** Events emitted by ``, keyed to their detail payload. */ export interface ZitadelLogoutEventMap { "zitadel-signout": ZitadelSignoutDetail; } /** * Events emitted by ``, keyed to their detail payload. * `zitadel-signout` reuses {@link ZitadelSignoutDetail} so the post-sign-in * card and the avatar menu speak the same sign-out contract. */ export interface ZitadelSessionEventMap { "zitadel-signout": ZitadelSignoutDetail; } /** * Maps each `` event to the callback prop the SDKs expose. The * `satisfies Record` is the drift lock: every * event needs exactly one handler entry — a missing one, or an extra one left * behind for a removed event, fails `tsc`. Everything below derives from this. */ export declare const ZITADEL_LOGIN_EVENT_HANDLERS: { readonly "zitadel-flow-step": "onFlowStep"; readonly "zitadel-flow-input": "onFlowInput"; readonly "zitadel-flow-complete": "onFlowComplete"; readonly "zitadel-flow-redirect": "onFlowRedirect"; readonly "zitadel-flow-error": "onFlowError"; }; /** Maps the `` event to the callback prop the SDKs expose. */ export declare const ZITADEL_LOGOUT_EVENT_HANDLERS: { readonly "zitadel-signout": "onSignout"; }; /** Maps the `` event to the callback prop the SDKs expose. */ export declare const ZITADEL_SESSION_EVENT_HANDLERS: { readonly "zitadel-signout": "onSignout"; }; /** Runtime list of `` event names (drives wiring + drift tests). */ export declare const ZITADEL_LOGIN_EVENTS: (keyof ZitadelLoginEventMap)[]; /** Runtime list of `` event names. */ export declare const ZITADEL_LOGOUT_EVENTS: (keyof ZitadelLogoutEventMap)[]; /** Runtime list of `` event names. */ export declare const ZITADEL_SESSION_EVENTS: (keyof ZitadelSessionEventMap)[]; /** Configuration props shared by every `ZitadelLogin` wrapper. */ export interface ZitadelLoginConfig { /** The SDK handle from `configureZitadel(...)`. */ readonly project?: ZitadelProject; /** Discrete project id, read when no {@link project} handle is supplied. */ readonly projectId?: string; /** Reverse-proxy path prefix the widget calls. */ readonly proxyPath?: string; /** * Sizing/chrome mode. `widget` (default) is content-sized and paints no * page chrome — for embedding inside an existing layout. `page` claims * the viewport, paints the surface background, loads the brand font, and * focuses the first field — for dedicated login routes. * @default "widget" */ readonly variant?: "widget" | "page"; /** * Colour mode. Unset defers to the tenant's `branding.theme.mode`, then to * the variant default — `dark` for `page`, `auto` (follow * `prefers-color-scheme`) for `widget`. Set it when your app's surface is * fixed so the widget doesn't render a dark card on a light page. */ readonly theme?: "light" | "dark" | "auto"; /** * Visually hide the widget's own heading block while keeping it in the * accessibility tree — for embeds whose page already carries the heading * (a brand-voice title above the card) so the card doesn't repeat it. * @default false */ readonly suppressHeader?: boolean; /** * Hide the show/hide button on password fields. The button is shown by * default, as NIST SP 800-63B recommends. * @default false */ readonly suppressPasswordToggle?: boolean; /** Flow purpose. @default "login" */ readonly purpose?: CreateFlowBodyPurpose$1; /** * Selects a specific flow definition by its `name` (the `name` field in * the flow file). Omit to run the project's default flow for the purpose. */ readonly flowName?: string; /** * Where to navigate after a completed sign-in. When the page's `next` query * parameter names a path on the same origin, the widget returns there * instead: the server SDKs' middleware sends a signed-out request for a * protected route to the login page with `?next=`. */ readonly postSignInUrl?: string; /** * Go to {@link postSignInUrl} even when the page's `next` query parameter * names a path, for a page that uses `next` for something of its own. * @default false */ readonly forcePostSignInUrl?: boolean; /** * An existing flow's id to resume instead of starting a new flow, for * example one kept across a reload. Unset or `null` falls back to the `flow` query * parameter a provider callback brings back; an id that no longer resolves * starts a new flow. */ readonly resumeFlowId?: string | null; /** * Copy overrides merged over the builtin locale dictionaries, keyed by * primary language subtag. Each dictionary may be partial — the widget * merges it over the builtin copy — so presets like the components' * `businessLocales` overlay are directly assignable. This is how custom * flow steps and actions get labels (keys follow `.title`, * `.action.`, `.field.`): * * ```tsx * * ``` */ readonly locales?: Record>>; /** BCP-47 language override; defaults to the browser language. */ readonly lang?: string; } /** Configuration props shared by every `ZitadelLogout` wrapper. */ export interface ZitadelLogoutConfig { /** The SDK handle from `configureZitadel(...)`. */ readonly project?: ZitadelProject; /** Discrete project id, read when no {@link project} handle is supplied. */ readonly projectId?: string; /** Reverse-proxy path prefix the widget calls. */ readonly proxyPath?: string; /** Where to navigate after sign-out. */ readonly postSignOutUrl?: string; /** * Colour mode. Unset defaults to `auto` (follow `prefers-color-scheme`) — * the control lives inside the app's own chrome. Set it when the * surrounding surface is fixed. */ readonly theme?: "light" | "dark" | "auto"; } /** Configuration props shared by every `ZitadelSession` wrapper. */ export interface ZitadelSessionConfig { /** The SDK handle from `configureZitadel(...)`. */ readonly project?: ZitadelProject; /** Discrete project id, read when no {@link project} handle is supplied. */ readonly projectId?: string; /** Reverse-proxy path prefix the widget calls. */ readonly proxyPath?: string; /** Where to navigate after sign-out. */ readonly postSignOutUrl?: string; /** Heading text override. */ readonly heading?: string; /** Logout action label override. */ readonly logoutLabel?: string; /** * Sizing/chrome mode. `widget` (default) is content-sized and paints no * page chrome — for embedding the signed-in card inside an existing * layout. `page` claims the viewport and paints the surface background — * for dedicated signed-in routes. * @default "widget" */ readonly variant?: "widget" | "page"; /** * Colour mode. Unset defers to the variant default — `dark` for `page`, * `auto` (follow `prefers-color-scheme`) for `widget`. Set it when your * app's surface is fixed so the card doesn't render dark on a light page. */ readonly theme?: "light" | "dark" | "auto"; /** * Visually hide the widget's own heading block while keeping it in the * accessibility tree — for embeds whose page already carries the heading * (a brand-voice title above the card) so the card doesn't repeat it. * @default false */ readonly suppressHeader?: boolean; } /** * Plain-callback handlers for the `` events, derived from * {@link ZitadelLoginEventMap} and {@link ZITADEL_LOGIN_EVENT_HANDLERS} so the * prop set can never drift from the events it forwards. */ export type ZitadelLoginHandlers = { readonly [E in keyof ZitadelLoginEventMap as (typeof ZITADEL_LOGIN_EVENT_HANDLERS)[E]]?: (detail: ZitadelLoginEventMap[E]) => ZitadelLoginEventMap[E] extends ZitadelNavigationDetail ? unknown : void; }; /** Plain-callback handler for the `` event (derived, as above). */ export type ZitadelLogoutHandlers = { readonly [E in keyof ZitadelLogoutEventMap as (typeof ZITADEL_LOGOUT_EVENT_HANDLERS)[E]]?: (detail: ZitadelLogoutEventMap[E]) => ZitadelLogoutEventMap[E] extends ZitadelNavigationDetail ? unknown : void; }; /** Plain-callback handlers for the `` events (derived, as above). */ export type ZitadelSessionHandlers = { readonly [E in keyof ZitadelSessionEventMap as (typeof ZITADEL_SESSION_EVENT_HANDLERS)[E]]?: (detail: ZitadelSessionEventMap[E]) => ZitadelSessionEventMap[E] extends ZitadelNavigationDetail ? unknown : void; }; /** Full prop set for a `ZitadelLogin` wrapper (config + plain-callback handlers). */ export type ZitadelLoginProps = ZitadelLoginConfig & ZitadelLoginHandlers; /** Full prop set for a `ZitadelLogout` wrapper (config + plain-callback handlers). */ export type ZitadelLogoutProps = ZitadelLogoutConfig & ZitadelLogoutHandlers; /** Full prop set for a `ZitadelSession` wrapper (config + plain-callback handlers). */ export type ZitadelSessionProps = ZitadelSessionConfig & ZitadelSessionHandlers; /** The names every framework applies to an element itself, so none of them takes a prefix. */ declare const NATIVE_NAMES: readonly ["class", "className", "style"]; type NativeName = (typeof NATIVE_NAMES)[number]; declare const STANDARD_NAMES: readonly ["class", "className", "style", "id", "title", "slot", "hidden", "role", "tabindex", "tabIndex"]; /** * The name of a standard HTML attribute: the fixed ones (`className` and * `tabIndex` are the spellings React and Qwik use), `data-*` and `aria-*`. * Matching is exact and case-sensitive. */ export type StandardAttributeName = (typeof STANDARD_NAMES)[number] | `data-${string}` | `aria-${string}`; /** * The standard attributes among the props `Props`, each name with `Prefix` * before it, except the native names. Every value keeps the type it has in * `Props`. */ export type StandardAttributes = { [Name in keyof Props & StandardAttributeName as Name extends NativeName ? Name : `${Prefix}${Name}`]?: Props[Name]; }; /** * What a wrapper's props type adds to the widget's own: the standard attributes * of the framework's element attributes type `Attributes`, and nothing else, so * no prop the type accepts is dropped. */ export type StandardAttributeProps = Pick>; /** * Whether `name` is the name of a standard HTML attribute (see * {@link StandardAttributeName}). A wrapper that needs to keep such a name away * from a property binding of its own asks this rather than listing the names. */ export declare function isStandardAttributeName(name: string): name is StandardAttributeName; /** * The standard HTML attributes among the given props: `class`, `style`, `id`, * `title`, `slot`, `hidden`, `role`, `tabindex`, `data-*` and `aria-*`. A widget * element takes these as plain DOM attributes, so a wrapper passes the result to * the element. Anything else is left out, so no stray prop can reach the * widget's configuration. A value of `undefined` or `null` is left out, and so * is `false` except for `aria-*` and `data-*`, which render as the string * `"false"`. A framework that needs the names marked (Solid writes `attr:id` as * an attribute) passes the `prefix` to put before each name except the native * ones (`class`, `className` and `style`). */ export declare function standardAttributes(props: Props, prefix?: Prefix): StandardAttributes; /** Every widget name, for code that loops over the widgets. */ export declare const widgetNames: readonly ["login", "logout", "session"]; /** The name of a widget. */ export type WidgetName = (typeof widgetNames)[number]; /** * The tag names of the widget elements. The elements register under these * names, and every SDK wrapper, spec and guard reads them from here rather than * spelling them out. The type ties each tag to its widget name. */ export declare const widgetTags: { readonly login: "zitadel-login"; readonly logout: "zitadel-logout"; readonly session: "zitadel-session"; }; /** One of the widget element tag names. */ export type WidgetTag = (typeof widgetTags)[WidgetName]; //#endregion export type { CreateFlowBodyPurpose }; //# sourceMappingURL=types.d.mts.map