Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
027d28a
Updated License Year
github-actions[bot] Jan 1, 2023
840dd2a
Bump webpack from 5.74.0 to 5.76.0
dependabot[bot] Mar 15, 2023
268ddbc
update some linter rules for code styling
EmilianoSanchez Mar 15, 2023
bd61aac
Merge branch 'development' into update-license
EmilianoSanchez Mar 15, 2023
9bb4181
Merge pull request #738 from splitio/dependabot/npm_and_yarn/webpack-…
EmilianoSanchez Mar 15, 2023
ca37b1a
Merge branch 'development' into update-license
EmilianoSanchez Mar 15, 2023
5808696
Merge pull request #730 from splitio/update-license
EmilianoSanchez Mar 15, 2023
05ad048
capitalizes the s in both JavaScript docs links
Mar 17, 2023
cc58a69
code styling
EmilianoSanchez Mar 17, 2023
9a8a094
Merge branch 'development' into linter_update
EmilianoSanchez Mar 17, 2023
f97ab28
capitalize the s in Javascript ocurrences
EmilianoSanchez Mar 17, 2023
b707dd0
Merge pull request #740 from chrisdemars/demars/changes-spelling-of-j…
Mar 17, 2023
a50a49f
Merge branch 'development' into linter_update
EmilianoSanchez Mar 17, 2023
3004025
Merge remote-tracking branch 'origin/linter_update' into linter_update
EmilianoSanchez Mar 17, 2023
ad910ea
Merge pull request #739 from splitio/linter_update
EmilianoSanchez Mar 17, 2023
83c8e60
ready promise test polishing
EmilianoSanchez Mar 31, 2023
f4d64ea
Bump engine.io and socket.io
dependabot[bot] May 4, 2023
fd5a200
Merge pull request #744 from splitio/dependabot/npm_and_yarn/engine.i…
EmilianoSanchez May 4, 2023
7b724e9
replace 'split', 'api key' and 'web console' terms
EmilianoSanchez May 10, 2023
d4c5fb5
update log messages
EmilianoSanchez May 10, 2023
0c1e3dd
update log message prefix
EmilianoSanchez May 10, 2023
9cfbc43
fix test
EmilianoSanchez May 11, 2023
5353a66
Merge branch 'development' into tests_polishing
EmilianoSanchez May 11, 2023
413fff5
Merge pull request #741 from splitio/tests_polishing
EmilianoSanchez May 11, 2023
aaf2ae9
Merge branch 'development' into dw_replace_terms
EmilianoSanchez May 11, 2023
fd0b5cf
add changelog entry
EmilianoSanchez May 12, 2023
bf79f79
Merge pull request #745 from splitio/dw_replace_terms
EmilianoSanchez May 12, 2023
0310476
prepare stable release
EmilianoSanchez May 15, 2023
b7b9b2d
Merge branch 'development' into dw_replace_terms
EmilianoSanchez May 15, 2023
6cb61de
update version
EmilianoSanchez May 15, 2023
1cc49d1
Merge pull request #746 from splitio/dw_replace_terms
EmilianoSanchez May 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@
},

"rules": {
"indent": [2, 2, {"SwitchCase": 1}],
"quotes": [1, "single", "avoid-escape"],
"linebreak-style": [2, "unix"],
"semi": [2, "always"],
"no-underscore-dangle": 0,
"eqeqeq": [2, "smart"],
"no-unused-expressions": 0,
"new-cap" : 0,
"no-mixed-requires": 0,
"camelcase": [2, {"properties": "never"}],
"no-use-before-define": [2, "nofunc"],
"no-trailing-spaces": "error"
"indent": ["error", 2, {"SwitchCase": 1}],
"quotes": ["warn", "single", "avoid-escape"],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"no-underscore-dangle": "off",
"eqeqeq": ["error", "smart"],
"no-unused-expressions": "off",
"new-cap" : "off",
"no-mixed-requires": "off",
"camelcase": ["error", {"properties": "never"}],
"no-use-before-define": ["error", "nofunc"],
"eol-last": ["error", "always"],
"keyword-spacing": "error",
"comma-style": "error",
"no-trailing-spaces": "error",
"space-before-function-paren": ["error", {"named": "never"}]
},

