Skip to content

Commit 463391c

Browse files
authored
fix: Client version in dispatched event now shows React SDK version instead of underlying Javscript SDK (#7)
## Summary Javascript SDK Client version was being sent in dispatched events. Changed it to send React SDK client version. ## Test Plan Manually tested thoroughly
1 parent d960234 commit 463391c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
### Fixed
10+
- Javascript SDK Client version was being sent in dispatched events. Changed it to send React SDK client version.
11+
912
## [1.0.0] - September 27th, 2019
1013

1114
Initial release

src/client.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ describe('ReactSDKClient', () => {
7979
expect(createInstanceSpy.mock.results[0].value).toBe(instance.client)
8080
})
8181

82-
it('adds clientEngine react-sdk the config, and passed the config to createInstance', () => {
82+
it('adds react-sdk clientEngine and clientVersion to the config, and passed the config to createInstance', () => {
8383
createInstance(config)
8484
expect(createInstanceSpy).toBeCalledTimes(1)
8585
expect(createInstanceSpy).toBeCalledWith({
8686
...config,
8787
clientEngine: 'react-sdk',
88+
clientVersion: '1.0.0',
8889
})
8990
})
9091

src/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type OnReadyResult = {
3333
}
3434

3535
const REACT_SDK_CLIENT_ENGINE = 'react-sdk'
36+
const REACT_SDK_CLIENT_VERSION = '1.0.0'
3637

3738
export interface ReactSDKClient extends optimizely.Client {
3839
user: UserContext
@@ -146,11 +147,12 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
146147

147148
this.userPromiseResovler = () => {}
148149

149-
const configWithClientEngine = {
150+
const configWithClientInfo = {
150151
...config,
151152
clientEngine: REACT_SDK_CLIENT_ENGINE,
153+
clientVersion: REACT_SDK_CLIENT_VERSION,
152154
}
153-
this._client = optimizely.createInstance(configWithClientEngine)
155+
this._client = optimizely.createInstance(configWithClientInfo)
154156

155157
this.userPromise = new Promise(resolve => {
156158
this.userPromiseResovler = resolve

0 commit comments

Comments
 (0)