@atlaskit/feature-gate-js-client
Advanced tools
Comparing version 4.15.2 to 4.16.0
# @atlaskit/feature-gate-js-client | ||
## 4.16.0 | ||
### Minor Changes | ||
- [#89773](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89773) [`654f882d8efe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/654f882d8efe) - - Add optional `fireGateExposure` option to `checkGate` in order to allow suppression of gate exposure events. | ||
- Expose `manuallyLogGateExposure` from `Statsig` class. | ||
- Expose `getOverrides` from `Statsig` class. | ||
## 4.15.2 | ||
@@ -4,0 +12,0 @@ |
@@ -278,3 +278,8 @@ "use strict"; | ||
* Returns the value for a feature gate. Returns false if there are errors. | ||
* @param gateName - The name of the feature gate. | ||
* @param {string} gateName - The name of the feature gate. | ||
* @param {Object} options | ||
* @param {boolean} options.fireGateExposure | ||
* Whether or not to fire the exposure event for the gate. Defaults to true. | ||
* To log an exposure event manually at a later time, use {@link FeatureGates.manuallyLogGateExposure} | ||
* (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
*/ | ||
@@ -284,4 +289,8 @@ }, { | ||
value: function checkGate(gateName) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
try { | ||
return _statsigJsLite.default.checkGate(gateName); | ||
var _options$fireGateExpo = options.fireGateExposure, | ||
fireGateExposure = _options$fireGateExpo === void 0 ? true : _options$fireGateExpo; | ||
var evalMethod = fireGateExposure ? _statsigJsLite.default.checkGate.bind(_statsigJsLite.default) : _statsigJsLite.default.checkGateWithExposureLoggingDisabled.bind(_statsigJsLite.default); | ||
return evalMethod(gateName); | ||
} catch (error) { | ||
@@ -303,2 +312,13 @@ // Log the first occurrence of the error | ||
/** | ||
* Manually log a gate exposure (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
* This is useful if you have evaluated a gate earlier via {@link FeatureGates.checkGate} where <code>options.fireGateExposure</code> is false. | ||
* @param gateName | ||
*/ | ||
}, { | ||
key: "manuallyLogGateExposure", | ||
value: function manuallyLogGateExposure(gateName) { | ||
_statsigJsLite.default.manuallyLogGateExposure(gateName); | ||
} | ||
/** | ||
* Returns the entire config for a given experiment. | ||
@@ -498,2 +518,11 @@ * | ||
/** | ||
* @returns The current overrides for gates, configs (including experiments) and layers. | ||
*/ | ||
}, { | ||
key: "getOverrides", | ||
value: function getOverrides() { | ||
return _statsigJsLite.default.getOverrides(); | ||
} | ||
/** | ||
* Clears overrides for all gates, configs (including experiments) and layers. | ||
@@ -500,0 +529,0 @@ */ |
@@ -7,2 +7,2 @@ "use strict"; | ||
exports.CLIENT_VERSION = void 0; | ||
var CLIENT_VERSION = exports.CLIENT_VERSION = "4.15.2"; | ||
var CLIENT_VERSION = exports.CLIENT_VERSION = "4.16.0"; |
@@ -141,7 +141,16 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
* Returns the value for a feature gate. Returns false if there are errors. | ||
* @param gateName - The name of the feature gate. | ||
* @param {string} gateName - The name of the feature gate. | ||
* @param {Object} options | ||
* @param {boolean} options.fireGateExposure | ||
* Whether or not to fire the exposure event for the gate. Defaults to true. | ||
* To log an exposure event manually at a later time, use {@link FeatureGates.manuallyLogGateExposure} | ||
* (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
*/ | ||
static checkGate(gateName) { | ||
static checkGate(gateName, options = {}) { | ||
try { | ||
return Statsig.checkGate(gateName); | ||
const { | ||
fireGateExposure = true | ||
} = options; | ||
const evalMethod = fireGateExposure ? Statsig.checkGate.bind(Statsig) : Statsig.checkGateWithExposureLoggingDisabled.bind(Statsig); | ||
return evalMethod(gateName); | ||
} catch (error) { | ||
@@ -163,2 +172,11 @@ // Log the first occurrence of the error | ||
/** | ||
* Manually log a gate exposure (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
* This is useful if you have evaluated a gate earlier via {@link FeatureGates.checkGate} where <code>options.fireGateExposure</code> is false. | ||
* @param gateName | ||
*/ | ||
static manuallyLogGateExposure(gateName) { | ||
Statsig.manuallyLogGateExposure(gateName); | ||
} | ||
/** | ||
* Returns the entire config for a given experiment. | ||
@@ -342,2 +360,9 @@ * | ||
/** | ||
* @returns The current overrides for gates, configs (including experiments) and layers. | ||
*/ | ||
static getOverrides() { | ||
return Statsig.getOverrides(); | ||
} | ||
/** | ||
* Clears overrides for all gates, configs (including experiments) and layers. | ||
@@ -344,0 +369,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
export const CLIENT_VERSION = "4.15.2"; | ||
export const CLIENT_VERSION = "4.16.0"; |
@@ -246,3 +246,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
* Returns the value for a feature gate. Returns false if there are errors. | ||
* @param gateName - The name of the feature gate. | ||
* @param {string} gateName - The name of the feature gate. | ||
* @param {Object} options | ||
* @param {boolean} options.fireGateExposure | ||
* Whether or not to fire the exposure event for the gate. Defaults to true. | ||
* To log an exposure event manually at a later time, use {@link FeatureGates.manuallyLogGateExposure} | ||
* (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
*/ | ||
@@ -252,4 +257,8 @@ }, { | ||
value: function checkGate(gateName) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
try { | ||
return Statsig.checkGate(gateName); | ||
var _options$fireGateExpo = options.fireGateExposure, | ||
fireGateExposure = _options$fireGateExpo === void 0 ? true : _options$fireGateExpo; | ||
var evalMethod = fireGateExposure ? Statsig.checkGate.bind(Statsig) : Statsig.checkGateWithExposureLoggingDisabled.bind(Statsig); | ||
return evalMethod(gateName); | ||
} catch (error) { | ||
@@ -271,2 +280,13 @@ // Log the first occurrence of the error | ||
/** | ||
* Manually log a gate exposure (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
* This is useful if you have evaluated a gate earlier via {@link FeatureGates.checkGate} where <code>options.fireGateExposure</code> is false. | ||
* @param gateName | ||
*/ | ||
}, { | ||
key: "manuallyLogGateExposure", | ||
value: function manuallyLogGateExposure(gateName) { | ||
Statsig.manuallyLogGateExposure(gateName); | ||
} | ||
/** | ||
* Returns the entire config for a given experiment. | ||
@@ -466,2 +486,11 @@ * | ||
/** | ||
* @returns The current overrides for gates, configs (including experiments) and layers. | ||
*/ | ||
}, { | ||
key: "getOverrides", | ||
value: function getOverrides() { | ||
return Statsig.getOverrides(); | ||
} | ||
/** | ||
* Clears overrides for all gates, configs (including experiments) and layers. | ||
@@ -468,0 +497,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
export var CLIENT_VERSION = "4.15.2"; | ||
export var CLIENT_VERSION = "4.16.0"; |
import { DynamicConfig, LocalOverrides } from 'statsig-js-lite'; | ||
import { FetcherOptions } from './fetcher'; | ||
import { ClientOptions, CustomAttributes, FromValuesClientOptions, GetExperimentOptions, GetExperimentValueOptions, Identifiers } from './types'; | ||
import { CheckGateOptions, ClientOptions, CustomAttributes, FromValuesClientOptions, GetExperimentOptions, GetExperimentValueOptions, Identifiers } from './types'; | ||
export type { EvaluationDetails, LocalOverrides } from 'statsig-js-lite'; | ||
@@ -66,6 +66,17 @@ export { DynamicConfig, EvaluationReason } from 'statsig-js-lite'; | ||
* Returns the value for a feature gate. Returns false if there are errors. | ||
* @param gateName - The name of the feature gate. | ||
* @param {string} gateName - The name of the feature gate. | ||
* @param {Object} options | ||
* @param {boolean} options.fireGateExposure | ||
* Whether or not to fire the exposure event for the gate. Defaults to true. | ||
* To log an exposure event manually at a later time, use {@link FeatureGates.manuallyLogGateExposure} | ||
* (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
*/ | ||
static checkGate(gateName: string): boolean; | ||
static checkGate(gateName: string, options?: CheckGateOptions): boolean; | ||
/** | ||
* Manually log a gate exposure (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
* This is useful if you have evaluated a gate earlier via {@link FeatureGates.checkGate} where <code>options.fireGateExposure</code> is false. | ||
* @param gateName | ||
*/ | ||
static manuallyLogGateExposure(gateName: string): void; | ||
/** | ||
* Returns the entire config for a given experiment. | ||
@@ -177,2 +188,6 @@ * | ||
/** | ||
* @returns The current overrides for gates, configs (including experiments) and layers. | ||
*/ | ||
static getOverrides(): LocalOverrides; | ||
/** | ||
* Clears overrides for all gates, configs (including experiments) and layers. | ||
@@ -179,0 +194,0 @@ */ |
@@ -80,2 +80,5 @@ import { StatsigOptions } from 'statsig-js-lite'; | ||
} | ||
export type CheckGateOptions = { | ||
fireGateExposure?: boolean; | ||
}; | ||
export type GetExperimentOptions = { | ||
@@ -82,0 +85,0 @@ fireExperimentExposure?: boolean; |
import { DynamicConfig, LocalOverrides } from 'statsig-js-lite'; | ||
import { FetcherOptions } from './fetcher'; | ||
import { ClientOptions, CustomAttributes, FromValuesClientOptions, GetExperimentOptions, GetExperimentValueOptions, Identifiers } from './types'; | ||
import { CheckGateOptions, ClientOptions, CustomAttributes, FromValuesClientOptions, GetExperimentOptions, GetExperimentValueOptions, Identifiers } from './types'; | ||
export type { EvaluationDetails, LocalOverrides } from 'statsig-js-lite'; | ||
@@ -66,6 +66,17 @@ export { DynamicConfig, EvaluationReason } from 'statsig-js-lite'; | ||
* Returns the value for a feature gate. Returns false if there are errors. | ||
* @param gateName - The name of the feature gate. | ||
* @param {string} gateName - The name of the feature gate. | ||
* @param {Object} options | ||
* @param {boolean} options.fireGateExposure | ||
* Whether or not to fire the exposure event for the gate. Defaults to true. | ||
* To log an exposure event manually at a later time, use {@link FeatureGates.manuallyLogGateExposure} | ||
* (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
*/ | ||
static checkGate(gateName: string): boolean; | ||
static checkGate(gateName: string, options?: CheckGateOptions): boolean; | ||
/** | ||
* Manually log a gate exposure (see [Statsig docs about manually logging exposures](https://docs.statsig.com/client/jsClientSDK#manual-exposures-)). | ||
* This is useful if you have evaluated a gate earlier via {@link FeatureGates.checkGate} where <code>options.fireGateExposure</code> is false. | ||
* @param gateName | ||
*/ | ||
static manuallyLogGateExposure(gateName: string): void; | ||
/** | ||
* Returns the entire config for a given experiment. | ||
@@ -177,2 +188,6 @@ * | ||
/** | ||
* @returns The current overrides for gates, configs (including experiments) and layers. | ||
*/ | ||
static getOverrides(): LocalOverrides; | ||
/** | ||
* Clears overrides for all gates, configs (including experiments) and layers. | ||
@@ -179,0 +194,0 @@ */ |
@@ -80,2 +80,5 @@ import { StatsigOptions } from 'statsig-js-lite'; | ||
} | ||
export type CheckGateOptions = { | ||
fireGateExposure?: boolean; | ||
}; | ||
export type GetExperimentOptions = { | ||
@@ -82,0 +85,0 @@ fireExperimentExposure?: boolean; |
{ | ||
"name": "@atlaskit/feature-gate-js-client", | ||
"version": "4.15.2", | ||
"version": "4.16.0", | ||
"description": "Atlassians wrapper for the Statsig js-lite client.", | ||
@@ -5,0 +5,0 @@ "author": "Atlassian Pty Ltd", |
@@ -518,11 +518,5 @@ # FeatureGateJsClient | ||
* How to run tests | ||
* In order to run all tests simply run `yarn test` | ||
* In order to run all tests simply run `yarn test packages/measurement/feature-gate-js-client` from the platform directory | ||
* In order to run jest tests in watch mode while doing development run `yarn test:jest --watch` | ||
* NOTE: You may need to run `yarn build` to create a version.ts file thats required for some tests | ||
* Deployment instructions | ||
* run `yarn build` | ||
* this should create a dist directory | ||
* there are two tsconfig files, one for the dev loop and some additional settings for the final dist build | ||
* run `yarn publish` | ||
* the "new version" in the CLI is the version that will be published | ||
* NOTE: You may need to run `yarn build @atlaskit/feature-gate-js-client` to create a version.ts file thats required for some tests | ||
@@ -540,16 +534,6 @@ ### Contribution guidelines | ||
Before you release please ensure that the appropriate `CHANGELOG.md` entry is in place for your changes. | ||
If your change is `minor` or `major` change in terms of semantic versioning then you will need to manually update the version number in the package.json. | ||
This package is part of the AFP monorepo. Create a changeset using `yarn changeset` and commit. [Documentation](https://hello.atlassian.net/wiki/spaces/AF/pages/2630205905/Releasing+Packages) | ||
In order to release a new version of this package you will need to use [Bitbucket Pipelines](https://bitbucket.org/atlassian/feature-gate-clients/pipelines). | ||
Once your change has been deployed to the `main` branch, you can run the `release-js-client` custom pipeline to deploy it to Artifactory. | ||
Hit "Run pipeline", and select the following: | ||
* `Branch`: main | ||
* `Pipeline`: custom: release-js-client | ||
After a release the version will automatically be incremented by one patch version on the main branch. | ||
### Who do I talk to? | ||
This repo is owned by the experimentation platform team, | ||
reach out to !disturbed in [#help-switcheroo-statsig](https://atlassian.enterprise.slack.com/archives/C04PR2YE4UC) if you need a hand. |
4057
221352
44
538