@culturehq/client
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -9,2 +9,8 @@ # Changelog | ||
## [4.0.0] - 2018-08-02 | ||
### Changed | ||
- Moved the `url-polyfill` to dev dependencies. It's now the consumer's responsibility to load it. | ||
- Removed the `store` dependency, just using `localStorage` directly. | ||
- Removed the unnecessary `index.js` file, instead just using `client.js` as the main export. | ||
## [3.1.0] - 2018-08-01 | ||
@@ -11,0 +17,0 @@ ### Added |
@@ -24,3 +24,3 @@ "use strict"; | ||
var headers = { "X-Client-Version": "3.1.0" }; | ||
var headers = { "X-Client-Version": "4.0.0" }; | ||
@@ -27,0 +27,0 @@ if (!multipart) { |
@@ -6,40 +6,33 @@ "use strict"; | ||
}); | ||
var TOKEN_KEY = "token"; | ||
var SIMULATION_KEY = "simulation"; | ||
var _store = require("store/dist/store.modern"); | ||
var _store2 = _interopRequireDefault(_store); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var tokenKey = "token"; | ||
var simulationKey = "simulation"; | ||
var state = { | ||
endSimulation: function endSimulation() { | ||
state.signIn(_store2.default.get(simulationKey)); | ||
_store2.default.remove(simulationKey); | ||
state.signIn(localStorage.getItem(SIMULATION_KEY)); | ||
localStorage.removeItem(SIMULATION_KEY); | ||
}, | ||
getSimulationToken: function getSimulationToken() { | ||
return _store2.default.get(simulationKey); | ||
return localStorage.getItem(SIMULATION_KEY); | ||
}, | ||
getToken: function getToken() { | ||
return _store2.default.get(tokenKey); | ||
return localStorage.getItem(TOKEN_KEY); | ||
}, | ||
isSignedIn: function isSignedIn() { | ||
return state.getToken() !== undefined; | ||
return state.getToken() !== null; | ||
}, | ||
isSimulating: function isSimulating() { | ||
return _store2.default.get(simulationKey) !== undefined; | ||
return localStorage.getItem(SIMULATION_KEY) !== null; | ||
}, | ||
signIn: function signIn(token) { | ||
return _store2.default.set(tokenKey, token); | ||
return localStorage.setItem(TOKEN_KEY, token); | ||
}, | ||
signOut: function signOut() { | ||
return _store2.default.clearAll(); | ||
return localStorage.clear(); | ||
}, | ||
@@ -52,3 +45,3 @@ | ||
_store2.default.set(simulationKey, state.getToken()); | ||
localStorage.setItem(SIMULATION_KEY, state.getToken()); | ||
state.signIn(token); | ||
@@ -55,0 +48,0 @@ } |
{ | ||
"name": "@culturehq/client", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "A JavaScript client that wraps the CultureHQ API", | ||
"main": "dist/index.js", | ||
"main": "dist/client.js", | ||
"scripts": { | ||
@@ -23,5 +23,3 @@ "build": "babel src --out-dir dist --copy-files", | ||
"dependencies": { | ||
"actioncable": "^5.2.0", | ||
"store": "^2.0.12", | ||
"url-polyfill": "^1.0.13" | ||
"actioncable": "^5.2.0" | ||
}, | ||
@@ -44,3 +42,4 @@ "devDependencies": { | ||
"packfiles": "^0.0.2", | ||
"prettier": "^1.14.0" | ||
"prettier": "^1.14.0", | ||
"url-polyfill": "^1.0.13" | ||
}, | ||
@@ -47,0 +46,0 @@ "jest": { |
1
94850
17
15
1472
- Removedstore@^2.0.12
- Removedurl-polyfill@^1.0.13
- Removedstore@2.0.12(transitive)
- Removedurl-polyfill@1.1.13(transitive)