Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 2.17.1 release #204

Merged
merged 519 commits into from
Mar 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
519 commits
Select commit Hold shift + click to select a range
e1af671
update jest to avoid some vulnerable dependencies
eli-darkly Mar 7, 2019
540db38
update sinon to avoid vulnerable dependency
eli-darkly Mar 7, 2019
e5e394f
update babel-jest to avoid an "npm audit" warning
eli-darkly Mar 7, 2019
7e6f6e2
Merge pull request #171 from launchdarkly/eb/ch33508/deps
eli-darkly Mar 7, 2019
173ec56
Update README.md (#170)
yusinto Mar 11, 2019
fd91889
[ch32994] Fix React SDK bootstrap logic (#169)
yusinto Mar 11, 2019
25fc39e
try Node 11.10.1 to avoid Jest problem
eli-darkly Mar 11, 2019
52d1ac8
Merge pull request #172 from launchdarkly/eb/ch33781/node-version
eli-darkly Mar 11, 2019
b0d7924
update changelog for version 2.9.5
eli-darkly Mar 12, 2019
6bbfbf6
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly Mar 12, 2019
a3d54ab
version 2.9.5
eli-darkly Mar 12, 2019
124ba3f
version 2.9.5
eli-darkly Mar 12, 2019
8a8cd80
Merge branch '2.9.5'
eli-darkly Mar 12, 2019
d6eac19
Merge pull request #166 from launchdarkly/eb/ch33425/experimentation
eli-darkly Mar 12, 2019
3dfdc21
Merge branch 'master' into experiment
eli-darkly Mar 13, 2019
6a22b48
rm -> rimraf
hroederld Mar 26, 2019
507f555
Merge pull request #173 from launchdarkly/hr/ch24812/rmonwindowsfix
hroederld Mar 27, 2019
8b21cdc
add azure pipeline
hroederld Mar 27, 2019
4a55655
Merge pull request #174 from launchdarkly/hr/windowsci
hroederld Mar 27, 2019
904e6b5
coerce user attributes into strings when necessary
eli-darkly Mar 29, 2019
8ffcff1
linter
eli-darkly Mar 29, 2019
caa749e
asyncify tests, simplify HTTP mocking, general cleanup
eli-darkly Mar 30, 2019
5d4c1de
rm unused
eli-darkly Mar 30, 2019
e064a3d
generate keys for anonymous users
eli-darkly Apr 2, 2019
0b04950
fix error handling
eli-darkly Apr 2, 2019
800b756
linter
eli-darkly Apr 2, 2019
2c59c9b
make user key optional in TypeScript defs
eli-darkly Apr 2, 2019
528a2eb
misc cleanup of validateUser
eli-darkly Apr 2, 2019
8fd4fc9
move Promise-wrapping of validateUser, for clarity
eli-darkly Apr 2, 2019
39e1964
linter
eli-darkly Apr 2, 2019
b6bbe01
Merge pull request #175 from launchdarkly/eb/ch35206/stringify-attrs
eli-darkly Apr 3, 2019
e266703
Merge pull request #176 from launchdarkly/eb/async-tests
eli-darkly Apr 5, 2019
39d3dbf
Merge pull request #177 from launchdarkly/eb/ch18858/anon-user-key
eli-darkly Apr 5, 2019
a098f2f
add more general HTTP abstraction, use Promises internally
eli-darkly Apr 9, 2019
ccb0836
eliminate some more uses of callbacks; update tests
eli-darkly Apr 9, 2019
288ea52
linter
eli-darkly Apr 9, 2019
adc301f
rm unused
eli-darkly Apr 9, 2019
e7fdc4e
fix init tests
eli-darkly Apr 9, 2019
9b096e4
fix init tests again
eli-darkly Apr 9, 2019
38d4e75
make stream init logic more reliable
eli-darkly Apr 10, 2019
2832c55
add another HTTP test
eli-darkly Apr 10, 2019
5d39679
better network errors
eli-darkly Apr 11, 2019
5d3aa4d
Merge branch 'master' into experiment
eli-darkly Apr 15, 2019
aea3145
support metric value in track()
eli-darkly Apr 15, 2019
2c0fed3
comment
eli-darkly Apr 16, 2019
bc15c00
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly Apr 17, 2019
96f2e6d
update method description
eli-darkly Apr 17, 2019
343de29
Merge pull request #179 from launchdarkly/eb/ch33425/metric-value
eli-darkly Apr 17, 2019
d258337
Merge branch 'master' into eb/ch35956/http-cleanup
eli-darkly Apr 17, 2019
35eaa2f
Merge pull request #178 from launchdarkly/eb/ch35956/http-cleanup
eli-darkly Apr 17, 2019
0aadc83
refactor to isolate the sync XHR logic; expose close() method
eli-darkly Apr 17, 2019
9039f9f
rm unused
eli-darkly Apr 17, 2019
b88d3cb
fix broken readme links
bwoskow-ld Apr 18, 2019
33a3c8a
absolute links
bwoskow-ld Apr 18, 2019
cfc1326
clarify common package
bwoskow-ld Apr 18, 2019
5ef8675
Merge pull request #182 from launchdarkly/bw/fix-broken-readme-links
bwoskow-ld Apr 18, 2019
2032179
sync requests should never be retried
eli-darkly Apr 19, 2019
da8c8cc
Merge pull request #181 from launchdarkly/eb/ch36705/refactor-sync-xhr
eli-darkly Apr 19, 2019
e88e4a3
add script to publish docs to Github Pages
eli-darkly Apr 19, 2019
b059bb4
can't delete a directory while we're in it
eli-darkly Apr 19, 2019
148c235
fix a GH Pages configuration problem
eli-darkly Apr 19, 2019
b55794b
readme link to generated docs
eli-darkly Apr 19, 2019
dcb39ef
Merge pull request #183 from launchdarkly/eb/ch30937/publish-docs
eli-darkly Apr 19, 2019
c7c4e60
fix uuid dependency, add unit tests for user key
eli-darkly Apr 19, 2019
f827e41
linter
eli-darkly Apr 19, 2019
663b822
rm debugging
eli-darkly Apr 19, 2019
389f236
revert accidental change
eli-darkly Apr 19, 2019
036e31c
revert accidental change
eli-darkly Apr 19, 2019
4d624ab
Merge pull request #184 from launchdarkly/eb/ch18858/uuid-crypto-dep
eli-darkly Apr 19, 2019
25e3bc9
Merge branch 'master' into eb/ch35956/http-headers
eli-darkly Apr 19, 2019
6fb3f94
change HTTP response handling to avoid CORS header errors
eli-darkly Apr 19, 2019
cae70b4
Merge pull request #185 from launchdarkly/eb/ch35956/http-headers
eli-darkly Apr 20, 2019
503bebe
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly Apr 20, 2019
8d48889
don't use Promise.finally()
eli-darkly Apr 23, 2019
dae51eb
Merge pull request #187 from launchdarkly/eb/ch37469/no-finally
eli-darkly Apr 23, 2019
2594bb7
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly Apr 24, 2019
a46cc28
allow Electron and Node SDKs to report their own SDK version
eli-darkly Apr 27, 2019
7fa36af
Merge pull request #188 from launchdarkly/eb/ch37716/sdk-version
eli-darkly Apr 27, 2019
a143aab
apply markdown templates
bwoskow-ld Apr 30, 2019
14135aa
markdown fixes
bwoskow-ld Apr 30, 2019
d51c0a5
rename package ids
bwoskow-ld May 1, 2019
d2a28d2
add new JS SDK test/demo page
eli-darkly May 1, 2019
89e7ace
Merge pull request #189 from launchdarkly/bw/36771/apply-markdown-tem…
bwoskow-ld May 2, 2019
d84451e
misc doc edits
eli-darkly May 2, 2019
7a53f4a
Merge pull request #192 from launchdarkly/eb/doc-edits
eli-darkly May 2, 2019
20d3bb0
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly May 2, 2019
1b5f965
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
bwoskow-ld May 3, 2019
d0d87ec
Merge pull request #190 from launchdarkly/bw/ch36754/rename-package-ids
bwoskow-ld May 3, 2019
4732080
Merge branch 'bw/36771/apply-markdown-templates' of github.com:launch…
bwoskow-ld May 4, 2019
8a00b23
fixing merge error
bwoskow-ld May 4, 2019
2b0ea42
fixing merge error
bwoskow-ld May 4, 2019
ddd30a2
fix broken links on npmjs.com (#193)
bwoskow-ld May 7, 2019
dc0045f
update lockfiles for new packages
eli-darkly May 8, 2019
d15517b
Merge branch 'master' of github.com:launchdarkly/js-client
eli-darkly May 8, 2019
f3bd889
fix changelog formatting error that messes up the release script
eli-darkly May 10, 2019
b016a78
Specify unpkg default target file in package.json for
gwhelanLD May 20, 2019
a1ceb4d
Merge pull request #195 from launchdarkly/gw/ch39115/unpkg-min-js
gwhelanLD May 20, 2019
ac1cf04
Correct requestor call to fetch flags on a received ping event.
gwhelanLD May 21, 2019
ffdbbb4
Merge pull request #197 from launchdarkly/gw/ch39114/ping-stream
gwhelanLD May 21, 2019
d258832
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
gwhelanLD May 22, 2019
5f6a2f8
merge from public after release
LaunchDarklyCI May 22, 2019
decb730
Implement Hooks API (#196)
yusinto May 22, 2019
51cc15c
bumping our lerna version to resolve transitive dependency vulnerabil…
bwoskow-ld May 31, 2019
49bbca2
Merge branch 'master' into experiment
eli-darkly Jun 6, 2019
c148884
merge from public after release
LaunchDarklyCI Jun 7, 2019
cb19f25
fix goals query logic for Electron, also fix handling of invalid cont…
eli-darkly Jun 14, 2019
a5cfb07
Merge pull request #199 from launchdarkly/eb/ch40967/electron-goals
eli-darkly Jun 17, 2019
cb9124e
add ability to alter URL in events
eli-darkly Jun 17, 2019
a532ce7
Merge pull request #200 from launchdarkly/eb/ch41207/url-path-prefix
eli-darkly Jun 18, 2019
bc95369
merge from public after release
LaunchDarklyCI Jun 18, 2019
4a609cb
Merge branch 'master' into experiment
eli-darkly Jun 18, 2019
d894e44
Update browserPlatform definition to detect when an EventSource
gwhelanLD Jun 19, 2019
ea142cd
Fix initial linter warnings.
gwhelanLD Jun 19, 2019
a3f3b71
Fix another linter warning.
gwhelanLD Jun 19, 2019
839400c
fix a broken readme link (#202)
bwoskow-ld Jun 25, 2019
72f84f7
removing a stray character in the readme
bwoskow-ld Jun 25, 2019
ad9de1f
fix stream reconnect logic and add stream connection logging
eli-darkly Jun 27, 2019
b5465ea
linter
eli-darkly Jun 27, 2019
cf2637a
assume logger always exists, as we do in other components
eli-darkly Jun 27, 2019
bbf8a69
Merge pull request #203 from launchdarkly/eb/ch42125/stream-reconnect
eli-darkly Jun 27, 2019
3903fd7
fix and simplify how the logger object is passed around
eli-darkly Jun 28, 2019
0bc0b22
Merge pull request #204 from launchdarkly/eb/ch42125/fix-loggers
eli-darkly Jun 28, 2019
5e64220
merge from public after release
LaunchDarklyCI Jun 28, 2019
5b5b16d
Merge branch 'master' into experiment
eli-darkly Jun 28, 2019
9b9de28
make it so eventUrlTransformer actually does something
eli-darkly Jun 29, 2019
5a3cffb
linter
eli-darkly Jun 29, 2019
850bf08
Merge pull request #205 from launchdarkly/eb/ch41207/fix-url-transform
eli-darkly Jun 29, 2019
e0dca4a
merge from public after release
LaunchDarklyCI Jun 29, 2019
cf99467
copy flags object to prevent subtle update problem in Electron
eli-darkly Jul 4, 2019
b9eaec5
additional fix + test
eli-darkly Jul 4, 2019
74f2ea5
make bootstrapped flags available immediately
eli-darkly Jul 8, 2019
1990aa3
Refactor some of the EventSource constructor selection logic.
gwhelanLD Jul 8, 2019
f99d9ed
Merge branch 'master' into gw/ch15353/report-stream
gwhelanLD Jul 8, 2019
ac65049
Merge pull request #207 from launchdarkly/eb/ch42598/immediate-bootstrap
eli-darkly Jul 8, 2019
712b590
Merge pull request #206 from launchdarkly/eb/ch42529/change-event
eli-darkly Jul 8, 2019
202498a
Change browserPlatform.js to check config options when determining
gwhelanLD Jul 8, 2019
855e547
Deal with linter.
gwhelanLD Jul 8, 2019
ef9d5e6
merge from public after release
LaunchDarklyCI Jul 8, 2019
a4a247e
Merge pull request #201 from launchdarkly/gw/ch15353/report-stream
gwhelanLD Jul 9, 2019
dba61bf
Merge branch 'master' into eb/ch37354/demo
eli-darkly Jul 9, 2019
7c322c8
change how supported options are detected in EventSource polyfill
eli-darkly Jul 9, 2019
1d20c38
Merge pull request #208 from launchdarkly/eb/ch15353/report-stream
eli-darkly Jul 10, 2019
edaab07
fix broken homepage attributes (#209)
bwoskow-ld Jul 10, 2019
efd4c2c
merge from public after release
LaunchDarklyCI Jul 11, 2019
08b705e
improve bad initialization messages (#210)
bwoskow-ld Jul 11, 2019
84ec55f
fixing a broken link in a logged message (#212)
bwoskow-ld Jul 18, 2019
fe08546
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Jul 29, 2019
0189751
merge from public after release
LaunchDarklyCI Jul 29, 2019
fe930da
add jsdelivr attribute to js packages (#213)
bwoskow-ld Aug 1, 2019
d68a635
adding an option to disable the camel-casing of flag keys (#214)
bwoskow-ld Aug 12, 2019
ae8aa69
use persistent anonymous user logic by default in react sdk (#216)
bwoskow-ld Aug 12, 2019
810c684
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
bwoskow-ld Aug 15, 2019
05f854d
merge from public after release
LaunchDarklyCI Aug 15, 2019
a05309d
remove React package from monorepo
eli-darkly Sep 6, 2019
8ffd505
make link text match link
eli-darkly Sep 6, 2019
b8320c1
Merge pull request #218 from launchdarkly/eb/ch48625/remove-react
eli-darkly Sep 9, 2019
636e838
Merge branch 'master' of github.com:launchdarkly/js-client-sdk-privat…
zmdavis Sep 23, 2019
8fbdd87
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Oct 2, 2019
3854728
improve log format and add configurable prefix
eli-darkly Oct 9, 2019
8005f13
fix test
eli-darkly Oct 9, 2019
9da6dd7
linter
eli-darkly Oct 9, 2019
ef238c4
Merge pull request #219 from launchdarkly/eb/ch52309/log-format
eli-darkly Oct 10, 2019
00d8142
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Oct 10, 2019
46a015f
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
bwoskow-ld Oct 11, 2019
6683ad7
deprecate samplingInterval
eli-darkly Oct 17, 2019
cf35f0b
linter
eli-darkly Oct 17, 2019
12d18e5
Merge pull request #220 from launchdarkly/eb/ch38635/deprecate-sampling
eli-darkly Oct 17, 2019
7aa81f4
improve log message for stream connection failures (#221)
bwoskow-ld Oct 28, 2019
6d8216f
updating the js-common readme to mention client-side node (#222)
bwoskow-ld Oct 29, 2019
9e50339
remove common package, no more monorepo
eli-darkly Oct 30, 2019
7e09455
add Releaser metadata
eli-darkly Oct 30, 2019
a460085
npm audit fix
eli-darkly Oct 30, 2019
bdc72e7
unify Rollup config
eli-darkly Oct 30, 2019
fd45520
Merge branch 'master' into eb/ch37354/demo
eli-darkly Oct 31, 2019
9beb82f
migrate new demo code to new package structure
eli-darkly Oct 31, 2019
5af9fb6
moved example folder
eli-darkly Oct 31, 2019
d38871d
syntax fix in demo
eli-darkly Nov 4, 2019
4722400
fix directory name
eli-darkly Nov 4, 2019
70ea56a
fix linting
eli-darkly Nov 4, 2019
94a8bd1
Merge pull request #223 from launchdarkly/eb/ch48393/remove-common-pkg
eli-darkly Nov 4, 2019
6209205
use spread operator instead of Object.assign
eli-darkly Nov 4, 2019
227accd
Merge pull request #224 from launchdarkly/eb/ch54985/object-assign
eli-darkly Nov 4, 2019
4c6476f
don't close client on beforeunload, but do flush events
eli-darkly Nov 5, 2019
ce81189
typo
eli-darkly Nov 5, 2019
6c4728f
clarify test postconditions
eli-darkly Nov 5, 2019
d4c3b06
Merge pull request #225 from launchdarkly/eb/ch55109/beforeunload
eli-darkly Nov 5, 2019
c944bc6
Merge branch 'demo-new-build' into eb/ch37354/demo
eli-darkly Nov 5, 2019
7509e8c
Merge branch 'master' into eb/ch37354/demo
eli-darkly Nov 5, 2019
7547396
misc test app improvements for testing beforeunload handler
eli-darkly Nov 5, 2019
153f5ef
Merge pull request #191 from launchdarkly/eb/ch37354/demo
eli-darkly Nov 5, 2019
8e20332
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Nov 5, 2019
5963c2f
merge from public after release
LaunchDarklyCI Nov 5, 2019
67bdf02
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Nov 6, 2019
4c5ab24
rm unused yarn.lock
eli-darkly Nov 6, 2019
6c5f960
rm typedoc dependency, don't commit installation of it during release
eli-darkly Nov 6, 2019
95da8b3
fix paths
eli-darkly Nov 6, 2019
298ed11
fix file copying logic
eli-darkly Nov 6, 2019
8b5d084
Merge pull request #226 from launchdarkly/eb/ch55415/typedoc-dep
eli-darkly Nov 6, 2019
6fc3c94
merge from public after release
LaunchDarklyCI Nov 6, 2019
86299f9
pr template
bwoskow-ld Nov 7, 2019
c81d53a
revert
bwoskow-ld Nov 7, 2019
db369c8
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
bwoskow-ld Nov 7, 2019
f0ce0f8
fix programmatically reported version string
eli-darkly Nov 14, 2019
2965ba1
Merge pull request #227 from launchdarkly/eb/ch56237
eli-darkly Nov 14, 2019
34d9a0f
upgrade Typescript to avoid Typedoc incompatibility
eli-darkly Nov 15, 2019
5a04414
Revert "upgrade Typescript to avoid Typedoc incompatibility"
eli-darkly Nov 15, 2019
89438e5
update Babel, Jest, Rollup
eli-darkly Nov 15, 2019
c709922
Merge pull request #228 from launchdarkly/eb/ch56269/build-tools
eli-darkly Nov 15, 2019
f49c240
merge from public after release
LaunchDarklyCI Nov 15, 2019
3154c05
remove old releaser (#229)
bwoskow-ld Nov 26, 2019
5fe9de4
remove unused Rollup plugins, update dependencies
eli-darkly Dec 4, 2019
2ed1231
Merge pull request #230 from launchdarkly/eb/ch57982/rollup-plugins
eli-darkly Dec 4, 2019
301348b
use new config validation mechanism in js-sdk-common 3.x
eli-darkly Dec 11, 2019
1a04e46
Merge pull request #231 from launchdarkly/eb/ch57985/config-validation
eli-darkly Dec 12, 2019
d74e680
add image-loading event delivery logic factored out of js-sdk-common
eli-darkly Dec 12, 2019
e525b00
Merge branch 'master' into eb/ch59034/image-loading-events
eli-darkly Dec 12, 2019
f3330a7
enable diagnostic events in JS SDK
eli-darkly Dec 12, 2019
96791a1
lint
eli-darkly Dec 12, 2019
7787c59
fix tests
eli-darkly Dec 12, 2019
9879af0
use common 3.0.0-beta2
eli-darkly Dec 12, 2019
2f1b220
use 3.1.0-beta3, fix property name
eli-darkly Dec 12, 2019
70cc7bb
lint
eli-darkly Dec 16, 2019
b7a8b3a
use js-sdk-common 3.1.0
eli-darkly Dec 16, 2019
3c2f9bf
merge from public after release
LaunchDarklyCI Dec 16, 2019
02d4daf
Merge branch 'master' into eb/ch59034/image-loading-events
eli-darkly Dec 18, 2019
3038603
Merge pull request #232 from launchdarkly/eb/ch59034/image-loading-ev…
eli-darkly Dec 18, 2019
b744406
use js-sdk-common 3.1.1 for event payload ID fix
eli-darkly Jan 15, 2020
3ca7119
Merge pull request #234 from launchdarkly/eb/ch61092/commonsdk-fix
eli-darkly Jan 15, 2020
448e351
merge from public after release
LaunchDarklyCI Jan 16, 2020
5e22e76
Merge branch 'master' of github.com:launchdarkly/js-client-sdk
eli-darkly Jan 27, 2020
152a246
merge from public after release
LaunchDarklyCI Jan 27, 2020
e13c33b
use js-sdk-common 3.1.2 and loosen our other dependency
eli-darkly Feb 1, 2020
7041236
Merge pull request #235 from launchdarkly/eb/ch63559/deps
eli-darkly Feb 5, 2020
8c21b80
merge from public after release
LaunchDarklyCI Feb 6, 2020
cad066a
fix license
eli-darkly Feb 8, 2020
018d52c
Merge pull request #236 from launchdarkly/eb/ch64906/license
eli-darkly Feb 8, 2020
6ce9e2d
use js-sdk-common 3.2.0-beta1
eli-darkly Feb 11, 2020
b82005f
SDK name should be js-client-sdk
eli-darkly Feb 11, 2020
fe82c4e
Merge branch 'diagnostic-events' into eb/ch57741/diagnostic-events
eli-darkly Feb 11, 2020
1e7d16a
misc fixes
eli-darkly Feb 12, 2020
105d0be
use js-sdk-common 3.2.0
eli-darkly Feb 12, 2020
b12d0c5
use js-sdk-common 3.2.0
eli-darkly Feb 12, 2020
914cad2
Merge pull request #233 from launchdarkly/eb/ch57741/diagnostic-events
eli-darkly Feb 12, 2020
7520610
standardize linting
eli-darkly Feb 13, 2020
be211de
use js-sdk-common 3.2.1
eli-darkly Feb 13, 2020
94d761a
Merge pull request #237 from launchdarkly/eb/ch65303/standardize-linting
eli-darkly Feb 13, 2020
3000dac
use js-sdk-common 3.2.2
eli-darkly Feb 14, 2020
deaed37
update package-lock
eli-darkly Feb 14, 2020
4cd5e06
merge from public after release
LaunchDarklyCI Feb 14, 2020
2791ab9
update js-sdk-common dependency for initialization error bugfix
eli-darkly Mar 7, 2020
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
Prev Previous commit
Next Next commit
apply markdown templates
bwoskow-ld committed Apr 30, 2019
commit a143aabfdf7f780c6470a1159794931474dc2bb7
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
All notable changes to the LaunchDarkly client-side JavaScript SDKs will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org).

# Note on future releases

The LaunchDarkly SDK repositories are being renamed for consistency. This repository is now `js-client-sdk` rather than `js-client`.

The package names will also change. In the 2.10.1 release, there were packages for `ldclient-js`, `ldclient-react` and `ldclient-js-common`; in all future releases, they will be `launchdarkly-js-client-sdk`, `launchdarkly-react-client-sdk`, and `launchdarkly-js-common`, respectively.

## [2.10.1] - 2019-04-23
### Fixed:
- The 2.10.0 release added a usage of the `Promise.finally()` method, which made it incompatible with some older browsers. This has been removed. ([#151](https://github.com/launchdarkly/js-client/issues/151))
42 changes: 38 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
# Contributing to LaunchDarkly SDK for JavaScript
# Contributing to LaunchDarkly SDK for Browser JavaScript

We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.

## Submitting bug reports and feature requests

This repository is a monorepo containing three projects, each of which is published to npm as a package with the same name:
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/js-client-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.

Submitting pull requests
------------------

We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.

Build instructions
------------------

Before building the code, it would be helpful to know a bit about the structure of the code in this repository. This repository is a monorepo containing three projects, each of which is published to npm as a package with the same name:

- `ldclient-js`: This is the main SDK package that applications will import. Any logic that specifically relies on being in a browser environment should go here (see `browserPlatform.js`). This automatically imports `ldclient-js-common`.
- `ldclient-js-common`: Internal implementation code that is not browser-specific.
- `ldclient-react`: The React wrapper. This automatically imports both of the other packages.

The reason `ldclient-js-common` exists is that the [Electron SDK](https://github.com/launchdarkly/electron-client) has very similar functionality to the browser SDK. Therefore, all of the code that is used by both has been factored out into the common package.

To build and test the project, you will first need to run `npm install lerna`. Then, running `npm run build` or `npm test` from the project root directory will build or test all three packages.
### Prerequisites

Before building the SDK, you need to install [Lerna](https://www.npmjs.com/package/lerna).

```
npm install lerna
```

### Building

You can build all three packages by running the following command from the root directory:

```
npm run build
```

### Testing

You can run all tests by running the following command from the root directory:

```
npm test
```
280 changes: 31 additions & 249 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,21 +2,23 @@

[![Circle CI](https://circleci.com/gh/launchdarkly/js-client-sdk/tree/master.svg?style=svg)](https://circleci.com/gh/launchdarkly/js-client-sdk/tree/master)

## Introduction
## LaunchDarkly overview

This is the official LaunchDarkly JavaScript SDK for web browser applications. It provides the same functionality as all of the LaunchDarkly SDKs:
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!

[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)

* Making feature flags available to your JavaScript code.
* Sending events to LaunchDarkly for analytics and/or A/B testing.
* Optionally maintaining a streaming connection to LaunchDarkly for immediate notification of any feature flag changes.
## Getting started

The JavaScript SDK has two special requirements in terms of your LaunchDarkly environment. First, in terms of the credentials for your environment that appear on your [Account Settings](https://app.launchdarkly.com/settings/projects) dashboard, the JavaScript SDK uses the "Client-side ID"-- not the "SDK key" or the "Mobile key". Second, for any feature flag that you will be using in JavaScript code, you must check the "Make this flag available to client-side SDKs" box on that flag's Settings page.
Refer to the [SDK documentation](https://docs.launchdarkly.com/docs/js-sdk-reference#section-getting-started) for instructions on getting started with using the SDK.

## React
Please note that the JavaScript SDK has two special requirements in terms of your LaunchDarkly environment. First, in terms of the credentials for your environment that appear on your [Account Settings](https://app.launchdarkly.com/settings/projects) dashboard, the JavaScript SDK uses the "Client-side ID"-- not the "SDK key" or the "Mobile key". Second, for any feature flag that you will be using in JavaScript code, you must check the "Make this flag available to client-side SDKs" box on that flag's Settings page.

The SDK does not require any particular JavaScript framework. However, if you are using React, there is an add-on to simplify use of the SDK. See the [`ldclient-react` documentation](packages/ldclient-react/README.md).
### ReactJS

## Browser compatibility
The SDK does not require any particular JavaScript framework. However, if you are using [React](https://reactjs.org/), there is an add-on to simplify use of the SDK. See the [`ldclient-react` documentation](packages/ldclient-react/README.md).

## SDK browser compatibility

The SDK supports the following browsers:

@@ -27,25 +29,9 @@ The SDK supports the following browsers:
* Edge (any recent)\*
* Opera (any recent)\*

\* These browsers do not have built-in support for streaming; see [#EventSource]("EventSource") below.

_If you are using JavaScript in a non-browser environment,_ please see our [Node.js SDK](https://github.com/launchdarkly/node-client) and [Electron SDK](https://github.com/launchdarkly/electron-client).

## Installation

The SDK can be installed in two ways:

1. Via the `npm` package: `npm install --save ldclient-js`
\* These browsers do not have built-in support for streaming; see ["EventSource"](#eventsource) below.

2. A minimized version of the script is also hosted on our CDN, and can be included via a `script` tag:

```
<script src="https://app.launchdarkly.com/snippet/ldclient.min.js">
```

The hosted copy of `ldclient.min.js` is updated after every release, so be aware that if you use the `script` tag approach, the SDK may change without warning.

## Browser feature support
_If you are using JavaScript in a non-browser environment,_ please see our [server-side Node.js SDK](https://github.com/launchdarkly/node-server-sdk), [client-side Node.js SDK](https://github.com/launchdarkly/node-client-sdk), and [Electron SDK](https://github.com/launchdarkly/electron-client-sdk).

Web browsers vary widely in their support of specific features and standards. Three features that are used by the LaunchDarkly SDK that may not be available on every browser are `EventSource`, `document.querySelectorAll()`, and `Promise`. See below for more about how to ensure that these will work.

@@ -107,239 +93,35 @@ Then import it before the module that initializes the LaunchDarkly client:

require('es6-promise/auto');

## Usage

### Initializing the client

To create a client instance, pass your environment's client-side ID (available on your [account settings page](https://app.launchdarkly.com/settings#/projects)) and user context to the `LDClient.initialize` function:

```js
var user = { key: 'user.example.com' };
var client = LDClient.initialize('YOUR_CLIENT_SIDE_ID', user);
```

The user object can contain any of the properties described [here](https://docs.launchdarkly.com/docs/targeting-users). The SDK always has a single current user; you can change it after initialization (see "Changing users"). If you want the SDK to generate a unique key for the user, omit the `key` property and set the `anonymous` property to `true`.

The client is initialized asynchronously, so if you want to determine when the client is ready to evaluate feature flags, use the `ready` event, or the Promise-based method `waitForInitialization()`:

```js
client.on('ready', function() {
// now we can evaluate some feature flags
});

// or:
client.waitForInitialization().then(function() {
// now we can evaluate some feature flags
});
```

If you try to evaluate feature flags before the client is ready, it will behave as it would if no flags existed (i.e. `variation` will return a default value).

Out of the box, initializing the client will make a remote request to LaunchDarkly, so it may take approximately 100 milliseconds before the ready event is emitted. If you require feature flag values before rendering the page, we recommend bootstrapping the client-- see below.

### Bootstrapping from the server side

The bootstrapping mechanism lets you provide initial feature flag values at startup time. In a web application, a common approach is for your back-end application code to obtain flag values from its own server-side SDK and then pass them to the front end.

LaunchDarkly's server-side SDKs have a function called `allFlagsState`, which returns a snapshot of the feature flags for a particular user. This data structure can be passed directly to the `bootstrap` property of the front-end client; you will also want to pass the user properties. Here's an example of how this might be done if you are using Node.js, Express, and Mustache templates on the back end.

```js
// in the back-end code:
app.get('/page', function(req, res) {
var user = { key: 'example-user' };
client.allFlagsState(user, function(err, flagsData) {
templateVars = {
user: user,
allFlags: flagsData
};
res.render('myPage', templateVars);
});
});

// in a script within the page template:
var user = {{ user }};
var clientOptions = {
bootstrap: {{ allFlags }}
};
var client = ldclient.initialize('YOUR_CLIENT_SIDE_ID', user, clientOptions);
```

### Feature flags

To evaluate any feature flag for the current user, call `variation`:

```js
var showFeature = client.variation("YOUR_FEATURE_KEY", false);

if (showFeature) {
// feature flag is on
} else {
// feature flag is off
}
```

The return value of `variation` will always be either one of the variations you defined for your flag in the LaunchDarkly dashboard, or the default value. The default value is the second parameter to `variation` (in this case `false`) and it is what the client will use if it's not possible to evaluate the flag (for instance, if the flag key does not exist, or if something about the definition of the flag is invalid).

You can also fetch all feature flags for the current user:

```js
var flags = client.allFlags();
var showFeature = flags['YOUR_FEATURE_KEY'];
```

This returns a key-value map of all your feature flags. It will contain `null` values for any flags that could not be evaluated.

Note that both of these methods are synchronous. The client always has the last known flag values in memory, so retrieving them does not involve any I/O.

### Changing users

The `identify()` method tells the client to change the current user, and obtain the feature flag values for the new user. For example, on a sign-in page in a single-page app, you may initialize the client with an anonymous user; when the user logs in, you'd want the feature flag settings for the authenticated user.

If you provide a callback function, it will be called (with a map of flag keys and values) once the flag values for the new user are available; after that point, `variation()` will be using the new values. You can also use a Promise for the same purpose.

```js
var newUser = { key: 'someone-else', name: 'John' };

client.identify(newUser, function(newFlags) {
console.log('value of flag for this user is: ' + newFlags["YOUR_FEATURE_KEY"]);
console.log('this should be the same: ' + client.variation("YOUR_FEATURE_KEY"));
});

// or:
client.identify(newUser).then(function(newFlags) {
// as above
});
```

Note that the client always has _one_ current user. The client-side SDKs are not designed for evaluating flags for different users at the same time.

### Analytics events

Evaluating flags, either with `variation()` or with `allFlags()`, produces analytics events which you can observe on your LaunchDarkly Debugger page. Specifying a user with `identify()` (and also the initial user specified in the client constructor) also produces an analytics event, which is how LaunchDarkly receives your user data.

You can also explicitly send an event with any data you like using the `track` function:

```js
client.track('my-custom-event-key', { customProperty: someValue });
```

If you've defined [click or pageview goals](https://docs.launchdarkly.com/docs/running-ab-tests) in LaunchDarkly, they'll be sent automatically once the client has been initialized. You do not have to do anything else with the client to send click or pageview goals. The SDK will generate pageview events correctly regardless of how the URL is changed (via the HTML5 history API, by changing the URL hash fragment, etc.).

You can completely disable event sending by setting `sendEvents` to `false` in the client options, but be aware that this means you will not have user data on your LaunchDarkly dashboard.

In browsers that have a "do not track" option, the SDK will not attempt to send any analytics events if this option is set.

### Receiving live updates

By default, the client requests feature flag values only once per user (i.e. once at startup time, and then each time you call `identify()`). You can also use a persistent connection to receive flag updates whenever they occur.

Setting `streaming` to `true` in the client options, or calling `client.setStreaming(true)`, turns on this behavior. LaunchDarkly will push new values to the SDK, which will update the current feature flag state in the background, ensuring that `variation()` will always return the latest values.

If you want to be notified when a flag has changed, you can use an event listener for a specific flag:

```js
client.on('change:YOUR_FEATURE_KEY', function(newValue, oldValue) {
console.log('The flag was ' + oldValue + ' and now it is ' + newValue);
});
```

Or, you can listen for all feature flag changes:

```js
client.on('change', function(allFlagChanges)) {
Object.keys(allFlagChanges).forEach(function(key) {
console.log('Flag ' + key + ' is now ' + allFlagChanges[key]);
});
});
```

Subscribing to `change` events will automatically turn on streaming mode too, unless you have explicitly set `streaming` to `false`.

### Logging

By default, the SDK uses the `winston` package. There are four logging levels: `debug`, `info`, `warn`, and `error`; by default, `debug` and `info` messages are hidden. See the [TypeScript definitions](https://github.com/launchdarkly/js-client/tree/master/packages/ldclient-js-common/typings.d.ts) for `LDLogger`, `LDOptions`, and `createConsoleLogger` for more details.

### Secure mode

Secure mode ensures that feature flag settings for a user are kept private, and that one user cannot inspect the settings for another user. Secure mode works by having you include a server-generated HMAC SHA256 hash of your user key, signed with the SDK key for your environment.

You can enable secure mode for each environment on your [account settings page](https://app.launchdarkly.com/settings#/projects). You should send the computed hash for your user in the `options` array during client initialization:

```js
var user = { key: 'user.example.com' };
var client = LDClient.initialize(
'YOUR_CLIENT_SIDE_ID',
user,
(options = {
hash: 'SERVER_GENERATED_HASH',
})
);
```

Each of our server-side SDKs includes a method to compute the secure mode hash for a user. You can pass this to your front-end code in a template. For example:

```js
var client = LDClient.initialize('YOUR_CLIENT_SIDE_ID', user, options = {
hash: {{ ldclient.secure_mode_hash(user) }} // this is a template directive, and the ldclient instance here is your server-side SDK client
});
```

To compute the hash yourself, locate the SDK key for your environment on your account settings page. Then, compute an HMAC SHA256 hash of your user key, using your SDK key as a secret. Here's what this would look like in Node.js:

```js
var crypto = require('crypto');
var hmac = crypto.createHmac('sha256', 'YOUR_SDK_KEY');
hmac.update('YOUR_USER_KEY');
hash = hmac.digest('hex');
```

If you change the user context dynamically with `identify()`, you can provide a new secure mode hash at the same time:

```js
client.identify(newUser, hash, function() {
console.log("New user's flags available");
});
```
By default, the SDK uses the `winston` package. There are four logging levels: `debug`, `info`, `warn`, and `error`; by default, `debug` and `info` messages are hidden. See the [TypeScript definitions](https://github.com/launchdarkly/js-client-sdk/tree/master/packages/ldclient-js-common/typings.d.ts) for `LDLogger`, `LDOptions`, and `createConsoleLogger` for more details.

## Learn more

For an additional overview with code samples, see the online [JavaScript SDK Reference](https://docs.launchdarkly.com/docs/js-sdk-reference).

The authoritative full description of all properties, types, and methods is the [online TypeScript documentation](https://launchdarkly.github.io/js-client-sdk/). If you are not using TypeScript, then the types are only for your information and are not enforced, although the properties and methods are still the same as described in the documentation.
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/docs/js-sdk-reference). Additionally, the authoritative full description of all properties, types, and methods is the [online TypeScript documentation](https://launchdarkly.github.io/js-client-sdk/). If you are not using TypeScript, then the types are only for your information and are not enforced, although the properties and methods are still the same as described in the documentation.

For examples of using the SDK in a simple JavaScript application, see [`hello-js`](https://github.com/launchdarkly/hello-js) and [`hello-bootstrap`](https://github.com/launchdarkly/hello-bootstrap).

## Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

## Contributing

We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See [CONTRIBUTING](CONTRIBUTING.md) for more developer information about this project.
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK.

## About LaunchDarkly

* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
* LaunchDarkly provides feature flag SDKs for
* [Java](http://docs.launchdarkly.com/docs/java-sdk-reference 'Java SDK')
* [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference 'LaunchDarkly JavaScript SDK')
* [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference 'LaunchDarkly PHP SDK')
* [Python](http://docs.launchdarkly.com/docs/python-sdk-reference 'LaunchDarkly Python SDK')
* [Go](http://docs.launchdarkly.com/docs/go-sdk-reference 'LaunchDarkly Go SDK')
* [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference 'LaunchDarkly Node SDK')
* [Electron](http://docs.launchdarkly.com/docs/electron-sdk-reference 'LaunchDarkly Electron SDK')
* [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference 'LaunchDarkly .Net SDK')
* [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference 'LaunchDarkly Ruby SDK')
* [iOS](http://docs.launchdarkly.com/docs/ios-sdk-reference 'LaunchDarkly iOS SDK')
* [Android](http://docs.launchdarkly.com/docs/android-sdk-reference 'LaunchDarkly Android SDK')
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
* Explore LaunchDarkly
* [launchdarkly.com](http://www.launchdarkly.com/ 'LaunchDarkly Main Website')
for more information
* [docs.launchdarkly.com](http://docs.launchdarkly.com/ 'LaunchDarkly Documentation')
for our documentation and SDKs
* [apidocs.launchdarkly.com](http://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation')
for our API documentation
* [blog.launchdarkly.com](http://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation')
for the latest product updates
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ 'Feature Flagging Guide')
for best practices and strategies
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies