configcat-react
Version:
ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.
35 lines (34 loc) • 2.21 kB
JavaScript
"use client";
import withConfigCatClient from "./ConfigCatHOC";
import { useConfigCatClient, useFeatureFlag } from "./ConfigCatHooks";
import ConfigCatProvider from "./ConfigCatProvider";
import { QueryParamsOverrideDataSource, flagOverridesConstructor } from "./FlagOverrides";
export { createConsoleLogger, createFlagOverridesFromMap } from "configcat-common";
/**
* Creates an instance of `FlagOverrides` that uses query string parameters as data source.
* @param behaviour The override behaviour.
* Specifies whether the local values should override the remote values
* or local values should only be used when a remote value doesn't exist
* or the local values should be used only.
* @param watchChanges If set to `true`, the query string will be tracked for changes.
* @param paramPrefix The parameter name prefix used to indicate which query string parameters
* specify feature flag override values. Parameters whose name doesn't start with the
* prefix will be ignored. Defaults to `cc-`.
* @param queryStringProvider The provider object used to obtain the query string.
* Defaults to a provider that returns the value of `window.location.search`.
*/
export function createFlagOverridesFromQueryParams(behaviour, watchChanges, paramPrefix, queryStringProvider) {
return new flagOverridesConstructor(new QueryParamsOverrideDataSource(watchChanges, paramPrefix, queryStringProvider), behaviour);
}
export { ConfigCatProvider, useFeatureFlag, useConfigCatClient, withConfigCatClient };
/* Public types re-export from common-js */
// These exports should be kept in sync with the exports listed in the section "Public types for end users" of common-js/src/index.ts!
export { PollingMode } from "configcat-common";
export { DataGovernance } from "configcat-common";
export { LogLevel } from "configcat-common";
export { FormattableLogMessage } from "configcat-common";
export { SettingType, UserComparator, PrerequisiteFlagComparator, SegmentComparator } from "configcat-common";
export { SettingKeyValue } from "configcat-common";
export { User } from "configcat-common";
export { OverrideBehaviour } from "configcat-common";
export { ClientCacheState, RefreshResult } from "configcat-common";