Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/sdkClient/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function clientFactory(params: IClientFactoryParams): SplitIO.IClient | S
getTreatmentWithConfig,
getTreatments,
getTreatmentsWithConfig,
track
track,
isBrowserClient: false
} as SplitIO.IClient | SplitIO.IAsyncClient;
}
4 changes: 3 additions & 1 deletion src/sdkClient/clientCS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: Sp
getTreatmentsWithConfig: clientCS.getTreatmentsWithConfig.bind(clientCS, key),

// Key is bound to the `track` method. Same thing happens with trafficType but only if provided
track: trafficType ? clientCS.track.bind(clientCS, key, trafficType) : clientCS.track.bind(clientCS, key)
track: trafficType ? clientCS.track.bind(clientCS, key, trafficType) : clientCS.track.bind(clientCS, key),

isBrowserClient: true
}) as SplitIO.ICsClient;
}
2 changes: 1 addition & 1 deletion src/services/splitHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function splitHttpClientFactory(settings: Pick<ISettings, 'log' | 'versio
return response;
})
.catch(error => {
const resp = error.response;
const resp = error && error.response;
let msg = '';

if (resp) { // An HTTP error
Expand Down
6 changes: 5 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ interface IBasicClient extends IStatusInterface {
* @returns {Promise<void>}
*/
destroy(): Promise<void>

// Whether the client implements the client-side API, i.e, with bound key, (true), or the server-side API (false).
// Exposed for internal purposes only. Not considered part of the public API, and might be renamed eventually.
isBrowserClient: boolean
}
/**
* Common definitions between SDK instances for different environments interface.
Expand Down Expand Up @@ -1139,7 +1143,7 @@ export namespace SplitIO {
/**
* Removes from client's in memory attributes storage the attribute with the given key
* @function removeAttribute
* @param {string} attributeName
* @param {string} attributeName
* @returns {boolean} true if attribute was removed and false otherways
*/
removeAttribute(attributeName: string): boolean,
Expand Down