import * as react_jsx_runtime from 'react/jsx-runtime';
import React, { ComponentProps, ReactNode, ComponentPropsWithRef, Dispatch, SetStateAction } from 'react';
import { Flex } from '@raystack/apsara-v1';
import * as yup from 'yup';
import { Plan, Organization, Group, User, BillingAccount, Subscription, PaymentMethod, OrganizationKyc, BillingAccountDetails } from '@raystack/proton/frontier';
import { ThemeProviderProps } from '@raystack/apsara';
import { QueryClient, UseQueryResult, UseMutationResult } from '@tanstack/react-query';
import { ConnectError } from '@connectrpc/connect';
import { DescMessage, MessageShape, DescMethodUnary, MessageInitShape } from '@bufbuild/protobuf';
import { Timestamp } from '@bufbuild/protobuf/wkt';
import { Dayjs } from 'dayjs';

interface ImageUploadProps {
    description?: string;
    value?: string;
    onChange?: (value: string) => void;
    disabled?: boolean;
    initials?: string;
    'data-test-id'?: string;
}
declare function ImageUpload({ description, value, onChange, disabled, initials, ...rest }: ImageUploadProps): react_jsx_runtime.JSX.Element;

interface ViewContainerProps extends ComponentProps<typeof Flex> {
    contentProps?: Omit<ComponentProps<typeof Flex>, 'children'>;
}
declare function ViewContainer({ children, contentProps, className, ...props }: ViewContainerProps): react_jsx_runtime.JSX.Element;

interface ViewHeaderProps extends ComponentProps<typeof Flex> {
    title: string;
    description?: string;
    /**
     * When provided, renders a breadcrumb row above the title.
     * `children` are placed alongside the breadcrumb (e.g. action buttons).
     * Without breadcrumb, `children` render alongside the title (default layout).
     */
    breadcrumb?: ReactNode;
}
declare function ViewHeader({ title, description, breadcrumb, children, ...props }: ViewHeaderProps): react_jsx_runtime.JSX.Element;

type AuthContainerProps = ComponentPropsWithRef<'div'> & {
    children?: ReactNode;
    className?: string;
};
declare const AuthContainer: ({ children, style, className }: AuthContainerProps) => react_jsx_runtime.JSX.Element;

type AuthHeaderProps = ComponentPropsWithRef<'div'> & {
    title?: string;
    logo?: ReactNode;
};
declare const AuthHeader: ({ title, logo }: AuthHeaderProps) => react_jsx_runtime.JSX.Element;

type SignInViewProps = ComponentPropsWithRef<'div'> & AuthContainerProps & {
    logo?: ReactNode;
    title?: string;
    excludes?: string[];
    footer?: boolean;
};
declare const SignInView: ({ logo, title, excludes, footer, ...props }: SignInViewProps) => react_jsx_runtime.JSX.Element;

type SignUpViewProps = ComponentPropsWithRef<'div'> & AuthContainerProps & {
    logo?: ReactNode;
    title?: string;
    excludes?: string[];
};
declare const SignUpView: ({ logo, title, excludes, ...props }: SignUpViewProps) => react_jsx_runtime.JSX.Element;

type MagicLinkViewProps = ComponentPropsWithRef<'div'> & AuthContainerProps & {
    logo?: ReactNode;
    title?: string;
    open?: boolean;
    inline?: boolean;
};
declare const MagicLinkView: ({ logo, title, open, inline, ...props }: MagicLinkViewProps) => react_jsx_runtime.JSX.Element;

type MagicLinkVerifyViewProps = ComponentPropsWithRef<'div'> & AuthContainerProps & {
    logo?: ReactNode;
    title?: string;
    redirectURL?: string;
};
declare const MagicLinkVerifyView: ({ logo, title, redirectURL, ...props }: MagicLinkVerifyViewProps) => react_jsx_runtime.JSX.Element;

declare const schema$1: yup.ObjectSchema<{
    name: string;
    email: string;
    contactNumber: string | null | undefined;
}, yup.AnyObject, {
    name: undefined;
    email: undefined;
    contactNumber: undefined;
}, "">;
type FormData$1 = yup.InferType<typeof schema$1>;
type SubscribeViewProps = {
    title?: string;
    desc?: string;
    activity?: string;
    medium?: string;
    source?: string;
    confirmSection?: ReactNode;
    onSubmit?: (data: FormData$1) => void;
};
declare const SubscribeView: ({ title, desc, activity, medium, source, confirmSection, onSubmit }: SubscribeViewProps) => react_jsx_runtime.JSX.Element;

