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
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"@typescript-eslint/no-unused-vars": "error",
"keyword-spacing": "error",
"comma-style": "error",
"no-trailing-spaces": "error"
"no-trailing-spaces": "error",
"space-before-function-paren": ["error", {"named": "never"}]
},

"overrides": [
{
"files": ["src/**/*.ts"],
"excludedFiles": ["src/**/__tests__/**"],
"extends": [
"eslint:recommended",
"plugin:compat/recommended"
],
"rules": {
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
matrix:
environment:
- stage
- stage-eu
# - stage-eu
include:
- environment: stage
account_id: "079419646996"
bucket: split-public-stage
- environment: stage-eu
account_id: "901851837056"
bucket: split-public-stage-eu-west-1
# - environment: stage-eu
# account_id: "901851837056"
# bucket: split-public-stage-eu-west-1

steps:
- name: Download assets
Expand Down Expand Up @@ -106,14 +106,14 @@ jobs:
matrix:
environment:
- prod
- prod-eu
# - prod-eu
include:
- environment: prod
account_id: "825951051969"
bucket: split-public
- environment: prod-eu
account_id: "842946900133"
bucket: split-public-eu-west-1
# - environment: prod-eu
# account_id: "842946900133"
# bucket: split-public-eu-west-1

steps:
- name: Download assets
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.3 (March 20, 2023)
- Updated @splitsoftware/splitio-commons package to version 1.8.1 that includes minor improvements.
- Updated some transitive dependencies for vulnerability fixes.

0.9.2 (December 16, 2022)
- Updated some transitive dependencies for vulnerability fixes.
- Bugfixing - Upgrade @splitsoftware/splitio-commons package to version 1.7.3 which includes a memory leak fix for localhost mode (Related to issue https://github.com/splitio/javascript-commons/issues/181) among other improvements.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2022 Split Software, Inc.
Copyright © 2023 Split Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Split JavaScript SDK for Browsers

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

## 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.
Expand Down Expand Up @@ -63,11 +63,12 @@ Split has built and maintains SDKs for:

* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
* 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
18 changes: 9 additions & 9 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@splitsoftware/splitio-browserjs",
"version": "0.9.2",
"description": "Split SDK for Javascript on Browser",
"version": "0.9.3-rc.1",
"description": "Split SDK for JavaScript on Browser",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "types",
Expand Down Expand Up @@ -64,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.7.3",
"@splitsoftware/splitio-commons": "1.8.1",
"@types/google.analytics": "0.0.40"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion rollup.ci.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import terser from '@rollup/plugin-terser';

export default env => {

const fileName = (outputSuffix) => `split-browser${env.branch !== 'main' ? `-dev-${env.commit_hash || VERSION}` : `-${VERSION}`}${outputSuffix ? `.${outputSuffix}` : ''}`;
const fileName = (outputSuffix) => `split-browser-${env.branch !== 'main' ? `dev-${env.commit_hash || VERSION}` : VERSION}${outputSuffix ? `.${outputSuffix}` : ''}`;

const createRollupConfig = (input, outputSuffix) => ({
input,
Expand Down
2 changes: 1 addition & 1 deletion rollup.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const plugins = [
nodeResolve({
// defaults `extensions` plus '.ts' files
extensions: [
'.mjs', '.js', '.json', '.node'
'.mjs', '.js', '.json', '.node', '.ts'
],
browser: true,
preferBuiltins: false,
Expand Down
14 changes: 7 additions & 7 deletions src/__tests__/browserSuites/events.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export function withoutBindingTT(fetchMock, assert) {
// Key binded as with getTreatment.
tsStart = Date.now();
assert.ok(client.track('sometraffictype', 'someEvent', 10), 'client.track returns true if an event is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 25), 'client.track returns true if event value is null and is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 25, null), 'client.track returns true if event properties is null and is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 24, { prop1: true, prop2: 'a', prop3: 2, prop4: null, willBeNulled: {} }), 'client.track returns true if event properties is an object and is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 25), 'client.track returns true if event value is null and is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 25, null), 'client.track returns true if event properties is null and is added to the queue.');
assert.ok(client.track('othertraffictype', 'genericEvent', 24, { prop1: true, prop2: 'a', prop3: 2, prop4: null, willBeNulled: {} }), 'client.track returns true if event properties is an object and is added to the queue.');
assert.ok(client.track('othertraffictype', 'my.click.event'), 'client.track returns true if an event is added to the queue.');
assert.ok(client.track('othertraffictype', 'my.checkout.event', null), 'client.track returns true if an event is added to the queue.');
tsEnd = Date.now();
Expand All @@ -89,7 +89,7 @@ export function withoutBindingTT(fetchMock, assert) {
assert.notOk(client.track(10, 'sometraffictype', 'someEvent'), 'client.track returns false if an event data was incorrect and it could not be added to the queue.');
assert.notOk(client.track('asd', 20, 'trafficType'), 'client.track returns false if an event data was incorrect and it could not be added to the queue.');
assert.notOk(client.track('othertraffictype', 'my.checkout.event', null, []), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('othertraffictype', 'my.checkout.event', null, function() {}), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('othertraffictype', 'my.checkout.event', null, function () { }), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('othertraffictype', 'my.checkout.event', null, 'asd'), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
}

Expand Down Expand Up @@ -143,8 +143,8 @@ export function bindingTT(fetchMock, assert) {
tsStart = Date.now();
assert.ok(client.track('someEvent', 10), 'client.track returns true if an event is added to the queue.');
assert.ok(client.track('genericEvent', 25), 'client.track returns true if an event is added to the queue');
assert.ok(client.track('genericEvent', 25, null), 'client.track returns true if event properties is null and is added to the queue.');
assert.ok(client.track('genericEvent', 24, { prop1: true, prop2: 'a', prop3: 2, prop4: null, willBeNulled: {} }), 'client.track returns true if event properties is an object and is added to the queue.');
assert.ok(client.track('genericEvent', 25, null), 'client.track returns true if event properties is null and is added to the queue.');
assert.ok(client.track('genericEvent', 24, { prop1: true, prop2: 'a', prop3: 2, prop4: null, willBeNulled: {} }), 'client.track returns true if event properties is an object and is added to the queue.');
assert.ok(client.track('my.click.event'), 'client.track returns true if an event is added to the queue.');
assert.ok(client.track('my.checkout.event', null), 'client.track returns true if an event is added to the queue.');
tsEnd = Date.now();
Expand All @@ -158,6 +158,6 @@ export function bindingTT(fetchMock, assert) {
assert.notOk(client.track('randomEvent', 'invalid value'), 'client.track returns false if event value is invalid and it could not be added to the queue.');
assert.notOk(client.track('my.checkout.event', ['some', 'stuff']), 'client.track returns false if event value is invalid and it could not be added to the queue.');
assert.notOk(client.track('my.checkout.event', null, []), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('my.checkout.event', null, function() {}), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('my.checkout.event', null, function () { }), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
assert.notOk(client.track('my.checkout.event', null, 'asd'), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
}
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/impressions-listener.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config = {
streamingEnabled: false
};

export default function(assert) {
export default function (assert) {
const splitio = SplitFactory(config);
const client = splitio.client();
const client2 = splitio.client({ matchingKey: 'marcio@split.io', bucketingKey: 'impr_bucketing_2' });
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import splitChangesMockReal from '../mocks/splitchanges.real.json';
import map from 'lodash/map';
import { url } from '../testUtils';

export default async function(settings, fetchMock, assert) {
export default async function (settings, fetchMock, assert) {
fetchMock.getOnce({ url: url(settings, '/splitChanges?since=-1'), overwriteRoutes: true }, { status: 200, body: splitChangesMockReal });

const mockSplits = splitChangesMockReal;
Expand Down
2 changes: 1 addition & 1 deletion src/settings/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';

const packageVersion = '0.9.2';
const packageVersion = '0.9.3-rc.1';

/**
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
Expand Down
2 changes: 1 addition & 1 deletion types/full/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Declaration file for Javascript Browser Split Software SDK
// Declaration file for JavaScript Browser Split Software SDK
// Project: http://www.split.io/
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>

Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Declaration file for Javascript Browser Split Software SDK
// Declaration file for JavaScript Browser Split Software SDK
// Project: http://www.split.io/
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>

Expand Down
17 changes: 11 additions & 6 deletions types/splitio.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Javascript Browser Split Software SDK
// Type definitions for JavaScript Browser Split Software SDK
// Project: http://www.split.io/
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>

Expand Down Expand Up @@ -296,9 +296,14 @@ interface IStatusInterface extends IEventEmitter {
*/
interface IBasicClient extends IStatusInterface {
/**
* Destroy the client instance.
* Destroys the client instance.
*
* In 'standalone' and 'partial consumer' modes, this method will flush any pending impressions and events.
* In 'standalone' mode, it also stops the synchronization of feature flag definitions with the backend.
* In 'consumer' and 'partial consumer' modes, this method also disconnects the SDK from the Pluggable storage.
*
* @function destroy
* @returns {Promise<void>}
* @returns {Promise<void>} A promise that will be resolved once the client is destroyed.
*/
destroy(): Promise<void>
}
Expand Down Expand Up @@ -541,7 +546,7 @@ declare namespace SplitIO {
/**
* Optional prefix to prevent any kind of data collision when having multiple factories using the same storage type.
* @property {string} prefix
* @default SPLITIO
* @default 'SPLITIO'
*/
prefix?: string
}
Expand All @@ -565,7 +570,7 @@ declare namespace SplitIO {
/**
* Optional prefix to prevent any kind of data collision when having multiple factories using the same storage wrapper.
* @property {string} prefix
* @default SPLITIO
* @default 'SPLITIO'
*/
prefix?: string,
/**
Expand Down Expand Up @@ -896,7 +901,7 @@ declare namespace SplitIO {
* For "localhost" mode, use "localhost" as authorizationKey.
*
* @property {'standalone'} mode
* @default standalone
* @default 'standalone'
*/
mode?: 'standalone',
/**
Expand Down