Skip to content

Commit dabfdab

Browse files
2nd step: move SplitIO namespace definition from React Native SDK to JS-Commons and merge
1 parent a331623 commit dabfdab

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/splitFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getFetch } from './platform/getFetch';
66
import { getEventSource } from './platform/getEventSource';
77
import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents';
88
import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/browser';
9-
import { IBrowserSettings } from '../types/splitio';
9+
import SplitIO from '@splitsoftware/splitio-commons/types/splitio';
1010

1111
const platform = { getFetch, getEventSource, EventEmitter, now };
1212

@@ -18,7 +18,7 @@ const platform = { getFetch, getEventSource, EventEmitter, now };
1818
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
1919
* @throws Will throw an error if the provided config is invalid.
2020
*/
21-
export function SplitFactory(config: IBrowserSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
21+
export function SplitFactory(config: SplitIO.IClientSideSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
2222
const settings = settingsFactory(config);
2323
const modules = getModules(settings, platform);
2424
if (__updateModules) __updateModules(modules);

ts-tests/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ let SDK: SplitIO.ISDK;
3232
// Settings interfaces
3333
// let nodeSettings: SplitIO.INodeSettings;
3434
// let asyncSettings: SplitIO.INodeAsyncSettings;
35-
let browserSettings: SplitIO.IBrowserSettings;
36-
let browserAsyncSettings: SplitIO.IBrowserAsyncSettings;
35+
let browserSettings: SplitIO.IClientSideSettings;
36+
let browserAsyncSettings: SplitIO.IClientSideAsyncSettings;
3737
// Client & Manager APIs
3838
// let client: SplitIO.IClient;
3939
let client: SplitIO.IClient;
@@ -518,7 +518,7 @@ userConsent = AsyncSDK.UserConsent.Status.UNKNOWN;
518518
// Split filters
519519
let splitFilters: SplitIO.SplitFilter[] = [{ type: 'bySet', values: ['set_a', 'set_b'] }, { type: 'byName', values: ['my_split_1', 'my_split_1'] }, { type: 'byPrefix', values: ['my_split', 'test_split_'] }]
520520

521-
let fullBrowserSettings: SplitIO.IBrowserSettings = {
521+
let fullBrowserSettings: SplitIO.IClientSideSettings = {
522522
core: {
523523
authorizationKey: 'asd',
524524
key: 'asd',
@@ -568,7 +568,7 @@ let fullBrowserSettings: SplitIO.IBrowserSettings = {
568568
fullBrowserSettings.userConsent = 'DECLINED';
569569
fullBrowserSettings.userConsent = 'UNKNOWN';
570570

571-
let fullBrowserAsyncSettings: SplitIO.IBrowserAsyncSettings = {
571+
let fullBrowserAsyncSettings: SplitIO.IClientSideAsyncSettings = {
572572
mode: 'consumer',
573573
core: {
574574
authorizationKey: 'asd',

types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ declare module JsSdk {
1010
/**
1111
* Split.io SDK factory function.
1212
*
13-
* The settings parameter should be an object that complies with the SplitIO.IBrowserSettings.
13+
* The settings parameter should be an object that complies with the SplitIO.IClientSideSettings or SplitIO.IClientSideAsyncSettings interfaces.
1414
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
1515
*/
16-
export function SplitFactory(settings: SplitIO.IBrowserSettings): SplitIO.ISDK;
17-
export function SplitFactory(settings: SplitIO.IBrowserAsyncSettings): SplitIO.IAsyncSDK;
16+
export function SplitFactory(config: SplitIO.IClientSideSettings): SplitIO.ISDK;
17+
export function SplitFactory(config: SplitIO.IClientSideAsyncSettings): SplitIO.IAsyncSDK;
1818

1919
/**
2020
* Persistent storage based on the LocalStorage Web API for browsers.

0 commit comments

Comments
 (0)