declare const schema: yup.ObjectSchema<{
    newsletter: boolean | undefined;
}, yup.AnyObject, {
    newsletter: undefined;
}, "">;
type FormData = yup.InferType<typeof schema>;
type UpdatesViewProps = {
    logo?: ReactNode;
    title?: string;
    preferenceTitle?: string;
    preferenceDescription?: string;
    onSubmit?: (data: FormData) => void;
};
declare const UpdatesView: ({ logo, title, preferenceTitle, preferenceDescription, onSubmit }: UpdatesViewProps) => react_jsx_runtime.JSX.Element;

interface GeneralViewProps {
    onDeleteSuccess?: () => void;
    urlPrefix?: string;
}
declare function GeneralView({ onDeleteSuccess, urlPrefix }?: GeneralViewProps): react_jsx_runtime.JSX.Element;

declare const THEME_OPTIONS: {
    light: {
        label: string;
        icon: react_jsx_runtime.JSX.Element;
    };
    dark: {
        label: string;
        icon: react_jsx_runtime.JSX.Element;
    };
    system: {
        label: string;
        icon: react_jsx_runtime.JSX.Element;
    };
};
type Theme = keyof typeof THEME_OPTIONS;
interface PreferencesViewProps {
    children?: ReactNode;
    /**
     * The theme to use for Theme Select.
     * If not provided, the theme will be fetched from ThemeProvider.
     */
    theme?: Theme;
    /**
     * The callback to call when the theme is changed.
     * If not provided, the theme will be set in the ThemeProvider.
     */
    onThemeChange?: (theme: Theme) => void;
}
declare function PreferencesView({ children, theme: providedTheme, onThemeChange }: PreferencesViewProps): react_jsx_runtime.JSX.Element;

interface PreferenceRowProps extends ComponentProps<typeof Flex> {
    title: string;
    description: string;
    isLoading?: boolean;
    contentProps?: ComponentProps<typeof Flex>;
}
declare function PreferenceRow({ title, description, isLoading, children, className, contentProps, ...props }: PreferenceRowProps): react_jsx_runtime.JSX.Element;

declare function ProfileView(): react_jsx_runtime.JSX.Element;

interface SessionsViewProps {
    onLogout?: () => void;
    onRevoke?: () => void;
}
declare function SessionsView({ onLogout, onRevoke }?: SessionsViewProps): react_jsx_runtime.JSX.Element;

interface MembersViewProps {
    showTeamField?: boolean;
}
declare function MembersView({ showTeamField }: MembersViewProps): react_jsx_runtime.JSX.Element;

interface SecurityViewProps {
    children?: ReactNode;
}
declare function SecurityView({ children }: SecurityViewProps): react_jsx_runtime.JSX.Element;

interface ProjectsViewProps {
    title?: string;
    description?: string;
    onProjectClick?: (projectId: string) => void;
}
declare function ProjectsView({ title, description, onProjectClick }: ProjectsViewProps): react_jsx_runtime.JSX.Element;

interface ProjectDetailsViewProps {
    projectId: string;
    projectsLabel?: string;
    onNavigateToProjects?: () => void;
    onDeleteSuccess?: () => void;
}
declare function ProjectDetailsView({ projectId, projectsLabel, onNavigateToProjects, onDeleteSuccess }: ProjectDetailsViewProps): react_jsx_runtime.JSX.Element;

interface BillingViewProps {
    onNavigateToPlans?: () => void;
}
declare function BillingView({ onNavigateToPlans }: BillingViewProps): react_jsx_runtime.JSX.Element;

declare function TokensView(): react_jsx_runtime.JSX.Element;

interface TeamsViewProps {
    title?: string;
    description?: string;
    onTeamClick?: (teamId: string) => void;
}
declare function TeamsView({ title, description, onTeamClick }: TeamsViewProps): react_jsx_runtime.JSX.Element;

interface TeamDetailsViewProps {
    teamId: string;
    teamsLabel?: string;
    onNavigateToTeams?: () => void;
    onDeleteSuccess?: () => void;
}
declare function TeamDetailsView({ teamId, teamsLabel, onNavigateToTeams, onDeleteSuccess }: TeamDetailsViewProps): react_jsx_runtime.JSX.Element;

