diff --git a/package.json b/package.json index f5387414..11e2b53d 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "bignumber.js": "2.4.0", "color-hash": "^1.0.3", "commander": "^2.19.0", + "connected-react-router": "^6.0.0", "copy-webpack-plugin": "^4.5.2", "cross-env": "^5.2.0", "date-fns": "^1.29.0", @@ -54,9 +55,9 @@ "react-hot-loader": "^4.6.2", "react-json-view": "^1.19.1", "react-qr-svg": "^2.1.0", - "react-redux": "^5.0.7", + "react-redux": "^6.0.0", + "react-router": "^4.3.1", "react-router-dom": "^4.2.2", - "react-router-redux": "next", "react-scale-text": "^1.2.2", "react-select": "2.0.0", "react-textarea-autosize": "^7.0.4", diff --git a/src/actions/RouterActions.js b/src/actions/RouterActions.js index 3cb7dea1..0e632a16 100644 --- a/src/actions/RouterActions.js +++ b/src/actions/RouterActions.js @@ -1,6 +1,6 @@ /* @flow */ -import { push, LOCATION_CHANGE } from 'react-router-redux'; +import { push, LOCATION_CHANGE } from 'connected-react-router'; import { CONTEXT_NONE } from 'actions/constants/modal'; import { SET_INITIAL_URL } from 'actions/constants/wallet'; import { routes } from 'support/routes'; @@ -15,7 +15,7 @@ import type { Dispatch, GetState, } from 'flowtype'; -import type { RouterAction } from 'react-router-redux'; +import type { RouterAction } from 'connected-react-router'; /* * Parse url string to RouterLocationState object (key/value) diff --git a/src/actions/SelectedAccountActions.js b/src/actions/SelectedAccountActions.js index ba498cf0..868b7155 100644 --- a/src/actions/SelectedAccountActions.js +++ b/src/actions/SelectedAccountActions.js @@ -1,5 +1,5 @@ /* @flow */ -import { LOCATION_CHANGE } from 'react-router-redux'; +import { LOCATION_CHANGE } from 'connected-react-router'; import { BLOCKCHAIN } from 'trezor-connect'; import * as WALLET from 'actions/constants/wallet'; import * as ACCOUNT from 'actions/constants/account'; diff --git a/src/actions/WalletActions.js b/src/actions/WalletActions.js index f0d72a1b..9fe17a93 100644 --- a/src/actions/WalletActions.js +++ b/src/actions/WalletActions.js @@ -1,6 +1,6 @@ /* @flow */ -import { LOCATION_CHANGE } from 'react-router-redux'; +import { LOCATION_CHANGE } from 'connected-react-router'; import { DEVICE } from 'trezor-connect'; import * as CONNECT from 'actions/constants/TrezorConnect'; import * as WALLET from 'actions/constants/wallet'; diff --git a/src/flowtype/index.js b/src/flowtype/index.js index 68a8cfee..28d23197 100644 --- a/src/flowtype/index.js +++ b/src/flowtype/index.js @@ -47,7 +47,7 @@ import type { BlockchainLinkTransaction, } from 'trezor-connect'; -import type { RouterAction, LocationState } from 'react-router-redux'; +import type { RouterAction, LocationState } from 'connected-react-router'; export type AcquiredDevice = $Exact<{ +type: 'acquired', diff --git a/src/flowtype/npm/react-router-redux.js b/src/flowtype/npm/react-router-redux.js index 81c9a297..6401dc77 100644 --- a/src/flowtype/npm/react-router-redux.js +++ b/src/flowtype/npm/react-router-redux.js @@ -3,7 +3,7 @@ import type { Location as RouterLocation, } from 'react-router'; -declare module 'react-router-redux' { +declare module 'connected-react-router' { // custom state for location declare export type LocationState = {[key: string]: string}; diff --git a/src/reducers/NotificationReducer.js b/src/reducers/NotificationReducer.js index 34274aea..46b1aea9 100644 --- a/src/reducers/NotificationReducer.js +++ b/src/reducers/NotificationReducer.js @@ -1,7 +1,7 @@ /* @flow */ import * as React from 'react'; -import { LOCATION_CHANGE } from 'react-router-redux'; +import { LOCATION_CHANGE } from 'connected-react-router'; import * as NOTIFICATION from 'actions/constants/notification'; import { DEVICE } from 'trezor-connect'; diff --git a/src/reducers/WalletReducer.js b/src/reducers/WalletReducer.js index 37fd38fd..15086746 100644 --- a/src/reducers/WalletReducer.js +++ b/src/reducers/WalletReducer.js @@ -1,7 +1,7 @@ /* @flow */ -import { LOCATION_CHANGE } from 'react-router-redux'; +import { LOCATION_CHANGE } from 'connected-react-router'; import { DEVICE, TRANSPORT } from 'trezor-connect'; import * as MODAL from 'actions/constants/modal'; import * as WALLET from 'actions/constants/wallet'; diff --git a/src/reducers/index.js b/src/reducers/index.js index 498e5a70..fea2abc5 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,6 +1,6 @@ /* @flow */ import { combineReducers } from 'redux'; -import { routerReducer } from 'react-router-redux'; +import { connectRouter } from 'connected-react-router'; import log from 'reducers/LogReducer'; import localStorage from 'reducers/LocalStorageReducer'; @@ -23,8 +23,8 @@ import devices from 'reducers/DevicesReducer'; import blockchain from 'reducers/BlockchainReducer'; import signVerify from 'reducers/SignVerifyReducer'; -const reducers = { - router: routerReducer, +export default history => combineReducers({ + router: connectRouter(history), log, localStorage, connect, @@ -45,10 +45,8 @@ const reducers = { devices, blockchain, signVerify, -}; +}); export type Reducers = typeof reducers; type $ExtractFunctionReturn = (v: (...args: any) => V) => V; export type ReducersState = $ObjMap; - -export default combineReducers(reducers); diff --git a/src/services/RouterService.js b/src/services/RouterService.js index 202165af..a853ae86 100644 --- a/src/services/RouterService.js +++ b/src/services/RouterService.js @@ -1,5 +1,5 @@ /* @flow */ -import { LOCATION_CHANGE, replace } from 'react-router-redux'; +import { LOCATION_CHANGE, replace } from 'connected-react-router'; import * as RouterActions from 'actions/RouterActions'; import type { diff --git a/src/services/WalletService.js b/src/services/WalletService.js index 0c44a3a3..815818df 100644 --- a/src/services/WalletService.js +++ b/src/services/WalletService.js @@ -1,6 +1,6 @@ /* @flow */ import { DEVICE } from 'trezor-connect'; -import { LOCATION_CHANGE } from 'react-router-redux'; +import { LOCATION_CHANGE } from 'connected-react-router'; import * as WALLET from 'actions/constants/wallet'; import * as CONNECT from 'actions/constants/TrezorConnect'; diff --git a/src/store.js b/src/store.js index 78fce246..678148ed 100644 --- a/src/store.js +++ b/src/store.js @@ -1,11 +1,11 @@ /* @flow */ import { createStore, applyMiddleware, compose } from 'redux'; -import { routerMiddleware } from 'react-router-redux'; +import { routerMiddleware } from 'connected-react-router'; import thunk from 'redux-thunk'; import createHistory from 'history/createHashHistory'; import { createLogger } from 'redux-logger'; -import reducers from 'reducers'; +import createRootReducer from 'reducers'; import services from 'services'; import Raven from 'raven-js'; @@ -65,7 +65,7 @@ if (buildUtils.isDev()) { } export default createStore( - reducers, + createRootReducer(history), initialState, composedEnhancers, ); diff --git a/src/views/index.js b/src/views/index.js index 6e37aef5..62221dce 100644 --- a/src/views/index.js +++ b/src/views/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { hot } from 'react-hot-loader'; import { Route, Switch } from 'react-router-dom'; import { Provider } from 'react-redux'; -import { ConnectedRouter } from 'react-router-redux'; +import { ConnectedRouter } from 'connected-react-router'; // general import ErrorBoundary from 'support/ErrorBoundary'; diff --git a/yarn.lock b/yarn.lock index bd1dec40..8abb1c76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -127,6 +127,13 @@ version "7.0.0-rc.1" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-rc.1.tgz#d009a9bba8175d7b971e30cd03535b278c44082d" +"@babel/runtime@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.2.0.tgz#b03e42eeddf5898e00646e4c840fa07ba8dcad7f" + integrity sha512-oouEibCbHMVdZSDlJBO6bZmID/zA/G/Qx3H1d3rSNPTD+L8UNKvCat7aKWSJ74zYbm5zWGh0GQN0hKj8zYFTCg== + dependencies: + regenerator-runtime "^0.12.0" + "@babel/template@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" @@ -2611,6 +2618,14 @@ connect-history-api-fallback@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a" +connected-react-router@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/connected-react-router/-/connected-react-router-6.0.0.tgz#cb7ccbbc5ed353832ecd91d68289c916e8aba734" + integrity sha512-TarPqf2wY3cz993Mw3eBg2U12M5OmaGwKzJsinvRQh61nKb8WMUvimyhu6u2HeWS8625PHFXjNOU0OIAMWj/bQ== + dependencies: + immutable "^3.8.1" + seamless-immutable "^7.1.3" + console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" @@ -4822,6 +4837,13 @@ hoist-non-react-statics@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40" +hoist-non-react-statics@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz#c09c0555c84b38a7ede6912b61efddafd6e75e1e" + integrity sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw== + dependencies: + react-is "^16.3.2" + home-or-tmp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" @@ -5009,6 +5031,11 @@ ignore@^3.3.5: version "3.3.7" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" +immutable@^3.8.1: + version "3.8.2" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM= + import-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" @@ -5111,15 +5138,16 @@ into-stream@^3.1.0: from2 "^2.1.1" p-is-promise "^1.1.0" -invariant@^2.0.0, invariant@^2.2.1, invariant@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" +invariant@^2.2.0, invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: loose-envify "^1.0.0" -invariant@^2.2.0: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" +invariant@^2.2.1, invariant@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + integrity sha1-nh9WrArNtr8wMwbzOL47IErmA2A= dependencies: loose-envify "^1.0.0" @@ -5872,6 +5900,11 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" @@ -6227,10 +6260,6 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash-es@^4.17.5: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.5.tgz#9fc6e737b1c4d151d8f9cae2247305d552ce748f" - lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" @@ -6331,6 +6360,13 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3 dependencies: js-tokens "^3.0.0" +loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + loud-rejection@^1.0.0, loud-rejection@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" @@ -7986,7 +8022,7 @@ react-input-autosize@^2.2.1: dependencies: prop-types "^15.5.8" -react-is@^16.6.0: +react-is@^16.3.2, react-is@^16.6.0, react-is@^16.6.3: version "16.6.3" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.6.3.tgz#d2d7462fcfcbe6ec0da56ad69047e47e56e7eac0" @@ -8010,16 +8046,17 @@ react-qr-svg@^2.1.0: prop-types "^15.5.8" qr.js "0.0.0" -react-redux@^5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.7.tgz#0dc1076d9afb4670f993ffaef44b8f8c1155a4c8" +react-redux@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-6.0.0.tgz#09e86eeed5febb98e9442458ad2970c8f1a173ef" + integrity sha512-EmbC3uLl60pw2VqSSkj6HpZ6jTk12RMrwXMBdYtM6niq0MdEaRq9KYCwpJflkOZj349BLGQm1MI/JO1W96kLWQ== dependencies: - hoist-non-react-statics "^2.5.0" - invariant "^2.0.0" - lodash "^4.17.5" - lodash-es "^4.17.5" - loose-envify "^1.1.0" - prop-types "^15.6.0" + "@babel/runtime" "^7.2.0" + hoist-non-react-statics "^3.2.1" + invariant "^2.2.4" + loose-envify "^1.4.0" + prop-types "^15.6.2" + react-is "^16.6.3" react-router-dom@^4.2.2: version "4.2.2" @@ -8032,14 +8069,6 @@ react-router-dom@^4.2.2: react-router "^4.2.0" warning "^3.0.0" -react-router-redux@next: - version "5.0.0-alpha.8" - resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-5.0.0-alpha.8.tgz#5242c705730b2ac862aff7a8e90f870d0cf45e12" - dependencies: - history "^4.7.2" - prop-types "^15.6.0" - react-router "^4.2.0" - react-router@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.2.0.tgz#61f7b3e3770daeb24062dae3eedef1b054155986" @@ -8052,6 +8081,19 @@ react-router@^4.2.0: prop-types "^15.5.4" warning "^3.0.0" +react-router@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e" + integrity sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg== + dependencies: + history "^4.7.2" + hoist-non-react-statics "^2.5.0" + invariant "^2.2.4" + loose-envify "^1.3.1" + path-to-regexp "^1.7.0" + prop-types "^15.6.1" + warning "^4.0.1" + react-scale-text@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/react-scale-text/-/react-scale-text-1.2.2.tgz#4a56e1d2fd4e4582d2ad472c003ee12f51cbf2ae" @@ -8320,6 +8362,11 @@ regenerator-runtime@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" +regenerator-runtime@^0.12.0: + version "0.12.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" + integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== + regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd" @@ -8781,6 +8828,11 @@ scryptsy@^1.2.1: dependencies: pbkdf2 "^3.0.3" +seamless-immutable@^7.1.3: + version "7.1.4" + resolved "https://registry.yarnpkg.com/seamless-immutable/-/seamless-immutable-7.1.4.tgz#6e9536def083ddc4dea0207d722e0e80d0f372f8" + integrity sha512-XiUO1QP4ki4E2PHegiGAlu6r82o5A+6tRh7IkGGTVg/h+UoeX4nFBeCGPOhb4CYjvkqsfm/TUtvOMYC1xmV30A== + secp256k1@^3.0.1: version "3.4.0" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.4.0.tgz#1c905b256fa4ae5b9cc170e672dd59b4c5de46a4" @@ -10304,6 +10356,13 @@ warning@^3.0.0: dependencies: loose-envify "^1.0.0" +warning@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.2.tgz#aa6876480872116fa3e11d434b0d0d8d91e44607" + integrity sha512-wbTp09q/9C+jJn4KKJfJfoS6VleK/Dti0yqWSm6KMvJ4MRCXFQNapHuJXutJIrWV0Cf4AhTdeIe4qdKHR1+Hug== + dependencies: + loose-envify "^1.0.0" + watch@~0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986"