Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"keyword-spacing": "error",
"comma-style": "error"
"comma-style": "error",
"no-trailing-spaces": "error"
},

"overrides": [
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.9.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 @splitsoftware/splitio-commons package to version 1.7.0, that improves the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements.

0.8.0 (July 22, 2022)
- Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
- Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
Expand Down
15 changes: 15 additions & 0 deletions karma/config.debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const merge = require('lodash/merge');

module.exports = merge({}, require('./config'), {
browsers: [
'Chrome'
],
rollupPreprocessor: {
output: {
sourcemap: 'inline',
},
},
singleRun: false
});
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-browserjs",
"version": "0.8.0",
"version": "0.9.0",
"description": "Split SDK for Javascript on Browser",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -42,6 +42,7 @@
"pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
"test-ts-decls": "./scripts/ts-tests.sh",
"posttest-ts-decls": "npm unlink && npm install",
"all": "npm run check && npm run build && npm run test-ts-decls && npm run test",
"publish:rc": "npm run check && npm run build && npm publish --tag rc",
"publish:stable": "npm run check && npm run build && npm publish"
},
Expand All @@ -63,7 +64,7 @@
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.6.1",
"@splitsoftware/splitio-commons": "1.7.0",
"@types/google.analytics": "0.0.40"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/impressions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function (fetchMock, assert) {
fetchMock.postOnce(url(settings, '/testImpressions/count'), (url, opts) => {
const data = JSON.parse(opts.body);

assert.equal(data.pf.length, 2, 'We should generated 2 impressions count.');
assert.equal(data.pf.length, 1, 'We should generate impressions count for one feature.');

// finding these validate the feature names collection too
const dependencyChildImpr = data.pf.filter(e => e.f === 'hierarchical_splits_test')[0];
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/ready-from-cache.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ export default function (fetchMock, assert) {
localStorage.setItem('readyFromCache_8.SPLITIO.splits.till', 25);
localStorage.setItem('readyFromCache_8.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
localStorage.setItem('readyFromCache_8.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split));
localStorage.setItem('readyFromCache_8.SPLITIO.split.deleted__split', 'deleted_split');
localStorage.setItem('readyFromCache_8.SPLITIO.split.deleted__split', '{ "name": "deleted_split" }');
localStorage.setItem('readyFromCache_8.SPLITIO.splits.filterQuery', '&names=p2__split&prefixes=p1');

const splitio = SplitFactory({
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/ready-promise.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ export default function readyPromiseAssertions(fetchMock, assert) {
t.end();
});
});
}, 0);
}, 10);
});
}, fromSecondsToMillis(0.2));

Expand Down
6 changes: 4 additions & 2 deletions src/__tests__/browserSuites/telemetry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ export default async function telemetryBrowserSuite(fetchMock, assert) {
assert.equal(getLatencyCount(data.mL.tr), 1, 'One latency metric for track');
delete data.hL; delete data.mL;

// @TODO check if iDe value is correct
assert.deepEqual(data, {
mE: {}, hE: { sp: { 500: 1 }, ms: { 500: 1 } }, tR: 0, aR: 0, iQ: 4, iDe: 3, iDr: 0, spC: 31, seC: 1, skC: 1, eQ: 1, eD: 0, sE: [], t: []
mE: {}, hE: { sp: { 500: 1 }, ms: { 500: 1 } }, tR: 0, aR: 0, iQ: 4, iDe: 1, iDr: 0, spC: 31, seC: 1, skC: 1, eQ: 1, eD: 0, sE: [], t: []
}, 'metrics/usage JSON payload should be the expected');

finish.next();
Expand All @@ -87,9 +88,10 @@ export default async function telemetryBrowserSuite(fetchMock, assert) {
assert.true(data.sL > 0, 'sessionLengthMs must be defined');
delete data.sL;

// @TODO check if iDe value is correct
assert.deepEqual(data, {
mL: {}, mE: {}, hE: {}, hL: {}, // errors and latencies were popped
tR: 0, aR: 0, iQ: 4, iDe: 3, iDr: 0, spC: 31, seC: 1, skC: 1, eQ: 1, eD: 0, sE: [], t: []
tR: 0, aR: 0, iQ: 4, iDe: 1, iDr: 0, spC: 31, seC: 1, skC: 1, eQ: 1, eD: 0, sE: [], t: []
}, '2nd metrics/usage JSON payload should be the expected');
return 200;
});
Expand Down
6 changes: 4 additions & 2 deletions src/__tests__/browserSuites/use-beacon-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ function beaconApiSendTest(fetchMock, assert) {
const splitio = SplitFactory(config);
const client = splitio.client();
client.on(client.Event.SDK_READY, () => {
client.getTreatment('hierarchical_splits_test');
client.getTreatment('hierarchical_splits_test'); // first impression counted in backend
client.getTreatment('hierarchical_splits_test'); // impression counted in sdk
client.track('sometraffictype', 'someEvent', 10);

// trigger both events inmmediatly, before scheduled push of events and impressions, to assert that beacon requests are not duplicated
Expand Down Expand Up @@ -174,7 +175,8 @@ function fallbackTest(fetchMock, assert) {
});

client.on(client.Event.SDK_READY, () => {
client.getTreatment('hierarchical_splits_test');
client.getTreatment('hierarchical_splits_test');// first impression counted in backend
client.getTreatment('hierarchical_splits_test');// impression counted in sdk
client.track('sometraffictype', 'someEvent', 10);
// trigger both events inmmediatly, before scheduled push of events and impressions, to assert that POST requests are not duplicated
triggerPagehideEvent();
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/browserSuites/user-consent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export default function userConsent(fetchMock, t) {
await client.ready();

assert.equal(client.track('user', 'event1'), true, 'Events queue is full, but submitter is not executed');
assert.equal(client.getTreatment('always_on'), 'on', 'Impressions queue is full, but submitter is not executed');
assert.equal(client.getTreatment('always_on'), 'on', 'Impressions queue is full, but submitter is not executed');// First impression counted in backend
assert.equal(client.getTreatment('always_on'), 'on', 'Impressions queue is full, but submitter is not executed');// impression counted in sdk

let submitterCalls = 0;
const start = Date.now();
Expand Down
Loading