interface ServiceAccountsViewProps {
    onServiceAccountClick?: (id: string) => void;
}
declare function ServiceAccountsView({ onServiceAccountClick }: ServiceAccountsViewProps): react_jsx_runtime.JSX.Element;

interface ServiceAccountDetailsViewProps {
    serviceAccountId: string;
    serviceAccountsLabel?: string;
    onNavigateToServiceAccounts?: () => void;
    onDeleteSuccess?: () => void;
}
declare function ServiceAccountDetailsView({ serviceAccountId, serviceAccountsLabel, onNavigateToServiceAccounts, onDeleteSuccess }: ServiceAccountDetailsViewProps): react_jsx_runtime.JSX.Element;

declare function PlansView(): react_jsx_runtime.JSX.Element;

interface PatsViewProps {
    onPATClick?: (patId: string) => void;
}
declare function PatsView({ onPATClick }?: PatsViewProps): react_jsx_runtime.JSX.Element;

interface PATDetailsViewProps {
    patId: string;
    onNavigateToPats?: () => void;
    onDeleteSuccess?: () => void;
}
declare function PATDetailsView({ patId, onNavigateToPats, onDeleteSuccess }: PATDetailsViewProps): react_jsx_runtime.JSX.Element;

type CreateOrganizationViewProps = ComponentPropsWithRef<'div'> & {
    title?: string;
    description?: string;
};
declare const CreateOrganizationView: ({ title, description, ...props }: CreateOrganizationViewProps) => react_jsx_runtime.JSX.Element;

interface BasePlan extends Omit<Plan, 'title'> {
    features?: Record<string, string>;
    title: string;
}

interface FrontierClientBillingOptions {
    supportEmail?: string;
    successUrl?: string;
    cancelUrl?: string;
    hideDecimals?: boolean;
    cancelAfterTrial?: boolean;
    showPerMonthPrice?: boolean;
    tokenProductId?: string;
    basePlan?: BasePlan;
}
interface EntityTerminologies {
    singular: string;
    plural: string;
}
interface FrontierClientCustomizationOptions {
    terminology?: {
        organization?: EntityTerminologies;
        project?: EntityTerminologies;
        team?: EntityTerminologies;
        member?: EntityTerminologies;
        user?: EntityTerminologies;
        appName?: string;
    };
    messages?: {
        billing?: {
            plan_change?: Record<string, string>;
        };
        general?: Record<string, string>;
    };
}
interface FrontierClientOptions {
    locale?: string;
    connectEndpoint?: string;
    redirectSignup?: string;
    redirectLogin?: string;
    redirectMagicLinkVerify?: string;
    callbackUrl?: string;
    dateFormat?: string;
    shortDateFormat?: string;
    billing?: FrontierClientBillingOptions;
    customization?: FrontierClientCustomizationOptions;
}
interface InitialState {
    sessionId?: string | null;
}
type CustomHeaderValue = string | (() => string);
interface FrontierProviderProps {
    config: FrontierClientOptions;
    children: React.ReactNode;
    initialState?: InitialState;
    customHeaders?: Record<string, CustomHeaderValue>;
    theme?: ThemeProviderProps;
    renderToastProvider?: boolean;
    renderThemeProvider?: boolean;
}

interface FrontierContextProviderProps {
    config: FrontierClientOptions;
    organizations: Organization[];
    groups: Group[];
    user: User | undefined;
    activeOrganization: Organization | undefined;
    setActiveOrganization: Dispatch<SetStateAction<Organization | undefined>>;
    isActiveOrganizationLoading: boolean;
    setIsActiveOrganizationLoading: Dispatch<SetStateAction<boolean>>;
    isUserLoading: boolean;
    billingAccount: BillingAccount | undefined;
    isBillingAccountLoading: boolean;
    trialSubscription: Subscription | undefined;
    activeSubscription: Subscription | undefined;
    subscriptions: Subscription[];
    isActiveSubscriptionLoading: boolean;
    trialPlan: Plan | undefined;
    activePlan: Plan | undefined;
    allPlans: Plan[];
    isAllPlansLoading: boolean;
    fetchActiveSubscription: () => Promise<Subscription | undefined>;
    paymentMethod: PaymentMethod | undefined;
    basePlan?: Plan;
    organizationKyc: OrganizationKyc | undefined;
    isOrganizationKycLoading: boolean;
    billingDetails: BillingAccountDetails | undefined;
    sessionMetadata: {
        browser?: string;
        operatingSystem?: string;
        ipAddress?: string;
        location?: {
            city?: string;
            country?: string;
            latitude?: string;
            longitude?: string;
        };
    } | undefined;
}
declare function useFrontier(): FrontierContextProviderProps;

