Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"homepage": "https://github.com/splitio/react-native-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.16.0"
"@splitsoftware/splitio-commons": "1.16.1-rc.5"
},
"devDependencies": {
"@react-native-community/eslint-config": "^2.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/settings/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const defaults = {
readyTimeout: 10,
// Amount of time we will wait before the first push of events.
eventsFirstPushWindow: 10,
// Wait for large segments to emit SDK_READY event.
waitForLargeSegments: true,
},

// Consent is considered granted by default
Expand Down
5 changes: 5 additions & 0 deletions src/settings/full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
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';
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';

const params = {
defaults,
Expand All @@ -22,5 +23,9 @@ export function settingsFactory(config: any) {
const settings = settingsValidation(config, params);
// @ts-ignore. For internal use, flush data on background until a persistent storage is provided.
settings.flushDataOnBackground = true;

// Override in localhost mode to properly emit SDK_READY
if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;

return settings;
}
5 changes: 5 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
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';
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';

const params = {
defaults,
Expand All @@ -22,5 +23,9 @@ export function settingsFactory(config: any) {
const settings = settingsValidation(config, params);
// @ts-ignore. For internal use, flush data on background until a persistent storage is provided.
settings.flushDataOnBackground = true;

// Override in localhost mode to properly emit SDK_READY
if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;

return settings;
}
30 changes: 28 additions & 2 deletions types/splitio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface ISettings {
impressionsQueueSize: number,
telemetryRefreshRate: number,
segmentsRefreshRate: number,
largeSegmentsRefreshRate: number,
offlineRefreshRate: number,
eventsPushRate: number,
eventsQueueSize: number,
Expand All @@ -62,7 +63,8 @@ interface ISettings {
readyTimeout: number,
requestTimeoutBeforeReady: number,
retriesOnFailureBeforeReady: number,
eventsFirstPushWindow: number
eventsFirstPushWindow: number,
waitForLargeSegments: boolean
},
readonly storage?: SplitIO.StorageSyncFactory,
readonly urls: {
Expand All @@ -84,6 +86,8 @@ interface ISettings {
splitFilters: SplitIO.SplitFilter[],
impressionsMode: SplitIO.ImpressionsMode,
enabled: boolean,
largeSegmentsEnabled: boolean,
flagSpecVersion: string,
localhostMode?: SplitIO.LocalhostFactory,
},
readonly userConsent: SplitIO.ConsentStatus
Expand Down Expand Up @@ -704,6 +708,13 @@ declare namespace SplitIO {
* @default 10
*/
eventsFirstPushWindow?: number,
/**
* Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
* It only applies if largeSegmentsEnabled is true.
* @property {boolean} waitForLargeSegments
* @default true
*/
waitForLargeSegments?: boolean
},
/**
* SDK scheduler settings.
Expand Down Expand Up @@ -741,6 +752,13 @@ declare namespace SplitIO {
* @default 60
*/
segmentsRefreshRate?: number,
/**
* The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
* It only applies if largeSegmentsEnabled is true.
* @property {number} largeSegmentsRefreshRate
* @default 60
*/
largeSegmentsRefreshRate?: number,
/**
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
* @property {number} eventsPushRate
Expand Down Expand Up @@ -824,7 +842,15 @@ declare namespace SplitIO {
* @typedef {string} userConsent
* @default 'GRANTED'
*/
userConsent?: ConsentStatus
userConsent?: ConsentStatus,
sync?: ISharedSettings['sync'] & {
/**
* Enables synchronization of large segments.
* @property {boolean} largeSegmentsEnabled
* @default false
*/
largeSegmentsEnabled?: boolean
}
}
/**
* This represents the interface for the SDK instance with synchronous storage and client-side API,
Expand Down