Merge remote-tracking branch 'remotes/dartandrevinsky/private-event-sourcing-examples-38' into private-event-sourcing-examples-38

This commit is contained in:
dartpopikyardo
2016-09-20 11:22:35 +03:00
13 changed files with 89 additions and 102 deletions

File diff suppressed because one or more lines are too long

View File

@@ -36,6 +36,7 @@ webpackJsonp([0,3],{
* Created by andrew on 12/02/16. * Created by andrew on 12/02/16.
*/ */
if (process.env.NODE_ENV !== "production") { if (process.env.NODE_ENV !== "production") {
var reactRoot = window.document.getElementById("root");
if (!reactRoot.firstChild || !reactRoot.firstChild.attributes || !reactRoot.firstChild.attributes["data-react-checksum"]) { if (!reactRoot.firstChild || !reactRoot.firstChild.attributes || !reactRoot.firstChild.attributes["data-react-checksum"]) {
console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code."); console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.");
} }
@@ -2243,7 +2244,7 @@ webpackJsonp([0,3],{
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.apiRetrieveUsers = exports.apiDeleteAccount = exports.apiRetrieveAccount = exports.apiRetrieveTransfers = exports.apiRetrieveAccounts = exports.apiMakeTransfer = exports.apiCreateRefAccount = exports.apiCreateAccount = exports.apiGetCurrentUser = exports.apiSignUp = exports.apiSignIn = undefined; exports.apiRetrieveUsers = exports.apiDeleteRefAccount = exports.apiDeleteAccount = exports.apiRetrieveAccount = exports.apiRetrieveTransfers = exports.apiRetrieveAccounts = exports.apiMakeTransfer = exports.apiCreateRefAccount = exports.apiCreateAccount = exports.apiGetCurrentUser = exports.apiSignUp = exports.apiSignIn = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**
* Created by andrew on 12/03/16. * Created by andrew on 12/03/16.
@@ -2292,19 +2293,19 @@ webpackJsonp([0,3],{
}; };
var apiSignIn = exports.apiSignIn = function apiSignIn(body) { var apiSignIn = exports.apiSignIn = function apiSignIn(body) {
return fetch(ENDPOINTS.emailSignInPath(), _extends({}, METHODS.POST, { return fetch(ENDPOINTS.emailSignIn(), _extends({}, METHODS.POST, {
body: _root2.default.JSON.stringify(body) body: _root2.default.JSON.stringify(body)
})); }));
}; };
var apiSignUp = exports.apiSignUp = function apiSignUp(body) { var apiSignUp = exports.apiSignUp = function apiSignUp(body) {
return fetch(ENDPOINTS.emailSignUpUrl(), _extends({}, METHODS.POST, { return fetch(ENDPOINTS.emailSignUp(), _extends({}, METHODS.POST, {
body: _root2.default.JSON.stringify(body) body: _root2.default.JSON.stringify(body)
})); }));
}; };
var apiGetCurrentUser = exports.apiGetCurrentUser = function apiGetCurrentUser() { var apiGetCurrentUser = exports.apiGetCurrentUser = function apiGetCurrentUser() {
return fetch(ENDPOINTS.currentUserPath(), _extends({}, METHODS.GET)); return fetch(ENDPOINTS.currentUser(), _extends({}, METHODS.GET));
}; };
var apiCreateAccount = exports.apiCreateAccount = function apiCreateAccount(customerId, _ref) { var apiCreateAccount = exports.apiCreateAccount = function apiCreateAccount(customerId, _ref) {
@@ -2325,7 +2326,7 @@ webpackJsonp([0,3],{
var accountId = _ref2.account; var accountId = _ref2.account;
var title = _ref2.title; var title = _ref2.title;
var description = _ref2.description; var description = _ref2.description;
return fetch(ENDPOINTS.toAccounts(customerId), _extends({}, METHODS.POST, { return fetch(ENDPOINTS.refAccounts(customerId), _extends({}, METHODS.POST, {
body: _root2.default.JSON.stringify({ body: _root2.default.JSON.stringify({
owner: owner, owner: owner,
id: accountId, id: accountId,
@@ -2338,7 +2339,7 @@ webpackJsonp([0,3],{
var account = _ref3.account; var account = _ref3.account;
var amount = _ref3.amount; var amount = _ref3.amount;
var description = _ref3.description; var description = _ref3.description;
return fetch(ENDPOINTS.transfersUrl(), _extends({}, METHODS.POST, { return fetch(ENDPOINTS.transfers(), _extends({}, METHODS.POST, {
body: _root2.default.JSON.stringify({ body: _root2.default.JSON.stringify({
amount: amount, amount: amount,
fromAccountId: fromAccountId, fromAccountId: fromAccountId,
@@ -2361,7 +2362,11 @@ webpackJsonp([0,3],{
}; };
var apiDeleteAccount = exports.apiDeleteAccount = function apiDeleteAccount(customerId, accountId) { var apiDeleteAccount = exports.apiDeleteAccount = function apiDeleteAccount(customerId, accountId) {
return fetch(ENDPOINTS.customersAccount(customerId, accountId), _extends({}, METHODS.DELETE)); return fetch(ENDPOINTS.account(accountId), _extends({}, METHODS.DELETE));
};
var apiDeleteRefAccount = exports.apiDeleteRefAccount = function apiDeleteRefAccount(customerId, accountId) {
return fetch(ENDPOINTS.refAccount(customerId, accountId), _extends({}, METHODS.DELETE));
}; };
var apiRetrieveUsers = exports.apiRetrieveUsers = function apiRetrieveUsers(email) { var apiRetrieveUsers = exports.apiRetrieveUsers = function apiRetrieveUsers(email) {
@@ -2488,16 +2493,13 @@ webpackJsonp([0,3],{
*/ */
var API_ROOT = '/api'; var API_ROOT = '/api';
var emailSignInPath = exports.emailSignInPath = function emailSignInPath() { var emailSignIn = exports.emailSignIn = function emailSignIn() {
return API_ROOT + '/login'; return API_ROOT + '/login';
}; };
var emailSignUpUrl = exports.emailSignUpUrl = function emailSignUpUrl() { var emailSignUp = exports.emailSignUp = function emailSignUp() {
return API_ROOT + '/customers'; return API_ROOT + '/customers';
}; };
var customersPath = exports.customersPath = function customersPath() { var currentUser = exports.currentUser = function currentUser() {
return API_ROOT + '/customers';
};
var currentUserPath = exports.currentUserPath = function currentUserPath() {
return API_ROOT + '/user'; return API_ROOT + '/user';
}; };
var accountsPath = exports.accountsPath = function accountsPath() { var accountsPath = exports.accountsPath = function accountsPath() {
@@ -2509,19 +2511,19 @@ webpackJsonp([0,3],{
var customersAccounts = exports.customersAccounts = function customersAccounts(customerId) { var customersAccounts = exports.customersAccounts = function customersAccounts(customerId) {
return API_ROOT + '/customers/' + customerId + '/accounts'; return API_ROOT + '/customers/' + customerId + '/accounts';
}; };
var customersAccount = exports.customersAccount = function customersAccount(customerId, accountId) { var refAccounts = exports.refAccounts = function refAccounts(customerId) {
return API_ROOT + '/customers/' + customerId + '/accounts/' + accountId;
};
var toAccounts = exports.toAccounts = function toAccounts(customerId) {
return API_ROOT + '/customers/' + customerId + '/toaccounts'; return API_ROOT + '/customers/' + customerId + '/toaccounts';
}; };
var refAccount = exports.refAccount = function refAccount(customerId, accountId) {
return API_ROOT + '/customers/' + customerId + '/toaccounts/' + accountId;
};
var account = exports.account = function account(accountId) { var account = exports.account = function account(accountId) {
return API_ROOT + '/accounts/' + accountId; return API_ROOT + '/accounts/' + accountId;
}; };
var history = exports.history = function history(accountId) { var history = exports.history = function history(accountId) {
return API_ROOT + '/accounts/' + accountId + '/history'; return API_ROOT + '/accounts/' + accountId + '/history';
}; };
var transfersUrl = exports.transfersUrl = function transfersUrl() { var transfers = exports.transfers = function transfers() {
return API_ROOT + '/transfers'; return API_ROOT + '/transfers';
}; };
@@ -2680,7 +2682,6 @@ webpackJsonp([0,3],{
var _this = this; var _this = this;
var initialDataFlat = _root2.default['JSON'].stringify(initialData); var initialDataFlat = _root2.default['JSON'].stringify(initialData);
debugger;
return new Promise(function (rs, rj) { return new Promise(function (rs, rj) {
setTimeout(function () { setTimeout(function () {
api.apiRetrieveAccounts(customerId).then(function (data) { api.apiRetrieveAccounts(customerId).then(function (data) {
@@ -2766,14 +2767,17 @@ webpackJsonp([0,3],{
var deleteAccountComplete = exports.deleteAccountComplete = (0, _actions.makeActionCreator)(_ACTION_TYPES2.default.ACCOUNT.DELETE_COMPLETE); var deleteAccountComplete = exports.deleteAccountComplete = (0, _actions.makeActionCreator)(_ACTION_TYPES2.default.ACCOUNT.DELETE_COMPLETE);
var deleteAccountError = exports.deleteAccountError = (0, _actions.makeActionCreator)(_ACTION_TYPES2.default.ACCOUNT.DELETE_ERROR); var deleteAccountError = exports.deleteAccountError = (0, _actions.makeActionCreator)(_ACTION_TYPES2.default.ACCOUNT.DELETE_ERROR);
function deleteAccount(customerId, accountId) { function deleteAccount(customerId, accountId, isRef) {
return function (dispatch) { return function (dispatch) {
dispatch(deleteAccountRequested()); dispatch(deleteAccountRequested());
return api.apiDeleteAccount(customerId, accountId).then(function (data) {
var deleteApiAction = isRef ? api.apiDeleteRefAccount(customerId, accountId) : api.apiDeleteAccount(customerId, accountId);
return deleteApiAction.then(function (data) {
dispatch(deleteAccountComplete(data)); dispatch(deleteAccountComplete(data));
return Promise.resolve(data); return Promise.resolve(data);
}).catch(function (err) { }).catch(function (err) {
dispatch(deleteAccountError()); dispatch(deleteAccountError(err));
return Promise.reject(err); return Promise.reject(err);
}); });
}; };
@@ -3746,14 +3750,17 @@ webpackJsonp([0,3],{
} }
}, { }, {
key: "remove3rdPartyAccountModalConfirmed", key: "remove3rdPartyAccountModalConfirmed",
value: function remove3rdPartyAccountModalConfirmed(accountId) { value: function remove3rdPartyAccountModalConfirmed(account) {
var _this4 = this; var _this4 = this;
var accountId = account.id || account.accountId;
var isRef = typeof account.balance == 'undefined';
var _props = this.props; var _props = this.props;
var customerId = _props.customerId; var customerId = _props.customerId;
var dispatch = _props.dispatch; var dispatch = _props.dispatch;
dispatch(A.deleteAccount(customerId, accountId)).then(function () { dispatch(A.deleteAccount(customerId, accountId, isRef)).then(function () {
_this4.close(); _this4.close();
setTimeout(function () { setTimeout(function () {
return Promise.all([dispatch(AU.authenticate(true)), dispatch(A.fetchOwnAccounts(customerId))]); return Promise.all([dispatch(AU.authenticate(true)), dispatch(A.fetchOwnAccounts(customerId))]);
@@ -3812,7 +3819,7 @@ webpackJsonp([0,3],{
_react2.default.createElement( _react2.default.createElement(
"strong", "strong",
null, null,
error JSON.stringify(error.errors || error)
) )
) : []; ) : [];
@@ -5167,17 +5174,12 @@ webpackJsonp([0,3],{
key: "handleAction", key: "handleAction",
value: function handleAction(evt) { value: function handleAction(evt) {
evt.preventDefault(); evt.preventDefault();
var action = this.props.action; var _props = this.props;
var account = this.props.account; var action = _props.action;
var account = _props.account;
var _ref = account || {};
var id = _ref.id;
var accountId = _ref.accountId;
if (action) { if (action) {
action(id || accountId); action(account);
} }
} }
}, { }, {
@@ -5185,13 +5187,13 @@ webpackJsonp([0,3],{
value: function render() { value: function render() {
var account = this.props.account; var account = this.props.account;
var _ref2 = account || {}; var _ref = account || {};
var titleRaw = _ref2.title; var titleRaw = _ref.title;
var descriptionRaw = _ref2.description; var descriptionRaw = _ref.description;
var balanceRaw = _ref2.balance; var balanceRaw = _ref.balance;
var id = _ref2.id; var id = _ref.id;
var accountId = _ref2.accountId; var accountId = _ref.accountId;
var entityId = id || accountId; var entityId = id || accountId;
@@ -5576,18 +5578,6 @@ webpackJsonp([0,3],{
this.ensureAccounts(nextProps); this.ensureAccounts(nextProps);
this.ensureTransfers(nextProps); this.ensureTransfers(nextProps);
} }
}, {
key: "createAccountModal",
value: function createAccountModal() {
this.setState({
showAccountModal: true
});
}
}, {
key: "createAccountModalConfirmed",
value: function createAccountModalConfirmed() {
// debugger;
}
}, { }, {
key: "close", key: "close",
value: function close() { value: function close() {
@@ -5720,7 +5710,7 @@ webpackJsonp([0,3],{
null, null,
_react2.default.createElement( _react2.default.createElement(
_reactBootstrap.Button, _reactBootstrap.Button,
{ bsStyle: "link", onClick: this.createAccountModal.bind(this) }, { bsStyle: "link", onClick: null, disabled: true },
"Edit" "Edit"
) )
) )
@@ -5878,7 +5868,7 @@ webpackJsonp([0,3],{
), ),
_react2.default.createElement(_TransfersTable.TransfersTable, { forAccount: accountId, transfers: this.props.transfers[accountId] }), _react2.default.createElement(_TransfersTable.TransfersTable, { forAccount: accountId, transfers: this.props.transfers[accountId] }),
_react2.default.createElement(Modals.NewAccountModal, { show: showAccountModal, _react2.default.createElement(Modals.NewAccountModal, { show: showAccountModal,
action: this.createAccountModalConfirmed.bind(this), action: null,
account: { loading: true }, account: { loading: true },
onHide: this.close.bind(this), onHide: this.close.bind(this),
key: 0 }) key: 0 })
@@ -7125,4 +7115,4 @@ webpackJsonp([0,3],{
/***/ } /***/ }
}); });
//# sourceMappingURL=app.30bd94eeaf3cbe7d3133.js.map //# sourceMappingURL=app.d2fd5066a9f7115b01b3.js.map

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@
<!-- Optional theme --> <!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"><link href="/style.b588c60da106277d78c8.css" rel="stylesheet"></head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"><link href="/style.b588c60da106277d78c8.css" rel="stylesheet"></head>
<body><div id="root"></div><script src="/manifest.02fd442c32e31abaf744.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.30bd94eeaf3cbe7d3133.js"></script><script> <body><div id="root"></div><script src="/manifest.7e5f85c8a08963380597.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.d2fd5066a9f7115b01b3.js"></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@@ -27,5 +27,5 @@
ga('send', 'pageview'); ga('send', 'pageview');
</script><!--{"files":{"publicPath":"/","chunks":{"manifest":{"size":0,"entry":"/manifest.02fd442c32e31abaf744.js","hash":"02fd442c32e31abaf744","css":[]},"vendor":{"size":1654379,"entry":"/vendor.85781b28c9410377534e.js","hash":"85781b28c9410377534e","css":[]},"style":{"size":122,"entry":"/style.b588c60da106277d78c8.js","hash":"b588c60da106277d78c8","css":["/style.b588c60da106277d78c8.css"]},"app":{"size":349495,"entry":"/app.30bd94eeaf3cbe7d3133.js","hash":"30bd94eeaf3cbe7d3133","css":[]}},"js":["/manifest.02fd442c32e31abaf744.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.30bd94eeaf3cbe7d3133.js"],"css":["/style.b588c60da106277d78c8.css"]},"options":{"template":"/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/html-webpack-plugin/lib/loader.js!/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/public/index.ejs","filename":"index.html","hash":false,"inject":false,"compile":true,"favicon":false,"minify":false,"cache":true,"showErrors":true,"chunks":"all","excludeChunks":[],"title":"Money Transfer App","xhtml":false,"description":"ES Money Transfer App","appMountId":"root","googleAnalytics":{"trackingId":"UA-XXXX-XX","pageViewOnLoad":true},"mobile":true}}--></body> </script><!--{"files":{"publicPath":"/","chunks":{"manifest":{"size":0,"entry":"/manifest.7e5f85c8a08963380597.js","hash":"7e5f85c8a08963380597","css":[]},"vendor":{"size":1654379,"entry":"/vendor.85781b28c9410377534e.js","hash":"85781b28c9410377534e","css":[]},"style":{"size":122,"entry":"/style.b588c60da106277d78c8.js","hash":"b588c60da106277d78c8","css":["/style.b588c60da106277d78c8.css"]},"app":{"size":349426,"entry":"/app.d2fd5066a9f7115b01b3.js","hash":"d2fd5066a9f7115b01b3","css":[]}},"js":["/manifest.7e5f85c8a08963380597.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.d2fd5066a9f7115b01b3.js"],"css":["/style.b588c60da106277d78c8.css"]},"options":{"template":"/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/html-webpack-plugin/lib/loader.js!/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/public/index.ejs","filename":"index.html","hash":false,"inject":false,"compile":true,"favicon":false,"minify":false,"cache":true,"showErrors":true,"chunks":"all","excludeChunks":[],"title":"Money Transfer App","xhtml":false,"description":"ES Money Transfer App","appMountId":"root","googleAnalytics":{"trackingId":"UA-XXXX-XX","pageViewOnLoad":true},"mobile":true}}--></body>
</html> </html>

View File

@@ -76,7 +76,7 @@
/******/ script.charset = 'utf-8'; /******/ script.charset = 'utf-8';
/******/ script.async = true; /******/ script.async = true;
/******/ /******/
/******/ script.src = __webpack_require__.p + "" + {"0":"30bd94eeaf3cbe7d3133","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js"; /******/ script.src = __webpack_require__.p + "" + {"0":"d2fd5066a9f7115b01b3","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
/******/ head.appendChild(script); /******/ head.appendChild(script);
/******/ } /******/ }
/******/ }; /******/ };
@@ -92,4 +92,4 @@
/******/ }) /******/ })
/************************************************************************/ /************************************************************************/
/******/ ([]); /******/ ([]);
//# sourceMappingURL=manifest.02fd442c32e31abaf744.js.map //# sourceMappingURL=manifest.7e5f85c8a08963380597.js.map

View File

@@ -1 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap a170b0c0e7e1bb98aa38?"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAA+C,iFAAiF;AAChI;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"manifest.02fd442c32e31abaf744.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t3:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + {\"0\":\"30bd94eeaf3cbe7d3133\",\"1\":\"b588c60da106277d78c8\",\"2\":\"85781b28c9410377534e\"}[chunkId] + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap a170b0c0e7e1bb98aa38\n **/"],"sourceRoot":""} {"version":3,"sources":["webpack:///webpack/bootstrap b0451df0d1f510adc177?"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAA+C,iFAAiF;AAChI;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"manifest.7e5f85c8a08963380597.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t3:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + {\"0\":\"d2fd5066a9f7115b01b3\",\"1\":\"b588c60da106277d78c8\",\"2\":\"85781b28c9410377534e\"}[chunkId] + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap b0451df0d1f510adc177\n **/"],"sourceRoot":""}

View File

@@ -47,7 +47,6 @@ export function accountsList(customerId) {
function readUntilChanged(initialData, customerId) { function readUntilChanged(initialData, customerId) {
const initialDataFlat = root['JSON'].stringify(initialData); const initialDataFlat = root['JSON'].stringify(initialData);
debugger;
return new Promise((rs, rj) => { return new Promise((rs, rj) => {
setTimeout(() => { setTimeout(() => {
api.apiRetrieveAccounts(customerId) api.apiRetrieveAccounts(customerId)
@@ -145,16 +144,21 @@ export const deleteAccountRequested = makeActionCreator(T.ACCOUNT.DELETE_START);
export const deleteAccountComplete = makeActionCreator(T.ACCOUNT.DELETE_COMPLETE); export const deleteAccountComplete = makeActionCreator(T.ACCOUNT.DELETE_COMPLETE);
export const deleteAccountError = makeActionCreator(T.ACCOUNT.DELETE_ERROR); export const deleteAccountError = makeActionCreator(T.ACCOUNT.DELETE_ERROR);
export function deleteAccount(customerId, accountId) { export function deleteAccount(customerId, accountId, isRef) {
return dispatch => { return dispatch => {
dispatch(deleteAccountRequested()); dispatch(deleteAccountRequested());
return api.apiDeleteAccount(customerId, accountId)
const deleteApiAction = (isRef ?
api.apiDeleteRefAccount(customerId, accountId) :
api.apiDeleteAccount(customerId, accountId));
return deleteApiAction
.then(data => { .then(data => {
dispatch(deleteAccountComplete(data)); dispatch(deleteAccountComplete(data));
return Promise.resolve(data); return Promise.resolve(data);
}) })
.catch(err => { .catch(err => {
dispatch(deleteAccountError()); dispatch(deleteAccountError(err));
return Promise.reject(err); return Promise.reject(err);
}) })
}; };

View File

@@ -17,6 +17,7 @@ initialize().then(({ provider }) => {
* Detect whether the server-side render has been discarded due to an invalid checksum. * Detect whether the server-side render has been discarded due to an invalid checksum.
*/ */
if (process.env.NODE_ENV !== "production") { if (process.env.NODE_ENV !== "production") {
const reactRoot = window.document.getElementById("root");
if (!reactRoot.firstChild || !reactRoot.firstChild.attributes || if (!reactRoot.firstChild || !reactRoot.firstChild.attributes ||
!reactRoot.firstChild.attributes["data-react-checksum"]) { !reactRoot.firstChild.attributes["data-react-checksum"]) {
console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code."); console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.");

View File

@@ -30,17 +30,17 @@ const METHODS = {
const fetch = (...args) => authedFetch(...args).then(parseResponse); const fetch = (...args) => authedFetch(...args).then(parseResponse);
export const apiSignIn = (body) => fetch(ENDPOINTS.emailSignInPath(), { export const apiSignIn = (body) => fetch(ENDPOINTS.emailSignIn(), {
...METHODS.POST, ...METHODS.POST,
body: root.JSON.stringify(body) body: root.JSON.stringify(body)
}); });
export const apiSignUp = (body) => fetch(ENDPOINTS.emailSignUpUrl(), { export const apiSignUp = (body) => fetch(ENDPOINTS.emailSignUp(), {
...METHODS.POST, ...METHODS.POST,
body: root.JSON.stringify(body) body: root.JSON.stringify(body)
}); });
export const apiGetCurrentUser = () => fetch(ENDPOINTS.currentUserPath(), { export const apiGetCurrentUser = () => fetch(ENDPOINTS.currentUser(), {
...METHODS.GET ...METHODS.GET
}); });
@@ -57,7 +57,7 @@ export const apiCreateAccount = (customerId, {
}); });
export const apiCreateRefAccount = (customerId, { export const apiCreateRefAccount = (customerId, {
owner, account: accountId, title, description }) => fetch(ENDPOINTS.toAccounts(customerId), { owner, account: accountId, title, description }) => fetch(ENDPOINTS.refAccounts(customerId), {
...METHODS.POST, ...METHODS.POST,
body: root.JSON.stringify({ body: root.JSON.stringify({
owner, owner,
@@ -67,7 +67,7 @@ export const apiCreateRefAccount = (customerId, {
}); });
export const apiMakeTransfer = (fromAccountId, { export const apiMakeTransfer = (fromAccountId, {
account, amount, description }) => fetch(ENDPOINTS.transfersUrl(), { account, amount, description }) => fetch(ENDPOINTS.transfers(), {
...METHODS.POST, ...METHODS.POST,
body: root.JSON.stringify({ body: root.JSON.stringify({
amount, amount,
@@ -89,7 +89,11 @@ export const apiRetrieveAccount = (accountId) => fetch(ENDPOINTS.account(account
...METHODS.GET ...METHODS.GET
}); });
export const apiDeleteAccount = (customerId, accountId) => fetch(ENDPOINTS.customersAccount(customerId, accountId), { export const apiDeleteAccount = (customerId, accountId) => fetch(ENDPOINTS.account(accountId), {
...METHODS.DELETE
});
export const apiDeleteRefAccount = (customerId, accountId) => fetch(ENDPOINTS.refAccount(customerId, accountId), {
...METHODS.DELETE ...METHODS.DELETE
}); });

View File

@@ -3,19 +3,20 @@
*/ */
const API_ROOT = '/api'; const API_ROOT = '/api';
export const emailSignInPath = () => API_ROOT + '/login'; export const emailSignIn = () => API_ROOT + '/login';
export const emailSignUpUrl = () => API_ROOT + '/customers'; export const emailSignUp = () => API_ROOT + '/customers';
export const customersPath = () => API_ROOT + '/customers'; export const currentUser = () => API_ROOT + '/user';
export const currentUserPath = () => API_ROOT + '/user';
export const accountsPath = () => API_ROOT + '/accounts'; export const accountsPath = () => API_ROOT + '/accounts';
export const customersLookup = (lookup) => `${API_ROOT}/customers?${ makeQuery(lookup) }`; export const customersLookup = (lookup) => `${API_ROOT}/customers?${ makeQuery(lookup) }`;
export const customersAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/accounts`; export const customersAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/accounts`;
export const customersAccount = (customerId, accountId) => `${API_ROOT}/customers/${customerId}/accounts/${accountId}`; export const refAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/toaccounts`;
export const toAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/toaccounts`; export const refAccount = (customerId, accountId) => `${API_ROOT}/customers/${customerId}/toaccounts/${accountId}`;
export const account = (accountId) => `${API_ROOT}/accounts/${accountId}`; export const account = (accountId) => `${API_ROOT}/accounts/${accountId}`;
export const history = (accountId) => `${API_ROOT}/accounts/${accountId}/history`; export const history = (accountId) => `${API_ROOT}/accounts/${accountId}/history`;
export const transfersUrl = () => API_ROOT + '/transfers'; export const transfers = () => API_ROOT + '/transfers';
function makeQuery(params) { function makeQuery(params) {
return Object.keys(params).map(key => [encodeURIComponent(key), encodeURIComponent(params[key])].join('=')).join('&'); return Object.keys(params)
.map(key => [ encodeURIComponent(key), encodeURIComponent(params[key]) ].join('='))
.join('&');
} }

View File

@@ -105,16 +105,6 @@ export class Account extends React.Component {
this.ensureTransfers(nextProps); this.ensureTransfers(nextProps);
} }
createAccountModal() {
this.setState({
showAccountModal: true
});
}
createAccountModalConfirmed() {
// debugger;
}
close() { close() {
this.setState({ this.setState({
@@ -201,7 +191,7 @@ export class Account extends React.Component {
Account Account
<Nav pullRight={true}> <Nav pullRight={true}>
<ButtonGroup> <ButtonGroup>
<Button bsStyle={"link"} onClick={this.createAccountModal.bind(this)}>Edit</Button> <Button bsStyle="link" onClick={ null } disabled={true}>Edit</Button>
</ButtonGroup> </ButtonGroup>
</Nav> </Nav>
</PageHeader> </PageHeader>
@@ -288,7 +278,7 @@ export class Account extends React.Component {
<TransfersTable forAccount={accountId} transfers={ this.props.transfers[accountId] } /> <TransfersTable forAccount={accountId} transfers={ this.props.transfers[accountId] } />
<Modals.NewAccountModal show={showAccountModal} <Modals.NewAccountModal show={showAccountModal}
action={this.createAccountModalConfirmed.bind(this)} action={ null }
account={{ loading: true }} account={{ loading: true }}
onHide={this.close.bind(this)} onHide={this.close.bind(this)}
key={0} /> key={0} />

View File

@@ -101,9 +101,12 @@ class MyAccounts extends React.Component {
}); });
} }
remove3rdPartyAccountModalConfirmed(accountId) { remove3rdPartyAccountModalConfirmed(account) {
const accountId = account.id || account.accountId;
const isRef = typeof account.balance == 'undefined';
const { customerId, dispatch } = this.props; const { customerId, dispatch } = this.props;
dispatch(A.deleteAccount(customerId, accountId)) dispatch(A.deleteAccount(customerId, accountId, isRef))
.then(() => { .then(() => {
this.close(); this.close();
setTimeout(() => { setTimeout(() => {
@@ -160,7 +163,7 @@ class MyAccounts extends React.Component {
const { accountToRemove = null} = this.state; const { accountToRemove = null} = this.state;
const { error } = this.props; const { error } = this.props;
const errorLine = error ? (<BS.Panel bsStyle="danger"><strong>{ error }</strong></BS.Panel>) : []; const errorLine = error ? (<BS.Panel bsStyle="danger"><strong>{ JSON.stringify(error.errors || error) }</strong></BS.Panel>) : [];
const ownAccountsData = this.props.app.accounts.own || []; const ownAccountsData = this.props.app.accounts.own || [];

View File

@@ -15,15 +15,9 @@ export class RemoveAccountBookmarkModal extends React.Component {
handleAction(evt) { handleAction(evt) {
evt.preventDefault(); evt.preventDefault();
const { action } = this.props; const { action, account } = this.props;
const { account } = this.props;
const {
id,
accountId
} = account || {};
if (action) { if (action) {
action(id || accountId); action(account);
} }
} }