@splitsoftware/splitio-browserjs 0.11.0 → 0.12.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,3 +1,13 @@
1
+ 0.12.0 (November 3, 2023)
2
+ - Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation):
3
+ - Added new variations of the get treatment methods to support evaluating flags in given flag set/s.
4
+ - getTreatmentsByFlagSet and getTreatmentsByFlagSets
5
+ - getTreatmentsWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets
6
+ - Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload.
7
+ - Note: Only applicable when the SDK is in charge of the rollout data synchronization. When not applicable, the SDK will log a warning on init.
8
+ - Added `sets` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager to expose flag sets on flag views.
9
+ - Updated @splitsoftware/splitio-commons package to version 1.11.0.
10
+
1
11
  0.11.0 (October 31, 2023)
2
12
  - Added `defaultTreatment` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager (Related to issue https://github.com/splitio/javascript-commons/issues/225).
3
13
  - Updated @splitsoftware/splitio-commons package to version 1.10.0 that includes vulnerability fixes, and adds the `defaultTreatment` property to the `SplitView` object.
@@ -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.11.0';
6
+ var packageVersion = '0.12.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'.
@@ -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.11.0';
3
+ var packageVersion = '0.12.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'.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.11.0",
3
+ "version": "0.12.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.10.0",
67
+ "@splitsoftware/splitio-commons": "1.11.0",
68
68
  "@types/google.analytics": "0.0.40",
69
69
  "unfetch": "^4.2.0"
70
70
  },
@@ -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.11.0';
5
+ const packageVersion = '0.12.0';
6
6
 
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -499,6 +499,11 @@ declare namespace SplitIO {
499
499
  configs: {
500
500
  [treatmentName: string]: string
501
501
  },
502
+ /**
503
+ * List of sets of the feature flag.
504
+ * @property {string[]} sets
505
+ */
506
+ sets: string[],
502
507
  /**
503
508
  * The default treatment of the feature flag.
504
509
  * @property {string} defaultTreatment
@@ -801,7 +806,7 @@ declare namespace SplitIO {
801
806
  *
802
807
  * @typedef {string} SplitFilterType
803
808
  */
804
- type SplitFilterType = 'byName' | 'byPrefix';
809
+ type SplitFilterType = 'bySet' | 'byName' | 'byPrefix';
805
810
  /**
806
811
  * Defines a feature flag filter, described by a type and list of values.
807
812
  */
@@ -1218,6 +1223,42 @@ declare namespace SplitIO {
1218
1223
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1219
1224
  */
1220
1225
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1226
+ /**
1227
+ * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1228
+ * @function getTreatmentsByFlagSet
1229
+ * @param {string} key - The string key representing the consumer.
1230
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1231
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1232
+ * @returns {Treatments} The map with all the Treatment objects
1233
+ */
1234
+ getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments,
1235
+ /**
1236
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1237
+ * @function getTreatmentsWithConfigByFlagSet
1238
+ * @param {string} key - The string key representing the consumer.
1239
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1240
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1241
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1242
+ */
1243
+ getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
1244
+ /**
1245
+ * Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1246
+ * @function getTreatmentsByFlagSets
1247
+ * @param {string} key - The string key representing the consumer.
1248
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1249
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1250
+ * @returns {Treatments} The map with all the Treatment objects
1251
+ */
1252
+ getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments,
1253
+ /**
1254
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1255
+ * @function getTreatmentsWithConfigByFlagSets
1256
+ * @param {string} key - The string key representing the consumer.
1257
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1258
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1259
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1260
+ */
1261
+ getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
1221
1262
  /**
1222
1263
  * Tracks an event to be fed to the results product on Split user interface.
1223
1264
  * @function track
@@ -1278,6 +1319,46 @@ declare namespace SplitIO {
1278
1319
  * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1279
1320
  */
1280
1321
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1322
+ /**
1323
+ * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1324
+ * For usage on NodeJS as we don't have only one key.
1325
+ * @function getTreatmentsByFlagSet
1326
+ * @param {string} key - The string key representing the consumer.
1327
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1328
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1329
+ * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1330
+ */
1331
+ getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments,
1332
+ /**
1333
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1334
+ * For usage on NodeJS as we don't have only one key.
1335
+ * @function getTreatmentsWithConfigByFlagSet
1336
+ * @param {string} key - The string key representing the consumer.
1337
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1338
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1339
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1340
+ */
1341
+ getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1342
+ /**
1343
+ * Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1344
+ * For usage on NodeJS as we don't have only one key.
1345
+ * @function getTreatmentsByFlagSets
1346
+ * @param {string} key - The string key representing the consumer.
1347
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1348
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1349
+ * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1350
+ */
1351
+ getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments,
1352
+ /**
1353
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1354
+ * For usage on NodeJS as we don't have only one key.
1355
+ * @function getTreatmentsWithConfigByFlagSets
1356
+ * @param {string} key - The string key representing the consumer.
1357
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1358
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1359
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1360
+ */
1361
+ getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentWithConfig,
1281
1362
  /**
1282
1363
  * Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not).
1283
1364
  * @function track
@@ -1328,6 +1409,38 @@ declare namespace SplitIO {
1328
1409
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1329
1410
  */
1330
1411
  getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1412
+ /**
1413
+ * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1414
+ * @function getTreatmentsByFlagSet
1415
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1416
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1417
+ * @returns {Treatments} The map with all the Treatments objects
1418
+ */
1419
+ getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments,
1420
+ /**
1421
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1422
+ * @function getTreatmentsWithConfigByFlagSet
1423
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1424
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1425
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1426
+ */
1427
+ getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
1428
+ /**
1429
+ * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1430
+ * @function getTreatmentsByFlagSets
1431
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1432
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1433
+ * @returns {Treatments} The map with all the Treatments objects
1434
+ */
1435
+ getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments,
1436
+ /**
1437
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1438
+ * @function getTreatmentsWithConfigByFlagSets
1439
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1440
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1441
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1442
+ */
1443
+ getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
1331
1444
  /**
1332
1445
  * Tracks an event to be fed to the results product on Split user interface.
1333
1446
  * @function track
@@ -1415,9 +1528,41 @@ declare namespace SplitIO {
1415
1528
  * @function getTreatmentsWithConfig
1416
1529
  * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1417
1530
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1418
- * @returns {TreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1531
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1419
1532
  */
1420
1533
  getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1534
+ /**
1535
+ * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1536
+ * @function getTreatmentsByFlagSet
1537
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1538
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1539
+ * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1540
+ */
1541
+ getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): AsyncTreatments,
1542
+ /**
1543
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1544
+ * @function getTreatmentsWithConfigByFlagSet
1545
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1546
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1547
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1548
+ */
1549
+ getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig,
1550
+ /**
1551
+ * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1552
+ * @function getTreatmentsByFlagSets
1553
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1554
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1555
+ * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1556
+ */
1557
+ getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): AsyncTreatments,
1558
+ /**
1559
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1560
+ * @function getTreatmentsWithConfigByFlagSets
1561
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1562
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1563
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the TreatmentsWithConfig object.
1564
+ */
1565
+ getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1421
1566
  /**
1422
1567
  * Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not).
1423
1568
  * @function track