@splitsoftware/splitio-browserjs 0.14.2-rc.0 → 0.15.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.txt CHANGED
@@ -1,5 +1,13 @@
1
- 0.14.2 (August XX, 2024)
2
- - Updated some transitive dependencies for vulnerability fixes.
1
+ 0.16.0 (September XX, 2024)
2
+ - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
3
+ - Updated @splitsoftware/splitio-commons package to version 1.18.0 that includes minor updates:
4
+ - Added support for targeting rules based on large segments for browsers.
5
+ - Updated some transitive dependencies for vulnerability fixes.
6
+
7
+ 0.15.0 (September 13, 2024)
8
+ - Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
9
+ - Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
10
+ - Updated some transitive dependencies for vulnerability fixes.
3
11
 
4
12
  0.14.1 (June 14, 2024)
5
13
  - Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaults = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index");
5
5
  var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
6
- var packageVersion = '0.14.2-rc.0';
6
+ var packageVersion = '0.15.1-rc.0';
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
9
9
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -22,7 +22,7 @@ var params = {
22
22
  };
23
23
  function settingsFactory(config) {
24
24
  var settings = (0, index_1.settingsValidation)(config, params);
25
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
26
  if (settings.mode !== constants_1.STANDALONE_MODE)
27
27
  settings.sync.largeSegmentsEnabled = false;
28
28
  return settings;
@@ -22,7 +22,7 @@ var params = {
22
22
  };
23
23
  function settingsFactory(config) {
24
24
  var settings = (0, index_1.settingsValidation)(config, params);
25
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
26
  if (settings.mode !== constants_1.STANDALONE_MODE)
27
27
  settings.sync.largeSegmentsEnabled = false;
28
28
  return settings;
@@ -1,6 +1,6 @@
1
1
  import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
2
2
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/esm/utils/constants';
3
- var packageVersion = '0.14.2-rc.0';
3
+ var packageVersion = '0.15.1-rc.0';
4
4
  /**
5
5
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
6
6
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -19,7 +19,7 @@ var params = {
19
19
  };
20
20
  export function settingsFactory(config) {
21
21
  var settings = settingsValidation(config, params);
22
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
23
  if (settings.mode !== STANDALONE_MODE)
24
24
  settings.sync.largeSegmentsEnabled = false;
25
25
  return settings;
@@ -19,7 +19,7 @@ var params = {
19
19
  };
20
20
  export function settingsFactory(config) {
21
21
  var settings = settingsValidation(config, params);
22
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
23
  if (settings.mode !== STANDALONE_MODE)
24
24
  settings.sync.largeSegmentsEnabled = false;
25
25
  return settings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.14.2-rc.0",
3
+ "version": "0.15.1-rc.0",
4
4
  "description": "Split SDK for JavaScript on Browser",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -64,7 +64,7 @@
64
64
  "bugs": "https://github.com/splitio/javascript-browser-client/issues",
65
65
  "homepage": "https://github.com/splitio/javascript-browser-client#readme",
66
66
  "dependencies": {
67
- "@splitsoftware/splitio-commons": "1.16.1-rc.5",
67
+ "@splitsoftware/splitio-commons": "1.17.1-rc.1",
68
68
  "@types/google.analytics": "0.0.40",
69
69
  "tslib": "^2.3.1",
70
70
  "unfetch": "^4.2.0"
@@ -81,7 +81,7 @@
81
81
  "eslint": "^8.48.0",
82
82
  "eslint-plugin-compat": "^4.2.0",
83
83
  "eslint-plugin-import": "^2.25.4",
84
- "fetch-mock": "^9.11.0",
84
+ "fetch-mock": "^11.1.3",
85
85
  "jest": "^27.2.3",
86
86
  "karma": "^6.4.1",
87
87
  "karma-chrome-launcher": "^3.1.1",
@@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
2
2
  import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
3
3
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';
4
4
 
5
- const packageVersion = '0.14.2-rc.0';
5
+ const packageVersion = '0.15.1-rc.0';
6
6
 
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -22,7 +22,7 @@ const params = {
22
22
  export function settingsFactory(config: any) {
23
23
  const settings = settingsValidation(config, params);
24
24
 
25
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
26
  if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
27
 
28
28
  return settings;
@@ -22,7 +22,7 @@ const params = {
22
22
  export function settingsFactory(config: any) {
23
23
  const settings = settingsValidation(config, params);
24
24
 
25
- // @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
26
  if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
27
 
28
28
  return settings;
@@ -94,9 +94,11 @@ interface ISettings {
94
94
  splitFilters: SplitIO.SplitFilter[],
95
95
  impressionsMode: SplitIO.ImpressionsMode,
96
96
  enabled: boolean,
97
- largeSegmentsEnabled: boolean,
98
97
  flagSpecVersion: string,
99
- localhostMode?: SplitIO.LocalhostFactory
98
+ localhostMode?: SplitIO.LocalhostFactory,
99
+ requestOptions?: {
100
+ getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
101
+ },
100
102
  },
101
103
  readonly userConsent: SplitIO.ConsentStatus
102
104
  }
@@ -256,6 +258,38 @@ interface ISharedSettings {
256
258
  * @default true
257
259
  */
258
260
  enabled?: boolean
261
+ /**
262
+ * Custom options object for HTTP(S) requests in the Browser.
263
+ * If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
264
+ * This configuration has no effect in "consumer" mode, as no HTTP(S) requests are made by the SDK.
265
+ */
266
+ requestOptions?: {
267
+ /**
268
+ * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
269
+ * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
270
+ * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
271
+ * Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
272
+ *
273
+ * NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
274
+ * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and will be ignored.
275
+ *
276
+ * @property getHeaderOverrides
277
+ * @default undefined
278
+ *
279
+ * @param context - The context for the request.
280
+ * @param context.headers - The current headers in the request.
281
+ * @returns A set of headers to be merged with the current headers.
282
+ *
283
+ * @example
284
+ * const getHeaderOverrides = (context) => {
285
+ * return {
286
+ * 'Authorization': context.headers['Authorization'] + ', other-value',
287
+ * 'custom-header': 'custom-value'
288
+ * };
289
+ * };
290
+ */
291
+ getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
292
+ },
259
293
  }
260
294
  }
261
295
  /**
@@ -327,7 +361,13 @@ interface IBasicSDK {
327
361
  * User consent API.
328
362
  * @property UserConsent
329
363
  */
330
- UserConsent: IUserConsentAPI
364
+ UserConsent: IUserConsentAPI,
365
+ /**
366
+ * Destroys all the clients created by this factory.
367
+ * @function destroy
368
+ * @returns {Promise<void>}
369
+ */
370
+ destroy(): Promise<void>
331
371
  }
332
372
  /****** Exposed namespace ******/
333
373
  /**