Skip to content

Commit 721a80a

Browse files
Merge pull request #133 from splitio/development
Release v1.0.1
2 parents 576ef3a + b9ecaaa commit 721a80a

File tree

11 files changed

+118
-16
lines changed

11 files changed

+118
-16
lines changed

.github/workflows/sonar-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22-
- name: Set up nodejs
22+
- name: Set up Node.js
2323
uses: actions/setup-node@v3
2424
with:
2525
node-version: 'lts/*'

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
1.0.1 (November 11, 2024)
2+
- Bugfixing - Revert removal of TypeScript `SplitIO` namespace at `/types/splitio.d.ts` to allow explicit imports of types from the Browser SDK package. E.g., `import type { IClientSideSettings } from '@splitsoftware/splitio-browserjs/types/splitio';`.
3+
14
1.0.0 (November 1, 2024)
25
- Added support for targeting rules based on large segments.
36
- Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
47
- Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
58
- BREAKING CHANGES:
9+
- NOTE: Refer to ./MIGRATION-GUIDE.md for instructions on how to migrate your codebase from version 0.x to 1.0.0.
610
- Dropped support for Split Proxy below version 5.9.0. The SDK now requires Split Proxy 5.9.0 or above.
11+
- Renamed some TypeScript definitions in the `SplitIO` namespace to avoid conflicts with other Split packages: `IBrowserSettings`, `IBrowserAsyncSettings`, `ISDK`, `IAsyncSDK`, `IClient`, and `IAsyncClient` were renamed to `IClientSideSettings`, `IClientSideAsyncSettings`, `IBrowserSDK`, `IBrowserAsyncSDK`, `IBrowserClient` and `IBrowserAsyncClient` respectively.
12+
- Removed TypeScript `SplitIO` namespace from `@splitsoftware/splitio-browserjs/types/splitio`. Reverted in 1.0.1.
713
- Removed internal ponyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or provide a polyfill.
814
- Removed the deprecated `GoogleAnalyticsToSplit` and `SplitToGoogleAnalytics` pluggable integration modules, along with the related interfaces in the TypeScript definitions.
915
- Removed the `LocalhostFromObject` export from the default import (`import { LocalhostFromObject } from '@splitsoftware/splitio-browserjs'`). It is no longer necessary to manually import and configure it in the `sync.localhostMode` option to enable localhost mode.

