/** * Type map for parent component lookups. * Maps custom element tag names to their corresponding TypeScript types. */ type ParentComponentMap = { "u-profile": HTMLUProfileElement; "u-signin-root": HTMLUSigninRootElement; "u-signin-step": HTMLUSigninStepElement; "u-newsletter-root": HTMLUNewsletterRootElement; "u-ticketable-list": HTMLUTicketableListElement; "u-transaction-list": HTMLUTransactionListElement; "u-oauth-provider": HTMLUOauthProviderElement; "u-registration-root": HTMLURegistrationRootElement; }; /** * Component context types used throughout the SDK. */ export type ComponentContext = "auth" | "profile" | "newsletter" | "ticketable" | "transaction" | "oauth" | "registration"; /** * Generic helper to find a parent component by tag name with proper typing. * * @param element - The element to start searching from * @param tagName - The tag name of the parent component to find * @returns The parent component element or null if not found * * @example * const profile = findParent(this.element, "u-profile"); * profile?.submitProfile(); */ export declare function findParent(element: HTMLElement, tagName: T): ParentComponentMap[T] | null; /** * Find the parent u-profile component. */ export declare function findParentProfile(element: HTMLElement): HTMLUProfileElement | null; /** * Find the parent u-signin-root component. */ export declare function findParentSigninRoot(element: HTMLElement): HTMLUSigninRootElement | null; /** * Find the parent u-signin-step component. */ export declare function findParentSigninStep(element: HTMLElement): HTMLUSigninStepElement | null; /** * Find the parent u-newsletter-root component. */ export declare function findParentNewsletterRoot(element: HTMLElement): HTMLUNewsletterRootElement | null; /** * Find the parent u-ticketable-list component. */ export declare function findParentTicketableList(element: HTMLElement): HTMLUTicketableListElement | null; /** * Find the parent u-transaction-list component. */ export declare function findParentTransactionList(element: HTMLElement): HTMLUTransactionListElement | null; /** * Find the nearest paginated list ancestor (u-ticketable-list or u-transaction-list). * Used by pagination controls to locate the list whose `page` attribute they drive. */ export declare function findParentPaginatedList(element: HTMLElement): HTMLUTicketableListElement | HTMLUTransactionListElement | null; /** * Find the parent u-oauth-provider component. */ export declare function findParentOAuthProvider(element: HTMLElement): HTMLUOauthProviderElement | null; /** * Find the parent u-registration-root component. */ export declare function findParentRegistrationRoot(element: HTMLElement): HTMLURegistrationRootElement | null; /** * Detects which component context an element is within. * Returns null if not within any known context. * * @param element - The element to detect context for * @returns The detected context or null * * @example * const context = detectContext(this.element); * if (context === "auth") { ... } */ export declare function detectContext(element: HTMLElement): ComponentContext | null; /** * Detects component context, throwing an error if not found. * Use this when the component requires being within a specific context. * * @param element - The element to detect context for * @param componentName - Name of the component for error message * @returns The detected context * @throws Error if no context is found * * @example * const context = detectContextOrThrow(this.element, "submit button"); */ export declare function detectContextOrThrow(element: HTMLElement, componentName: string): ComponentContext; export {};