Skip to content

Commit a7a4c34

Browse files
Merge branch 'main' into type_declarations_test
2 parents c446171 + 721a80a commit a7a4c34

File tree

11 files changed

+112
-9
lines changed

11 files changed

+112
-9
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: 7 additions & 1 deletion
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
/**** Interfaces ****/
2330

2431
// Facade return interface
@@ -72,7 +79,6 @@ AsyncSDK = SplitFactory(browserAsyncSettings);
7279
// Client and Manager
7380
client = SDK.client();
7481
client = SDK.client('a customer key');
75-
// client = SDK.client('a customer key', 'a traffic type'); // Not valid in Browser JS SDK
7682
manager = SDK.manager();
7783
asyncClient = AsyncSDK.client();
7884
asyncClient = AsyncSDK.client('a customer key');

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

0 commit comments

Comments
 (0)