MIGRATION-GUIDE.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Migrating to JavaScript Browser SDK v1
2+
3+
JavaScript Browser SDK v1.0.0 has a few breaking changes that you should consider when migrating from version 0.x.x.
4+
5+
## Renamed some TypeScript definitions in the `SplitIO` namespace to avoid conflicts with other Split packages
6+
7+
The renamed types are:
8+
- `SplitIO.IBrowserSettings` -> `SplitIO.IClientSideSettings`
9+
- `SplitIO.IBrowserAsyncSettings` -> `SplitIO.IClientSideAsyncSettings`
10+
- `SplitIO.ISDK` -> `SplitIO.IBrowserSDK`
11+
- `SplitIO.IAsyncSDK` -> `SplitIO.IBrowserAsyncSDK`
12+
- `SplitIO.IClient` -> `SplitIO.IBrowserClient`
13+
- `SplitIO.IAsyncClient` -> `SplitIO.IBrowserAsyncClient`
14+
15+
For example, you should replace:
16+
17+
```ts
18+
import { SplitFactory } from '@splitsoftware/splitio-browserjs';
19+
20+
const config: SplitIO.IBrowserSettings = { ... };
21+
const factory: SplitIO.ISDK = SplitFactory(config);
22+
```
23+
24+
with:
25+
26+
```ts
27+
import { SplitFactory } from '@splitsoftware/splitio-browserjs';
28+
29+
const config: SplitIO.IClientSideSettings = { ... };
30+
const factory: SplitIO.IBrowserSDK = SplitFactory(config);
31+
```
32+
33+
34+
## Removed the `LocalhostFromObject` export from the default import
35+
36+
In order to simplify the SDK API, the `LocalhostFromObject` export was removed from the default import (`import { LocalhostFromObject } from '@splitsoftware/splitio-browserjs'`), and it is no longer necessary to manually pass it to the `sync.localhostMode` configuration option to enable localhost mode.
37+
38+
If you were using the `LocalhostFromObject` export, you should remove it from your code. For example, replace:
39+
40+
```js
41+
import { SplitFactory, LocalhostFromObject } from '@splitsoftware/splitio-browserjs';
42+
43+
const factory = SplitFactory({
44+
core: {
45+
authorizationKey: 'localhost',
46+
key: SOME_KEY
47+
},
48+
features: {
49+
'feature1': 'on'
50+
},
51+
sync: {
52+
localhostMode: LocalhostFromObject()
53+
}
54+
});
55+
```
56+
57+
with:
58+
59+
```js
60+
import { SplitFactory } from '@splitsoftware/splitio-browserjs';
61+
62+
const factory = SplitFactory({
63+
core: {
64+
authorizationKey: 'localhost',
65+
key: SOME_KEY
66+
},
67+
features: {
68+
'feature1': 'on'
69+
}
70+
});
71+
```
72+
73+
## Removed the deprecated `GoogleAnalyticsToSplit` and `SplitToGoogleAnalytics` pluggable integration modules, along with the related interfaces in the TypeScript definitions
74+
75+
The Google Analytics integrations were removed since they integrate with the *Google Universal Analytics* library, which was shut down on July 1, 2024, and [replaced by *Google Analytics 4*](https://support.google.com/analytics/answer/11583528?hl=en). Check [this docs](https://help.split.io/hc/en-us/articles/360040838752-Google-Analytics#google-analytics-4-ga4) for more information on how to integrate Split with Google Analytics 4.
76+
77+
## Removed internal polyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers
78+
79+
The SDK no longer ships with internal implementations for the `Map` and `Set` global objects, which were used to support old browsers like IE.
80+
81+
If you need to target environments that do not support these features natively, you should provide a polyfill for them. For example, [es6-map](https://github.com/medikoo/es6-map) for `Map`, and [es6-set](https://github.com/medikoo/es6-set) for `Set`.
82+
83+
## Dropped support for Split Proxy below version 5.9.0. The SDK now requires Split Proxy 5.9.0 or above
84+
85+
If using the Split Proxy with the SDK, make sure to update it to version 5.9.0 or above. This is required due to the introduction of Large Segments matchers in the SDK, which uses a new HTTP endpoint to retrieve the segments data and is only supported by Split Proxy 5.9.0.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Split has built and maintains SDKs for:
7070
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
7171
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
7272
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
73-
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
73+
* Node.js [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
7474
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
7575
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK)
7676
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-browserjs",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Split SDK for JavaScript on Browser",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",

src/settings/defaults.ts

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

5-
const packageVersion = '1.0.0';
5+
const packageVersion = '1.0.1';
66

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

ts-tests/index.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* @author Nico Zelaya <nicolas.zelaya@split.io>
1212
*/
1313

14+
import type * as SplitTypes from '../types/splitio';
15+
1416
import { SplitFactory as SplitFactoryFull, InLocalStorage as InLocalStorageFull, DebugLogger as DebugLoggerFull, InfoLogger as InfoLoggerFull, WarnLogger as WarnLoggerFull, ErrorLogger as ErrorLoggerFull, PluggableStorage as PluggableStorageFull } from '../types/full';
1517
import { SplitFactory, InLocalStorage, DebugLogger, InfoLogger, WarnLogger, ErrorLogger, PluggableStorage } from '../types/index';
1618

@@ -19,6 +21,11 @@ let splitFactory = SplitFactory; splitFactory = SplitFactoryFull;
1921
let inLocalStorage = InLocalStorage; inLocalStorage = InLocalStorageFull;
2022
let pluggableStorage = PluggableStorage; pluggableStorage = PluggableStorageFull;
2123

24+
// Validate that the SplitIO namespace is available and matches the types when imported explicitly
25+
let ambientType: SplitIO.ISDK;
26+
let importedType: SplitTypes.ISDK;
27+
ambientType = importedType;
28+
2229
let stringPromise: Promise<string>;
2330
let splitNamesPromise: Promise<SplitIO.SplitNames>;
2431
let splitViewPromise: Promise<SplitIO.SplitView>;
@@ -149,13 +156,13 @@ splitKey = 'someKey';
149156

150157
/**** Tests for ISDK interface ****/
151158

152-
// // For node with sync storage
159+
// // For Node.js with sync storage
153160
// nodeSettings = {
154161
// core: {
155162
// authorizationKey: 'key'
156163
// }
157164
// };
158-
// // For node with async storage
165+
// // For Node.js with async storage
159166
// asyncSettings = {
160167
// core: {
161168
// authorizationKey: 'key'
@@ -210,9 +217,7 @@ SDK.settings.features = { 'split_x': 'on' };
210217
// Client and Manager
211218
client = SDK.client();
212219
client = SDK.client('a customer key');
213-
// client = SDK.client('a customer key', 'a traffic type'); // Not valid in Browser JS SDK
214220
manager = SDK.manager();
215-
// // Today async clients are only possible on Node. Shared client creation not available here.
216221
asyncClient = AsyncSDK.client();
217222
asyncManager = AsyncSDK.manager();
218223

@@ -242,7 +247,7 @@ splitEvent = client.Event.SDK_READY_FROM_CACHE;
242247
splitEvent = client.Event.SDK_READY_TIMED_OUT;
243248
splitEvent = client.Event.SDK_UPDATE;
244249

245-
// Client implements methods from IEventEmitter that is a subset of NodeJS.Events. Testing a few.
250+
// Client implements methods from IEventEmitter that is a subset of Node.js EventEmitter. Testing a few.
246251
client = client.on(splitEvent, () => { });
247252
const a: boolean = client.emit(splitEvent);
248253
client = client.removeAllListeners(splitEvent);
@@ -334,7 +339,7 @@ splitEvent = asyncClient.Event.SDK_READY_FROM_CACHE;
334339
splitEvent = asyncClient.Event.SDK_READY_TIMED_OUT;
335340
splitEvent = asyncClient.Event.SDK_UPDATE;
336341

337-
// Client implements methods from NodeJS.Events. (same as for sync client, just for interface checking)
342+
// Client implements methods from Node.js EventEmitter. (same as for sync client, just for interface checking)
338343
asyncClient = asyncClient.on(splitEvent, () => { });
339344
const a1: boolean = asyncClient.emit(splitEvent);
340345
asyncClient = asyncClient.removeAllListeners(splitEvent);
@@ -421,7 +426,7 @@ splitViews = manager.splits();
421426
// Manager implements ready promise.
422427
promise = manager.ready();
423428

424-
// Manager implements methods from NodeJS.Events. Testing a few.
429+
// Manager implements methods from Node.js EventEmitter. Testing a few.
425430
manager = manager.on(splitEvent, () => { });
426431
const aa: boolean = manager.emit(splitEvent);
427432
manager = manager.removeAllListeners(splitEvent);
@@ -444,7 +449,7 @@ splitViewsAsync = asyncManager.splits();
444449
// asyncManager implements ready promise.
445450
promise = asyncManager.ready();
446451

447-
// asyncManager implements methods from NodeJS.Events. Testing a few.
452+
// asyncManager implements methods from Node.js EventEmitter. Testing a few.
448453
asyncManager = asyncManager.on(splitEvent, () => { });
449454
const aaa: boolean = asyncManager.emit(splitEvent);
450455
asyncManager = asyncManager.removeAllListeners(splitEvent);

types/full/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Project: http://www.split.io/
33
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
44

5-
import '@splitsoftware/splitio-commons';
5+
/// <reference path="../splitio.d.ts" />
66

77
export = JsSdk;
88

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Project: http://www.split.io/
33
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
44

5-
import '@splitsoftware/splitio-commons';
5+
/// <reference path="./splitio.d.ts" />
66

77
export = JsSdk;
88

types/splitio.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Type definitions for JavaScript Browser Split Software SDK
2+
3+
import '@splitsoftware/splitio-commons';
4+
5+
export as namespace SplitIO;
6+
export = SplitIO;

0 commit comments

Comments
 (0)