Feature gate js client
Atlassians wrapper for the Statsig js-lite client.
yarn add @atlaskit/feature-gate-js-client
4.26.4
Patch Changes
- #120085
2175282f6acb9
- Make check for window more robust and prevent issues in Node.
Atlassians wrapper for the Statsig js-lite client.
yarn add @atlaskit/feature-gate-js-client
2175282f6acb9
-
Make check for window more robust and prevent issues in Node.2175282f6acb9
-
Make check for window more robust and prevent issues in Node.132c887d3d1a0
-
Enabling localMode
will now also disable exposure logging and storage capabilities. This brings
it inline with version 4.23.x and below (and was an unintentional change in 4.24.0). This prevents
warnings like [Statsig] Failed to flush events
from being logged when run in local mode.497f8f10f6716
-
Fixed an issue where local overrides would be multiplied when saved and read from local storage0390682da69b2
- -
Added ability to control the local storage key where overrides are saved per Client
4.23.3
and this versionaf35867237785
-
Fixed gates evaluating with reason "stable ID mismatch".12526bf66663f
-
Produces two prebuilt files under /dist feature-gate-js-client.with-deps.amd.js and
feature-gate-js-client.with-deps.amd.min.jsf317911486c79
-
The client now reads STATSIG_JS_LITE_LOCAL_OVERRIDES (the old local storage key) when initialising
itself, for better compatibility with code that's relying on deprecated and obsolete private
Statsig APIs#111947
d9e24de5d5abe
-
Upgrades from the old deprecated statsig-js-lite library to the newer and more performant
@statsig/js-client library while keeping the API identical to avoid a breaking change.
Also exposes the client under @atlaskit/feature-gate-js-client/client so that consumers which need to (like Marketplace) can create their own client instance separate to the static client used by products.
851e510c3036c
-
Refactored internals to prepare for non-static client usage.bcb59292573a3
-
Set a sensible default for perimeter
based on the hostname, rather than always defaulting to
commercial476c1b4e48adb
-
Bugfixes - subscriptions method support when update user without using a provider, and fix to
update user with provider when update fails0935b95608ca3
-
Add support for providers to initialize and update users69b1ce7f8cfc5
-
Introduce productIntegrationsVendorId
, bitbucketConnectAppId
and bitbucketRepositoryId
identifier typesf5b17f8223772
-
[ux] Add getLayer, getLayerValue and manuallyLogLayerExposure method to the FeatureGates class52eed0e32c8b
-
Refactored some code to support lower ECMAScript versions11fe9dfc5d0a
-
Make the check for an existing FeatureGate client on the window safer. Only log warn when there is
a version mismatch found between the existing FeatureGate client and the current one.654f882d8efe
- -
Add optional fireGateExposure
option to checkGate
in order to allow suppression of gate
exposure events.
manuallyLogGateExposure
from Statsig
class.getOverrides
from Statsig
class.2a138baa0014
-
Updated the request timeout and ensure doc-comments match reality74d711290a14
-
Ensure the DynamicConfig
class is exported, so that new instances can be created for testing.activationId
identifier type.f01ea03ca266
-
Added optional perimeter
initialization option to allow customization of the base url for the
feature-flag-service
based on environment and perimeter type; this parameter enables use of this
client in FedRAMP envrionments.c15908464f29
-
Migrated @atlassian/feature-gate-js-client to @atlaskit/feature-gate-js-clientmsTeamsTenantId
identifier type.@atlassian/feature-gate-js-client
to work together via global
variable. If multiple copies of @atlassian/feature-gate-js-client
prior to v4.11.0 exist in your
frontend bundles, race conditions may cause strange behaviour in evaluations.gsacIssueId
identifier type.intercomConversationId
identifier type.marketplacePartnerId
identifier type.randomizationId
identifier type. A fallback identifier when there are no other
applicable identifiers. This cannot be used with metrics.initialize
and initializeFromValues
functions. If
passed in, this will enable the collection of monitoring events which can be used to debug any
issues with client initialization.CustomAttributes
.undefined
values for the fireExperimentExposure
options to be treat as
false
instead of the default value true
.setOverrides
to accept a Partial<LocalOverrides>
instead of LocalOverrides
. The
client will now provide its own defaults for any missing fields.checkGate
, where false
will be returned if there are errors.There is a new default value for the eventLoggingApi
initialization parameter:
https://xp.atlassian.com/v1/
. This will prevent exposure event loss due to ad blockers blocking
Statsig's default event logging API.
Please see this blog and the "Exposure Event Logging" section of the README for more information.
marketplaceAnonymousId
identifier typetrelloWorkspaceId
identifier typefilterTags
from clientOptions
. filterTags
will no longer be an accepted parameter to
pass to the client when initializing.customAttributes
from feature-flag-service
response when creating or update
Statsig.User
. This will support TAP traits for User Dimensions.window is not defined
error that occurs when the module is loaded in a server environmentisCurrentUser
method, which can be used to check whether the currently configured
user aligns with a given set of values.initializeCompleted
method, which can be used to check whether the
initialize
/initializeFromValues
Promises have been resolved yet.window.__FEATUREGATES_JS__
global variable to allow
this package to be imported in server-side rendering environments, which don't contain a global
variable for window
.getExperimentCohort
methodgetExperimentWithExposureLoggingDisabled
methodtargetApp
is now a mandatory initialization parameter, and replaces the products
parameter.
Please see the v3.5.0 release notes for more information on how to set this up.getExperimentValue
APIgetExperimentCohort
has been deprecated in favour of a new getExperimentValue
API, which can be
used to access any named parameter. Existing calls to getExperimentCohort
can be migrated using
the following replacement:
Before:
FeatureGates.getExperimentCohort('example-experiment', 'default-value');
After:
FeatureGates.getExperimentValue(
'example-experiment',
'cohort', // <-- use this exact string
'default-value',
);
Please see this blog and the "Evaluation" section of the README for more information.
targetApp
initialization parameter<ins>Use of this parameter requires additional configuration within Statsig and
feature-flag-service
!</ins>
The targetApp
initialization parameter will allow your client to pull only the experiments and
gates that are relevant for your product. The client will only fetch gates and experiments that
either:
targetApp
in their selected list of Target ApplicationsBefore setting this parameter, you will need to add the Target Application configuration to all of your existing gates and experiments.
Please see this blog for more information on how to set this up.
New overrideExperiment
, overrideGate
and setOverrides
methods have been added that allow you
to override values locally.
Please note that these overrides are persisted to localStorage, so they will affect all subsequent
page views. You will need to call the clearExperimentOverride
, clearGateOverride
or
clearAllOverrides
methods to de-activate an override.
These were mostly introduced for E2E testing, allowing you to set up test suites for different combinations of gate and experiment values. Please see the Testing section of the README for some example usage.
window.__FEATUREGATES_JS__
as a way to get a reference to the FeatureGates client at
runtime. This is important for mocking gate and experiment values in E2E testing frameworks like
Cyprus, as it allows them to get a reference to the instance that was created for each generated
window.analyticsAnonymousId
, transactionAccountId
and trelloUserId
identifier typesupdateUser
and updateUserWithValues
methods which can be used to re-initialize the client
for a different user.sdkKey
for FeatureGates.initializeFromValues
is now optional. A default client key is used if
one is not provided. This should only be used in the case where a sdkKey is not available as this
means events are not sent back to StatsigfetchTimeoutMs
to clientOptions for FeatureGates.initialize
to set the timeout for
requests to feature-flag-service. Default being 2000ms.initialize
and initializeWithValues
:
initializeCalled
will now return true
immediately after a call to initialize
or
initializeWithValues
as expectedisLocalMode
initialization option has been renamed to localMode
fromValuesClientOptions
type has been renamed to FromValuesClientOptions
2.0.0
- 2.0.1
FeatureGate.initialize
with
the previous method moved to FeatureGate.initializeFromValues
FeatureGate.initializeFromValues
method signatureactivationId
(no longer supported), and userId
(replaced by atlassianAccountId
)