import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from "@metamask/base-controller"; import { BaseController } from "@metamask/base-controller"; import type { AbstractClientConfigApiService } from "./client-config-api-service/abstract-client-config-api-service.cjs"; import type { FeatureFlags } from "./remote-feature-flag-controller-types.cjs"; export declare const controllerName = "RemoteFeatureFlagController"; export declare const DEFAULT_CACHE_DURATION: number; export type RemoteFeatureFlagControllerState = { remoteFeatureFlags: FeatureFlags; cacheTimestamp: number; }; export type RemoteFeatureFlagControllerGetStateAction = ControllerGetStateAction; export type RemoteFeatureFlagControllerGetRemoteFeatureFlagAction = { type: `${typeof controllerName}:updateRemoteFeatureFlags`; handler: RemoteFeatureFlagController['updateRemoteFeatureFlags']; }; export type RemoteFeatureFlagControllerActions = RemoteFeatureFlagControllerGetStateAction; export type AllowedActions = never; export type RemoteFeatureFlagControllerStateChangeEvent = ControllerStateChangeEvent; export type RemoteFeatureFlagControllerEvents = RemoteFeatureFlagControllerStateChangeEvent; export type AllowedEvents = never; export type RemoteFeatureFlagControllerMessenger = RestrictedControllerMessenger; /** * Returns the default state for the RemoteFeatureFlagController. * * @returns The default controller state. */ export declare function getDefaultRemoteFeatureFlagControllerState(): RemoteFeatureFlagControllerState; /** * The RemoteFeatureFlagController manages the retrieval and caching of remote feature flags. * It fetches feature flags from a remote API, caches them, and provides methods to access * and manage these flags. The controller ensures that feature flags are refreshed based on * a specified interval and handles cases where the controller is disabled or the network is unavailable. */ export declare class RemoteFeatureFlagController extends BaseController { #private; /** * Constructs a new RemoteFeatureFlagController instance. * * @param options - The controller options. * @param options.messenger - The controller messenger used for communication. * @param options.state - The initial state of the controller. * @param options.clientConfigApiService - The service instance to fetch remote feature flags. * @param options.fetchInterval - The interval in milliseconds before cached flags expire. Defaults to 1 day. * @param options.disabled - Determines if the controller should be disabled initially. Defaults to false. */ constructor({ messenger, state, clientConfigApiService, fetchInterval, disabled, }: { messenger: RemoteFeatureFlagControllerMessenger; state?: Partial; clientConfigApiService: AbstractClientConfigApiService; fetchInterval?: number; disabled?: boolean; }); /** * Retrieves the remote feature flags, fetching from the API if necessary. * Uses caching to prevent redundant API calls and handles concurrent fetches. * * @returns A promise that resolves to the current set of feature flags. */ updateRemoteFeatureFlags(): Promise; /** * Enables the controller, allowing it to make network requests. */ enable(): void; /** * Disables the controller, preventing it from making network requests. */ disable(): void; } //# sourceMappingURL=remote-feature-flag-controller.d.cts.map