declare const queryClient: QueryClient;
declare const FrontierProvider: {
    (props: FrontierProviderProps): react_jsx_runtime.JSX.Element;
    displayName: string;
};

interface CustomizationProviderProps {
    children: ReactNode;
    config?: FrontierClientCustomizationOptions;
}
declare const CustomizationProvider: React.FC<CustomizationProviderProps>;

interface TerminologyOptions {
    plural?: boolean;
    case?: "lower" | "upper" | "capital";
}
interface TerminologyEntity {
    (options?: TerminologyOptions): string;
}
interface TerminologyMap {
    organization: TerminologyEntity;
    project: TerminologyEntity;
    team: TerminologyEntity;
    member: TerminologyEntity;
    user: TerminologyEntity;
    appName: TerminologyEntity;
}
declare const useTerminology: () => TerminologyMap;

interface UseTokensReturn {
    tokenBalance: bigint;
    isTokensLoading: boolean;
    fetchTokenBalance: () => Promise<any>;
}
declare const useTokens: () => UseTokensReturn;

declare const useBillingPermission: () => {
    isFetching: boolean;
    isAllowed: boolean;
    canSeeBilling: boolean;
};

type UseConnectQueryPollingResult<TData> = UseQueryResult<TData, ConnectError> & {
    isPollingFailed: boolean;
};
declare function useConnectQueryPolling<I extends DescMessage, O extends DescMessage, SelectOutData = MessageShape<O>>(params: {
    method: DescMethodUnary<I, O>;
    input: MessageInitShape<I> | undefined;
    enabled: boolean;
    select: (data: MessageShape<O>) => SelectOutData;
    isComplete: (data: SelectOutData) => boolean;
    maxPoll?: number;
    pollingInterval?: number;
}): UseConnectQueryPollingResult<SelectOutData>;

type Preference = {
    name?: string;
    value?: string;
    scopeType?: string;
    scopeId?: string;
    [key: string]: any;
};
type Preferences = Record<string, Preference>;
interface UsePreferences {
    preferences: Preferences;
    isLoading: boolean;
    isFetching: boolean;
    status: 'idle' | 'fetching' | 'loading';
    fetchPreferences: () => void;
    updatePreferences: (preferences: Preference[]) => Promise<void>;
    fetchPreferencesStatus: UseQueryResult['status'];
    updatePreferencesStatus: UseMutationResult['status'];
}
declare function usePreferences({ autoFetch, scopeType, scopeId }?: {
    autoFetch?: boolean;
    scopeType?: string;
    scopeId?: string;
}): UsePreferences;

declare const PREFERENCE_OPTIONS: {
    readonly NEWSLETTER: "newsletter";
};

/**
 * Converts a ConnectRPC Timestamp to a JavaScript Date
 */
declare function timestampToDate(timestamp?: Timestamp): Date | null;
/**
 * Converts a ConnectRPC Timestamp to a Dayjs object
 */
declare function timestampToDayjs(timestamp?: Timestamp): Dayjs | null;
/**
 * Checks if a ConnectRPC Timestamp is the null time (0001-01-01T00:00:00Z)
 */
declare function isNullTimestamp(timestamp?: Timestamp): boolean;
type TimeStamp = Timestamp;

export { AuthContainer, AuthHeader, BillingView, CreateOrganizationView, CustomizationProvider, FrontierClientBillingOptions, FrontierClientCustomizationOptions, FrontierClientOptions, FrontierProvider, GeneralView, ImageUpload, MagicLinkVerifyView, MagicLinkView, MembersView, PATDetailsView, PREFERENCE_OPTIONS, PatsView, PlansView, PreferenceRow, PreferencesView, ProfileView, ProjectDetailsView, ProjectsView, SecurityView, ServiceAccountDetailsView, ServiceAccountsView, SessionsView, SignInView, SignUpView, SubscribeView, TeamDetailsView, TeamsView, TimeStamp, TokensView, UpdatesView, ViewContainer, ViewHeader, isNullTimestamp, queryClient, timestampToDate, timestampToDayjs, useBillingPermission, useConnectQueryPolling, useFrontier, usePreferences, useTerminology, useTokens };
