import { r as readHydratedFlags, t as DEFAULT_FLAGS_GLOBAL } from "./hydration-dkNFVide.js"; import { CacheConfig, Flag, Flag as Flag$1, FlagsSDK, SDKConfig, SDKConfig as SDKConfig$1 } from "@basestack/flags-js"; import { ReactNode } from "react"; //#region src/wc-modals.d.ts interface FeatureFlagPreviewModalConfig { theme?: "light" | "dark"; /** When omitted, uses baseURL from FlagsProvider config + "/flags/preview". */ apiEndpoint?: string; /** When omitted, uses projectKey from FlagsProvider config. */ projectKey?: string; /** When omitted, uses environmentKey from FlagsProvider config. */ environmentKey?: string; heading?: string; subtitle?: string; selectionPrompt?: string; selectionPlaceholder?: string; enableLabel?: string; enabledLabel?: string; loadingLabel?: string; emptyLabel?: string; previewBadgeLabel?: string; expiresSoonLabel?: string; learnMoreLabel?: string; } interface FeatureFlagFeedbackModalConfig { theme?: "light" | "dark"; /** When omitted, uses baseURL from FlagsProvider config + "/flags/preview/feedback". */ apiEndpoint?: string; /** When omitted, uses projectKey from FlagsProvider config. */ projectKey?: string; /** When omitted, uses environmentKey from FlagsProvider config. */ environmentKey?: string; heading?: string; moodPrompt?: string; ratingPrompt?: string; feedbackLabel?: string; feedbackPlaceholder?: string; submitLabel?: string; privacyPolicyUrl?: string; privacyPolicyLabel?: string; privacyPolicyLinkLabel?: string; } interface FeatureFlagModalsConfig { preview: FeatureFlagPreviewModalConfig; feedback: FeatureFlagFeedbackModalConfig; } interface OpenFeedbackModalOptions { featureName?: string; metadata?: Record; } interface FeatureFlagModalsContextValue { ready: boolean; error: Error | null; openPreviewModal: () => void; openFeedbackModal: (flagKey: string, options?: OpenFeedbackModalOptions) => void; } declare function useFeatureFlagModals(): FeatureFlagModalsContextValue; /** Returns modals API or null when not inside FeatureFlagModalsProvider. Use from useFlag to optionally open the feedback modal. */ declare function useFeatureFlagModalsOptional(): FeatureFlagModalsContextValue | null; interface FeatureFlagModalsProviderProps { config: FeatureFlagModalsConfig; children: ReactNode; onError?: (error: Error) => void; } declare function FeatureFlagModalsProvider({ config, children, onError }: FeatureFlagModalsProviderProps): import("react").JSX.Element; //#endregion //#region src/hooks.d.ts interface UseFlagOptions { readonly defaultEnabled?: boolean; readonly defaultPayload?: TPayload; readonly fetch?: boolean; } interface UseFlagResult { readonly flag?: Flag$1; readonly enabled: boolean; readonly payload: TPayload | undefined; readonly isLoading: boolean; readonly error: Error | null; readonly refresh: () => Promise; /** Opens the feedback modal for this flag when FeatureFlagModalsProvider is present; no-op otherwise. */ readonly openFeedbackModal: (options?: OpenFeedbackModalOptions) => void; } declare const useFlag: (slug: string, options?: UseFlagOptions) => UseFlagResult; declare const useFlags: () => { flags: Flag$1[]; flagsBySlug: Record; isLoading: boolean; error: Error | null; refresh: () => Promise; }; declare const useFlagsClient: () => import("@basestack/flags-js").FlagsSDK; //#endregion //#region src/feature.d.ts type FeatureRenderContent = ReactNode | ((flag: UseFlagResult) => ReactNode); interface FeatureProps extends UseFlagOptions { readonly slug: string; readonly children?: FeatureRenderContent; readonly fallback?: FeatureRenderContent; readonly loading?: FeatureRenderContent; } declare const Feature: ({ slug, children, fallback, loading, ...options }: FeatureProps) => import("react").JSX.Element; //#endregion //#region src/preview-state.d.ts /** LocalStorage key where preview-enabled flag keys are stored by @basestack/flags-wc */ declare const BS_FLAGS_PREVIEW_STATE_KEY = "bs-flags-preview-state"; /** * Reads the preview state from localStorage. * When a user enables a feature in the preview modal, the flag key is stored here. * After refresh, useFlag will consider this and return enabled: true for those keys. */ declare function getPreviewState(): Record; //#endregion //#region src/provider.d.ts interface FlagsProviderProps { readonly config: SDKConfig$1; readonly children: ReactNode; readonly initialFlags?: Flag$1[]; readonly preload?: boolean; readonly onError?: (error: Error) => void; } declare function FlagsProvider({ config, children, initialFlags, preload, onError }: FlagsProviderProps): import("react").JSX.Element; //#endregion export { BS_FLAGS_PREVIEW_STATE_KEY, type CacheConfig, DEFAULT_FLAGS_GLOBAL, Feature, type FeatureFlagFeedbackModalConfig, type FeatureFlagModalsConfig, FeatureFlagModalsProvider, type FeatureFlagModalsProviderProps, type FeatureFlagPreviewModalConfig, type FeatureProps, type FeatureRenderContent, type Flag, FlagsProvider, type FlagsProviderProps, FlagsSDK, type OpenFeedbackModalOptions, type SDKConfig, type UseFlagOptions, type UseFlagResult, getPreviewState, readHydratedFlags, useFeatureFlagModals, useFeatureFlagModalsOptional, useFlag, useFlags, useFlagsClient }; //# sourceMappingURL=client.d.ts.map