Skip to content

Commit adc2b53

Browse files
Merge pull request #120 from splitio/development
Release v0.14.1
2 parents 09afbbe + e11aa7e commit adc2b53

File tree

7 files changed

+62
-41
lines changed

7 files changed

+62
-41
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.14.1 (June 14, 2024)
2+
- Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
3+
- Bugfixing - Restored some input validation error logs that were removed in version 0.12.0. The logs inform the user when the `getTreatment(s)` methods are called with an invalid value as feature flag name or flag set name.
4+
- Bugfixing - Fixed localhost mode to emit SDK_UPDATE when mocked feature flags are updated in the `features` object map of the config object (Related to issue https://github.com/splitio/javascript-browser-client/issues/119).
5+
16
0.14.0 (May 6, 2024)
27
- Updated @splitsoftware/splitio-commons package to version 1.14.0 that includes minor updates:
38
- Added support for targeting rules based on semantic versions (https://semver.org/).
@@ -77,7 +82,7 @@
7782
- Updated some dependencies for vulnerability fixes.
7883

7984
0.7.0 (June 29, 2022)
80-
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config sync.enabled . Running online, Split will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
85+
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config `sync.enabled`. Running online, Split will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
8186
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
8287
- Updated submitters logic, to avoid duplicating the post of impressions to Split cloud when the SDK is destroyed while its periodic post of impressions is running.
8388
- Bugfixing - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending.

package-lock.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-browserjs",
3-
"version": "0.14.0",
3+
"version": "0.14.1",
44
"description": "Split SDK for JavaScript on Browser",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",
@@ -64,7 +64,7 @@
6464
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
6565
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
6666
"dependencies": {
67-
"@splitsoftware/splitio-commons": "1.14.0",
67+
"@splitsoftware/splitio-commons": "1.16.0",
6868
"@types/google.analytics": "0.0.40",
6969
"tslib": "^2.3.1",
7070
"unfetch": "^4.2.0"

src/__tests__/browserSuites/ready-from-cache.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ export default function (fetchMock, assert) {
582582
fetchMock.getOnce(testUrls.sdk + '/splitChanges?s=1.1&since=25&names=p2__split&prefixes=p1', { status: 200, body: { splits: [splitDeclarations.p1__split, splitDeclarations.p2__split], since: 25, till: 1457552620999 } }, { delay: 10 }); // short delay to let emit SDK_READY_FROM_CACHE
583583
fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } });
584584

585-
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } });
585+
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } });
586586
localStorage.setItem('some_user_item', 'user_item');
587587
localStorage.setItem('readyFromCache_6.SPLITIO.splits.till', 25);
588588
localStorage.setItem('readyFromCache_6.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
@@ -633,7 +633,7 @@ export default function (fetchMock, assert) {
633633
fetchMock.getOnce(testUrls.sdk + '/splitChanges?s=1.1&since=-1&prefixes=p1,p2', { status: 200, body: { splits: [splitDeclarations.p1__split, splitDeclarations.p2__split], since: -1, till: 1457552620999 } }, { delay: 10 }); // short delay to let emit SDK_READY_FROM_CACHE
634634
fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } });
635635

636-
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' } } });
636+
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' }, flagSpecVersion: '1.1' } });
637637
localStorage.setItem('some_user_item', 'user_item');
638638
localStorage.setItem('readyFromCache_7.SPLITIO.splits.till', 25);
639639
localStorage.setItem('readyFromCache_7.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
@@ -755,7 +755,7 @@ export default function (fetchMock, assert) {
755755
localStorage.setItem('readyFromCache_9.SPLITIO.splits.till', 25);
756756
localStorage.setItem('readyFromCache_9.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
757757
localStorage.setItem('readyFromCache_9.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split));
758-
localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } }));
758+
localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } }));
759759

760760
const splitio = SplitFactory({
761761
...baseConfig,
@@ -784,7 +784,7 @@ export default function (fetchMock, assert) {
784784
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits');
785785
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached');
786786
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'feature flag declarations must be cached');
787-
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.hash'), getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2' } } }), 'Storage hash must correspond to the split filter query and SDK key');
787+
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.hash'), getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2' }, flagSpecVersion: '1.1' } }), 'Storage hash must correspond to the split filter query and SDK key');
788788
t.end();
789789
});
790790
});

