diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml new file mode 100644 index 0000000..9e58254 --- /dev/null +++ b/.github/workflows/update-license-year.yml @@ -0,0 +1,45 @@ +name: Update License Year + +on: + schedule: + - cron: "0 3 1 1 *" # 03:00 AM on January 1 + +permissions: + contents: write + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set Current year + run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" + + - name: Set Previous Year + run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" + + - name: Update LICENSE + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: ${{ env.PREVIOUS }} + replace: ${{ env.CURRENT }} + include: "LICENSE" + regex: false + + - name: Commit files + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git commit -m "Updated License Year" -a + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: Update License Year + branch: update-license diff --git a/CHANGES.txt b/CHANGES.txt index 08f8e05..b7cb516 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,10 @@ +0.2.0 (March 31, 2022) + - Added support for user consent, a way to control if the SDK tracks impressions and events or not, based on users granting or rejecting consent for it. + - Added support to SDK clients to optionally bind attributes, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag. + - Added `scheduler.impressionsQueueSize` property to SDK configuration (See https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#configuration). + - Updated some NPM dependencies for vulnerability fixes. + - Bugfixing - Fixed validation of SDK configuration, to parse core.key into a string and log a warning when passing a number (Related to issue https://github.com/splitio/react-native-client/issues/19). + 0.1.0 (October 20, 2021) - Added localhost mode support (Read more in our docs here: https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#localhost-mode). - Updated @splitsoftware/splitio-commons dependency to version 1.0.0, which includes: diff --git a/LICENSE b/LICENSE index 18dec1b..051b5fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2021 Split Software, Inc. +Copyright © 2022 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. diff --git a/README.md b/README.md index 8bc20c7..056ec74 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Split JavaScript SDK for React Native -[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://travis-ci.com/splitio/react-native-client.svg?branch=main)](https://travis-ci.com/splitio/react-native-client) +[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://github.com/splitio/react-native-client/actions/workflows/ci.yml/badge.svg)](https://github.com/splitio/react-native-client/actions/workflows/ci.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. @@ -62,8 +62,8 @@ Split has built and maintains SDKs for: * 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) -* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-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) * React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 884adb6..2b4aa99 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -316,7 +316,7 @@ PODS: - React-cxxreact (= 0.64.1) - React-jsi (= 0.64.1) - React-perflogger (= 0.64.1) - - RNSplit (0.1.0): + - RNSplit (0.2.0): - React - Yoga (1.14.0) - YogaKit (1.18.1): @@ -488,7 +488,7 @@ SPEC CHECKSUMS: React-RCTVibration: 4b99a7f5c6c0abbc5256410cc5425fb8531986e1 React-runtimeexecutor: ff951a0c241bfaefc4940a3f1f1a229e7cb32fa6 ReactCommon: bedc99ed4dae329c4fcf128d0c31b9115e5365ca - RNSplit: e75dc5a74f4c0e34bec2b68a6d075cbd8aadbe48 + RNSplit: c04b293ec271725d77729f8d4703a189bbf5b8a3 Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/example/package-lock.json b/example/package-lock.json index c6744f7..6a6881a 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -1110,9 +1110,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "rimraf": { @@ -1996,9 +1996,9 @@ } }, "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==" }, "ansi-styles": { "version": "4.3.0", @@ -2375,24 +2375,24 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==" + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" }, "bplist-creator": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz", - "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz", + "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==", "requires": { - "stream-buffers": "~2.2.0" + "stream-buffers": "2.2.x" } }, "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz", + "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==", "requires": { - "big-integer": "^1.6.44" + "big-integer": "1.6.x" } }, "brace-expansion": { @@ -2583,9 +2583,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "strip-ansi": { "version": "6.0.0", @@ -3234,9 +3234,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "cross-spawn": { @@ -5684,9 +5684,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "fs-extra": { "version": "1.0.0", @@ -6015,9 +6015,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mixin-deep": { "version": "1.3.2", @@ -6104,9 +6104,33 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } }, "node-int64": { "version": "0.4.0", @@ -6654,13 +6678,12 @@ } }, "plist": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz", - "integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "requires": { "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7", - "xmldom": "^0.5.0" + "xmlbuilder": "^9.0.7" } }, "posix-character-classes": { @@ -6701,9 +6724,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" } } }, @@ -6889,6 +6912,13 @@ "strip-ansi": "^5.2.0", "sudo-prompt": "^9.0.0", "wcwidth": "^1.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + } } }, "chalk": { @@ -7491,9 +7521,9 @@ } }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "requires": { "glob": "^7.0.0", "interpret": "^1.0.0", @@ -7524,13 +7554,13 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "simple-plist": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz", - "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", + "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==", "requires": { - "bplist-creator": "0.0.8", - "bplist-parser": "0.2.0", - "plist": "^3.0.1" + "bplist-creator": "0.1.0", + "bplist-parser": "0.3.1", + "plist": "^3.0.5" } }, "sisteransi": { @@ -7831,9 +7861,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "strip-ansi": { @@ -7858,9 +7888,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -8008,9 +8038,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "astral-regex": { @@ -8111,9 +8141,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==" }, "to-fast-properties": { "version": "2.0.0", @@ -8551,9 +8581,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "strip-ansi": { "version": "6.0.0", @@ -8622,11 +8652,6 @@ "sax": "^1.2.1" } }, - "xmldom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz", - "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==" - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package-lock.json b/package-lock.json index ec834d9..0b936d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3555,12 +3555,11 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.0.0.tgz", - "integrity": "sha512-hup5YVuf9eEd9FJix7siGhFgsUJndCfeMwTLNeO+mPL2gehjGZLS0GjOMofVAa+Y1cDrpo41CQ54w/QIbixYQg==", + "version": "1.2.1-rc.11", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.11.tgz", + "integrity": "sha512-kiba0u5Fnn9O+MBKhM140KnVm7zsY77sIyBrTodOo2EKNHTw8p88eBPnLiR5rRyurQ8AJpMosdrlRphGuQLMYQ==", "requires": { - "object-assign": "^4.1.1", - "tslib": "^2.1.0" + "tslib": "^2.3.1" }, "dependencies": { "tslib": { @@ -3789,12 +3788,6 @@ "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==", "dev": true }, - "@types/object-assign": { - "version": "4.0.30", - "resolved": "https://registry.npmjs.org/@types/object-assign/-/object-assign-4.0.30.tgz", - "integrity": "sha1-iUk3HVqZ9Dge4PHfCpt6GH4H5lI=", - "dev": true - }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -3825,9 +3818,9 @@ } }, "@types/react-native": { - "version": "0.62.13", - "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.62.13.tgz", - "integrity": "sha512-hs4/tSABhcJx+J8pZhVoXHrOQD89WFmbs8QiDLNSA9zNrD46pityAuBWuwk1aMjPk9I3vC5ewkJroVRHgRIfdg==", + "version": "0.65.1", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.65.1.tgz", + "integrity": "sha512-pyRmTnvjYORIXuL8+ZhoI8gqamTE/8Lo9bU/1Ife3VOTgeFzY9rHnx3Tna7OOixBW5Exh2PcHSkJXma4FENC0g==", "dev": true, "requires": { "@types/react": "*" @@ -4062,9 +4055,9 @@ }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "astral-regex": { @@ -4590,27 +4583,27 @@ "dev": true }, "big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", "dev": true }, "bplist-creator": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz", - "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz", + "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==", "dev": true, "requires": { - "stream-buffers": "~2.2.0" + "stream-buffers": "2.2.x" } }, "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz", + "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==", "dev": true, "requires": { - "big-integer": "^1.6.44" + "big-integer": "1.6.x" } }, "brace-expansion": { @@ -11819,9 +11812,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mixin-deep": { @@ -11904,10 +11897,37 @@ "dev": true }, "node-fetch": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", - "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==", - "dev": true + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } }, "node-int64": { "version": "0.4.0", @@ -11991,7 +12011,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -12390,9 +12411,9 @@ } }, "plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "dev": true, "requires": { "base64-js": "^1.5.1", @@ -12723,6 +12744,17 @@ "open": "^6.2.0", "semver": "^6.3.0", "shell-quote": "1.6.1" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + } } }, "@react-native-community/cli-types": { @@ -12801,6 +12833,12 @@ "@sideway/pinpoint": "^2.0.0" } }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -12892,9 +12930,9 @@ } }, "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "ansi-styles": { @@ -13048,6 +13086,28 @@ "has-flag": "^4.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "ws": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", @@ -13845,14 +13905,14 @@ "dev": true }, "simple-plist": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz", - "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", + "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==", "dev": true, "requires": { - "bplist-creator": "0.0.8", - "bplist-parser": "0.2.0", - "plist": "^3.0.1" + "bplist-creator": "0.1.0", + "bplist-parser": "0.3.1", + "plist": "^3.0.5" } }, "sisteransi": { @@ -14579,9 +14639,9 @@ } }, "typescript": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", - "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, "uglify-es": { diff --git a/package.json b/package.json index a9da112..ee7ee02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.0", + "version": "0.2.0", "description": "Split SDK for React Native", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", @@ -54,14 +54,13 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.0.0" + "@splitsoftware/splitio-commons": "1.2.1-rc.11" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", "@types/jest": "^27.0.2", - "@types/object-assign": "^4.0.30", "@types/react": "^16.9.19", - "@types/react-native": "0.62.13", + "@types/react-native": "0.65.1", "eslint": "^7.2.0", "eslint-config-prettier": "^7.0.0", "eslint-plugin-import": "^2.23.4", @@ -73,7 +72,7 @@ "react-native": "^0.65.1", "react-native-builder-bob": "^0.18.1", "replace": "^1.2.1", - "typescript": "^4.1.3" + "typescript": "4.4.4" }, "peerDependencies": { "react": "*", diff --git a/src/full/splitFactory.ts b/src/full/splitFactory.ts index 1c92de6..a5d6f77 100644 --- a/src/full/splitFactory.ts +++ b/src/full/splitFactory.ts @@ -2,18 +2,19 @@ import { settingsValidator } from '../settings/full'; import { getModules } from '../platform/getModules'; import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index'; import type { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { merge } from '@splitsoftware/splitio-commons/src/utils/lang'; /** * SplitFactory for React Native. * Includes localhost mode. * - * @param config Configuration object used to instantiates the SDK - * @param customModules Optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. + * @param config Configuration object used to instantiate the SDK + * @param __updateModules Optional function that lets redefine internal SDK modules. Use with + * caution since, unlike `config`, this param is not validated neither considered part of the public API. * @throws Will throw an error if the provided config is invalid. */ -export function SplitFactory(config: any, customModules?: Partial) { +export function SplitFactory(config: any, __updateModules: (modules: ISdkFactoryParams) => void) { const settings = settingsValidator(config); const modules = getModules(settings); - return sdkFactory(customModules ? (merge(modules, customModules) as ISdkFactoryParams) : modules); + if (__updateModules) __updateModules(modules); + return sdkFactory(modules); } diff --git a/src/index.ts b/src/index.ts index 1cbaec6..7e7f9af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,19 @@ +/** +Copyright 2022 Split Software + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**/ + export { SplitFactory } from './splitFactory'; export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger'; export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger'; diff --git a/src/platform/RNSignalListener.ts b/src/platform/RNSignalListener.ts index e75b4c8..0413411 100644 --- a/src/platform/RNSignalListener.ts +++ b/src/platform/RNSignalListener.ts @@ -44,9 +44,11 @@ export class RNSignalListener implements ISignalListener { case TO_FOREGROUND: this.settings.log.debug(`App transition to foreground${this.syncManager.pushManager ? '. Attempting to resume streaming' : ''}`); - // This branch is called when app transition to foreground or it is launched, - // in which case calling pushManager.start has no effect (it has been already started). - // Here, synchronization is resumed. + // This branch is called when (1) app is launched, or (2) app transitions to foreground. + // In 1, calling pushManager.start has no effect, since it has already been started. + // In 2, PushManager is resumed in case it was paused and the SDK is running in push mode. + // If running in polling mode, either pushManager is not defined (e.g., streamingEnabled is false) + // or calling pushManager.start has no effect because it was disabled (PUSH_NONRETRYABLE_ERROR). if (this.syncManager.pushManager) this.syncManager.pushManager.start(); break; @@ -58,15 +60,16 @@ export class RNSignalListener implements ISignalListener { ); // This branch is called when the app transition to background. - // Here, pushManager is stopped to close streaming connections for Android. - // In iOS, connections are automatically closed/resumed by the OS. - // Polling mode is paused during background, since JS timers callbacks are executed only - // when the app is in the foreground. Therefore, stopping syncManager is not necessary. - // Other features like Fetch, AsyncStorage, AppState and NetInfo listeners, can be used. + // Here, PushManager is paused in case the SDK is running in push mode, to close streaming connection for Android. + // In iOS it is not strictly required, since connections are automatically closed/resumed by the OS. + // The remaining SyncManager components (PollingManager and Submitter) don't need to be stopped, even if running in + // polling mode, because sync tasks are "delayed" during background, since JS timers callbacks are executed only + // when the app is in foreground (https://github.com/facebook/react-native/issues/12981#issuecomment-652745831). + // Other features like Fetch, AsyncStorage, AppState and NetInfo listeners, can be used in background. if (this.syncManager.pushManager) this.syncManager.pushManager.stop(); // We cannot listen when the app is evicted by the OS or the user, but it always transitions to background before that. - // So we should not flush events and impressions in the background, except that they cannot be stored in a persistent storage. + // So we should not flush events and impressions in background, except that they cannot be stored in a persistent storage. if (this.settings.flushDataOnBackground) this.syncManager.flush(); break; @@ -79,7 +82,7 @@ export class RNSignalListener implements ISignalListener { */ start() { this.settings.log.debug(CLEANUP_REGISTERING, [EVENT_NAME]); - // Checking currentState in the rare case that the SDK is instantiated in the background, where streaming should not connect. + // Checking currentState in the rare case that the SDK is instantiated in background, where streaming should not connect. // The SDK should be instantiated when React Native JS context is initiated or the root componentDidMount method is called, where the app is in the foreground. this._handleAppStateChange(AppState.currentState); AppState.addEventListener('change', this._handleAppStateChange); diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 6fb3a9a..76650af 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -1,16 +1,17 @@ import { splitApiFactory } from '@splitsoftware/splitio-commons/src/services/splitApi'; import { syncManagerOnlineFactory } from '@splitsoftware/splitio-commons/src/sync/syncManagerOnline'; -import pushManagerFactory from '@splitsoftware/splitio-commons/src/sync/streaming/pushManager'; -import pollingManagerCSFactory from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerCS'; +import { pushManagerFactory } from '@splitsoftware/splitio-commons/src/sync/streaming/pushManager'; +import { pollingManagerCSFactory } from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerCS'; import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager/index'; import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS'; import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS'; -import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents'; +import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents'; import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils'; import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types'; +import { ISettings } from '@splitsoftware/splitio-commons/src/types'; import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants'; +import { userConsentProps } from '@splitsoftware/splitio-commons/src/sdkFactory/userConsentProps'; import { RNSignalListener } from './RNSignalListener'; import { getEventSource } from './getEventSource'; @@ -44,9 +45,9 @@ export function getModules(settings: ISettings): ISdkFactoryParams { SignalListener: RNSignalListener as ISdkFactoryParams['SignalListener'], - impressionListener: settings.impressionListener as SplitIO.IImpressionListener, - impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined, + + extraProps: userConsentProps, }; if (settings.mode === LOCALHOST_MODE) { diff --git a/src/settings/__tests__/index.spec.ts b/src/settings/__tests__/index.spec.ts new file mode 100644 index 0000000..a9fc014 --- /dev/null +++ b/src/settings/__tests__/index.spec.ts @@ -0,0 +1,18 @@ +import { settingsValidator as slimSettingsValidator } from '../index'; +import { settingsValidator as fullSettingsValidator } from '../index'; + +test('SETTINGS / Consent is overwritable and "GRANTED" by default', () => { + [slimSettingsValidator, fullSettingsValidator].forEach((settingsValidator) => { + let settings = settingsValidator({}); + expect(settings.userConsent).toEqual('GRANTED'); // userConsent defaults to granted if not provided + + settings = settingsValidator({ userConsent: 'INVALID-VALUE' }); + expect(settings.userConsent).toEqual('GRANTED'); // userConsent defaults to granted if a wrong value is provided + + settings = settingsValidator({ userConsent: 'UNKNOWN' }); + expect(settings.userConsent).toEqual('UNKNOWN'); // userConsent can be overwritten + + settings = settingsValidator({ userConsent: 'declined' }); + expect(settings.userConsent).toEqual('DECLINED'); // userConsent can be overwritten + }); +}); diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 6d8a7d7..1419a4a 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -1,4 +1,7 @@ -const packageVersion = '0.1.0'; +import { ConsentStatus } from '@splitsoftware/splitio-commons/src/types'; +import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; + +const packageVersion = '0.2.0'; export const defaults = { startup: { @@ -12,6 +15,9 @@ export const defaults = { eventsFirstPushWindow: 10, }, + // Consent is considered granted by default + userConsent: CONSENT_GRANTED as ConsentStatus, + // Instance version. version: `reactnative-${packageVersion}`, diff --git a/src/settings/full.ts b/src/settings/full.ts index 3cc6702..0ce7c37 100644 --- a/src/settings/full.ts +++ b/src/settings/full.ts @@ -1,17 +1,21 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index'; import { defaults } from './defaults'; +import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime'; import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS'; import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/builtin'; +import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent'; const params = { defaults, + acceptKey: true, // Client with bound key + runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, - // Full SplitFactory returns a default instance, except a valid one is provided - localhost: validateLocalhostWithDefault, + localhost: validateLocalhostWithDefault, // Full SplitFactory provides a default localhost module, except a valid one is provided + consent: validateConsent, }; export function settingsValidator(config: any) { diff --git a/src/settings/index.ts b/src/settings/index.ts index d495033..00f939f 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -1,17 +1,21 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index'; import { defaults } from './defaults'; +import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime'; import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS'; import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/pluggable'; +import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent'; const params = { defaults, + acceptKey: true, // Client with bound key + runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, - // Slim SplitFactory validates that the localhost module is passed in localhost mode - localhost: validateLocalhost, + localhost: validateLocalhost, // Slim SplitFactory validates that the localhost module is passed in localhost mode + consent: validateConsent, }; export function settingsValidator(config: any) { diff --git a/src/splitFactory.ts b/src/splitFactory.ts index fa72775..fa4d022 100644 --- a/src/splitFactory.ts +++ b/src/splitFactory.ts @@ -2,18 +2,19 @@ import { settingsValidator } from './settings'; import { getModules } from './platform/getModules'; import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index'; import type { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { merge } from '@splitsoftware/splitio-commons/src/utils/lang'; /** * Slim SplitFactory for React Native. * Doesn't include localhost mode out-of-the-box. * - * @param config Configuration object used to instantiates the SDK - * @param customModules Optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. + * @param config Configuration object used to instantiate the SDK + * @param __updateModules Optional function that lets redefine internal SDK modules. Use with + * caution since, unlike `config`, this param is not validated neither considered part of the public API. * @throws Will throw an error if the provided config is invalid. */ -export function SplitFactory(config: any, customModules?: Partial) { +export function SplitFactory(config: any, __updateModules: (modules: ISdkFactoryParams) => void) { const settings = settingsValidator(config); const modules = getModules(settings); - return sdkFactory(customModules ? (merge(modules, customModules) as ISdkFactoryParams) : modules); + if (__updateModules) __updateModules(modules); + return sdkFactory(modules); } diff --git a/types/full/index.d.ts b/types/full/index.d.ts index d3283a6..13bf73d 100644 --- a/types/full/index.d.ts +++ b/types/full/index.d.ts @@ -1,4 +1,4 @@ -// Declaration file for React Native Split Software SDK v1.0.0 +// Declaration file for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya diff --git a/types/index.d.ts b/types/index.d.ts index 4cac88b..655da3e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,4 +1,4 @@ -// Declaration file for React Native Split Software SDK v1.0.0 +// Declaration file for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya @@ -12,7 +12,7 @@ declare module JsSdk { * Recommended to use for bundle size reduction in production, since it doesn't include localhost mode out-of-the-box * @see {@link https://help.split.io/hc/en-us/articles/4406066357901#localhost-mode}. * - * The settings parameter should be an object that complies with the SplitIO.IBrowserSettings. + * The settings parameter should be an object that complies with the SplitIO.IReactNativeSettings. * For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/4406066357901#configuration} */ export function SplitFactory(settings: SplitIO.IReactNativeSettings): SplitIO.ISDK; diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 9f0a707..05e04b2 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Native Split Software SDK v1.0.0 +// Type definitions for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya @@ -9,11 +9,11 @@ export = SplitIO; * EventEmitter interface based on a subset of the NodeJS.EventEmitter methods. */ interface IEventEmitter { - addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: string, listener: (...args: any[]) => void): this on(event: string, listener: (...args: any[]) => void): this once(event: string, listener: (...args: any[]) => void): this - removeListener(event: string, listener: (...args: any[]) => void): this; - off(event: string, listener: (...args: any[]) => void): this; + removeListener(event: string, listener: (...args: any[]) => void): this + off(event: string, listener: (...args: any[]) => void): this removeAllListeners(event?: string): this emit(event: string, ...args: any[]): boolean } @@ -50,6 +50,7 @@ interface ISettings { readonly scheduler: { featuresRefreshRate: number, impressionsRefreshRate: number, + impressionsQueueSize: number, segmentsRefreshRate: number, offlineRefreshRate: number, eventsPushRate: number, @@ -81,7 +82,8 @@ interface ISettings { splitFilters: SplitIO.SplitFilter[], impressionsMode: SplitIO.ImpressionsMode, localhostMode?: SplitIO.LocalhostFactory - } + }, + readonly userConsent: SplitIO.ConsentStatus } /** * Log levels. @@ -181,7 +183,7 @@ interface ISharedSettings { */ impressionsMode?: SplitIO.ImpressionsMode, /** - * Defines the factory function to instanciate the SDK in localhost mode. + * Defines the factory function to instantiate the SDK in localhost mode. * * NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode. * @@ -334,12 +336,17 @@ declare namespace SplitIO { type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update'; /** * Split attributes should be on object with values of type string or number (dates should be sent as millis since epoch). - * @typedef {Object.} Attributes + * @typedef {Object.} Attributes * @see {@link https://help.split.io/hc/en-us/articles/4406066357901#attribute-syntax} */ type Attributes = { - [attributeName: string]: string | number | boolean | Array + [attributeName: string]: AttributeType }; + /** + * Type of an attribute value + * @typedef {string | number | boolean | Array} AttributeType + */ + type AttributeType = string | number | boolean | Array; /** * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb. * @typedef {Object.} Attributes @@ -495,7 +502,10 @@ declare namespace SplitIO { * By returning an integration, the SDK will queue events and impressions into it. * Input parameter details are not part of the public API. */ - type IntegrationFactory = (params: {}) => (Integration | void) + type IntegrationFactory = { + readonly type: string + (params: {}): (Integration | void) + } /** * A pair of user key and it's trafficType, required for tracking valid Split events. * @typedef {Object} Identity @@ -580,6 +590,11 @@ declare namespace SplitIO { * @typedef {string} ImpressionsMode */ type ImpressionsMode = 'OPTIMIZED' | 'DEBUG'; + /** + * User consent status. + * @typedef {string} ConsentStatus + */ + type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN'; /** * Logger * Its interface details are not part of the public API. It shouldn't be used directly. @@ -644,6 +659,13 @@ declare namespace SplitIO { * @default 60 */ impressionsRefreshRate?: number, + /** + * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer. + * If you use a 0 here, the queue will have no maximum size. + * @property {number} impressionsQueueSize + * @default 30000 + */ + impressionsQueueSize?: number, /** * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds. * @property {number} segmentsRefreshRate @@ -706,7 +728,7 @@ declare namespace SplitIO { */ features?: MockedFeaturesMap, /** - * Defines the factory function to instanciate the storage. If not provided, the default IN MEMORY storage is used. + * Defines the factory function to instantiate the storage. If not provided, the default IN MEMORY storage is used. * @property {Object} storage * @todo at the moment there are not storages to plug in React Native SDK. */ @@ -723,6 +745,17 @@ declare namespace SplitIO { * @todo at the moment there are not integrations to plug in React Native SDK. */ integrations?: IntegrationFactory[], + /** + * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`. + * - `'GRANTED'`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. + * - `'DECLINED'`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. + * - `'UNKNOWN'`: the user has neither granted nor declined consent for tracking events and impressions. The SDK will track them in its internal storage, and eventually send + * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `setUserConsent` factory method. + * + * @typedef {string} userConsent + * @default 'GRANTED' + */ + userConsent?: ConsentStatus } /** * This represents the interface for the SDK instance with synchronous storage and client-side API, @@ -732,13 +765,13 @@ declare namespace SplitIO { */ export interface ISDK extends IBasicSDK { /** - * Returns the default client instance of the SDK, associated with the key and optional traffic type from settings. + * Returns the default client instance of the SDK, associated with the key provided on settings. * @function client * @returns {IClient} The client instance. */ client(): IClient, /** - * Returns a shared client of the SDK, associated with the given key and optional traffic type. + * Returns a shared client of the SDK, associated with the given key. * @function client * @param {SplitKey} key The key for the new client instance. * @returns {IClient} The client instance. @@ -749,7 +782,26 @@ declare namespace SplitIO { * @function manager * @returns {IManager} The manager instance. */ - manager(): IManager + manager(): IManager, + /** + * Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively. + * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. + * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. + * + * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory. + * + * @function setUserConsent + * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'. + * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not. + */ + setUserConsent(userConsent: boolean): boolean; + /** + * Get the user consent status. + * + * @function getUserConsent + * @returns {ConsentStatus} The user consent status. + */ + getUserConsent(): SplitIO.ConsentStatus; } /** @@ -759,35 +811,35 @@ declare namespace SplitIO { */ interface IClientSS extends IBasicClient { /** - * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature. + * Returns a Treatment value, which is the treatment string for the given feature. * @function getTreatment * @param {string} key - The string key representing the consumer. * @param {string} splitName - The string that represents the split we wan't to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment or treatment promise which will resolve to the treatment string. + * @returns {Treatment} The treatment string. */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value (a map of treatment and config), which will be (or eventually be) the map with treatment and config for the given feature. + * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature. * @function getTreatmentWithConfig * @param {string} key - The string key representing the consumer. * @param {string} splitName - The string that represents the split we wan't to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The TreatmentWithConfig or TreatmentWithConfig promise which will resolve to the map containing - * the treatment and the configuration stringified JSON (or null if there was no config for that treatment). + * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the + * configuration stringified JSON (or null if there was no config for that treatment). */ getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * Returns a Treatments value, which is an object map with the treatments for the given features. * @function getTreatments * @param {string} key - The string key representing the consumer. * @param {Array} splitNames - An array of the split names we wan't to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * @function getTreatmentsWithConfig * @param {string} key - The string key representing the consumer. * @param {Array} splitNames - An array of the split names we wan't to get the treatments. @@ -803,7 +855,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, } @@ -825,7 +877,7 @@ declare namespace SplitIO { */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment, /** - * Returns a TreatmentWithConfig value, which will be (or eventually be) a map with both treatment and config string for the given feature. + * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature. * For usage on NodeJS as we don't have only one key. * NOTE: Treatment will be a promise only in async storages, like REDIS. * @function getTreatmentWithConfig @@ -836,17 +888,17 @@ declare namespace SplitIO { */ getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features. * For usage on NodeJS as we don't have only one key. * @function getTreatments * @param {string} key - The string key representing the consumer. * @param {Array} splitNames - An array of the split names we wan't to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object. + * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments, /** - * Returns a Treatments value, whick will be (or eventually be) an object with all the maps of treatment and config string for the given features. + * Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * For usage on NodeJS as we don't have only one key. * @function getTreatmentsWithConfig * @param {string} key - The string key representing the consumer. @@ -863,7 +915,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue succesfully or not. + * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise } @@ -874,31 +926,31 @@ declare namespace SplitIO { */ interface IClient extends IBasicClient { /** - * Returns a Treatment value, which will be the treatment string for the given feature. + * Returns a Treatment value, which is the treatment string for the given feature. * @function getTreatment * @param {string} splitName - The string that represents the split we wan't to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment result. + * @returns {Treatment} The treatment string. */ getTreatment(splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value, which will be a map of treatment and the config for that treatment. - * @function getTreatment + * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature. + * @function getTreatmentWithConfig * @param {string} splitName - The string that represents the split we wan't to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The treatment or treatment promise which will resolve to the treatment string. + * @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment). */ getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * Returns a Treatments value, which is an object map with the treatments for the given features. * @function getTreatments * @param {Array} splitNames - An array of the split names we wan't to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * @function getTreatmentsWithConfig * @param {Array} splitNames - An array of the split names we wan't to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. @@ -912,9 +964,50 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, + /** + * Add an attribute to client's in memory attributes storage. + * + * @param {string} attributeName Attribute name + * @param {AttributeType} attributeValue Attribute value + * @returns {boolean} true if the attribute was stored and false otherwise + */ + setAttribute(attributeName: string, attributeValue: AttributeType): boolean, + /** + * Returns the attribute with the given key. + * + * @param {string} attributeName Attribute name + * @returns {AttributeType} Attribute with the given key + */ + getAttribute(attributeName: string): AttributeType, + /** + * Removes from client's in memory attributes storage the attribute with the given key. + * + * @param {string} attributeName + * @returns {boolean} true if attribute was removed and false otherwise + */ + removeAttribute(attributeName: string): boolean, + /** + * Add to client's in memory attributes storage the attributes in 'attributes'. + * + * @param {Attributes} attributes Object with attributes to store + * @returns true if attributes were stored an false otherwise + */ + setAttributes(attributes: Attributes): boolean, + /** + * Return all the attributes stored in client's in memory attributes storage. + * + * @returns {Attributes} returns all the stored attributes + */ + getAttributes(): Attributes, + /** + * Remove all the stored attributes in the client's in memory attribute storage. + * + * @returns {boolean} true if all attribute were removed and false otherwise + */ + clearAttributes(): boolean, } /** * Representation of a manager instance with synchronous storage of the SDK. @@ -927,20 +1020,20 @@ declare namespace SplitIO { * @function names * @returns {SplitNames} The lists of Split names. */ - names(): SplitNames; + names(): SplitNames, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViews} The list of SplitIO.SplitView. */ - splits(): SplitViews; + splits(): SplitViews, /** * Get the data of a split in SplitView format. * @function split * @param {string} splitName The name of the split we wan't to get info of. * @returns {SplitView} The SplitIO.SplitView of the given split. */ - split(splitName: string): SplitView; + split(splitName: string): SplitView, } /** * Representation of a manager instance with asynchronous storage of the SDK. @@ -953,19 +1046,19 @@ declare namespace SplitIO { * @function names * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames. */ - names(): SplitNamesAsync; + names(): SplitNamesAsync, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list. */ - splits(): SplitViewsAsync; + splits(): SplitViewsAsync, /** * Get the data of a split in SplitView format. * @function split * @param {string} splitName The name of the split we wan't to get info of. * @returns {SplitViewAsync} A promise that will resolve to the SplitIO.SplitView value. */ - split(splitName: string): SplitViewAsync; + split(splitName: string): SplitViewAsync, } }