import { RoxFlagFreezeLevel } from './FreezeOptions'; import { Context } from 'rox-base'; import RoxString from './RoxStringBrowser'; import RoxNumber from './RoxNumberBrowser'; import Flag from './RoxFlagBrowser'; import * as overrides from './Overrider'; export { RoxFlagFreezeLevel } from './FreezeOptions'; /** * Container for Rox entities (flags, strings, numbers) */ export interface RoxContainer { [key: string]: Flag | RoxString | RoxNumber; } /** * Fetcher status enum * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_configurationfetchedhandler */ export declare enum RoxFetcherStatus { AppliedFromEmbedded = "APPLIED_FROM_EMBEDDED", AppliedFromCache = "APPLIED_FROM_CACHE", AppliedFromNetwork = "APPLIED_FROM_NETWORK", ErrorFetchFailed = "ERROR_FETCH_FAILED" } /** * Error trigger enum for error handler * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setuserspaceunhandlederrorhandler */ export declare enum RoxErrorTrigger { DYNAMIC_PROPERTIES_RULE = "DYNAMIC_PROPERTIES_RULE", CONFIGURATION_FETCHED_HANDLER = "CONFIGURATION_FETCHED_HANDLER", IMPRESSION_HANDLER = "IMPRESSION_HANDLER", CUSTOM_PROPERTY_GENERATOR = "CUSTOM_PROPERTY_GENERATOR" } /** * Override position for showOverrides UI * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_showoverrides */ export declare enum RoxOverridesPosition { TopLeft = "top left", TopRight = "top right", BottomLeft = "bottom left", BottomRight = "bottom right" } /** * Result of a configuration fetch operation * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_configurationfetchedhandler */ export interface RoxFetcherResult { fetcherStatus: RoxFetcherStatus; creationDate: Date; hasChanges: boolean; errorDetails?: string; } /** * Reporting value for impression handler * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_using_the_impressionhandler_option */ export interface RoxReporting { name: string; value: string; targeting: boolean; } /** * Context object for custom properties * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties */ export type RoxContext = Record; /** * Flag options interface * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_flag */ export interface RoxFlagOptions { freeze?: RoxFlagFreezeLevel; } /** * Setup options for Rox.setup() * Official documentation: https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setup */ export interface RoxSetupOptions { /** Application version */ version?: string; /** Debug level (e.g., 'verbose') */ debugLevel?: 'verbose'; /** Freeze level */ freeze?: RoxFlagFreezeLevel; /** Disable network fetch */ disableNetworkFetch?: boolean; /** Dev mode secret */ devModeSecret?: string; /** Proxy URL */ proxy?: string; /** Configuration preset (string or object) */ configuration?: string | Record; /** Hosting URL */ hosting?: string; /** Platform identifier */ platform?: string; /** Configuration fetched handler */ configurationFetchedHandler?: (fetcherResult: RoxFetcherResult) => void; /** Impression handler */ impressionHandler?: (reporting: RoxReporting, context?: RoxContext) => void; /** Dynamic property rule handler */ dynamicPropertyRuleHandler?: (propName: string, context: any) => any; /** Allow any additional properties to be passed to the SDK */ [key: string]: any; } declare class Rox { RoxString: typeof RoxString; RoxNumber: typeof RoxNumber; RoxFlagFreezeLevel: typeof RoxFlagFreezeLevel; RoxFetcherStatus: typeof RoxFetcherStatus; RoxErrorTrigger: typeof RoxErrorTrigger; RoxOverridesPosition: typeof RoxOverridesPosition; setContext: typeof Context.Manager.setContext; Flag: typeof Flag; overrides: typeof overrides; /** * Opens the flag override view, providing a debug UI for the application's set of feature flags. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_showoverrides */ showOverrides(position?: RoxOverridesPosition): void; /** * Initiate connection with Rox servers. Registered containers will be synced. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setup */ setup(appKey: string, options?: RoxSetupOptions): any; /** * Pulls the latest configuration and flag values. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_fetch */ fetch(): void; /** * Set a custom string property. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties */ setCustomStringProperty(key: string, value: string | ((context?: unknown) => string)): void; setCustomDateProperty(key: any, value: any): void; /** * Set a custom number property. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties */ setCustomNumberProperty(key: string, value: number | ((context?: unknown) => number)): void; /** * Set a custom boolean property. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties */ setCustomBooleanProperty(key: string, value: boolean | ((context?: unknown) => boolean)): void; setCustomSemverProperty(key: any, value: any): void; /** * Register a container of Rox entities. * Supports both with and without namespace. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_register */ register(container: RoxContainer | Record): void; register(name: string, container: RoxContainer | Record): void; /** * Unfreeze flags to return their most updated values. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-flags/flag-freeze#_flag_unfreeze */ unfreeze(namespace?: string): void; get flags(): any[]; get dynamicApi(): any; /** * Set a handler for unhandled errors. * @see https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setuserspaceunhandlederrorhandler */ setUserspaceUnhandledErrorHandler(handler: (errorTrigger: RoxErrorTrigger, error: Error) => void): void; } declare const instance: Rox; declare namespace Rox { export { RoxContainer, RoxFetcherStatus, RoxErrorTrigger, RoxOverridesPosition, RoxFetcherResult, RoxReporting, RoxContext, RoxFlagOptions, RoxSetupOptions, RoxFlagFreezeLevel, }; } export default instance; export { Rox };