src/__tests__/errorCatching/browser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const settings = settingsFactory({
2121
// prepare localstorage to emit SDK_READY_FROM_CACHE
2222
localStorage.clear();
2323
localStorage.setItem('SPLITIO.splits.till', 25);
24-
localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null } } }));
24+
localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null }, flagSpecVersion: '1.1' } }));
2525

2626
fetchMock.get(url(settings, '/splitChanges?s=1.1&since=25'), function () {
2727
return new Promise((res) => { setTimeout(() => res({ status: 200, body: splitChangesMock1 }), 1000); });

src/__tests__/offline/browser.spec.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,13 @@ tape('Browser offline mode', function (assert) {
9292
SplitFactory({ ...config, storage: InLocalStorage() }),
9393
SplitFactorySlim({ ...config, storage: InLocalStorage(), sync: { localhostMode: LocalhostFromObject() } }) // slim factory requires localhostFromObject module
9494
];
95-
const factoriesReady = [ // Multiple factories must handle their own `features` mock, even if instantiated with the same config.
96-
SplitFactory(config),
97-
SplitFactory({ ...config }),
98-
SplitFactory({ ...config, features: { ...config.features }, storage: InLocalStorage /* invalid */, sync: { localhostMode: LocalhostFromObject /* invalid */ } }),
95+
const configs = [
96+
{ ...config, features: { ...config.features }, storage: InLocalStorage /* invalid */, sync: { localhostMode: LocalhostFromObject /* invalid */ } },
97+
{ ...config },
98+
config,
99+
];
100+
const factoriesReady = [
101+
...configs.map(config => SplitFactory(config)),
99102
...factoriesReadyFromCache
100103
];
101104
const factoriesTimeout = [ // slim factory without a valid localhostFromObject module will timeout
@@ -115,7 +118,7 @@ tape('Browser offline mode', function (assert) {
115118
readyCount++;
116119
});
117120
client.on(client.Event.SDK_UPDATE, () => {
118-
assert.deepEqual(manager.names(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
121+
assert.deepEqual(manager.names().sort(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
119122
assert.equal(client.getTreatment('testing_split_with_config'), 'nope');
120123
updateCount++;
121124
});
@@ -225,7 +228,7 @@ tape('Browser offline mode', function (assert) {
225228
});
226229

227230
setTimeout(() => {
228-
// Update the features
231+
// Update features reference in settings
229232
factory.settings.features = {
230233
testing_split: 'on',
231234
testing_split_2: 'off',
@@ -235,10 +238,23 @@ tape('Browser offline mode', function (assert) {
235238
config: null
236239
}
237240
};
238-
// Update the features in all factories except one
239-
for (let i = 1; i < factories.length; i++) {
240-
factories[i].settings.features = factory.settings.features;
241+
242+
// Update features properties in config
243+
configs[0].features['testing_split'] = 'on';
244+
configs[0].features['testing_split_2'] = 'off';
245+
configs[0].features['testing_split_3'] = 'custom_treatment';
246+
configs[0].features['testing_split_with_config'] = {
247+
treatment: 'nope',
248+
config: null
249+
};
250+
251+
// Update the features in all remaining factories except the last one
252+
for (let i = 1; i < factoriesReady.length - 1; i++) {
253+
factoriesReady[i].settings.features = factory.settings.features;
241254
}
255+
256+
// Assigning a new object to the features property in the config object doesn't trigger an update
257+
configs[configs.length - 1].features = { ...factory.settings.features };
242258
}, 1000);
243259

244260
setTimeout(() => { factory.settings.features = originalFeaturesMap; }, 200);

src/settings/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
22
import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
33
import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';
44

5-
const packageVersion = '0.14.0';
5+
const packageVersion = '0.14.1';
66

77
/**
88
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.

0 commit comments

Comments
 (0)