Code overhaul & cleanup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
1
js-frontend/build/app.35229828558de671a3b3.js.map
Normal file
1
js-frontend/build/app.35229828558de671a3b3.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,8 +12,8 @@
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"><link href="/style.6734b6ac5d23d61b8e5f.css" rel="stylesheet"></head>
|
||||
<body><div id="root"></div><script src="/manifest.f7c52d40dd8e19ef0bdc.js"></script><script src="/vendor.d3d74fb754fa5fff76bc.js"></script><script src="/style.6734b6ac5d23d61b8e5f.js"></script><script src="/app.8e59f50dbdb226f8542e.js"></script><script>
|
||||
<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.5c9a90ba4de959b312e6.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.35229828558de671a3b3.js"></script><script>
|
||||
(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),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
@@ -27,5 +27,5 @@
|
||||
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script><!--{"files":{"publicPath":"/","chunks":{"manifest":{"size":0,"entry":"/manifest.f7c52d40dd8e19ef0bdc.js","hash":"f7c52d40dd8e19ef0bdc","css":[]},"vendor":{"size":1670874,"entry":"/vendor.d3d74fb754fa5fff76bc.js","hash":"d3d74fb754fa5fff76bc","css":[]},"style":{"size":122,"entry":"/style.6734b6ac5d23d61b8e5f.js","hash":"6734b6ac5d23d61b8e5f","css":["/style.6734b6ac5d23d61b8e5f.css"]},"app":{"size":351777,"entry":"/app.8e59f50dbdb226f8542e.js","hash":"8e59f50dbdb226f8542e","css":[]}},"js":["/manifest.f7c52d40dd8e19ef0bdc.js","/vendor.d3d74fb754fa5fff76bc.js","/style.6734b6ac5d23d61b8e5f.js","/app.8e59f50dbdb226f8542e.js"],"css":["/style.6734b6ac5d23d61b8e5f.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.5c9a90ba4de959b312e6.js","hash":"5c9a90ba4de959b312e6","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":349473,"entry":"/app.35229828558de671a3b3.js","hash":"35229828558de671a3b3","css":[]}},"js":["/manifest.5c9a90ba4de959b312e6.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.35229828558de671a3b3.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>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
/******/ script.charset = 'utf-8';
|
||||
/******/ script.async = true;
|
||||
/******/
|
||||
/******/ script.src = __webpack_require__.p + "" + {"0":"8e59f50dbdb226f8542e","1":"6734b6ac5d23d61b8e5f","2":"d3d74fb754fa5fff76bc"}[chunkId] + ".js";
|
||||
/******/ script.src = __webpack_require__.p + "" + {"0":"35229828558de671a3b3","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
|
||||
/******/ head.appendChild(script);
|
||||
/******/ }
|
||||
/******/ };
|
||||
@@ -92,4 +92,4 @@
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([]);
|
||||
//# sourceMappingURL=manifest.f7c52d40dd8e19ef0bdc.js.map
|
||||
//# sourceMappingURL=manifest.5c9a90ba4de959b312e6.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["webpack:///webpack/bootstrap 7c2a8d64f2b4afbde8ad?"],"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.f7c52d40dd8e19ef0bdc.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\":\"8e59f50dbdb226f8542e\",\"1\":\"6734b6ac5d23d61b8e5f\",\"2\":\"d3d74fb754fa5fff76bc\"}[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 7c2a8d64f2b4afbde8ad\n **/"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack:///webpack/bootstrap 46a236c46f2914f9a949?"],"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.5c9a90ba4de959b312e6.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\":\"35229828558de671a3b3\",\"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 46a236c46f2914f9a949\n **/"],"sourceRoot":""}
|
||||
@@ -438,4 +438,4 @@ body {
|
||||
h1 {
|
||||
margin-top: .5em;
|
||||
}
|
||||
/*# sourceMappingURL=style.6734b6ac5d23d61b8e5f.css.map*/
|
||||
/*# sourceMappingURL=style.b588c60da106277d78c8.css.map*/
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"style.6734b6ac5d23d61b8e5f.css","sourceRoot":""}
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"style.b588c60da106277d78c8.css","sourceRoot":""}
|
||||
@@ -3,20 +3,20 @@ webpackJsonp([1,3],{
|
||||
/***/ 0:
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(611);
|
||||
module.exports = __webpack_require__(615);
|
||||
__webpack_require__(612);
|
||||
module.exports = __webpack_require__(616);
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 611:
|
||||
/***/ 612:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
// removed by extract-text-webpack-plugin
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 615:
|
||||
/***/ 616:
|
||||
/***/ function(module, exports) {
|
||||
|
||||
// removed by extract-text-webpack-plugin
|
||||
@@ -24,4 +24,4 @@ webpackJsonp([1,3],{
|
||||
/***/ }
|
||||
|
||||
});
|
||||
//# sourceMappingURL=style.6734b6ac5d23d61b8e5f.js.map
|
||||
//# sourceMappingURL=style.b588c60da106277d78c8.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["webpack:///./~/react-select/dist/react-select.css?","webpack:///./src/main.less?"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0C;;;;;;;ACAA,0C","file":"style.6734b6ac5d23d61b8e5f.js","sourcesContent":["// removed by extract-text-webpack-plugin\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/react-select/dist/react-select.css\n ** module id = 611\n ** module chunks = 1\n **/","// removed by extract-text-webpack-plugin\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/main.less\n ** module id = 615\n ** module chunks = 1\n **/"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack:///./~/react-select/dist/react-select.css?","webpack:///./src/main.less?"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0C;;;;;;;ACAA,0C","file":"style.b588c60da106277d78c8.js","sourcesContent":["// removed by extract-text-webpack-plugin\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/react-select/dist/react-select.css\n ** module id = 612\n ** module chunks = 1\n **/","// removed by extract-text-webpack-plugin\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/main.less\n ** module id = 616\n ** module chunks = 1\n **/"],"sourceRoot":""}
|
||||
File diff suppressed because it is too large
Load Diff
1
js-frontend/build/vendor.85781b28c9410377534e.js.map
Normal file
1
js-frontend/build/vendor.85781b28c9410377534e.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,127 +0,0 @@
|
||||
import del from "del";
|
||||
import path from "path";
|
||||
import gulp from "gulp";
|
||||
import open from "open";
|
||||
import gulpLoadPlugins from "gulp-load-plugins";
|
||||
import packageJson from "./package.json";
|
||||
import runSequence from "run-sequence";
|
||||
import webpack from "webpack";
|
||||
import webpackConfig from "./webpack.config";
|
||||
import WebpackDevServer from "webpack-dev-server";
|
||||
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
const $ = gulpLoadPlugins({camelize: true});
|
||||
|
||||
|
||||
// MyAccounts tasks
|
||||
gulp.task('serve', () => runSequence('serve:clean', 'serve:index', 'serve:start'));
|
||||
gulp.task('dist', () => runSequence('dist:clean', 'dist:build', 'dist:index'));
|
||||
gulp.task('clean', ['dist:clean', 'serve:clean']);
|
||||
gulp.task('open', () => open('http://localhost:3000'));
|
||||
|
||||
gulp.task('export', () => runSequence(/*'dist:clean', 'dist:build', 'dist:index',*/ 'export:clean', 'export:copy'));
|
||||
|
||||
// Remove all built files
|
||||
gulp.task('serve:clean', cb => del('build', {dot: true}, cb));
|
||||
gulp.task('dist:clean', cb => del(['dist', 'dist-intermediate'], {dot: true}, cb));
|
||||
gulp.task('export:clean', cb => del(['../prebuilt-web-client/**'], {dot: true, force: true}, cb));
|
||||
|
||||
// Copy static files across to our final directory
|
||||
gulp.task('serve:static', () =>
|
||||
gulp.src([
|
||||
'src/static/**'
|
||||
])
|
||||
.pipe($.changed('build'))
|
||||
.pipe(gulp.dest('build'))
|
||||
.pipe($.size({title: 'static'}))
|
||||
);
|
||||
|
||||
gulp.task('dist:static', () =>
|
||||
gulp.src([
|
||||
'src/static/**'
|
||||
])
|
||||
.pipe(gulp.dest('dist'))
|
||||
.pipe($.size({title: 'static'}))
|
||||
);
|
||||
|
||||
gulp.task('export:copy', () => {
|
||||
return gulp.src(['dist/**'])
|
||||
.pipe(gulp.dest('../prebuilt-web-client'));
|
||||
});
|
||||
|
||||
// Copy our index file and inject css/script imports for this build
|
||||
gulp.task('serve:index', () => {
|
||||
return gulp
|
||||
.src('src/index.html')
|
||||
.pipe($.injectString.after('<!-- inject:app:js -->', '<script src="generated/main.js"></script>'))
|
||||
.pipe(gulp.dest('build'));
|
||||
});
|
||||
|
||||
// Copy our index file and inject css/script imports for this build
|
||||
gulp.task('dist:index', () => {
|
||||
const app = gulp
|
||||
.src(["*.{css,js}"], {cwd: 'dist-intermediate/generated'})
|
||||
.pipe(gulp.dest('dist'));
|
||||
|
||||
// Build the index.html using the names of compiled files
|
||||
return gulp.src('src/index.html')
|
||||
.pipe($.inject(app, {
|
||||
ignorePath: 'dist',
|
||||
starttag: '<!-- inject:app:{{ext}} -->'
|
||||
}))
|
||||
.on("error", $.util.log)
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
// Start a livereloading development server
|
||||
gulp.task('serve:start', ['serve:static'], () => {
|
||||
const config = webpackConfig(true, 'build', PORT);
|
||||
|
||||
// https://webpack.github.io/docs/webpack-dev-server.html
|
||||
return new WebpackDevServer(webpack(config), {
|
||||
contentBase: 'build',
|
||||
publicPath: config.output.publicPath,
|
||||
watchDelay: 100,
|
||||
historyApiFallback: true,
|
||||
//proxy: {
|
||||
// "*": "http://localhost:8080"
|
||||
//}
|
||||
|
||||
proxy: {
|
||||
'/user*' : {
|
||||
target: 'http://localhost:8080'
|
||||
},
|
||||
'/login' : {
|
||||
target: 'http://localhost:8080'
|
||||
},
|
||||
'/customers*' : {
|
||||
target: 'http://localhost:8080'
|
||||
},
|
||||
'/accounts*' : {
|
||||
target: 'http://localhost:8080'
|
||||
},
|
||||
'/transfers*' : {
|
||||
target: 'http://localhost:8080'
|
||||
}
|
||||
}
|
||||
})
|
||||
.listen(PORT, '0.0.0.0', (err) => {
|
||||
if (err) throw new $.util.PluginError('webpack-dev-server', err);
|
||||
|
||||
$.util.log(`[${packageJson.name} serve]`, `Listening at 0.0.0.0:${PORT}`);
|
||||
});
|
||||
});
|
||||
|
||||
// Create a distributable package
|
||||
gulp.task('dist:build', ['dist:static'], cb => {
|
||||
const config = webpackConfig(false, 'dist-intermediate');
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) throw new $.util.PluginError('dist', err);
|
||||
|
||||
$.util.log(`[${packageJson.name} dist]`, stats.toString({colors: true}));
|
||||
|
||||
cb();
|
||||
});
|
||||
});
|
||||
@@ -18,7 +18,6 @@
|
||||
"autoprefixer-loader": "^2.0.0",
|
||||
"babel-plugin-add-module-exports": "^0.1.2",
|
||||
"babel-plugin-transform-runtime": "^6.12.0",
|
||||
|
||||
"babel-cli": "^6.7.7",
|
||||
"babel-core": "^6.10.4",
|
||||
"babel-eslint": "^4.1.6",
|
||||
@@ -34,13 +33,6 @@
|
||||
"extract-text-webpack-plugin": "^0.8.1",
|
||||
"file-loader": "^0.8.4",
|
||||
"fill-range": "^2.2.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-changed": "^1.2.1",
|
||||
"gulp-inject": "^1.3.1",
|
||||
"gulp-inject-string": "0.0.2",
|
||||
"gulp-load-plugins": "^0.10.0",
|
||||
"gulp-size": "^1.2.1",
|
||||
"gulp-util": "^3.0.5",
|
||||
"html-webpack-plugin": "^2.22.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"less": "^2.5.3",
|
||||
@@ -65,13 +57,11 @@
|
||||
"invariant": "^2.1.1",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"js-cookie": "^2.1.0",
|
||||
"object-pick": "^0.1.1",
|
||||
"querystring": "^0.2.0",
|
||||
"react": "^0.14.7",
|
||||
"react-bootstrap": "^0.28.3",
|
||||
"react-dom": "^0.14.0",
|
||||
"react-loader": "^2.4.0",
|
||||
"react-pacomo": "^0.5.1",
|
||||
"react-redux": "^4.4.0",
|
||||
"react-router": "^2.7.0",
|
||||
"react-router-bootstrap": "^0.20.1",
|
||||
@@ -83,7 +73,6 @@
|
||||
"redux-logger": "^2.6.0",
|
||||
"redux-multi": "^0.1.91",
|
||||
"redux-router": "^1.0.0-beta7",
|
||||
"redux-thunk": "^1.0.3",
|
||||
"uniloc": "^0.2.0"
|
||||
"redux-thunk": "^1.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import ApplicationLayout from './components/ApplicationLayout'
|
||||
import DocumentContainer from './containers/DocumentContainer'
|
||||
import DocumentListContainer from './containers/DocumentListContainer'
|
||||
|
||||
|
||||
// Application is the root component for your application.
|
||||
export default function Application(props) {
|
||||
return (
|
||||
<ApplicationLayout locationName={props.state.navigation.location.name}>
|
||||
{selectChildContainer(props)}
|
||||
</ApplicationLayout>
|
||||
)
|
||||
}
|
||||
Application.propTypes = {
|
||||
state: PropTypes.object.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
|
||||
// Define this as a separate function to allow us to use the switch statement
|
||||
// with `return` statements instead of `break`
|
||||
const selectChildContainer = props => {
|
||||
const location = props.state.navigation.location
|
||||
|
||||
let child
|
||||
switch (location.name) {
|
||||
case 'documentEdit':
|
||||
child = <DocumentContainer {...props} id={location.options.id} />
|
||||
case 'documentList':
|
||||
return <DocumentListContainer {...props} id={location.options.id}>{child}</DocumentListContainer>
|
||||
|
||||
default:
|
||||
return "Not Found"
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
import T from '../constants/ACTION_TYPES';
|
||||
import { makeActionCreator } from '../utils/actions';
|
||||
import * as U from '../utils/sessionStorage';
|
||||
|
||||
import { apiGetCurrentUser } from '../utils/api';
|
||||
import { entityReceived } from './entities';
|
||||
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
/**
|
||||
* Created by andrew on 26/02/16.
|
||||
*/
|
||||
import {
|
||||
authenticate,
|
||||
} from "./authenticate";
|
||||
|
||||
import {applyConfig} from "../utils/clientSettings";
|
||||
import { authenticate } from "./authenticate";
|
||||
import { applyConfig } from "../utils/clientSettings";
|
||||
|
||||
export const SET_ENDPOINT_KEYS = "SET_ENDPOINT_KEYS";
|
||||
export const STORE_CURRENT_ENDPOINT_KEY = "STORE_CURRENT_ENDPOINT_KEY";
|
||||
|
||||
export function setEndpointKeys(endpoints, currentEndpointKey, defaultEndpointKey) {
|
||||
return { type: SET_ENDPOINT_KEYS, endpoints, currentEndpointKey, defaultEndpointKey };
|
||||
}
|
||||
|
||||
export function storeCurrentEndpointKey(currentEndpointKey) {
|
||||
return { type: STORE_CURRENT_ENDPOINT_KEY, currentEndpointKey };
|
||||
return {
|
||||
type: SET_ENDPOINT_KEYS,
|
||||
endpoints,
|
||||
currentEndpointKey,
|
||||
defaultEndpointKey
|
||||
};
|
||||
}
|
||||
|
||||
export function configure(endpoint={}, settings={}) {
|
||||
|
||||
return dispatch => {
|
||||
|
||||
|
||||
return applyConfig({ dispatch, endpoint, settings })
|
||||
.then(() => {
|
||||
return dispatch(authenticate());
|
||||
|
||||
@@ -255,7 +255,7 @@ export const getTransfers = (accountId) => {
|
||||
dispatch(getTransfersRequested(accountId));
|
||||
return api.apiRetrieveTransfers(accountId)
|
||||
.then(data => {
|
||||
dispatch(getTransfersComplete(accountId, data.transactionsHistory));
|
||||
dispatch(getTransfersComplete(accountId, data['transactionsHistory']));
|
||||
return data;
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
@@ -1,40 +1,18 @@
|
||||
/**
|
||||
* Created by andrew on 11/03/16.
|
||||
*/
|
||||
import {
|
||||
getEmailSignInUrl,
|
||||
setCurrentEndpointKey,
|
||||
getCurrentEndpointKey
|
||||
} from "../utils/sessionStorage";
|
||||
|
||||
import {destroySession} from "../utils/sessionStorage";
|
||||
|
||||
|
||||
import { entityReceived } from './entities';
|
||||
import { storeCurrentEndpointKey } from "./configure";
|
||||
import { parseResponse } from "../utils/handleFetchResponse";
|
||||
import fetch from "../utils/fetch";
|
||||
|
||||
import T from '../constants/ACTION_TYPES';
|
||||
import { makeActionCreator } from '../utils/actions';
|
||||
import { destroySession } from "../utils/sessionStorage";
|
||||
|
||||
import root from '../utils/root';
|
||||
|
||||
export function signOutStart() {
|
||||
return { type: T.AUTH.SIGN_OUT_START };
|
||||
}
|
||||
|
||||
export function signOutComplete() {
|
||||
return { type: T.AUTH.SIGN_OUT_COMPLETE };
|
||||
}
|
||||
|
||||
export function signOut() {
|
||||
return dispatch => {
|
||||
export const signOutStart = makeActionCreator(T.AUTH.SIGN_OUT_START);
|
||||
export const signOutComplete = makeActionCreator(T.AUTH.SIGN_OUT_COMPLETE);
|
||||
|
||||
export const signOut = () =>
|
||||
dispatch => {
|
||||
dispatch(signOutStart());
|
||||
|
||||
destroySession();
|
||||
|
||||
dispatch(signOutComplete());
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -7,8 +7,8 @@ import { initialize } from "./app";
|
||||
/**
|
||||
* Fire-up React Router.
|
||||
*/
|
||||
const reactRoot = window.document.getElementById("root");
|
||||
initialize().then(({ provider }) => {
|
||||
const reactRoot = window.document.getElementById("root");
|
||||
ReactDOM.render(provider, reactRoot);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
//import './ApplicationLayout.less'
|
||||
|
||||
import React, {PropTypes} from 'react'
|
||||
//import { pacomoTransformer } from '../utils/pacomo'
|
||||
import Link from './Link'
|
||||
|
||||
|
||||
const ApplicationLayout = ({
|
||||
children,
|
||||
locationName,
|
||||
}) =>
|
||||
(<div>
|
||||
<nav className='navbar'>
|
||||
<Link
|
||||
name='documentList'
|
||||
className={{
|
||||
'link': true,
|
||||
'link-active': locationName == 'documentList' || locationName == 'documentEdit',
|
||||
}}
|
||||
>
|
||||
Documents
|
||||
</Link>
|
||||
</nav>
|
||||
<main className='content'>
|
||||
{children}
|
||||
</main>
|
||||
</div>);
|
||||
|
||||
ApplicationLayout.propTypes = {
|
||||
children: PropTypes.element.isRequired,
|
||||
locationName: PropTypes.string
|
||||
};
|
||||
|
||||
export default ApplicationLayout;
|
||||
//export default pacomoTransformer(ApplicationLayout)
|
||||
@@ -1,26 +0,0 @@
|
||||
.app-ApplicationLayout {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
|
||||
&-navbar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 192px;
|
||||
|
||||
border-right: 1px solid black;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&-content {
|
||||
position: relative;
|
||||
padding-left: 192px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&-link-active {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { pushState } from 'redux-router';
|
||||
|
||||
import read from '../utils/readProp';
|
||||
|
||||
export function requireAuthentication(Component) {
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { LinkContainer } from "react-router-bootstrap";
|
||||
|
||||
import read from '../utils/readProp';
|
||||
|
||||
//import { PageHeader, OverlayTrigger, Tooltip, Grid, Col, Row, Nav, NavItem, ButtonGroup, Button, Table } from "react-bootstrap";
|
||||
import * as BS from "react-bootstrap";
|
||||
import { Link, IndexLink } from "react-router";
|
||||
|
||||
import read from '../utils/readProp';
|
||||
import { signOut } from '../actions/signOut';
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import ROUTES from '../constants/ROUTES'
|
||||
|
||||
|
||||
const Link = ({
|
||||
name,
|
||||
options,
|
||||
children,
|
||||
...props
|
||||
}) =>
|
||||
<a {...props} href={'#'+ROUTES.generate(name, options)}>{children}</a>
|
||||
|
||||
Link.propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
options: PropTypes.object,
|
||||
children: PropTypes.node.isRequired
|
||||
};
|
||||
|
||||
export default Link;
|
||||
@@ -6,7 +6,7 @@ import React from 'react';
|
||||
export const moneyText = (amount) => {
|
||||
|
||||
if (Number.isNaN(Number(amount))) {
|
||||
return '';
|
||||
return '—';
|
||||
}
|
||||
const absNum = Math.abs(Number(amount) / 100);
|
||||
if (absNum < 0) {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import './OneOrTwoColumnLayout.less'
|
||||
|
||||
import React, {PropTypes} from 'react'
|
||||
import { pacomoTransformer } from '../utils/pacomo'
|
||||
|
||||
|
||||
const OneOrTwoColumnLayout = ({
|
||||
left,
|
||||
right,
|
||||
}) =>
|
||||
<div>
|
||||
<div className={{'left': true, 'left-open': left}}>
|
||||
{left}
|
||||
</div>
|
||||
<div className={{'right': true, 'right-open': right}}>
|
||||
{right}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
OneOrTwoColumnLayout.propTypes = {
|
||||
left: PropTypes.element,
|
||||
right: PropTypes.element,
|
||||
}
|
||||
|
||||
export default pacomoTransformer(OneOrTwoColumnLayout)
|
||||
@@ -1,24 +0,0 @@
|
||||
.app-OneOrTwoColumnLayout {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
|
||||
&-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
&-right-open {
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,9 @@
|
||||
import React, { PropTypes } from "react";
|
||||
import { Grid, Col, Navbar, NavItem, Nav, NavbarBrand, Footer } from "react-bootstrap";
|
||||
import { LinkContainer } from "react-router-bootstrap";
|
||||
|
||||
import HeaderLinks from '../HeaderLinks';
|
||||
|
||||
//import { SignOutButton } from "redux-auth/bootstrap-theme";
|
||||
|
||||
//const SignOutButton = () => (<div>SignOutButton!</div>);
|
||||
|
||||
class Container extends React.Component {
|
||||
export class Container extends React.Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node
|
||||
};
|
||||
@@ -50,11 +45,5 @@ class Container extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
/*<a href="https://github.com/lynndylanhurley/redux-auth">
|
||||
<img
|
||||
style={{position: "absolute", top: 0, right: 0, border: 0}}
|
||||
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
|
||||
alt="Fork me on GitHub"
|
||||
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" />
|
||||
</a>*/
|
||||
|
||||
export default Container;
|
||||
@@ -4,7 +4,7 @@
|
||||
import React, { PropTypes } from "react";
|
||||
import { Panel, Col } from "react-bootstrap";
|
||||
|
||||
class IndexPanel extends React.Component {
|
||||
export class IndexPanel extends React.Component {
|
||||
static propTypes = {
|
||||
bsStyle: PropTypes.string,
|
||||
header: PropTypes.string,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import uniloc from 'uniloc'
|
||||
|
||||
export default uniloc({
|
||||
root: 'GET /',
|
||||
login: 'GET /login',
|
||||
register: 'GET /register',
|
||||
})
|
||||
@@ -1,27 +0,0 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import * as actions from '../actions/documentView'
|
||||
import compose from '../utils/compose'
|
||||
import partial from '../utils/partial'
|
||||
import DocumentForm from '../components/DocumentForm'
|
||||
|
||||
|
||||
export default function DocumentContainer({state, dispatch, id}) {
|
||||
const errors = state.view.document.saveErrors[id]
|
||||
const viewData = state.view.document.unsavedChanges[id]
|
||||
const data =
|
||||
viewData ||
|
||||
state.data.document[id] ||
|
||||
(id == 'new' && {})
|
||||
const props = {
|
||||
data,
|
||||
errors,
|
||||
onUpdate: compose(dispatch, partial(actions.updateChanges, id)),
|
||||
onCancel: compose(dispatch, partial(actions.cancelChanges, id)),
|
||||
onSubmit:
|
||||
viewData && !errors
|
||||
? compose(dispatch, partial(actions.submitChanges, id))
|
||||
: null,
|
||||
}
|
||||
|
||||
return !data ? <div>Not Found</div> : <DocumentForm {...props} />
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import * as actions from '../actions/documentListView'
|
||||
import compose from '../utils/compose'
|
||||
import OneOrTwoColumnLayout from '../components/OneOrTwoColumnLayout'
|
||||
import DocumentList from '../components/DocumentList'
|
||||
|
||||
|
||||
function listPredicate(query) {
|
||||
return (
|
||||
!query
|
||||
? () => true
|
||||
: ([id, data]) => data.title.replace(/\s+/g, '').indexOf(query) !== -1
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default function DocumentListContainer({state, dispatch, children, id}) {
|
||||
const query = state.view.documentList
|
||||
const props = {
|
||||
id,
|
||||
query,
|
||||
documents: Object
|
||||
.entries(state.data.document)
|
||||
.filter(listPredicate(query)),
|
||||
onChangeQuery: compose(dispatch, actions.updateQuery),
|
||||
}
|
||||
|
||||
return <OneOrTwoColumnLayout
|
||||
left={<DocumentList {...props} />}
|
||||
right={children}
|
||||
/>
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
import React, { PropTypes } from "react";
|
||||
import { Glyphicon } from "react-bootstrap";
|
||||
|
||||
|
||||
class AuxErrorLabel extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
@@ -17,9 +16,6 @@ class AuxErrorLabel extends React.Component {
|
||||
errors: []
|
||||
};
|
||||
|
||||
// <Input {...this.props}
|
||||
// bsStyle={(this.props.errors.length) ? "error" : null}
|
||||
// onChange={this.handleInput.bind(this)} />
|
||||
render () {
|
||||
const { errors } = this.props;
|
||||
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
* Created by andrew on 15/02/16.
|
||||
*/
|
||||
import React, {PropTypes} from "react";
|
||||
import { connect } from "react-redux";
|
||||
import read from '../../utils/readProp';
|
||||
|
||||
import * as BS from "react-bootstrap";
|
||||
import read from '../../utils/readProp';
|
||||
import Input from "./Input";
|
||||
import ButtonLoader from "./ButtonLoader";
|
||||
import AuxErrorLabel from './AuxErrorLabel';
|
||||
|
||||
import * as AS from "../../actions/signIn";
|
||||
|
||||
const formValidation = (payload) => [
|
||||
@@ -134,5 +131,3 @@ EmailSignInForm.defaultProps = {
|
||||
submit: {}
|
||||
}
|
||||
};
|
||||
|
||||
// export default connect(({app}) => ({auth: app.auth}))(EmailSignInForm);
|
||||
@@ -13,44 +13,3 @@ export const configReducer = createDataReducer([
|
||||
'config',
|
||||
(c = {}) => ({ ...c })
|
||||
);
|
||||
//
|
||||
// const configInitialState = {
|
||||
// loading: true,
|
||||
// errors: null,
|
||||
// config: null
|
||||
// };
|
||||
//
|
||||
// export const configReducer = (state = {...configInitialState}, action) => {
|
||||
// switch(action.type) {
|
||||
// case T.AUTH.CONFIGURE_START:
|
||||
// {
|
||||
// return {
|
||||
// ...state,
|
||||
// loading: true
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// case T.AUTH.CONFIGURE_COMPLETE: {
|
||||
// const { config } = action;
|
||||
// return {
|
||||
// ...state,
|
||||
// loading: false,
|
||||
// errors: null,
|
||||
// config
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// case T.AUTH.CONFIGURE_ERROR:
|
||||
// {
|
||||
// const { errors } = action;
|
||||
// return {
|
||||
// ...state,
|
||||
// loading: false,
|
||||
// errors
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// default:
|
||||
// return state;
|
||||
// }
|
||||
// };
|
||||
@@ -2,23 +2,10 @@
|
||||
* Created by andrew on 12/03/16.
|
||||
*/
|
||||
import authedFetch from './fetch';
|
||||
import {
|
||||
getEmailSignInUrl,
|
||||
getEmailSignUpUrl,
|
||||
getCurrentUserUrl,
|
||||
getAccountsUrl,
|
||||
getCustomersUrl,
|
||||
getTransfersUrl
|
||||
} from "./sessionStorage";
|
||||
import * as ENDPOINTS from './apiEndpoints';
|
||||
import root from './root';
|
||||
import { parseResponse } from "./handleFetchResponse";
|
||||
|
||||
const fetch = (...args) => authedFetch(...args).then(parseResponse);
|
||||
|
||||
function makeQuery(params) {
|
||||
return Object.keys(params).map(key => [encodeURIComponent(key), encodeURIComponent(params[key])].join('=')).join('&');
|
||||
}
|
||||
|
||||
const JSON_HEADERS = {
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
@@ -41,22 +28,26 @@ const METHODS = {
|
||||
}
|
||||
};
|
||||
|
||||
export const apiSignIn = (body) => fetch(getEmailSignInUrl(), {
|
||||
const fetch = (...args) => authedFetch(...args).then(parseResponse);
|
||||
|
||||
export const apiSignIn = (body) => fetch(ENDPOINTS.emailSignInPath(), {
|
||||
...METHODS.POST,
|
||||
body: root.JSON.stringify(body)
|
||||
});
|
||||
|
||||
export const apiSignUp = (body) => fetch(getEmailSignUpUrl(), {
|
||||
export const apiSignUp = (body) => fetch(ENDPOINTS.emailSignUpUrl(), {
|
||||
...METHODS.POST,
|
||||
body: root.JSON.stringify(body)
|
||||
});
|
||||
|
||||
export const apiGetCurrentUser = () => fetch(getCurrentUserUrl(), { ...METHODS.GET });
|
||||
export const apiGetCurrentUser = () => fetch(ENDPOINTS.currentUserPath(), {
|
||||
...METHODS.GET
|
||||
});
|
||||
|
||||
export const apiCreateAccount = (customerId, {
|
||||
title,
|
||||
balance: initialBalance,
|
||||
description }) => fetch(getAccountsUrl(), {
|
||||
description }) => fetch(ENDPOINTS.accountsPath(), {
|
||||
...METHODS.POST,
|
||||
body: root.JSON.stringify({
|
||||
customerId,
|
||||
@@ -66,7 +57,7 @@ export const apiCreateAccount = (customerId, {
|
||||
});
|
||||
|
||||
export const apiCreateRefAccount = (customerId, {
|
||||
owner, account: accountId, title, description }) => fetch(`${getCustomersUrl()}/${customerId}/toaccounts`, {
|
||||
owner, account: accountId, title, description }) => fetch(ENDPOINTS.toAccounts(customerId), {
|
||||
...METHODS.POST,
|
||||
body: root.JSON.stringify({
|
||||
owner,
|
||||
@@ -76,32 +67,32 @@ export const apiCreateRefAccount = (customerId, {
|
||||
});
|
||||
|
||||
export const apiMakeTransfer = (fromAccountId, {
|
||||
account, amount, description }) => fetch(getTransfersUrl(), {
|
||||
account, amount, description }) => fetch(ENDPOINTS.transfersUrl(), {
|
||||
...METHODS.POST,
|
||||
body: root.JSON.stringify({
|
||||
"amount": amount,
|
||||
"fromAccountId": fromAccountId,
|
||||
amount,
|
||||
fromAccountId,
|
||||
"toAccountId": account,
|
||||
description
|
||||
})
|
||||
});
|
||||
|
||||
export const apiRetrieveAccounts = (customerId) => fetch(`${getCustomersUrl()}/${customerId}/accounts`, {
|
||||
export const apiRetrieveAccounts = (customerId) => fetch(ENDPOINTS.customersAccounts(customerId), {
|
||||
...METHODS.GET
|
||||
});
|
||||
|
||||
export const apiRetrieveTransfers = (accountId) => fetch(`${getAccountsUrl()}/${accountId}/history`, {
|
||||
export const apiRetrieveTransfers = (accountId) => fetch(ENDPOINTS.history(accountId), {
|
||||
...METHODS.GET
|
||||
});
|
||||
|
||||
export const apiRetrieveAccount = (accountId) => fetch(`${getAccountsUrl()}/${accountId}`, {
|
||||
export const apiRetrieveAccount = (accountId) => fetch(ENDPOINTS.account(accountId), {
|
||||
...METHODS.GET
|
||||
});
|
||||
|
||||
export const apiDeleteAccount = (customerId, accountId) => fetch(`${getCustomersUrl()}/${customerId}/accounts/${accountId}`, {
|
||||
export const apiDeleteAccount = (customerId, accountId) => fetch(ENDPOINTS.customersAccount(customerId, accountId), {
|
||||
...METHODS.DELETE
|
||||
});
|
||||
|
||||
export const apiRetrieveUsers = (email) => fetch(`${getCustomersUrl()}?${makeQuery({ email })}`, {
|
||||
export const apiRetrieveUsers = (email) => fetch(ENDPOINTS.customersLookup({ email }), {
|
||||
...METHODS.GET
|
||||
});
|
||||
|
||||
21
js-frontend/src/utils/apiEndpoints.js
Normal file
21
js-frontend/src/utils/apiEndpoints.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Created by andrew on 9/16/16.
|
||||
*/
|
||||
const API_ROOT = '/api';
|
||||
|
||||
export const emailSignInPath = () => API_ROOT + '/login';
|
||||
export const emailSignUpUrl = () => API_ROOT + '/customers';
|
||||
export const customersPath = () => '/customers';
|
||||
export const currentUserPath = () => API_ROOT + '/user';
|
||||
export const accountsPath = () => API_ROOT + '/accounts';
|
||||
export const customersLookup = (lookup) => `${API_ROOT}/customers?${ makeQuery(lookup) }`;
|
||||
export const customersAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/accounts`;
|
||||
export const customersAccount = (customerId, accountId) => `${API_ROOT}/customers/${customerId}/accounts/${accountId}`;
|
||||
export const toAccounts = (customerId) => `${API_ROOT}/customers/${customerId}/toaccounts`;
|
||||
export const account = (accountId) => `${API_ROOT}/accounts/${accountId}`;
|
||||
export const history = (accountId) => `${API_ROOT}/accounts/${accountId}/history`;
|
||||
export const transfersUrl = () => '/transfers';
|
||||
|
||||
function makeQuery(params) {
|
||||
return Object.keys(params).map(key => [encodeURIComponent(key), encodeURIComponent(params[key])].join('=')).join('&');
|
||||
}
|
||||
@@ -3,65 +3,28 @@
|
||||
*/
|
||||
|
||||
import * as C from "./constants";
|
||||
import root from './root';
|
||||
|
||||
import fetch from "./fetch";
|
||||
|
||||
import parseEndpointConfig from "./parseEndpointConfig";
|
||||
import { setEndpointKeys } from "../actions/configure";
|
||||
|
||||
import {
|
||||
getCurrentSettings,
|
||||
setCurrentSettings,
|
||||
getInitialEndpointKey,
|
||||
setDefaultEndpointKey,
|
||||
setCurrentEndpoint,
|
||||
setCurrentEndpointKey,
|
||||
retrieveData,
|
||||
persistData,
|
||||
destroySession
|
||||
} from "./sessionStorage";
|
||||
|
||||
const defaultSettings = {
|
||||
//proxyIf: function() { return false; },
|
||||
//proxyUrl: "/proxy",
|
||||
forceHardRedirect: false,
|
||||
storage: "cookies",
|
||||
cookieExpiry: 14,
|
||||
cookiePath: "/",
|
||||
initialCredentials: null,
|
||||
|
||||
passwordResetSuccessUrl: function() {
|
||||
return root.location.href;
|
||||
},
|
||||
|
||||
confirmationSuccessUrl: function() {
|
||||
return root.location.href;
|
||||
},
|
||||
|
||||
tokenFormat: {
|
||||
"access-token": "{{ access-token }}"
|
||||
//"token-type": "Bearer",
|
||||
//client: "{{ client }}",
|
||||
//expiry: "{{ expiry }}",
|
||||
//uid: "{{ uid }}"
|
||||
},
|
||||
|
||||
parseExpiry: function(headers){
|
||||
// convert from ruby time (seconds) to js time (millis)
|
||||
return (parseInt(headers["expiry"], 10) * 1000) || null;
|
||||
},
|
||||
|
||||
handleLoginResponse: function(resp) {
|
||||
return resp.data;
|
||||
},
|
||||
|
||||
handleAccountUpdateResponse: function(resp) {
|
||||
return resp.data;
|
||||
},
|
||||
|
||||
handleTokenValidationResponse: function(resp) {
|
||||
return resp.data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -114,8 +77,6 @@ export function applyConfig({ dispatch, endpoint={}, settings={}, reset=false }
|
||||
|
||||
setCurrentEndpointKey(currentEndpointKey);
|
||||
|
||||
|
||||
|
||||
return Promise.resolve();
|
||||
|
||||
}
|
||||
@@ -39,28 +39,25 @@ function getAuthHeaders(url) {
|
||||
|
||||
function updateAuthCredentials(resp) {
|
||||
|
||||
// check config apiUrl matches the current response url
|
||||
if (isApiRequest(resp.url)) {
|
||||
// set header for each key in `tokenFormat` config
|
||||
var newHeaders = {};
|
||||
// set header for each key in `tokenFormat` config
|
||||
const newHeaders = {};
|
||||
|
||||
// set flag to ensure that we don't accidentally nuke the headers
|
||||
// if the response tokens aren't sent back from the API
|
||||
var blankHeaders = true;
|
||||
// set flag to ensure that we don't accidentally nuke the headers
|
||||
// if the response tokens aren't sent back from the API
|
||||
let blankHeaders = true;
|
||||
|
||||
// set header key + val for each key in `tokenFormat` config
|
||||
for (var key in getTokenFormat()) {
|
||||
newHeaders[key] = resp.headers.get(key);
|
||||
// set header key + val for each key in `tokenFormat` config
|
||||
for (let key in getTokenFormat()) {
|
||||
newHeaders[key] = resp.headers.get(key);
|
||||
|
||||
if (newHeaders[key]) {
|
||||
blankHeaders = false;
|
||||
}
|
||||
if (newHeaders[key]) {
|
||||
blankHeaders = false;
|
||||
}
|
||||
}
|
||||
|
||||
// persist headers for next request
|
||||
if (!blankHeaders) {
|
||||
persistData(C.SAVED_CREDS_KEY, newHeaders);
|
||||
}
|
||||
// persist headers for next request
|
||||
if (!blankHeaders) {
|
||||
persistData(C.SAVED_CREDS_KEY, newHeaders);
|
||||
}
|
||||
|
||||
return resp;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { withPackageName } from 'react-pacomo'
|
||||
|
||||
|
||||
const {
|
||||
decorator: pacomoDecorator,
|
||||
transformer: pacomoTransformer,
|
||||
} = withPackageName('app')
|
||||
|
||||
|
||||
export {pacomoTransformer, pacomoDecorator}
|
||||
@@ -25,17 +25,10 @@ export function setCurrentSettings (s) {
|
||||
authState.currentSettings = s;
|
||||
}
|
||||
|
||||
export function getCurrentSettings () {
|
||||
return authState.currentSettings;
|
||||
}
|
||||
|
||||
export function setCurrentEndpoint (e) {
|
||||
authState.currentEndpoint = e;
|
||||
}
|
||||
|
||||
export function getCurrentEndpoint () {
|
||||
return authState.currentEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -45,10 +38,6 @@ export function setCurrentEndpointKey (k) {
|
||||
persistData(C.SAVED_CONFIG_KEY, k || getDefaultEndpointKey());
|
||||
}
|
||||
|
||||
export function getCurrentEndpointKey () {
|
||||
return getDefaultEndpointKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param k
|
||||
@@ -106,54 +95,6 @@ export function isApiRequest(url) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getSessionEndpointKey () {
|
||||
return getCurrentEndpointKey();
|
||||
}
|
||||
|
||||
export function getSessionEndpoint (k) {
|
||||
return getCurrentEndpoint()[getSessionEndpointKey()];
|
||||
}
|
||||
|
||||
|
||||
//// only should work for current session
|
||||
//export function getSignOutUrl (endpointKey) {
|
||||
// return `${getApiUrl(endpointKey)}${getSessionEndpoint(endpointKey).signOutPath}`
|
||||
//}
|
||||
|
||||
export function getEmailSignInUrl () {
|
||||
return `${getSessionEndpoint().emailSignInPath}`
|
||||
}
|
||||
|
||||
export function getEmailSignUpUrl () {
|
||||
return getCustomersUrl();
|
||||
}
|
||||
|
||||
export function getCurrentUserUrl () {
|
||||
return `${getSessionEndpoint().currentUserPath}`
|
||||
}
|
||||
|
||||
export function getAccountsUrl () {
|
||||
return `${getSessionEndpoint().accountsPath}`
|
||||
}
|
||||
|
||||
export function getCustomersUrl () {
|
||||
return `${getSessionEndpoint().customersPath}`
|
||||
}
|
||||
|
||||
export function getTransfersUrl () {
|
||||
return `${getSessionEndpoint().transfersPath}`
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param key
|
||||
* @returns {string|string}
|
||||
*/
|
||||
export function getApiUrl(key) {
|
||||
let configKey = getSessionEndpointKey(key);
|
||||
return rauthState.currentEndpoint[configKey].apiUrl;
|
||||
}
|
||||
|
||||
export function getTokenFormat() {
|
||||
return authState.currentSettings.tokenFormat;
|
||||
}
|
||||
@@ -164,7 +105,7 @@ export const persistUserData = (user) => {
|
||||
|
||||
export const retrieveUserData = () =>{
|
||||
return memoryStorage[C.SAVED_USER_INFO];
|
||||
}
|
||||
};
|
||||
|
||||
export function retrieveHeaders() {
|
||||
return retrieveData(C.SAVED_CREDS_KEY) || {};
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
* Created by andrew on 17/02/16.
|
||||
*/
|
||||
import React from "react";
|
||||
import { PageHeader, OverlayTrigger, Tooltip, Grid, Col, Row, Nav, NavItem, ButtonGroup, Button, Table } from "react-bootstrap";
|
||||
import { PageHeader, Col, Row, Nav, ButtonGroup, Button, Table } from "react-bootstrap";
|
||||
import * as BS from "react-bootstrap";
|
||||
import { connect } from "react-redux";
|
||||
import AccountInfo from '../components/AccountInfo';
|
||||
import * as Modals from './modals';
|
||||
import * as M from './modals';
|
||||
import IndexPanel from "./../components/partials/IndexPanel";
|
||||
import * as A from '../actions/entities';
|
||||
import * as AU from '../actions/authenticate';
|
||||
import read from '../utils/readProp';
|
||||
import { Money } from '../components/Money';
|
||||
|
||||
|
||||
|
||||
const resetModals = {
|
||||
showAccountModal: false,
|
||||
show3rdPartyAccountModal: false,
|
||||
@@ -266,18 +264,18 @@ class MyAccounts extends React.Component {
|
||||
</Table>
|
||||
|
||||
|
||||
<Modals.NewAccountModal show={showAccountModal}
|
||||
<M.NewAccountModal show={showAccountModal}
|
||||
action={this.createAccountModalConfirmed.bind(this)}
|
||||
account={ this.props.app.accounts.create }
|
||||
onHide={this.close.bind(this)}
|
||||
key={0} />
|
||||
|
||||
<Modals.Add3rdPartyAccountModal show={show3rdPartyAccountModal}
|
||||
<M.Add3rdPartyAccountModal show={show3rdPartyAccountModal}
|
||||
action={this.create3rdPartyAccountModalConfirmed.bind(this)}
|
||||
onHide={this.close.bind(this)}
|
||||
key={1} />
|
||||
|
||||
<Modals.RemoveAccountBookmarkModal show={showDeleteAccountModal}
|
||||
<M.RemoveAccountBookmarkModal show={showDeleteAccountModal}
|
||||
account={accountToRemove}
|
||||
action={this.remove3rdPartyAccountModalConfirmed.bind(this)}
|
||||
onHide={this.close.bind(this)}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
import React, { PropTypes } from "react";
|
||||
import * as BS from 'react-bootstrap';
|
||||
import { PageHeader, OverlayTrigger, Modal, Tooltip, Grid, Col, Row, Nav, NavItem, ButtonGroup, Button, Table } from "react-bootstrap";
|
||||
import { Link, IndexLink} from "react-router";
|
||||
import { connect } from "react-redux";
|
||||
import Select from "react-select";
|
||||
import { moneyText } from '../../components/Money';
|
||||
|
||||
export class RemoveAccountBookmarkModal extends React.Component {
|
||||
|
||||
@@ -41,7 +39,7 @@ export class RemoveAccountBookmarkModal extends React.Component {
|
||||
const entityId = id || accountId;
|
||||
|
||||
const title = titleRaw || '—';
|
||||
const balance = isNaN(balanceRaw) ? '—' : ((balanceRaw > 0 && balanceRaw < 1) ? '$0' : '$') + Number(balanceRaw / 100).toFixed(2);
|
||||
const balance = moneyText(balanceRaw);
|
||||
const description = descriptionRaw || '—';
|
||||
|
||||
return (<Modal show={this.props.show} onHide={this.props.onHide} key={0}>
|
||||
|
||||
Reference in New Issue
Block a user