"parserOptions": {
Expand All @@ -38,7 +42,6 @@
"files": ["src/**/*.js"],
"excludedFiles": ["src/**/__tests__/**"],
"extends": [
"eslint:recommended",
"plugin:compat/recommended"
],
"rules": {
Expand Down
44 changes: 25 additions & 19 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
10.22.5 (May 15, 2023)
- Updated @splitsoftware/splitio-commons package to version 1.8.2 that includes minor improvements.
- Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and IntelliSense comments.
- Updated split storage modules to optimize some operations when using Redis and pluggable storages.
- Updated some transitive dependencies for vulnerability fixes.

10.22.4 (March 9, 2023)
- Updated @splitsoftware/splitio-commons package to version 1.8.1 that includes minor improvements.
- Updated some transitive dependencies for vulnerability fixes.
Expand All @@ -15,7 +21,7 @@
10.22.0 (October 5, 2022)
- Added a new impressions mode for the SDK called NONE, to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
- Updated default value of `scheduler.featuresRefreshRate` config parameter from 5 seconds to 60 seconds for NodeJS and from 30 seconds to 60 seconds for Browser.
- Updated @splitsoftware/splitio-commons package to version 1.7.1, that improves the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements.
- Updated @splitsoftware/splitio-commons package to version 1.7.1, that improves the performance of feature flag evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements.

10.21.1 (July 25, 2022)
- Bugfixing - Added missed type definitions `enabled` from `sync`.
Expand Down Expand Up @@ -84,7 +90,7 @@
- Bugfixing - Fixed an issue returning dynamic configs when the treatment name contains a dot (".").

10.16.1 (October 25, 2021)
- Updated some internal modules to optimize the time efficiency of split evaluations (i.e., `getTreatment(s)` method calls).
- Updated some internal modules to optimize the time efficiency of feature flag evaluations (i.e., `getTreatment(s)` method calls).
- Updated some dependencies for vulnerability fixes (ioredis, @babel/cli, eslint, eslint-plugin-compat).
- Bugfixing - Fixed localhost mode with localStorage, to use a mock in memory instead of localStorage API directly but keep emitting emit SDK_READY_FROM_CACHE event.

Expand Down Expand Up @@ -171,8 +177,8 @@
- Bugfixing - Replaced the use of `for...in` statements since it iterates over enumerable properties on the prototype chain, which might be polluted by code external to the library.

10.14.0 (Jul 31, 2020)
- Added `sync.splitFilters` property to SDK configuration to pass a list of filters for the splits that will be downloaded. Read more in our docs.
- Added expiration policy to split cache for browsers using localStorage: cache is cleared after 10 days of the last successful update.
- Added `sync.splitFilters` property to SDK configuration to pass a list of filters for the feature flags that will be downloaded. Read more in our docs.
- Added expiration policy to SDK cache for browsers using localStorage: cache is cleared after 10 days of the last successful update.
- Updated babel configuration to remove core-js dependency and refactored code in favor of size reduction of UMD, ESM and CommonJS builds.
- NOTE: removed some polyfills of global objects not available in some builds of IE10.

Expand Down Expand Up @@ -205,7 +211,7 @@
- Bugfixing - Emit SDK_UPDATE in localhost only when mock was actually updated.

10.10.0 (Jan 10, 2020)
- Added SDK_READY_FROM_CACHE event, which will be emitted in LocalStorage mode when the SDK finds split cache in the storage of the browser.
- Added SDK_READY_FROM_CACHE event, which will be emitted in LocalStorage mode when the SDK finds feature flag definitions in the storage of the browser.
- Updated a dependency to fix a vulnerability (serialize-javascript).
- Updated multiple dependencies and dev dependencies (@types/node, axios, core-js, events, sinon, tape and the babel cli, core, preset-env, register and plugin-transform-runtime)

Expand All @@ -220,14 +226,14 @@
10.9.0 (Oct 24, 2019)
- Added listener for 'unload' DOM events to push remaining impressions and events when the browser page is closed or reloaded.
- Added setting core.IPAddressesEnabled to disable reporting IP Addresses and Machine name back to Split cloud.
- Updated Redis storage to fetch multiple splits at once for getTreatments/getTreatmentsWithConfig.
- Updated Redis storage to fetch multiple feature flags at once for getTreatments/getTreatmentsWithConfig.
- Updated most dependencies to their latest versions. Biggest change is babel (from 6 to 7), Webpack 3 to 4, Karma and ioredis.

10.8.4 (Sep 24, 2019)
- Added module "events" as optional dependency.
- Removed dependency on "util" module.
- Updated transport module to use a local axios instance instead of the global one, to avoid polluting the shared one.
- Updated input validation log when trying to get data of a non-existent split to have level WARN instead of ERROR.
- Updated input validation log when trying to get data of a non-existent feature flag to have level WARN instead of ERROR.

10.8.3 (Sep 16, 2019)
- Updated two default values on startup configuration for Browsers:
Expand Down Expand Up @@ -350,7 +356,7 @@
- Updated SDK labels.
- Bugfixing - Shared clients (browser) were ready even if the main client was not.
- Bugfixing - Shared clients (browser) from different SDK instances should be separate.
- Bugfixing - When using API key with wrong permissions, Node was throwing a false ready event (without segments).
- Bugfixing - When using SDK key with wrong permissions, Node was throwing a false ready event (without segments).
- Bugfixing - Localhost mode was trying to flush impressions when client.destroy was invoked.

9.3.7 (Dec 22, 2017)
Expand Down Expand Up @@ -407,7 +413,7 @@

var settings = {
core: {
authorizationKey: 'YOUR_API_KEY',
authorizationKey: 'YOUR_SDK_KEY',
key: 'CUSTOMER_KEY' // If on the browser.
},
debug: true // Boolean flag for enabling logs. Default value is false.
Expand All @@ -423,7 +429,7 @@

var sdk = splitio({
core: {
authorizationKey: 'YOUR_API_KEY',
authorizationKey: 'YOUR_SDK_KEY',
key: 'CUSTOMER_KEY' // If on the browser.
}
});
Expand Down Expand Up @@ -460,13 +466,13 @@
- Adding getTreatments method to client API. For example:

```js
var treatmentsMap = client.getTreatments('CUSTOMER_KEY', ['Split_1', 'Split_2']);
var treatmentsMap = client.getTreatments('CUSTOMER_KEY', ['Feature_flag_1', 'Feature_flag_2']);

/*
* treatmentsMap will be an object mapping splits with treatments. For example:
* treatmentsMap will be an object mapping feature flags with treatments. For example:
* {
* Split_1: 'on',
* Split_2: 'off
* Feature_flag_1: 'on',
* Feature_flag_2: 'off
* }
*/
```
Expand Down Expand Up @@ -633,7 +639,7 @@ var treatmentsMap = client.getTreatments('CUSTOMER_KEY', ['Split_1', 'Split_2'])

6.0.0 (June 24, 2016)
- In the browser land we allow quick retries before start using the refresh
rates defined for segments and splits, plus the possibility of receive an
rates defined for segments and feature flags, plus the possibility of receive an
event when the SDK is taking to much time to startup.

```html
Expand Down Expand Up @@ -698,8 +704,8 @@ var treatmentsMap = client.getTreatments('CUSTOMER_KEY', ['Split_1', 'Split_2'])
});

// usage
var t1 = dynamic1.getTreatment('split-name');
var t2 = dynamic2.getTreatment('another-split-name');
var t1 = dynamic1.getTreatment('feature-flag-name');
var t2 = dynamic2.getTreatment('another-feature-flag-name');

// stop SDK
dynamic1.destroy();
Expand Down Expand Up @@ -776,7 +782,7 @@ var treatmentsMap = client.getTreatments('CUSTOMER_KEY', ['Split_1', 'Split_2'])
```js
var sdk = splitio({
core: {
authorizationKey: 'c1l5vkd50gimccout3c03pntbu', // your API key
authorizationKey: 'c1l5vkd50gimccout3c03pntbu', // your SDK key
key: '4a2c4490-ced1-11e5-9b97-d8a25e8b1578' // your customer id
}
});
Expand Down Expand Up @@ -805,7 +811,7 @@ seconds:
```js
var sdk = splitio({
core: {
authorizationKey: 'c1l5vkd50gimccout3c03pntbu', // your API key
authorizationKey: 'c1l5vkd50gimccout3c03pntbu', // your SDK key
key: '4a2c4490-ced1-11e5-9b97-d8a25e8b1578' // your customer id
},
scheduler: {
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Split SDK for Javascript
# Split SDK for JavaScript

[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://github.com/splitio/javascript-client/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/splitio/javascript-client/actions/workflows/ci-cd.yml) [![Greenkeeper badge](https://badges.greenkeeper.io/splitio/javascript-client.svg)](https://greenkeeper.io/)

## Overview
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.

[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)

Expand All @@ -23,7 +23,7 @@ var SplitFactory = require('@splitsoftware/splitio').SplitFactory;
// Instantiate the SDK
var factory = SplitFactory({
core: {
authorizationKey: 'YOUR_SDK_API_KEY'
authorizationKey: 'YOUR_SDK_KEY'
}
});

Expand All @@ -32,7 +32,7 @@ var client = factory.client();

// Set a callback to listen for the SDK_READY event, to make sure the SDK is properly loaded before asking for a treatment
client.on(client.Event.SDK_READY, function() {
var treatment = client.getTreatment('CUSTOMER_ID', 'SPLIT_NAME');
var treatment = client.getTreatment('CUSTOMER_ID', 'FEATURE_FLAG_NAME');
if (treatment == 'on') {
// insert code here for on treatment
} else if (treatment == 'off') {
Expand Down Expand Up @@ -67,8 +67,8 @@ Split has built and maintains SDKs for:
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
Expand Down
Loading