From 862bb474f929de73a78f5ac595163b08e6fefad0 Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:29:02 -0300 Subject: [PATCH 001/237] creating webchat service --- ecis | 25 ++++++++++--- webchat/app.js | 10 ++++++ webchat/config.js | 10 ++++++ webchat/favicon.ico | Bin 0 -> 32038 bytes webchat/firebase-config.js | 10 ++++++ webchat/index.html | 71 +++++++++++++++++++++++++++++++++++++ webchat/webchat.yaml | 17 +++++++++ 7 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 webchat/app.js create mode 100644 webchat/config.js create mode 100644 webchat/favicon.ico create mode 100644 webchat/firebase-config.js create mode 100644 webchat/index.html create mode 100644 webchat/webchat.yaml diff --git a/ecis b/ecis index 093ef874e..c7f42fbbe 100755 --- a/ecis +++ b/ecis @@ -14,18 +14,21 @@ FRONTEND_YAML=frontend/frontend.yaml BACKEND_YAML=backend/backend.yaml WORKER_YAML=backend/worker.yaml SUPPORT_YAML=support/support.yaml +WEBCHAT_YAML=webchat/webchat.yaml LANDINGPAGE_LOCAL="localhost:8080" FRONTEND_LOCAL="localhost:8081" BACKEND_LOCAL="localhost:8082" SUPPORT_LOCAL="localhost:8083" +WEBCHAT_LOCAL="localhost:8084" FRONTEND_CONFIG_FILE="frontend/config.js" SUPPORT_CONFIG_FILE="support/config.js" LANDINGPAGE_CONFIG_FILE="landing/config.js" +WEBCHAT_CONFIG_FILE="webchat/config.js" SW_FILE="frontend/sw.js" -git update-index --skip-worktree $FRONTEND_CONFIG_FILE $SUPPORT_CONFIG_FILE $LANDINGPAGE_CONFIG_FILE +git update-index --skip-worktree $FRONTEND_CONFIG_FILE $SUPPORT_CONFIG_FILE $LANDINGPAGE_CONFIG_FILE $WEBCHAT_CONFIG_FILE PY_ENV=backend/py_env @@ -77,6 +80,7 @@ function set_config_file { sed -i "$line s|.*| $service: '$url',|" $FRONTEND_CONFIG_FILE sed -i "$line s|.*| $service: '$url',|" $SUPPORT_CONFIG_FILE sed -i "$line s|.*| $service: '$url',|" $LANDINGPAGE_CONFIG_FILE + sed -i "$line s|.*| $service: '$url',|" $WEBCHAT_CONFIG_FILE catch_error $? "Frontend will use ${bold}$url${_bold} as $service_name." catch_error $? "Support will use ${bold}$url${_bold} as $service_name." @@ -114,12 +118,22 @@ function set_frontend_url { set_config_file $line $service $url $service_name; } +function set_webchat_url { + url=$(set_service_url $1 $2); + service="WEBCHAT_URL"; + line=8; + service_name="webchat"; + set_config_file $line $service $url $service_name; +} + function set_app_version_config { - sed -i "8s|.*| APP_VERSION: '$1'|" $FRONTEND_CONFIG_FILE + sed -i "9s|.*| APP_VERSION: '$1'|" $FRONTEND_CONFIG_FILE catch_error $? "APP VERSION on Frontend $1" - sed -i "8s|.*| APP_VERSION: '$1'|" $SUPPORT_CONFIG_FILE + sed -i "9s|.*| APP_VERSION: '$1'|" $SUPPORT_CONFIG_FILE catch_error $? "APP VERSION on Support $1" - sed -i "8s|.*| APP_VERSION: '$1'|" $LANDINGPAGE_CONFIG_FILE + sed -i "9s|.*| APP_VERSION: '$1'|" $LANDINGPAGE_CONFIG_FILE + catch_error $? "APP VERSION on LandingPage $1" + sed -i "9s|.*| APP_VERSION: '$1'|" $WEBCHAT_CONFIG_FILE catch_error $? "APP VERSION on LandingPage $1" } @@ -212,6 +226,7 @@ case "$1" in set_landingpage_url local $LANDINGPAGE_LOCAL set_support_url local $SUPPORT_LOCAL set_frontend_url local $FRONTEND_LOCAL + set_webchat_url local $WEBCHAT_LOCAL if [[ -n $2 ]] && [ $2 = "--enable_datastore_emulator" ] ; then gcloud beta emulators datastore start --host-port=0.0.0.0:8586 & @@ -223,7 +238,7 @@ case "$1" in fi $(gcloud beta emulators datastore env-init) - dev_appserver.py $APP_YAML $FRONTEND_YAML $BACKEND_YAML $SUPPORT_YAML $WORKER_YAML -A development-cis --support_datastore_emulator=$emulator $other_parameter + dev_appserver.py $APP_YAML $FRONTEND_YAML $BACKEND_YAML $SUPPORT_YAML $WEBCHAT_YAML $WORKER_YAML -A development-cis --support_datastore_emulator=$emulator $other_parameter $(gcloud beta emulators datastore env-unset) ;; diff --git a/webchat/app.js b/webchat/app.js new file mode 100644 index 000000000..49c192c08 --- /dev/null +++ b/webchat/app.js @@ -0,0 +1,10 @@ +'use strict'; + +(function() { + var app = angular.module('app', [ + ]); + + (function main() { + console.log("app running"); + })(); +})(); \ No newline at end of file diff --git a/webchat/config.js b/webchat/config.js new file mode 100644 index 000000000..1b378227d --- /dev/null +++ b/webchat/config.js @@ -0,0 +1,10 @@ +"use strict"; + +var Config = { + BACKEND_URL: 'http://localhost:8082', + LANDINGPAGE_URL: 'http://localhost:8080', + SUPPORT_URL: 'http://localhost:8083', + FRONTEND_URL: 'http://localhost:8081', + WEBCHAT_URL: 'http://localhost:8084', + APP_VERSION: 'dev' +} diff --git a/webchat/favicon.ico b/webchat/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..1d395073d639a42d5ed78f8ce87e6ca95d6386fe GIT binary patch literal 32038 zcmeHw2YlScmA_04A+(TOfIyBwLP?GQ2MHVrM<-z1WLt8Pd$;8-H@P=imQ}3Y%c}QY zR;$&ncD1WjUG?UM>4b1xj>{$a=kJj3|2wn$Tdfw^lH4HwWBqxaUzy*`dv9jm%)EK; z$<1wo+jVZY-|oiW{cfwSb8~xLT-|TG&*AeTK6~N``~6Sd+&sVU=Jw)?w);n3c60mt zb8c>r@KzLYKVgFWpLzJ5>kq&LX9%v?oRU^B3F%*gDX6!khB@aQ>3W9lsC9kv)9{aS z!_nyBP+YaDbfj;bpH0^vvrf?mV13NL;7H`?-=92r^5zpKPJCYh4}DC}=7u8?HYlp})-eAMo#2iG&AEYrt;OXE%r=C6w!S_NTXGM;#}J9t@h@R{+;1ct zsXB`E&RPd(dz(LFUFSr7&M>n+9RBe>XlSm&(V`$st|Qp<`09MIU$YKdw7bB%F|$7G z+}ipCtgVliu+$hM^Tw4$;)9RgMr?5yb~a>4*kj3pO0ynGIlsofDsTDy#wOLdH#}~~ zvh~lxbM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%2Vx66?pPy7L6-ozp-&X;kk z9!EISI{poUkc5AhGURgGe_RR=t_1yphkgRrT4uc8(YEPaojJRibKiqkgTArUK^h(>h`)DxZoKr2FaHgnh9^I9pv7vuY_z+^ M1Ni3te-{V-ABs94^8f$< literal 0 HcmV?d00001 diff --git a/webchat/firebase-config.js b/webchat/firebase-config.js new file mode 100644 index 000000000..519c127a7 --- /dev/null +++ b/webchat/firebase-config.js @@ -0,0 +1,10 @@ +var FIREBASE_CONFIG = { + apiKey: "AIzaSyBlpZudOyqMsSDIkZcPMmLCBxY5DWkoz14", + authDomain: "development-cis.firebaseapp.com", + databaseURL: "https://development-cis.firebaseio.com", + projectId: "development-cis", + storageBucket: "development-cis.appspot.com", + messagingSenderId: "531467954503" +}; + +var KEY_PAIR = "BBT_s9UZ_4AOO_0AbheNE1XpDHOK0EJphftaSP2an4zTkh1C8xRVKEpTFC7s5Z8eg9MBKZhGx96i3mS5a67oDeI"; diff --git a/webchat/index.html b/webchat/index.html new file mode 100644 index 000000000..2f7047472 --- /dev/null +++ b/webchat/index.html @@ -0,0 +1,71 @@ + + + + + + + + Plataforma CIS + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webchat/webchat.yaml b/webchat/webchat.yaml new file mode 100644 index 000000000..4a52fb0bd --- /dev/null +++ b/webchat/webchat.yaml @@ -0,0 +1,17 @@ +runtime: python27 +api_version: 1 +threadsafe: yes +service: webchat + +default_expiration: "1s" + +handlers: +- url: /app/(.*) + secure: always + static_files: \1 + upload: (.*) + +- url: /(.*) + secure: always + static_files: index.html + upload: index.html \ No newline at end of file From b3c97f3c20c33c4c97c49ca6f53c240e34b83220 Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:39:30 -0300 Subject: [PATCH 002/237] adding config in gitgnore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b4239cd22..0916a008e 100644 --- a/.gitignore +++ b/.gitignore @@ -526,6 +526,7 @@ paket-files/ frontend/config.js support/config.js landing/config.js +webchat/config.js frontend/firebase-config.js support/firebase-config.js From 6936c3b0b168a130f20c6b8006cdfa13519101f0 Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:42:19 -0300 Subject: [PATCH 003/237] config.js webchat modified --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0916a008e..2807a1bae 100644 --- a/.gitignore +++ b/.gitignore @@ -526,7 +526,7 @@ paket-files/ frontend/config.js support/config.js landing/config.js -webchat/config.js +# webchat/config.js frontend/firebase-config.js support/firebase-config.js From 2e112ba3cffc612f86089f72ed524a4384ab46cf Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:44:32 -0300 Subject: [PATCH 004/237] Modifieds configs js --- .gitignore | 6 +++--- frontend/config.js | 5 +++-- landing/config.js | 5 +++-- support/config.js | 5 +++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2807a1bae..917ac7210 100644 --- a/.gitignore +++ b/.gitignore @@ -523,9 +523,9 @@ paket-files/ # End of https://www.gitignore.io/api/vim,git,bower,grunt,python,intellij,appengine,sublimetext,visualstudio -frontend/config.js -support/config.js -landing/config.js +# frontend/config.js +# support/config.js +# landing/config.js # webchat/config.js frontend/firebase-config.js diff --git a/frontend/config.js b/frontend/config.js index 4161bf225..48ea6dec0 100644 --- a/frontend/config.js +++ b/frontend/config.js @@ -5,5 +5,6 @@ var Config = { LANDINGPAGE_URL: 'http://localhost:8080', SUPPORT_URL: 'http://localhost:8083', FRONTEND_URL: 'http://localhost:8081', - APP_VERSION: 'master' -}; + WEBCHAT_URL: 'http://localhost:8084', + APP_VERSION: 'webchat' +} diff --git a/landing/config.js b/landing/config.js index 4161bf225..e39039e35 100644 --- a/landing/config.js +++ b/landing/config.js @@ -5,5 +5,6 @@ var Config = { LANDINGPAGE_URL: 'http://localhost:8080', SUPPORT_URL: 'http://localhost:8083', FRONTEND_URL: 'http://localhost:8081', - APP_VERSION: 'master' -}; + WEBCHAT_URL: 'http://localhost:8084', + APP_VERSION: 'webchat' +} \ No newline at end of file diff --git a/support/config.js b/support/config.js index 4161bf225..48ea6dec0 100644 --- a/support/config.js +++ b/support/config.js @@ -5,5 +5,6 @@ var Config = { LANDINGPAGE_URL: 'http://localhost:8080', SUPPORT_URL: 'http://localhost:8083', FRONTEND_URL: 'http://localhost:8081', - APP_VERSION: 'master' -}; + WEBCHAT_URL: 'http://localhost:8084', + APP_VERSION: 'webchat' +} From 44c968522078856d2ff2915820a3ae0d09c9790b Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:46:07 -0300 Subject: [PATCH 005/237] added config.js in gitgnore --- .gitignore | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 917ac7210..c13020da8 100644 --- a/.gitignore +++ b/.gitignore @@ -523,13 +523,14 @@ paket-files/ # End of https://www.gitignore.io/api/vim,git,bower,grunt,python,intellij,appengine,sublimetext,visualstudio -# frontend/config.js -# support/config.js -# landing/config.js -# webchat/config.js +frontend/config.js +support/config.js +landing/config.js +webchat/config.js frontend/firebase-config.js support/firebase-config.js +webchat/firebase-config.js backend/firebase_config.py backend/app_version.py From cf5842c79f188ee828465ecdb4aae621737f3c65 Mon Sep 17 00:00:00 2001 From: JuliePessoa Date: Thu, 29 Nov 2018 10:47:53 -0300 Subject: [PATCH 006/237] config --- .gitignore | 2 +- webchat/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c13020da8..125b787c7 100644 --- a/.gitignore +++ b/.gitignore @@ -526,7 +526,7 @@ paket-files/ frontend/config.js support/config.js landing/config.js -webchat/config.js +# webchat/config.js frontend/firebase-config.js support/firebase-config.js diff --git a/webchat/config.js b/webchat/config.js index 1b378227d..48ea6dec0 100644 --- a/webchat/config.js +++ b/webchat/config.js @@ -6,5 +6,5 @@ var Config = { SUPPORT_URL: 'http://localhost:8083', FRONTEND_URL: 'http://localhost:8081', WEBCHAT_URL: 'http://localhost:8084', - APP_VERSION: 'dev' + APP_VERSION: 'webchat' } From 9448d22739c30e5c98c751737a5128931c76568a Mon Sep 17 00:00:00 2001 From: Julie Pessoa Date: Thu, 29 Nov 2018 11:27:43 -0300 Subject: [PATCH 007/237] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 125b787c7..c13020da8 100644 --- a/.gitignore +++ b/.gitignore @@ -526,7 +526,7 @@ paket-files/ frontend/config.js support/config.js landing/config.js -# webchat/config.js +webchat/config.js frontend/firebase-config.js support/firebase-config.js From 118866ae40337249ed9fd80420663d8405c05ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 30 Nov 2018 22:24:35 -0300 Subject: [PATCH 008/237] Add empty login.html --- webchat/auth/login.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 webchat/auth/login.html diff --git a/webchat/auth/login.html b/webchat/auth/login.html new file mode 100644 index 000000000..e69de29bb From 1b35f652eaf773b2f27b0f9ae4fb7e008a076dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 30 Nov 2018 23:09:03 -0300 Subject: [PATCH 009/237] Add ui-router support --- frontend/sw.js | 2 +- webchat/app.js | 50 + webchat/chat/chat.html | 0 webchat/home/home.html | 0 webchat/index.html | 4 + webchat/libs/angular-ui-router.js | 10075 ++++++++++++++++++++++++++++ webchat/video/video.html | 0 webchat/webchat/webchat.html | 0 8 files changed, 10130 insertions(+), 1 deletion(-) create mode 100644 webchat/chat/chat.html create mode 100644 webchat/home/home.html create mode 100644 webchat/libs/angular-ui-router.js create mode 100644 webchat/video/video.html create mode 100644 webchat/webchat/webchat.html diff --git a/frontend/sw.js b/frontend/sw.js index 4bca0fe8a..b8bb9a801 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -7,7 +7,7 @@ importScripts('app/firebase-config.js'); importScripts('app/config.js'); // if the line number of the code below changes, modify the /ecis script. - const CACHE_SUFIX = 'master'; + const CACHE_SUFIX = 'webchat'; let messaging; diff --git a/webchat/app.js b/webchat/app.js index 49c192c08..0e4d330c8 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -2,8 +2,58 @@ (function() { var app = angular.module('app', [ + 'ui.router', ]); + app.config(function($stateProvider) { + $stateProvider + .state("webchat", { + abstract: true, + views: { + main: { + templateUrl: "app/webchat/webchat.html", + controller: "WebchatController as controller", + }, + }, + }) + .state("webchat.home", { + url: "/", + views: { + content: { + templateUrl: "app/home/home.html", + controller: "HomeController as controller", + }, + }, + }) + .state("webchat.chat", { + url: "/chat", + views: { + content: { + templateUrl: "app/chat/chat.html", + controller: "ChatController as controller", + }, + }, + }) + .state("webchat.video", { + url: "/video", + views: { + content: { + templateUrl: "app/video/video.html", + controller: "VideoController as controller", + }, + }, + }) + .state("login", { + url: "/login", + views: { + main: { + templateUrl: "app/auth/login.html", + controller: "LoginController as controller", + }, + }, + }) + }); + (function main() { console.log("app running"); })(); diff --git a/webchat/chat/chat.html b/webchat/chat/chat.html new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/home/home.html b/webchat/home/home.html new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/index.html b/webchat/index.html index 2f7047472..d8ab61237 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -63,9 +63,13 @@ firebase.initializeApp(firebaseConfig); + + + + diff --git a/webchat/libs/angular-ui-router.js b/webchat/libs/angular-ui-router.js new file mode 100644 index 000000000..4e69b5e20 --- /dev/null +++ b/webchat/libs/angular-ui-router.js @@ -0,0 +1,10075 @@ +/** + * State-based routing for AngularJS 1.x + * NOTICE: This monolithic bundle also bundles the @uirouter/core code. + * This causes it to be incompatible with plugins that depend on @uirouter/core. + * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. + * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles + * @version v1.0.10 + * @link https://ui-router.github.io + * @license MIT License, http://www.opensource.org/licenses/MIT + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('angular')) : + typeof define === 'function' && define.amd ? define(['exports', 'angular'], factory) : + (factory((global['@uirouter/angularjs'] = {}),global.angular)); +}(this, (function (exports,ng_from_import) { 'use strict'; + +var ng_from_global = angular; +var ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global; + +/** + * Higher order functions + * + * These utility functions are exported, but are subject to change without notice. + * + * @module common_hof + */ /** */ +/** + * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. + * + * Given a function with N parameters, returns a new function that supports partial application. + * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters, + * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to + * accept more parameters until all N parameters have been supplied. + * + * + * This contrived example uses a partially applied function as an predicate, which returns true + * if an object is found in both arrays. + * @example + * ``` + * // returns true if an object is in both of the two arrays + * function inBoth(array1, array2, object) { + * return array1.indexOf(object) !== -1 && + * array2.indexOf(object) !== 1; + * } + * let obj1, obj2, obj3, obj4, obj5, obj6, obj7 + * let foos = [obj1, obj3] + * let bars = [obj3, obj4, obj5] + * + * // A curried "copy" of inBoth + * let curriedInBoth = curry(inBoth); + * // Partially apply both the array1 and array2 + * let inFoosAndBars = curriedInBoth(foos, bars); + * + * // Supply the final argument; since all arguments are + * // supplied, the original inBoth function is then called. + * let obj1InBoth = inFoosAndBars(obj1); // false + * + * // Use the inFoosAndBars as a predicate. + * // Filter, on each iteration, supplies the final argument + * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ]; + * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ] + * + * ``` + * + * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function + * + * @param fn + * @returns {*|function(): (*|any)} + */ +function curry(fn) { + var initial_args = [].slice.apply(arguments, [1]); + var func_args_length = fn.length; + function curried(args) { + if (args.length >= func_args_length) + return fn.apply(null, args); + return function () { + return curried(args.concat([].slice.apply(arguments))); + }; + } + return curried(initial_args); +} +/** + * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left + * given: f(x), g(x), h(x) + * let composed = compose(f,g,h) + * then, composed is: f(g(h(x))) + */ +function compose() { + var args = arguments; + var start = args.length - 1; + return function () { + var i = start, result = args[start].apply(this, arguments); + while (i--) + result = args[i].call(this, result); + return result; + }; +} +/** + * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right + * given: f(x), g(x), h(x) + * let piped = pipe(f,g,h); + * then, piped is: h(g(f(x))) + */ +function pipe() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i] = arguments[_i]; + } + return compose.apply(null, [].slice.call(arguments).reverse()); +} +/** + * Given a property name, returns a function that returns that property from an object + * let obj = { foo: 1, name: "blarg" }; + * let getName = prop("name"); + * getName(obj) === "blarg" + */ +var prop = function (name) { + return function (obj) { return obj && obj[name]; }; +}; +/** + * Given a property name and a value, returns a function that returns a boolean based on whether + * the passed object has a property that matches the value + * let obj = { foo: 1, name: "blarg" }; + * let getName = propEq("name", "blarg"); + * getName(obj) === true + */ +var propEq = curry(function (name, val, obj) { return obj && obj[name] === val; }); +/** + * Given a dotted property name, returns a function that returns a nested property from an object, or undefined + * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; + * let getName = prop("nestedObj.name"); + * getName(obj) === "blarg" + * let propNotFound = prop("this.property.doesnt.exist"); + * propNotFound(obj) === undefined + */ +var parse = function (name) { + return pipe.apply(null, name.split(".").map(prop)); +}; +/** + * Given a function that returns a truthy or falsey value, returns a + * function that returns the opposite (falsey or truthy) value given the same inputs + */ +var not = function (fn) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return !fn.apply(null, args); + }; +}; +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if both functions return truthy for the given arguments + */ +function and(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) && fn2.apply(null, args); + }; +} +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if at least one of the functions returns truthy for the given arguments + */ +function or(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) || fn2.apply(null, args); + }; +} +/** + * Check if all the elements of an array match a predicate function + * + * @param fn1 a predicate function `fn1` + * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array + */ +var all = function (fn1) { + return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; +}; +var any = function (fn1) { + return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; +}; +/** Given a class, returns a Predicate function that returns true if the object is of that class */ +var is = function (ctor) { + return function (obj) { + return (obj != null && obj.constructor === ctor || obj instanceof ctor); + }; +}; +/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ +var eq = function (val) { return function (other) { + return val === other; +}; }; +/** Given a value, returns a function which returns the value */ +var val = function (v) { return function () { return v; }; }; +function invoke(fnName, args) { + return function (obj) { + return obj[fnName].apply(obj, args); + }; +} +/** + * Sorta like Pattern Matching (a functional programming conditional construct) + * + * See http://c2.com/cgi/wiki?PatternMatching + * + * This is a conditional construct which allows a series of predicates and output functions + * to be checked and then applied. Each predicate receives the input. If the predicate + * returns truthy, then its matching output function (mapping function) is provided with + * the input and, then the result is returned. + * + * Each combination (2-tuple) of predicate + output function should be placed in an array + * of size 2: [ predicate, mapFn ] + * + * These 2-tuples should be put in an outer array. + * + * @example + * ``` + * + * // Here's a 2-tuple where the first element is the isString predicate + * // and the second element is a function that returns a description of the input + * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ]; + * + * // Second tuple: predicate "isNumber", mapfn returns a description + * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ]; + * + * let third = [ (input) => input === null, (input) => `Oh, null...` ]; + * + * let fourth = [ (input) => input === undefined, (input) => `notdefined` ]; + * + * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]); + * + * console.log(descriptionOf(undefined)); // 'notdefined' + * console.log(descriptionOf(55)); // '(55) That's a number!' + * console.log(descriptionOf("foo")); // 'Here's your string foo' + * ``` + * + * @param struct A 2D array. Each element of the array should be an array, a 2-tuple, + * with a Predicate and a mapping/output function + * @returns {function(any): *} + */ +function pattern(struct) { + return function (x) { + for (var i = 0; i < struct.length; i++) { + if (struct[i][0](x)) + return struct[i][1](x); + } + }; +} + +/** + * @coreapi + * @module core + */ +/** + * Matches state names using glob-like pattern strings. + * + * Globs can be used in specific APIs including: + * + * - [[StateService.is]] + * - [[StateService.includes]] + * - The first argument to Hook Registration functions like [[TransitionService.onStart]] + * - [[HookMatchCriteria]] and [[HookMatchCriterion]] + * + * A `Glob` string is a pattern which matches state names. + * Nested state names are split into segments (separated by a dot) when processing. + * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz'] + * + * Globs work according to the following rules: + * + * ### Exact match: + * + * The glob `'A.B'` matches the state named exactly `'A.B'`. + * + * | Glob |Matches states named|Does not match state named| + * |:------------|:--------------------|:---------------------| + * | `'A'` | `'A'` | `'B'` , `'A.C'` | + * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` | + * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`| + * + * ### Single star (`*`) + * + * A single star (`*`) is a wildcard that matches exactly one segment. + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:---------------------|:--------------------------| + * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` | + * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` | + * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`| + * + * ### Double star (`**`) + * + * A double star (`'**'`) is a wildcard that matches *zero or more segments* + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:----------------------------------------------|:----------------------------------| + * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) | + * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` | + * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` | + * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | + * + */ +var Glob = /** @class */ (function () { + function Glob(text) { + this.text = text; + this.glob = text.split('.'); + var regexpString = this.text.split('.') + .map(function (seg) { + if (seg === '**') + return '(?:|(?:\\.[^.]*)*)'; + if (seg === '*') + return '\\.[^.]*'; + return '\\.' + seg; + }).join(''); + this.regexp = new RegExp("^" + regexpString + "$"); + } + Glob.prototype.matches = function (name) { + return this.regexp.test('.' + name); + }; + /** Returns true if the string has glob-like characters in it */ + Glob.is = function (text) { + return !!/[!,*]+/.exec(text); + }; + /** Returns a glob from the string, or null if the string isn't Glob-like */ + Glob.fromString = function (text) { + return Glob.is(text) ? new Glob(text) : null; + }; + return Glob; +}()); + +/** + * Internal representation of a UI-Router state. + * + * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]]. + * + * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object. + * + * This class prototypally inherits from the corresponding [[StateDeclaration]]. + * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. + */ +var StateObject = /** @class */ (function () { + /** @deprecated use State.create() */ + function StateObject(config) { + return StateObject.create(config || {}); + } + /** + * Create a state object to put the private/internal implementation details onto. + * The object's prototype chain looks like: + * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...) + * + * @param stateDecl the user-supplied State Declaration + * @returns {StateObject} an internal State object + */ + StateObject.create = function (stateDecl) { + stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl; + var state = inherit(inherit(stateDecl, StateObject.prototype)); + stateDecl.$$state = function () { return state; }; + state.self = stateDecl; + state.__stateObjectCache = { + nameGlob: Glob.fromString(state.name) // might return null + }; + return state; + }; + /** + * Returns true if the provided parameter is the same state. + * + * Compares the identity of the state against the passed value, which is either an object + * reference to the actual `State` instance, the original definition object passed to + * `$stateProvider.state()`, or the fully-qualified name. + * + * @param ref Can be one of (a) a `State` instance, (b) an object that was passed + * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string. + * @returns Returns `true` if `ref` matches the current `State` instance. + */ + StateObject.prototype.is = function (ref) { + return this === ref || this.self === ref || this.fqn() === ref; + }; + /** + * @deprecated this does not properly handle dot notation + * @returns Returns a dot-separated name of the state. + */ + StateObject.prototype.fqn = function () { + if (!this.parent || !(this.parent instanceof this.constructor)) + return this.name; + var name = this.parent.fqn(); + return name ? name + "." + this.name : this.name; + }; + /** + * Returns the root node of this state's tree. + * + * @returns The root of this state's tree. + */ + StateObject.prototype.root = function () { + return this.parent && this.parent.root() || this; + }; + /** + * Gets the state's `Param` objects + * + * Gets the list of [[Param]] objects owned by the state. + * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects. + * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object + * + * @param opts options + */ + StateObject.prototype.parameters = function (opts) { + opts = defaults(opts, { inherit: true, matchingKeys: null }); + var inherited = opts.inherit && this.parent && this.parent.parameters() || []; + return inherited.concat(values(this.params)) + .filter(function (param) { return !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id); }); + }; + /** + * Returns a single [[Param]] that is owned by the state + * + * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s. + * @param id the name of the [[Param]] to return + * @param opts options + */ + StateObject.prototype.parameter = function (id, opts) { + if (opts === void 0) { opts = {}; } + return (this.url && this.url.parameter(id, opts) || + find(values(this.params), propEq('id', id)) || + opts.inherit && this.parent && this.parent.parameter(id)); + }; + StateObject.prototype.toString = function () { + return this.fqn(); + }; + /** Predicate which returns true if the object is an class with @State() decorator */ + StateObject.isStateClass = function (stateDecl) { + return isFunction(stateDecl) && stateDecl['__uiRouterState'] === true; + }; + /** Predicate which returns true if the object is an internal [[StateObject]] object */ + StateObject.isState = function (obj) { + return isObject(obj['__stateObjectCache']); + }; + return StateObject; +}()); + +/** Predicates + * + * These predicates return true/false based on the input. + * Although these functions are exported, they are subject to change without notice. + * + * @module common_predicates + */ +/** */ +var toStr = Object.prototype.toString; +var tis = function (t) { return function (x) { return typeof (x) === t; }; }; +var isUndefined = tis('undefined'); +var isDefined = not(isUndefined); +var isNull = function (o) { return o === null; }; +var isNullOrUndefined = or(isNull, isUndefined); +var isFunction = tis('function'); +var isNumber = tis('number'); +var isString = tis('string'); +var isObject = function (x) { return x !== null && typeof x === 'object'; }; +var isArray = Array.isArray; +var isDate = (function (x) { return toStr.call(x) === '[object Date]'; }); +var isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; }); +var isState = StateObject.isState; +/** + * Predicate which checks if a value is injectable + * + * A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array + * where all the elements in the array are Strings, except the last one, which is a Function + */ +function isInjectable(val$$1) { + if (isArray(val$$1) && val$$1.length) { + var head = val$$1.slice(0, -1), tail = val$$1.slice(-1); + return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length); + } + return isFunction(val$$1); +} +/** + * Predicate which checks if a value looks like a Promise + * + * It is probably a Promise if it's an object, and it has a `then` property which is a Function + */ +var isPromise = and(isObject, pipe(prop('then'), isFunction)); + +var notImplemented = function (fnname) { return function () { + throw new Error(fnname + "(): No coreservices implementation for UI-Router is loaded."); +}; }; +var services = { + $q: undefined, + $injector: undefined, +}; + +/** + * Random utility functions used in the UI-Router code + * + * These functions are exported, but are subject to change without notice. + * + * @preferred + * @module common + */ +/** for typedoc */ +var root = (typeof self === 'object' && self.self === self && self) || + (typeof global === 'object' && global.global === global && global) || undefined; +var angular$1 = root.angular || {}; +var fromJson = angular$1.fromJson || JSON.parse.bind(JSON); +var toJson = angular$1.toJson || JSON.stringify.bind(JSON); +var forEach = angular$1.forEach || _forEach; +var extend = Object.assign || _extend; +var equals = angular$1.equals || _equals; +function identity(x) { return x; } +function noop$1() { } +/** + * Builds proxy functions on the `to` object which pass through to the `from` object. + * + * For each key in `fnNames`, creates a proxy function on the `to` object. + * The proxy function calls the real function on the `from` object. + * + * + * #### Example: + * This example creates an new class instance whose functions are prebound to the new'd object. + * ```js + * class Foo { + * constructor(data) { + * // Binds all functions from Foo.prototype to 'this', + * // then copies them to 'this' + * bindFunctions(Foo.prototype, this, this); + * this.data = data; + * } + * + * log() { + * console.log(this.data); + * } + * } + * + * let myFoo = new Foo([1,2,3]); + * var logit = myFoo.log; + * logit(); // logs [1, 2, 3] from the myFoo 'this' instance + * ``` + * + * #### Example: + * This example creates a bound version of a service function, and copies it to another object + * ``` + * + * var SomeService = { + * this.data = [3, 4, 5]; + * this.log = function() { + * console.log(this.data); + * } + * } + * + * // Constructor fn + * function OtherThing() { + * // Binds all functions from SomeService to SomeService, + * // then copies them to 'this' + * bindFunctions(SomeService, this, SomeService); + * } + * + * let myOtherThing = new OtherThing(); + * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this' + * ``` + * + * @param source A function that returns the source object which contains the original functions to be bound + * @param target A function that returns the target object which will receive the bound functions + * @param bind A function that returns the object which the functions will be bound to + * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object) + * @param latebind If true, the binding of the function is delayed until the first time it's invoked + */ +function createProxyFunctions(source, target, bind, fnNames, latebind) { + if (latebind === void 0) { latebind = false; } + var bindFunction = function (fnName) { + return source()[fnName].bind(bind()); + }; + var makeLateRebindFn = function (fnName) { return function lateRebindFunction() { + target[fnName] = bindFunction(fnName); + return target[fnName].apply(null, arguments); + }; }; + fnNames = fnNames || Object.keys(source()); + return fnNames.reduce(function (acc, name) { + acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name); + return acc; + }, target); +} +/** + * prototypal inheritance helper. + * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it + */ +var inherit = function (parent, extra) { + return extend(Object.create(parent), extra); +}; +/** Given an array, returns true if the object is found in the array, (using indexOf) */ +var inArray = curry(_inArray); +function _inArray(array, obj) { + return array.indexOf(obj) !== -1; +} +/** + * Given an array, and an item, if the item is found in the array, it removes it (in-place). + * The same array is returned + */ +var removeFrom = curry(_removeFrom); +function _removeFrom(array, obj) { + var idx = array.indexOf(obj); + if (idx >= 0) + array.splice(idx, 1); + return array; +} +/** pushes a values to an array and returns the value */ +var pushTo = curry(_pushTo); +function _pushTo(arr, val$$1) { + return (arr.push(val$$1), val$$1); +} +/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */ +var deregAll = function (functions) { + return functions.slice().forEach(function (fn) { + typeof fn === 'function' && fn(); + removeFrom(functions, fn); + }); +}; +/** + * Applies a set of defaults to an options object. The options object is filtered + * to only those properties of the objects in the defaultsList. + * Earlier objects in the defaultsList take precedence when applying defaults. + */ +function defaults(opts) { + var defaultsList = []; + for (var _i = 1; _i < arguments.length; _i++) { + defaultsList[_i - 1] = arguments[_i]; + } + var _defaultsList = defaultsList.concat({}).reverse(); + var defaultVals = extend.apply(null, _defaultsList); + return extend({}, defaultVals, pick(opts || {}, Object.keys(defaultVals))); +} +/** Reduce function that merges each element of the list into a single object, using extend */ +var mergeR = function (memo, item) { return extend(memo, item); }; +/** + * Finds the common ancestor path between two states. + * + * @param {Object} first The first state. + * @param {Object} second The second state. + * @return {Array} Returns an array of state names in descending order, not including the root. + */ +function ancestors(first, second) { + var path = []; + for (var n in first.path) { + if (first.path[n] !== second.path[n]) + break; + path.push(first.path[n]); + } + return path; +} +/** + * Return a copy of the object only containing the whitelisted properties. + * + * #### Example: + * ``` + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the whitelisted property names + */ +function pick(obj, propNames) { + var objCopy = {}; + for (var prop_1 in obj) { + if (propNames.indexOf(prop_1) !== -1) { + objCopy[prop_1] = obj[prop_1]; + } + } + return objCopy; +} +/** + * Return a copy of the object omitting the blacklisted properties. + * + * @example + * ``` + * + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = omit(foo, ['a', 'b']); // { c: 3 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the blacklisted property names + */ +function omit(obj, propNames) { + return Object.keys(obj) + .filter(not(inArray(propNames))) + .reduce(function (acc, key) { return (acc[key] = obj[key], acc); }, {}); +} +/** + * Maps an array, or object to a property (by name) + */ +function pluck(collection, propName) { + return map(collection, prop(propName)); +} +/** Filters an Array or an Object's properties based on a predicate */ +function filter(collection, callback) { + var arr = isArray(collection), result = arr ? [] : {}; + var accept = arr ? function (x) { return result.push(x); } : function (x, key) { return result[key] = x; }; + forEach(collection, function (item, i) { + if (callback(item, i)) + accept(item, i); + }); + return result; +} +/** Finds an object from an array, or a property of an object, that matches a predicate */ +function find(collection, callback) { + var result; + forEach(collection, function (item, i) { + if (result) + return; + if (callback(item, i)) + result = item; + }); + return result; +} +/** Given an object, returns a new object, where each property is transformed by the callback function */ +var mapObj = map; +/** Maps an array or object properties using a callback function */ +function map(collection, callback) { + var result = isArray(collection) ? [] : {}; + forEach(collection, function (item, i) { return result[i] = callback(item, i); }); + return result; +} +/** + * Given an object, return its enumerable property values + * + * @example + * ``` + * + * let foo = { a: 1, b: 2, c: 3 } + * let vals = values(foo); // [ 1, 2, 3 ] + * ``` + */ +var values = function (obj) { + return Object.keys(obj).map(function (key) { return obj[key]; }); +}; +/** + * Reduce function that returns true if all of the values are truthy. + * + * @example + * ``` + * + * let vals = [ 1, true, {}, "hello world"]; + * vals.reduce(allTrueR, true); // true + * + * vals.push(0); + * vals.reduce(allTrueR, true); // false + * ``` + */ +var allTrueR = function (memo, elem) { return memo && elem; }; +/** + * Reduce function that returns true if any of the values are truthy. + * + * * @example + * ``` + * + * let vals = [ 0, null, undefined ]; + * vals.reduce(anyTrueR, true); // false + * + * vals.push("hello world"); + * vals.reduce(anyTrueR, true); // true + * ``` + */ +var anyTrueR = function (memo, elem) { return memo || elem; }; +/** + * Reduce function which un-nests a single level of arrays + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnestR = function (memo, elem) { return memo.concat(elem); }; +/** + * Reduce function which recursively un-nests all arrays + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flattenR = function (memo, elem) { + return isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem); +}; +/** + * Reduce function that pushes an object to an array, then returns the array. + * Mostly just for [[flattenR]] and [[uniqR]] + */ +function pushR(arr, obj) { + arr.push(obj); + return arr; +} +/** Reduce function that filters out duplicates */ +var uniqR = function (acc, token) { + return inArray(acc, token) ? acc : pushR(acc, token); +}; +/** + * Return a new array with a single level of arrays unnested. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnest = function (arr) { return arr.reduce(unnestR, []); }; +/** + * Return a completely flattened version of an array. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flatten = function (arr) { return arr.reduce(flattenR, []); }; +/** + * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass. + * @example + * ``` + * + * let isNumber = (obj) => typeof(obj) === 'number'; + * let allNumbers = [ 1, 2, 3, 4, 5 ]; + * allNumbers.filter(assertPredicate(isNumber)); //OK + * + * let oneString = [ 1, 2, 3, 4, "5" ]; + * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers""); + * ``` + */ +var assertPredicate = assertFn; +/** + * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test. + * @example + * ``` + * + * var data = { foo: 1, bar: 2 }; + * + * let keys = [ 'foo', 'bar' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // values is [1, 2] + * + * let keys = [ 'foo', 'bar', 'baz' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // throws Error("Key not found") + * ``` + */ +var assertMap = assertFn; +function assertFn(predicateOrMap, errMsg) { + if (errMsg === void 0) { errMsg = "assert failure"; } + return function (obj) { + var result = predicateOrMap(obj); + if (!result) { + throw new Error(isFunction(errMsg) ? errMsg(obj) : errMsg); + } + return result; + }; +} +/** + * Like _.pairs: Given an object, returns an array of key/value pairs + * + * @example + * ``` + * + * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ] + * ``` + */ +var pairs = function (obj) { + return Object.keys(obj).map(function (key) { return [key, obj[key]]; }); +}; +/** + * Given two or more parallel arrays, returns an array of tuples where + * each tuple is composed of [ a[i], b[i], ... z[i] ] + * + * @example + * ``` + * + * let foo = [ 0, 2, 4, 6 ]; + * let bar = [ 1, 3, 5, 7 ]; + * let baz = [ 10, 30, 50, 70 ]; + * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ] + * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ] + * ``` + */ +function arrayTuples() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (args.length === 0) + return []; + var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER + var i, result = []; + for (i = 0; i < maxArrayLen; i++) { + // This is a hot function + // Unroll when there are 1-4 arguments + switch (args.length) { + case 1: + result.push([args[0][i]]); + break; + case 2: + result.push([args[0][i], args[1][i]]); + break; + case 3: + result.push([args[0][i], args[1][i], args[2][i]]); + break; + case 4: + result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); + break; + default: + result.push(args.map(function (array) { return array[i]; })); + break; + } + } + return result; +} +/** + * Reduce function which builds an object from an array of [key, value] pairs. + * + * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration. + * + * Each keyValueTuple should be an array with values [ key: string, value: any ] + * + * @example + * ``` + * + * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ] + * + * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * + * // Or, more simply: + * var pairsToObj = pairs.reduce(applyPairs, {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * ``` + */ +function applyPairs(memo, keyValTuple) { + var key, value; + if (isArray(keyValTuple)) + key = keyValTuple[0], value = keyValTuple[1]; + if (!isString(key)) + throw new Error("invalid parameters to applyPairs"); + memo[key] = value; + return memo; +} +/** Get the last element of an array */ +function tail(arr) { + return arr.length && arr[arr.length - 1] || undefined; +} +/** + * shallow copy from src to dest + */ +function copy(src, dest) { + if (dest) + Object.keys(dest).forEach(function (key) { return delete dest[key]; }); + if (!dest) + dest = {}; + return extend(dest, src); +} +/** Naive forEach implementation works with Objects or Arrays */ +function _forEach(obj, cb, _this) { + if (isArray(obj)) + return obj.forEach(cb, _this); + Object.keys(obj).forEach(function (key) { return cb(obj[key], key); }); +} +function _extend(toObj) { + for (var i = 1; i < arguments.length; i++) { + var obj = arguments[i]; + if (!obj) + continue; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; j++) { + toObj[keys[j]] = obj[keys[j]]; + } + } + return toObj; +} +function _equals(o1, o2) { + if (o1 === o2) + return true; + if (o1 === null || o2 === null) + return false; + if (o1 !== o1 && o2 !== o2) + return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2; + if (t1 !== t2 || t1 !== 'object') + return false; + var tup = [o1, o2]; + if (all(isArray)(tup)) + return _arraysEq(o1, o2); + if (all(isDate)(tup)) + return o1.getTime() === o2.getTime(); + if (all(isRegExp)(tup)) + return o1.toString() === o2.toString(); + if (all(isFunction)(tup)) + return true; // meh + var predicates = [isFunction, isArray, isDate, isRegExp]; + if (predicates.map(any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) + return false; + var key, keys = {}; + for (key in o1) { + if (!_equals(o1[key], o2[key])) + return false; + keys[key] = true; + } + for (key in o2) { + if (!keys[key]) + return false; + } + return true; +} +function _arraysEq(a1, a2) { + if (a1.length !== a2.length) + return false; + return arrayTuples(a1, a2).reduce(function (b, t) { return b && _equals(t[0], t[1]); }, true); +} +// issue #2676 +var silenceUncaughtInPromise = function (promise) { + return promise.catch(function (e) { return 0; }) && promise; +}; +var silentRejection = function (error) { + return silenceUncaughtInPromise(services.$q.reject(error)); +}; + +/** + * @module common + */ /** for typedoc */ +var Queue = /** @class */ (function () { + function Queue(_items, _limit) { + if (_items === void 0) { _items = []; } + if (_limit === void 0) { _limit = null; } + this._items = _items; + this._limit = _limit; + } + Queue.prototype.enqueue = function (item) { + var items = this._items; + items.push(item); + if (this._limit && items.length > this._limit) + items.shift(); + return item; + }; + Queue.prototype.dequeue = function () { + if (this.size()) + return this._items.splice(0, 1)[0]; + }; + Queue.prototype.clear = function () { + var current = this._items; + this._items = []; + return current; + }; + Queue.prototype.size = function () { + return this._items.length; + }; + Queue.prototype.remove = function (item) { + var idx = this._items.indexOf(item); + return idx > -1 && this._items.splice(idx, 1)[0]; + }; + Queue.prototype.peekTail = function () { + return this._items[this._items.length - 1]; + }; + Queue.prototype.peekHead = function () { + if (this.size()) + return this._items[0]; + }; + return Queue; +}()); + +/** + * @coreapi + * @module transition + */ /** for typedoc */ +"use strict"; + +(function (RejectType) { + RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; + RejectType[RejectType["ABORTED"] = 3] = "ABORTED"; + RejectType[RejectType["INVALID"] = 4] = "INVALID"; + RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; + RejectType[RejectType["ERROR"] = 6] = "ERROR"; +})(exports.RejectType || (exports.RejectType = {})); +/** @hidden */ var id = 0; +var Rejection = /** @class */ (function () { + function Rejection(type, message, detail) { + this.$id = id++; + this.type = type; + this.message = message; + this.detail = detail; + } + Rejection.prototype.toString = function () { + var detailString = function (d) { + return d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d); + }; + var detail = detailString(this.detail); + var _a = this, $id = _a.$id, type = _a.type, message = _a.message; + return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; + }; + Rejection.prototype.toPromise = function () { + return extend(silentRejection(this), { _transitionRejection: this }); + }; + /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ + Rejection.isRejectionPromise = function (obj) { + return obj && (typeof obj.then === 'function') && is(Rejection)(obj._transitionRejection); + }; + /** Returns a Rejection due to transition superseded */ + Rejection.superseded = function (detail, options) { + var message = "The transition has been superseded by a different transition"; + var rejection = new Rejection(exports.RejectType.SUPERSEDED, message, detail); + if (options && options.redirected) { + rejection.redirected = true; + } + return rejection; + }; + /** Returns a Rejection due to redirected transition */ + Rejection.redirected = function (detail) { + return Rejection.superseded(detail, { redirected: true }); + }; + /** Returns a Rejection due to invalid transition */ + Rejection.invalid = function (detail) { + var message = "This transition is invalid"; + return new Rejection(exports.RejectType.INVALID, message, detail); + }; + /** Returns a Rejection due to ignored transition */ + Rejection.ignored = function (detail) { + var message = "The transition was ignored"; + return new Rejection(exports.RejectType.IGNORED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.aborted = function (detail) { + var message = "The transition has been aborted"; + return new Rejection(exports.RejectType.ABORTED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.errored = function (detail) { + var message = "The transition errored"; + return new Rejection(exports.RejectType.ERROR, message, detail); + }; + /** + * Returns a Rejection + * + * Normalizes a value as a Rejection. + * If the value is already a Rejection, returns it. + * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR). + * + * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection. + */ + Rejection.normalize = function (detail) { + return is(Rejection)(detail) ? detail : Rejection.errored(detail); + }; + return Rejection; +}()); + +/** + * # Transition tracing (debug) + * + * Enable transition tracing to print transition information to the console, + * in order to help debug your application. + * Tracing logs detailed information about each Transition to your console. + * + * To enable tracing, import the [[Trace]] singleton and enable one or more categories. + * + * ### ES6 + * ```js + * import {trace} from "ui-router-ng2"; // or "angular-ui-router" + * trace.enable(1, 5); // TRANSITION and VIEWCONFIG + * ``` + * + * ### CJS + * ```js + * let trace = require("angular-ui-router").trace; // or "ui-router-ng2" + * trace.enable("TRANSITION", "VIEWCONFIG"); + * ``` + * + * ### Globals + * ```js + * let trace = window["angular-ui-router"].trace; // or "ui-router-ng2" + * trace.enable(); // Trace everything (very verbose) + * ``` + * + * ### Angular 1: + * ```js + * app.run($trace => $trace.enable()); + * ``` + * + * @coreapi + * @module trace + */ /** for typedoc */ +/** @hidden */ +function uiViewString(uiview) { + if (!uiview) + return 'ui-view (defunct)'; + var state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)'; + return "[ui-view#" + uiview.id + " " + uiview.$type + ":" + uiview.fqn + " (" + uiview.name + "@" + state + ")]"; +} +/** @hidden */ +var viewConfigString = function (viewConfig) { + var view = viewConfig.viewDecl; + var state = view.$context.name || '(root)'; + return "[View#" + viewConfig.$id + " from '" + state + "' state]: target ui-view: '" + view.$uiViewName + "@" + view.$uiViewContextAnchor + "'"; +}; +/** @hidden */ +function normalizedCat(input) { + return isNumber(input) ? exports.Category[input] : exports.Category[exports.Category[input]]; +} +/** @hidden */ +var consoleLog = Function.prototype.bind.call(console.log, console); +/** @hidden */ +var consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console); +/** + * Trace categories Enum + * + * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]] + * + * `trace.enable(Category.TRANSITION)` + * + * These can also be provided using a matching string, or position ordinal + * + * `trace.enable("TRANSITION")` + * + * `trace.enable(1)` + */ + +(function (Category) { + Category[Category["RESOLVE"] = 0] = "RESOLVE"; + Category[Category["TRANSITION"] = 1] = "TRANSITION"; + Category[Category["HOOK"] = 2] = "HOOK"; + Category[Category["UIVIEW"] = 3] = "UIVIEW"; + Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; +})(exports.Category || (exports.Category = {})); +/** @hidden */ var _tid = parse("$id"); +/** @hidden */ var _rid = parse("router.$id"); +/** @hidden */ var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; +/** + * Prints UI-Router Transition trace information to the console. + */ +var Trace = /** @class */ (function () { + /** @hidden */ + function Trace() { + /** @hidden */ + this._enabled = {}; + this.approximateDigests = 0; + } + /** @hidden */ + Trace.prototype._set = function (enabled, categories) { + var _this = this; + if (!categories.length) { + categories = Object.keys(exports.Category) + .map(function (k) { return parseInt(k, 10); }) + .filter(function (k) { return !isNaN(k); }) + .map(function (key) { return exports.Category[key]; }); + } + categories.map(normalizedCat).forEach(function (category) { return _this._enabled[category] = enabled; }); + }; + Trace.prototype.enable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(true, categories); + }; + Trace.prototype.disable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(false, categories); + }; + /** + * Retrieves the enabled stateus of a [[Category]] + * + * ```js + * trace.enabled("VIEWCONFIG"); // true or false + * ``` + * + * @returns boolean true if the category is enabled + */ + Trace.prototype.enabled = function (category) { + return !!this._enabled[normalizedCat(category)]; + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceTransitionStart = function (trans) { + if (!this.enabled(exports.Category.TRANSITION)) + return; + console.log(transLbl(trans) + ": Started -> " + stringify(trans)); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceTransitionIgnored = function (trans) { + if (!this.enabled(exports.Category.TRANSITION)) + return; + console.log(transLbl(trans) + ": Ignored <> " + stringify(trans)); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceHookInvocation = function (step, trans, options) { + if (!this.enabled(exports.Category.HOOK)) + return; + var event = parse("traceData.hookType")(options) || "internal", context = parse("traceData.context.state.name")(options) || parse("traceData.context")(options) || "unknown", name = functionToString(step.registeredHook.callback); + console.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + maxLength(200, name)); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceHookResult = function (hookResult, trans, transitionOptions) { + if (!this.enabled(exports.Category.HOOK)) + return; + console.log(transLbl(trans) + ": <- Hook returned: " + maxLength(200, stringify(hookResult))); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceResolvePath = function (path, when, trans) { + if (!this.enabled(exports.Category.RESOLVE)) + return; + console.log(transLbl(trans) + ": Resolving " + path + " (" + when + ")"); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceResolvableResolved = function (resolvable, trans) { + if (!this.enabled(exports.Category.RESOLVE)) + return; + console.log(transLbl(trans) + ": <- Resolved " + resolvable + " to: " + maxLength(200, stringify(resolvable.data))); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceError = function (reason, trans) { + if (!this.enabled(exports.Category.TRANSITION)) + return; + console.log(transLbl(trans) + ": <- Rejected " + stringify(trans) + ", reason: " + reason); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceSuccess = function (finalState, trans) { + if (!this.enabled(exports.Category.TRANSITION)) + return; + console.log(transLbl(trans) + ": <- Success " + stringify(trans) + ", final state: " + finalState.name); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { + if (extra === void 0) { extra = ""; } + if (!this.enabled(exports.Category.UIVIEW)) + return; + console.log("ui-view: " + padString(30, event) + " " + uiViewString(viewData) + extra); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { + if (!this.enabled(exports.Category.UIVIEW)) + return; + this.traceUIViewEvent("Updating", viewData, " with ViewConfig from context='" + context + "'"); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceUIViewFill = function (viewData, html) { + if (!this.enabled(exports.Category.UIVIEW)) + return; + this.traceUIViewEvent("Fill", viewData, " with: " + maxLength(200, html)); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceViewSync = function (pairs) { + if (!this.enabled(exports.Category.VIEWCONFIG)) + return; + var mapping = pairs.map(function (_a) { + var uiViewData = _a[0], config = _a[1]; + var uiView = uiViewData.$type + ":" + uiViewData.fqn; + var view = config && config.viewDecl.$context.name + ": " + config.viewDecl.$name + " (" + config.viewDecl.$type + ")"; + return { 'ui-view fqn': uiView, 'state: view name': view }; + }).sort(function (a, b) { return a['ui-view fqn'].localeCompare(b['ui-view fqn']); }); + consoletable(mapping); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { + if (!this.enabled(exports.Category.VIEWCONFIG)) + return; + console.log("VIEWCONFIG: " + event + " " + viewConfigString(viewConfig)); + }; + /** @internalapi called by ui-router code */ + Trace.prototype.traceViewServiceUIViewEvent = function (event, viewData) { + if (!this.enabled(exports.Category.VIEWCONFIG)) + return; + console.log("VIEWCONFIG: " + event + " " + uiViewString(viewData)); + }; + return Trace; +}()); +/** + * The [[Trace]] singleton + * + * #### Example: + * ```js + * import {trace} from "angular-ui-router"; + * trace.enable(1, 5); + * ``` + */ +var trace = new Trace(); + +(function (TransitionHookPhase) { + TransitionHookPhase[TransitionHookPhase["CREATE"] = 0] = "CREATE"; + TransitionHookPhase[TransitionHookPhase["BEFORE"] = 1] = "BEFORE"; + TransitionHookPhase[TransitionHookPhase["RUN"] = 2] = "RUN"; + TransitionHookPhase[TransitionHookPhase["SUCCESS"] = 3] = "SUCCESS"; + TransitionHookPhase[TransitionHookPhase["ERROR"] = 4] = "ERROR"; +})(exports.TransitionHookPhase || (exports.TransitionHookPhase = {})); + +(function (TransitionHookScope) { + TransitionHookScope[TransitionHookScope["TRANSITION"] = 0] = "TRANSITION"; + TransitionHookScope[TransitionHookScope["STATE"] = 1] = "STATE"; +})(exports.TransitionHookScope || (exports.TransitionHookScope = {})); + +/** + * @coreapi + * @module state + */ /** for typedoc */ +/** + * Encapsulate the target (destination) state/params/options of a [[Transition]]. + * + * This class is frequently used to redirect a transition to a new destination. + * + * See: + * + * - [[HookResult]] + * - [[TransitionHookFn]] + * - [[TransitionService.onStart]] + * + * To create a `TargetState`, use [[StateService.target]]. + * + * --- + * + * This class wraps: + * + * 1) an identifier for a state + * 2) a set of parameters + * 3) and transition options + * 4) the registered state object (the [[StateDeclaration]]) + * + * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can + * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string). + * The `TargetState` class normalizes those options. + * + * A `TargetState` may be valid (the state being targeted exists in the registry) + * or invalid (the state being targeted is not registered). + */ +var TargetState = /** @class */ (function () { + /** + * The TargetState constructor + * + * Note: Do not construct a `TargetState` manually. + * To create a `TargetState`, use the [[StateService.target]] factory method. + * + * @param _stateRegistry The StateRegistry to use to look up the _definition + * @param _identifier An identifier for a state. + * Either a fully-qualified state name, or the object used to define the state. + * @param _params Parameters for the target state + * @param _options Transition options. + * + * @internalapi + */ + function TargetState(_stateRegistry, _identifier, _params, _options) { + this._stateRegistry = _stateRegistry; + this._identifier = _identifier; + this._identifier = _identifier; + this._params = extend({}, _params || {}); + this._options = extend({}, _options || {}); + this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); + } + /** The name of the state this object targets */ + TargetState.prototype.name = function () { + return this._definition && this._definition.name || this._identifier; + }; + /** The identifier used when creating this TargetState */ + TargetState.prototype.identifier = function () { + return this._identifier; + }; + /** The target parameter values */ + TargetState.prototype.params = function () { + return this._params; + }; + /** The internal state object (if it was found) */ + TargetState.prototype.$state = function () { + return this._definition; + }; + /** The internal state declaration (if it was found) */ + TargetState.prototype.state = function () { + return this._definition && this._definition.self; + }; + /** The target options */ + TargetState.prototype.options = function () { + return this._options; + }; + /** True if the target state was found */ + TargetState.prototype.exists = function () { + return !!(this._definition && this._definition.self); + }; + /** True if the object is valid */ + TargetState.prototype.valid = function () { + return !this.error(); + }; + /** If the object is invalid, returns the reason why */ + TargetState.prototype.error = function () { + var base = this.options().relative; + if (!this._definition && !!base) { + var stateName = base.name ? base.name : base; + return "Could not resolve '" + this.name() + "' from state '" + stateName + "'"; + } + if (!this._definition) + return "No such state '" + this.name() + "'"; + if (!this._definition.self) + return "State '" + this.name() + "' has an invalid definition"; + }; + TargetState.prototype.toString = function () { + return "'" + this.name() + "'" + stringify(this.params()); + }; + /** + * Returns a copy of this TargetState which targets a different state. + * The new TargetState has the same parameter values and transition options. + * + * @param state The new state that should be targeted + */ + TargetState.prototype.withState = function (state) { + return new TargetState(this._stateRegistry, state, this._params, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified parameter values. + * + * @param params the new parameter values to use + * @param replace When false (default) the new parameter values will be merged with the current values. + * When true the parameter values will be used instead of the current values. + */ + TargetState.prototype.withParams = function (params, replace) { + if (replace === void 0) { replace = false; } + var newParams = replace ? params : extend({}, this._params, params); + return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified Transition Options. + * + * @param options the new options to use + * @param replace When false (default) the new options will be merged with the current options. + * When true the options will be used instead of the current options. + */ + TargetState.prototype.withOptions = function (options, replace) { + if (replace === void 0) { replace = false; } + var newOpts = replace ? options : extend({}, this._options, options); + return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); + }; + /** Returns true if the object has a state property that might be a state or state name */ + TargetState.isDef = function (obj) { + return obj && obj.state && (isString(obj.state) || isString(obj.state.name)); + }; + return TargetState; +}()); + +/** + * @coreapi + * @module transition + */ +/** for typedoc */ +var defaultOptions = { + current: noop$1, + transition: null, + traceData: {}, + bind: null, +}; +/** @hidden */ +var TransitionHook = /** @class */ (function () { + function TransitionHook(transition, stateContext, registeredHook, options) { + var _this = this; + this.transition = transition; + this.stateContext = stateContext; + this.registeredHook = registeredHook; + this.options = options; + this.isSuperseded = function () { + return _this.type.hookPhase === exports.TransitionHookPhase.RUN && !_this.options.transition.isActive(); + }; + this.options = defaults(options, defaultOptions); + this.type = registeredHook.eventType; + } + TransitionHook.prototype.logError = function (err) { + this.transition.router.stateService.defaultErrorHandler()(err); + }; + TransitionHook.prototype.invokeHook = function () { + var _this = this; + var hook = this.registeredHook; + if (hook._deregistered) + return; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + var options = this.options; + trace.traceHookInvocation(this, this.transition, options); + var invokeCallback = function () { + return hook.callback.call(options.bind, _this.transition, _this.stateContext); + }; + var normalizeErr = function (err) { + return Rejection.normalize(err).toPromise(); + }; + var handleError = function (err) { + return hook.eventType.getErrorHandler(_this)(err); + }; + var handleResult = function (result) { + return hook.eventType.getResultHandler(_this)(result); + }; + try { + var result = invokeCallback(); + if (!this.type.synchronous && isPromise(result)) { + return result.catch(normalizeErr) + .then(handleResult, handleError); + } + else { + return handleResult(result); + } + } + catch (err) { + // If callback throws (synchronously) + return handleError(Rejection.normalize(err)); + } + finally { + if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) { + hook.deregister(); + } + } + }; + /** + * This method handles the return value of a Transition Hook. + * + * A hook can return false (cancel), a TargetState (redirect), + * or a promise (which may later resolve to false or a redirect) + * + * This also handles "transition superseded" -- when a new transition + * was started while the hook was still running + */ + TransitionHook.prototype.handleHookResult = function (result) { + var _this = this; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + // Hook returned a promise + if (isPromise(result)) { + // Wait for the promise, then reprocess with the resulting value + return result.then(function (val$$1) { return _this.handleHookResult(val$$1); }); + } + trace.traceHookResult(result, this.transition, this.options); + // Hook returned false + if (result === false) { + // Abort this Transition + return Rejection.aborted("Hook aborted transition").toPromise(); + } + var isTargetState = is(TargetState); + // hook returned a TargetState + if (isTargetState(result)) { + // Halt the current Transition and redirect (a new Transition) to the TargetState. + return Rejection.redirected(result).toPromise(); + } + }; + /** + * Return a Rejection promise if the transition is no longer current due + * to a stopped router (disposed), or a new transition has started and superseded this one. + */ + TransitionHook.prototype.getNotCurrentRejection = function () { + var router = this.transition.router; + // The router is stopped + if (router._disposed) { + return Rejection.aborted("UIRouter instance #" + router.$id + " has been stopped (disposed)").toPromise(); + } + if (this.transition._aborted) { + return Rejection.aborted().toPromise(); + } + // This transition is no longer current. + // Another transition started while this hook was still running. + if (this.isSuperseded()) { + // Abort this transition + return Rejection.superseded(this.options.current()).toPromise(); + } + }; + TransitionHook.prototype.toString = function () { + var _a = this, options = _a.options, registeredHook = _a.registeredHook; + var event = parse("traceData.hookType")(options) || "internal", context = parse("traceData.context.state.name")(options) || parse("traceData.context")(options) || "unknown", name = fnToString(registeredHook.callback); + return event + " context: " + context + ", " + maxLength(200, name); + }; + /** + * Chains together an array of TransitionHooks. + * + * Given a list of [[TransitionHook]] objects, chains them together. + * Each hook is invoked after the previous one completes. + * + * #### Example: + * ```js + * var hooks: TransitionHook[] = getHooks(); + * let promise: Promise = TransitionHook.chain(hooks); + * + * promise.then(handleSuccess, handleError); + * ``` + * + * @param hooks the list of hooks to chain together + * @param waitFor if provided, the chain is `.then()`'ed off this promise + * @returns a `Promise` for sequentially invoking the hooks (in order) + */ + TransitionHook.chain = function (hooks, waitFor) { + // Chain the next hook off the previous + var createHookChainR = function (prev, nextHook) { + return prev.then(function () { return nextHook.invokeHook(); }); + }; + return hooks.reduce(createHookChainR, waitFor || services.$q.when()); + }; + /** + * Invokes all the provided TransitionHooks, in order. + * Each hook's return value is checked. + * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. + * If no hook returns a promise, then all hooks are processed synchronously. + * + * @param hooks the list of TransitionHooks to invoke + * @param doneCallback a callback that is invoked after all the hooks have successfully completed + * + * @returns a promise for the async result, or the result of the callback + */ + TransitionHook.invokeHooks = function (hooks, doneCallback) { + for (var idx = 0; idx < hooks.length; idx++) { + var hookResult = hooks[idx].invokeHook(); + if (isPromise(hookResult)) { + var remainingHooks = hooks.slice(idx + 1); + return TransitionHook.chain(remainingHooks, hookResult) + .then(doneCallback); + } + } + return doneCallback(); + }; + /** + * Run all TransitionHooks, ignoring their return value. + */ + TransitionHook.runAllHooks = function (hooks) { + hooks.forEach(function (hook) { return hook.invokeHook(); }); + }; + /** + * These GetResultHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.HANDLE_RESULT = function (hook) { return function (result) { + return hook.handleHookResult(result); + }; }; + /** + * If the result is a promise rejection, log it. + * Otherwise, ignore the result. + */ + TransitionHook.LOG_REJECTED_RESULT = function (hook) { return function (result) { + isPromise(result) && result.catch(function (err) { + return hook.logError(Rejection.normalize(err)); + }); + return undefined; + }; }; + /** + * These GetErrorHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.LOG_ERROR = function (hook) { return function (error) { + return hook.logError(error); + }; }; + TransitionHook.REJECT_ERROR = function (hook) { return function (error) { + return silentRejection(error); + }; }; + TransitionHook.THROW_ERROR = function (hook) { return function (error) { + throw error; + }; }; + return TransitionHook; +}()); + +/** + * @coreapi + * @module transition + */ /** for typedoc */ +/** + * Determines if the given state matches the matchCriteria + * + * @hidden + * + * @param state a State Object to test against + * @param criterion + * - If a string, matchState uses the string as a glob-matcher against the state name + * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name + * and returns a positive match if any of the globs match. + * - If a function, matchState calls the function with the state and returns true if the function's result is truthy. + * @returns {boolean} + */ +function matchState(state, criterion) { + var toMatch = isString(criterion) ? [criterion] : criterion; + function matchGlobs(_state) { + var globStrings = toMatch; + for (var i = 0; i < globStrings.length; i++) { + var glob = new Glob(globStrings[i]); + if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) { + return true; + } + } + return false; + } + var matchFn = (isFunction(toMatch) ? toMatch : matchGlobs); + return !!matchFn(state); +} +/** + * @internalapi + * The registration data for a registered transition hook + */ +var RegisteredHook = /** @class */ (function () { + function RegisteredHook(tranSvc, eventType, callback, matchCriteria, removeHookFromRegistry, options) { + if (options === void 0) { options = {}; } + this.tranSvc = tranSvc; + this.eventType = eventType; + this.callback = callback; + this.matchCriteria = matchCriteria; + this.removeHookFromRegistry = removeHookFromRegistry; + this.invokeCount = 0; + this._deregistered = false; + this.priority = options.priority || 0; + this.bind = options.bind || null; + this.invokeLimit = options.invokeLimit; + } + /** + * Gets the matching [[PathNode]]s + * + * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing + * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes. + * + * Returning `null` is significant to distinguish between the default + * "match-all criterion value" of `true` compared to a `() => true` function, + * when the nodes is an empty array. + * + * This is useful to allow a transition match criteria of `entering: true` + * to still match a transition, even when `entering === []`. Contrast that + * with `entering: (state) => true` which only matches when a state is actually + * being entered. + */ + RegisteredHook.prototype._matchingNodes = function (nodes, criterion) { + if (criterion === true) + return nodes; + var matching = nodes.filter(function (node) { return matchState(node.state, criterion); }); + return matching.length ? matching : null; + }; + /** + * Gets the default match criteria (all `true`) + * + * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.: + * + * ```js + * { + * to: true, + * from: true, + * entering: true, + * exiting: true, + * retained: true, + * } + */ + RegisteredHook.prototype._getDefaultMatchCriteria = function () { + return map(this.tranSvc._pluginapi._getPathTypes(), function () { return true; }); + }; + /** + * Gets matching nodes as [[IMatchingNodes]] + * + * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to: + * + * ```js + * let matches: IMatchingNodes = { + * to: _matchingNodes([tail(treeChanges.to)], mc.to), + * from: _matchingNodes([tail(treeChanges.from)], mc.from), + * exiting: _matchingNodes(treeChanges.exiting, mc.exiting), + * retained: _matchingNodes(treeChanges.retained, mc.retained), + * entering: _matchingNodes(treeChanges.entering, mc.entering), + * }; + * ``` + */ + RegisteredHook.prototype._getMatchingNodes = function (treeChanges) { + var _this = this; + var criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria); + var paths = values(this.tranSvc._pluginapi._getPathTypes()); + return paths.reduce(function (mn, pathtype) { + // STATE scope criteria matches against every node in the path. + // TRANSITION scope criteria matches against only the last node in the path + var isStateHook = pathtype.scope === exports.TransitionHookScope.STATE; + var path = treeChanges[pathtype.name] || []; + var nodes = isStateHook ? path : [tail(path)]; + mn[pathtype.name] = _this._matchingNodes(nodes, criteria[pathtype.name]); + return mn; + }, {}); + }; + /** + * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]] + * + * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values + * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering) + */ + RegisteredHook.prototype.matches = function (treeChanges) { + var matches = this._getMatchingNodes(treeChanges); + // Check if all the criteria matched the TreeChanges object + var allMatched = values(matches).every(identity); + return allMatched ? matches : null; + }; + RegisteredHook.prototype.deregister = function () { + this.removeHookFromRegistry(this); + this._deregistered = true; + }; + return RegisteredHook; +}()); +/** @hidden Return a registration function of the requested type. */ +function makeEvent(registry, transitionService, eventType) { + // Create the object which holds the registered transition hooks. + var _registeredHooks = registry._registeredHooks = (registry._registeredHooks || {}); + var hooks = _registeredHooks[eventType.name] = []; + var removeHookFn = removeFrom(hooks); + // Create hook registration function on the IHookRegistry for the event + registry[eventType.name] = hookRegistrationFn; + function hookRegistrationFn(matchObject, callback, options) { + if (options === void 0) { options = {}; } + var registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options); + hooks.push(registeredHook); + return registeredHook.deregister.bind(registeredHook); + } + return hookRegistrationFn; +} + +/** + * @coreapi + * @module transition + */ /** for typedoc */ +/** + * This class returns applicable TransitionHooks for a specific Transition instance. + * + * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g. + * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is + * determined by the type of hook) + * + * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition. + * + * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder + * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private + * in the Transition class, so we must also provide the Transition's _treeChanges) + * + */ +var HookBuilder = /** @class */ (function () { + function HookBuilder(transition) { + this.transition = transition; + } + HookBuilder.prototype.buildHooksForPhase = function (phase) { + var _this = this; + var $transitions = this.transition.router.transitionService; + return $transitions._pluginapi._getEvents(phase) + .map(function (type) { return _this.buildHooks(type); }) + .reduce(unnestR, []) + .filter(identity); + }; + /** + * Returns an array of newly built TransitionHook objects. + * + * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]]. + * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s) + * - For each of the [[PathNode]]s, creates a TransitionHook + * + * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'. + */ + HookBuilder.prototype.buildHooks = function (hookType) { + var transition = this.transition; + var treeChanges = transition.treeChanges(); + // Find all the matching registered hooks for a given hook type + var matchingHooks = this.getMatchingHooks(hookType, treeChanges); + if (!matchingHooks) + return []; + var baseHookOptions = { + transition: transition, + current: transition.options().current + }; + var makeTransitionHooks = function (hook) { + // Fetch the Nodes that caused this hook to match. + var matches = hook.matches(treeChanges); + // Select the PathNode[] that will be used as TransitionHook context objects + var matchingNodes = matches[hookType.criteriaMatchPath.name]; + // Return an array of HookTuples + return matchingNodes.map(function (node) { + var _options = extend({ + bind: hook.bind, + traceData: { hookType: hookType.name, context: node } + }, baseHookOptions); + var state = hookType.criteriaMatchPath.scope === exports.TransitionHookScope.STATE ? node.state.self : null; + var transitionHook = new TransitionHook(transition, state, hook, _options); + return { hook: hook, node: node, transitionHook: transitionHook }; + }); + }; + return matchingHooks.map(makeTransitionHooks) + .reduce(unnestR, []) + .sort(tupleSort(hookType.reverseSort)) + .map(function (tuple) { return tuple.transitionHook; }); + }; + /** + * Finds all RegisteredHooks from: + * - The Transition object instance hook registry + * - The TransitionService ($transitions) global hook registry + * + * which matched: + * - the eventType + * - the matchCriteria (to, from, exiting, retained, entering) + * + * @returns an array of matched [[RegisteredHook]]s + */ + HookBuilder.prototype.getMatchingHooks = function (hookType, treeChanges) { + var isCreate = hookType.hookPhase === exports.TransitionHookPhase.CREATE; + // Instance and Global hook registries + var $transitions = this.transition.router.transitionService; + var registries = isCreate ? [$transitions] : [this.transition, $transitions]; + return registries.map(function (reg) { return reg.getHooks(hookType.name); }) // Get named hooks from registries + .filter(assertPredicate(isArray, "broken event named: " + hookType.name)) // Sanity check + .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array + .filter(function (hook) { return hook.matches(treeChanges); }); // Only those satisfying matchCriteria + }; + return HookBuilder; +}()); +/** + * A factory for a sort function for HookTuples. + * + * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares + * the EventHook priority. + * + * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth + * @returns a tuple sort function + */ +function tupleSort(reverseDepthSort) { + if (reverseDepthSort === void 0) { reverseDepthSort = false; } + return function nodeDepthThenPriority(l, r) { + var factor = reverseDepthSort ? -1 : 1; + var depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor; + return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority; + }; +} + +/** + * @coreapi + * @module params + */ +/** */ +/** + * An internal class which implements [[ParamTypeDefinition]]. + * + * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types. + * When a param type definition is registered, an instance of this class is created internally. + * + * This class has naive implementations for all the [[ParamTypeDefinition]] methods. + * + * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values. + * + * #### Example: + * ```js + * var paramTypeDef = { + * decode: function(val) { return parseInt(val, 10); }, + * encode: function(val) { return val && val.toString(); }, + * equals: function(a, b) { return this.is(a) && a === b; }, + * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; }, + * pattern: /\d+/ + * } + * + * var paramType = new ParamType(paramTypeDef); + * ``` + * @internalapi + */ +var ParamType = /** @class */ (function () { + /** + * @param def A configuration object which contains the custom type definition. The object's + * properties will override the default methods and/or pattern in `ParamType`'s public interface. + * @returns a new ParamType object + */ + function ParamType(def) { + /** @inheritdoc */ + this.pattern = /.*/; + /** @inheritdoc */ + this.inherit = true; + extend(this, def); + } + // consider these four methods to be "abstract methods" that should be overridden + /** @inheritdoc */ + ParamType.prototype.is = function (val, key) { return true; }; + /** @inheritdoc */ + ParamType.prototype.encode = function (val, key) { return val; }; + /** @inheritdoc */ + ParamType.prototype.decode = function (val, key) { return val; }; + /** @inheritdoc */ + ParamType.prototype.equals = function (a, b) { return a == b; }; + ParamType.prototype.$subPattern = function () { + var sub = this.pattern.toString(); + return sub.substr(1, sub.length - 2); + }; + ParamType.prototype.toString = function () { + return "{ParamType:" + this.name + "}"; + }; + /** Given an encoded string, or a decoded object, returns a decoded object */ + ParamType.prototype.$normalize = function (val) { + return this.is(val) ? val : this.decode(val); + }; + /** + * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'. + * e.g.: + * - urlmatcher pattern "/path?{queryParam[]:int}" + * - url: "/path?queryParam=1&queryParam=2 + * - $stateParams.queryParam will be [1, 2] + * if `mode` is "auto", then + * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 + * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] + */ + ParamType.prototype.$asArray = function (mode, isSearch) { + if (!mode) + return this; + if (mode === "auto" && !isSearch) + throw new Error("'auto' array mode is for query parameters only"); + return new ArrayType(this, mode); + }; + return ParamType; +}()); +/** + * Wraps up a `ParamType` object to handle array values. + * @internalapi + */ +function ArrayType(type, mode) { + var _this = this; + // Wrap non-array value as array + function arrayWrap(val) { + return isArray(val) ? val : (isDefined(val) ? [val] : []); + } + // Unwrap array value for "auto" mode. Return undefined for empty array. + function arrayUnwrap(val) { + switch (val.length) { + case 0: return undefined; + case 1: return mode === "auto" ? val[0] : val; + default: return val; + } + } + // Wraps type (.is/.encode/.decode) functions to operate on each value of an array + function arrayHandler(callback, allTruthyMode) { + return function handleArray(val) { + if (isArray(val) && val.length === 0) + return val; + var arr = arrayWrap(val); + var result = map(arr, callback); + return (allTruthyMode === true) ? filter(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result); + }; + } + // Wraps type (.equals) functions to operate on each value of an array + function arrayEqualsHandler(callback) { + return function handleArray(val1, val2) { + var left = arrayWrap(val1), right = arrayWrap(val2); + if (left.length !== right.length) + return false; + for (var i = 0; i < left.length; i++) { + if (!callback(left[i], right[i])) + return false; + } + return true; + }; + } + ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) { + var paramTypeFn = type[name].bind(type); + var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler; + _this[name] = wrapperFn(paramTypeFn); + }); + extend(this, { + dynamic: type.dynamic, + name: type.name, + pattern: type.pattern, + inherit: type.inherit, + is: arrayHandler(type.is.bind(type), true), + $arrayMode: mode + }); +} + +/** + * @coreapi + * @module params + */ /** for typedoc */ +/** @hidden */ var hasOwn = Object.prototype.hasOwnProperty; +/** @hidden */ var isShorthand = function (cfg) { + return ["value", "type", "squash", "array", "dynamic"].filter(hasOwn.bind(cfg || {})).length === 0; +}; +/** @internalapi */ + +(function (DefType) { + DefType[DefType["PATH"] = 0] = "PATH"; + DefType[DefType["SEARCH"] = 1] = "SEARCH"; + DefType[DefType["CONFIG"] = 2] = "CONFIG"; +})(exports.DefType || (exports.DefType = {})); +/** @hidden */ +function unwrapShorthand(cfg) { + cfg = isShorthand(cfg) && { value: cfg } || cfg; + getStaticDefaultValue['__cacheable'] = true; + function getStaticDefaultValue() { + return cfg.value; + } + return extend(cfg, { + $$fn: isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue, + }); +} +/** @hidden */ +function getType(cfg, urlType, location, id, paramTypes) { + if (cfg.type && urlType && urlType.name !== 'string') + throw new Error("Param '" + id + "' has two type configurations."); + if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type)) + return paramTypes.type(cfg.type); + if (urlType) + return urlType; + if (!cfg.type) { + var type = location === exports.DefType.CONFIG ? "any" : + location === exports.DefType.PATH ? "path" : + location === exports.DefType.SEARCH ? "query" : "string"; + return paramTypes.type(type); + } + return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type); +} +/** + * @internalapi + * returns false, true, or the squash value to indicate the "default parameter url squash policy". + */ +function getSquashPolicy(config, isOptional, defaultPolicy) { + var squash = config.squash; + if (!isOptional || squash === false) + return false; + if (!isDefined(squash) || squash == null) + return defaultPolicy; + if (squash === true || isString(squash)) + return squash; + throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); +} +/** @internalapi */ +function getReplace(config, arrayMode, isOptional, squash) { + var replace, configuredKeys, defaultPolicy = [ + { from: "", to: (isOptional || arrayMode ? undefined : "") }, + { from: null, to: (isOptional || arrayMode ? undefined : "") }, + ]; + replace = isArray(config.replace) ? config.replace : []; + if (isString(squash)) + replace.push({ from: squash, to: undefined }); + configuredKeys = map(replace, prop("from")); + return filter(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); +} +/** @internalapi */ +var Param = /** @class */ (function () { + function Param(id, type, config, location, urlMatcherFactory) { + config = unwrapShorthand(config); + type = getType(config, type, location, id, urlMatcherFactory.paramTypes); + var arrayMode = getArrayMode(); + type = arrayMode ? type.$asArray(arrayMode, location === exports.DefType.SEARCH) : type; + var isOptional = config.value !== undefined || location === exports.DefType.SEARCH; + var dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic; + var raw = isDefined(config.raw) ? !!config.raw : !!type.raw; + var squash = getSquashPolicy(config, isOptional, urlMatcherFactory.defaultSquashPolicy()); + var replace = getReplace(config, arrayMode, isOptional, squash); + var inherit$$1 = isDefined(config.inherit) ? !!config.inherit : !!type.inherit; + // array config: param name (param[]) overrides default settings. explicit config overrides param name. + function getArrayMode() { + var arrayDefaults = { array: (location === exports.DefType.SEARCH ? "auto" : false) }; + var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; + return extend(arrayDefaults, arrayParamNomenclature, config).array; + } + extend(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit$$1, array: arrayMode, config: config }); + } + Param.prototype.isDefaultValue = function (value) { + return this.isOptional && this.type.equals(this.value(), value); + }; + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + Param.prototype.value = function (value) { + var _this = this; + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + var getDefaultValue = function () { + if (_this._defaultValueCache) + return _this._defaultValueCache.defaultValue; + if (!services.$injector) + throw new Error("Injectable functions cannot be called at configuration time"); + var defaultValue = services.$injector.invoke(_this.config.$$fn); + if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) + throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); + if (_this.config.$$fn['__cacheable']) { + _this._defaultValueCache = { defaultValue: defaultValue }; + } + return defaultValue; + }; + var replaceSpecialValues = function (val$$1) { + for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { + var tuple = _a[_i]; + if (tuple.from === val$$1) + return tuple.to; + } + return val$$1; + }; + value = replaceSpecialValues(value); + return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value); + }; + Param.prototype.isSearch = function () { + return this.location === exports.DefType.SEARCH; + }; + Param.prototype.validates = function (value) { + // There was no parameter value, but the param is optional + if ((isUndefined(value) || value === null) && this.isOptional) + return true; + // The value was not of the correct ParamType, and could not be decoded to the correct ParamType + var normalized = this.type.$normalize(value); + if (!this.type.is(normalized)) + return false; + // The value was of the correct type, but when encoded, did not match the ParamType's regexp + var encoded = this.type.encode(normalized); + return !(isString(encoded) && !this.type.pattern.exec(encoded)); + }; + Param.prototype.toString = function () { + return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; + }; + Param.values = function (params, values$$1) { + if (values$$1 === void 0) { values$$1 = {}; } + var paramValues = {}; + for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { + var param = params_1[_i]; + paramValues[param.id] = param.value(values$$1[param.id]); + } + return paramValues; + }; + /** + * Finds [[Param]] objects which have different param values + * + * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects + * + * @param params: The list of Param objects to filter + * @param values1: The first set of parameter values + * @param values2: the second set of parameter values + * + * @returns any Param objects whose values were different between values1 and values2 + */ + Param.changed = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return params.filter(function (param) { return !param.type.equals(values1[param.id], values2[param.id]); }); + }; + /** + * Checks if two param value objects are equal (for a set of [[Param]] objects) + * + * @param params The list of [[Param]] objects to check + * @param values1 The first set of param values + * @param values2 The second set of param values + * + * @returns true if the param values in values1 and values2 are equal + */ + Param.equals = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return Param.changed(params, values1, values2).length === 0; + }; + /** Returns true if a the parameter values are valid, according to the Param definitions */ + Param.validates = function (params, values$$1) { + if (values$$1 === void 0) { values$$1 = {}; } + return params.map(function (param) { return param.validates(values$$1[param.id]); }).reduce(allTrueR, true); + }; + return Param; +}()); + +/** @module path */ /** for typedoc */ +/** + * @internalapi + * + * A node in a [[TreeChanges]] path + * + * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path. + * Each PathNode corresponds to a state being entered, exited, or retained. + * The stateful information includes parameter values and resolve data. + */ +var PathNode = /** @class */ (function () { + function PathNode(stateOrNode) { + if (stateOrNode instanceof PathNode) { + var node = stateOrNode; + this.state = node.state; + this.paramSchema = node.paramSchema.slice(); + this.paramValues = extend({}, node.paramValues); + this.resolvables = node.resolvables.slice(); + this.views = node.views && node.views.slice(); + } + else { + var state = stateOrNode; + this.state = state; + this.paramSchema = state.parameters({ inherit: false }); + this.paramValues = {}; + this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); + } + } + /** Sets [[paramValues]] for the node, from the values of an object hash */ + PathNode.prototype.applyRawParams = function (params) { + var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; + this.paramValues = this.paramSchema.reduce(function (memo, pDef) { return applyPairs(memo, getParamVal(pDef)); }, {}); + return this; + }; + /** Gets a specific [[Param]] metadata that belongs to the node */ + PathNode.prototype.parameter = function (name) { + return find(this.paramSchema, propEq("id", name)); + }; + /** + * @returns true if the state and parameter values for another PathNode are + * equal to the state and param values for this PathNode + */ + PathNode.prototype.equals = function (node, paramsFn) { + var diff = this.diff(node, paramsFn); + return diff && diff.length === 0; + }; + /** + * Finds Params with different parameter values on another PathNode. + * + * Given another node (of the same state), finds the parameter values which differ. + * Returns the [[Param]] (schema objects) whose parameter values differ. + * + * Given another node for a different state, returns `false` + * + * @param node The node to compare to + * @param paramsFn A function that returns which parameters should be compared. + * @returns The [[Param]]s which differ, or null if the two nodes are for different states + */ + PathNode.prototype.diff = function (node, paramsFn) { + if (this.state !== node.state) + return false; + var params = paramsFn ? paramsFn(this) : this.paramSchema; + return Param.changed(params, this.paramValues, node.paramValues); + }; + /** Returns a clone of the PathNode */ + PathNode.clone = function (node) { + return new PathNode(node); + }; + return PathNode; +}()); + +/** @module path */ /** for typedoc */ +/** + * This class contains functions which convert TargetStates, Nodes and paths from one type to another. + */ +var PathUtils = /** @class */ (function () { + function PathUtils() { + } + /** Given a PathNode[], create an TargetState */ + PathUtils.makeTargetState = function (registry, path) { + var state = tail(path).state; + return new TargetState(registry, state, path.map(prop("paramValues")).reduce(mergeR, {}), {}); + }; + PathUtils.buildPath = function (targetState) { + var toParams = targetState.params(); + return targetState.$state().path.map(function (state) { return new PathNode(state).applyRawParams(toParams); }); + }; + /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */ + PathUtils.buildToPath = function (fromPath, targetState) { + var toPath = PathUtils.buildPath(targetState); + if (targetState.options().inherit) { + return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params())); + } + return toPath; + }; + /** + * Creates ViewConfig objects and adds to nodes. + * + * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state + */ + PathUtils.applyViewConfigs = function ($view, path, states) { + // Only apply the viewConfigs to the nodes for the given states + path.filter(function (node) { return inArray(states, node.state); }).forEach(function (node) { + var viewDecls = values(node.state.views || {}); + var subPath = PathUtils.subPath(path, function (n) { return n === node; }); + var viewConfigs = viewDecls.map(function (view) { return $view.createViewConfig(subPath, view); }); + node.views = viewConfigs.reduce(unnestR, []); + }); + }; + /** + * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath + * + * For a parameter in a node to be inherited from the from path: + * - The toPath's node must have a matching node in the fromPath (by state). + * - The parameter name must not be found in the toKeys parameter array. + * + * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some + * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, + * it is not inherited from the fromPath. + */ + PathUtils.inheritParams = function (fromPath, toPath, toKeys) { + if (toKeys === void 0) { toKeys = []; } + function nodeParamVals(path, state) { + var node = find(path, propEq('state', state)); + return extend({}, node && node.paramValues); + } + var noInherit = fromPath.map(function (node) { return node.paramSchema; }) + .reduce(unnestR, []) + .filter(function (param) { return !param.inherit; }) + .map(prop('id')); + /** + * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the + * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath"" + */ + function makeInheritedParamsNode(toNode) { + // All param values for the node (may include default key/vals, when key was not found in toParams) + var toParamVals = extend({}, toNode && toNode.paramValues); + // limited to only those keys found in toParams + var incomingParamVals = pick(toParamVals, toKeys); + toParamVals = omit(toParamVals, toKeys); + var fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit); + // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals + var ownParamVals = extend(toParamVals, fromParamVals, incomingParamVals); + return new PathNode(toNode.state).applyRawParams(ownParamVals); + } + // The param keys specified by the incoming toParams + return toPath.map(makeInheritedParamsNode); + }; + /** + * Computes the tree changes (entering, exiting) between a fromPath and toPath. + */ + PathUtils.treeChanges = function (fromPath, toPath, reloadState) { + var keep = 0, max = Math.min(fromPath.length, toPath.length); + var nodesMatch = function (node1, node2) { + return node1.equals(node2, PathUtils.nonDynamicParams); + }; + while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) { + keep++; + } + /** Given a retained node, return a new node which uses the to node's param values */ + function applyToParams(retainedNode, idx) { + var cloned = PathNode.clone(retainedNode); + cloned.paramValues = toPath[idx].paramValues; + return cloned; + } + var from, retained, exiting, entering, to; + from = fromPath; + retained = from.slice(0, keep); + exiting = from.slice(keep); + // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped + var retainedWithToParams = retained.map(applyToParams); + entering = toPath.slice(keep); + to = (retainedWithToParams).concat(entering); + return { from: from, to: to, retained: retained, exiting: exiting, entering: entering }; + }; + /** + * Returns a new path which is: the subpath of the first path which matches the second path. + * + * The new path starts from root and contains any nodes that match the nodes in the second path. + * It stops before the first non-matching node. + * + * Nodes are compared using their state property and their parameter values. + * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes. + * + * @param pathA the first path + * @param pathB the second path + * @param paramsFn a function which returns the parameters to consider when comparing + * + * @returns an array of PathNodes from the first path which match the nodes in the second path + */ + PathUtils.matching = function (pathA, pathB, paramsFn) { + var done = false; + var tuples = arrayTuples(pathA, pathB); + return tuples.reduce(function (matching, _a) { + var nodeA = _a[0], nodeB = _a[1]; + done = done || !nodeA.equals(nodeB, paramsFn); + return done ? matching : matching.concat(nodeA); + }, []); + }; + /** + * Returns true if two paths are identical. + * + * @param pathA + * @param pathB + * @param paramsFn a function which returns the parameters to consider when comparing + * @returns true if the the states and parameter values for both paths are identical + */ + PathUtils.equals = function (pathA, pathB, paramsFn) { + return pathA.length === pathB.length && + PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length; + }; + /** + * Return a subpath of a path, which stops at the first matching node + * + * Given an array of nodes, returns a subset of the array starting from the first node, + * stopping when the first node matches the predicate. + * + * @param path a path of [[PathNode]]s + * @param predicate a [[Predicate]] fn that matches [[PathNode]]s + * @returns a subpath up to the matching node, or undefined if no match is found + */ + PathUtils.subPath = function (path, predicate) { + var node = find(path, predicate); + var elementIdx = path.indexOf(node); + return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1); + }; + PathUtils.nonDynamicParams = function (node) { + return node.state.parameters({ inherit: false }) + .filter(function (param) { return !param.dynamic; }); + }; + /** Gets the raw parameter values from a path */ + PathUtils.paramValues = function (path) { + return path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {}); + }; + return PathUtils; +}()); + +/** + * @coreapi + * @module resolve + */ /** for typedoc */ +// TODO: explicitly make this user configurable +var defaultResolvePolicy = { + when: "LAZY", + async: "WAIT" +}; +/** + * The basic building block for the resolve system. + * + * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), + * and the unwrapped-when-complete (.data) result of the resolveFn. + * + * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the + * resolveFn) and returns the resulting promise. + * + * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first + * parameter to those fns. + */ +var Resolvable = /** @class */ (function () { + function Resolvable(arg1, resolveFn, deps, policy, data) { + this.resolved = false; + this.promise = undefined; + if (arg1 instanceof Resolvable) { + extend(this, arg1); + } + else if (isFunction(resolveFn)) { + if (isNullOrUndefined(arg1)) + throw new Error("new Resolvable(): token argument is required"); + if (!isFunction(resolveFn)) + throw new Error("new Resolvable(): resolveFn argument must be a function"); + this.token = arg1; + this.policy = policy; + this.resolveFn = resolveFn; + this.deps = deps || []; + this.data = data; + this.resolved = data !== undefined; + this.promise = this.resolved ? services.$q.when(this.data) : undefined; + } + else if (isObject(arg1) && arg1.token && isFunction(arg1.resolveFn)) { + var literal = arg1; + return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data); + } + } + Resolvable.prototype.getPolicy = function (state) { + var thisPolicy = this.policy || {}; + var statePolicy = state && state.resolvePolicy || {}; + return { + when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when, + async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async, + }; + }; + /** + * Asynchronously resolve this Resolvable's data + * + * Given a ResolveContext that this Resolvable is found in: + * Wait for this Resolvable's dependencies, then invoke this Resolvable's function + * and update the Resolvable's state + */ + Resolvable.prototype.resolve = function (resolveContext, trans) { + var _this = this; + var $q = services.$q; + // Gets all dependencies from ResolveContext and wait for them to be resolved + var getResolvableDependencies = function () { + return $q.all(resolveContext.getDependencies(_this).map(function (resolvable) { + return resolvable.get(resolveContext, trans); + })); + }; + // Invokes the resolve function passing the resolved dependencies as arguments + var invokeResolveFn = function (resolvedDeps) { + return _this.resolveFn.apply(null, resolvedDeps); + }; + /** + * For RXWAIT policy: + * + * Given an observable returned from a resolve function: + * - enables .cache() mode (this allows multicast subscribers) + * - then calls toPromise() (this triggers subscribe() and thus fetches) + * - Waits for the promise, then return the cached observable (not the first emitted value). + */ + var waitForRx = function (observable$) { + var cached = observable$.cache(1); + return cached.take(1).toPromise().then(function () { return cached; }); + }; + // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through. + var node = resolveContext.findNode(this); + var state = node && node.state; + var maybeWaitForRx = this.getPolicy(state).async === "RXWAIT" ? waitForRx : identity; + // After the final value has been resolved, update the state of the Resolvable + var applyResolvedValue = function (resolvedValue) { + _this.data = resolvedValue; + _this.resolved = true; + trace.traceResolvableResolved(_this, trans); + return _this.data; + }; + // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick. + return this.promise = $q.when() + .then(getResolvableDependencies) + .then(invokeResolveFn) + .then(maybeWaitForRx) + .then(applyResolvedValue); + }; + /** + * Gets a promise for this Resolvable's data. + * + * Fetches the data and returns a promise. + * Returns the existing promise if it has already been fetched once. + */ + Resolvable.prototype.get = function (resolveContext, trans) { + return this.promise || this.resolve(resolveContext, trans); + }; + Resolvable.prototype.toString = function () { + return "Resolvable(token: " + stringify(this.token) + ", requires: [" + this.deps.map(stringify) + "])"; + }; + Resolvable.prototype.clone = function () { + return new Resolvable(this); + }; + Resolvable.fromData = function (token, data) { + return new Resolvable(token, function () { return data; }, null, null, data); + }; + return Resolvable; +}()); + +/** @internalapi */ +var resolvePolicies = { + when: { + LAZY: "LAZY", + EAGER: "EAGER" + }, + async: { + WAIT: "WAIT", + NOWAIT: "NOWAIT", + RXWAIT: "RXWAIT" + } +}; + +/** @module resolve */ +/** for typedoc */ +var whens = resolvePolicies.when; +var ALL_WHENS = [whens.EAGER, whens.LAZY]; +var EAGER_WHENS = [whens.EAGER]; +var NATIVE_INJECTOR_TOKEN = "Native Injector"; +/** + * Encapsulates Dependency Injection for a path of nodes + * + * UI-Router states are organized as a tree. + * A nested state has a path of ancestors to the root of the tree. + * When a state is being activated, each element in the path is wrapped as a [[PathNode]]. + * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated. + * + * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. + */ +var ResolveContext = /** @class */ (function () { + function ResolveContext(_path) { + this._path = _path; + } + /** Gets all the tokens found in the resolve context, de-duplicated */ + ResolveContext.prototype.getTokens = function () { + return this._path.reduce(function (acc, node) { return acc.concat(node.resolvables.map(function (r) { return r.token; })); }, []).reduce(uniqR, []); + }; + /** + * Gets the Resolvable that matches the token + * + * Gets the last Resolvable that matches the token in this context, or undefined. + * Throws an error if it doesn't exist in the ResolveContext + */ + ResolveContext.prototype.getResolvable = function (token) { + var matching = this._path.map(function (node) { return node.resolvables; }) + .reduce(unnestR, []) + .filter(function (r) { return r.token === token; }); + return tail(matching); + }; + /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */ + ResolveContext.prototype.getPolicy = function (resolvable) { + var node = this.findNode(resolvable); + return resolvable.getPolicy(node.state); + }; + /** + * Returns a ResolveContext that includes a portion of this one + * + * Given a state, this method creates a new ResolveContext from this one. + * The new context starts at the first node (root) and stops at the node for the `state` parameter. + * + * #### Why + * + * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. + * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables. + * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). + * This method is used to create a narrower context when injecting ancestor nodes. + * + * @example + * `let ABCD = new ResolveContext([A, B, C, D]);` + * + * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: + * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. + * However, `B` should only be able to access resolvables from `A`, `B`. + * + * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. + * `let AB = ABCD.subcontext(a)` + */ + ResolveContext.prototype.subContext = function (state) { + return new ResolveContext(PathUtils.subPath(this._path, function (node) { return node.state === state; })); + }; + /** + * Adds Resolvables to the node that matches the state + * + * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block). + * The resolvable is added to the node matching the `state` parameter. + * + * These new resolvables are not automatically fetched. + * The calling code should either fetch them, fetch something that depends on them, + * or rely on [[resolvePath]] being called when some state is being entered. + * + * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default. + * + * @param newResolvables the new Resolvables + * @param state Used to find the node to put the resolvable on + */ + ResolveContext.prototype.addResolvables = function (newResolvables, state) { + var node = find(this._path, propEq('state', state)); + var keys = newResolvables.map(function (r) { return r.token; }); + node.resolvables = node.resolvables.filter(function (r) { return keys.indexOf(r.token) === -1; }).concat(newResolvables); + }; + /** + * Returns a promise for an array of resolved path Element promises + * + * @param when + * @param trans + * @returns {Promise|any} + */ + ResolveContext.prototype.resolvePath = function (when, trans) { + var _this = this; + if (when === void 0) { when = "LAZY"; } + // This option determines which 'when' policy Resolvables we are about to fetch. + var whenOption = inArray(ALL_WHENS, when) ? when : "LAZY"; + // If the caller specified EAGER, only the EAGER Resolvables are fetched. + // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` + var matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; + // get the subpath to the state argument, if provided + trace.traceResolvePath(this._path, when, trans); + var matchesPolicy = function (acceptedVals, whenOrAsync) { + return function (resolvable) { + return inArray(acceptedVals, _this.getPolicy(resolvable)[whenOrAsync]); + }; + }; + // Trigger all the (matching) Resolvables in the path + // Reduce all the "WAIT" Resolvables into an array + var promises = this._path.reduce(function (acc, node) { + var nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when')); + var nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async')); + var wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async'))); + // For the matching Resolvables, start their async fetch process. + var subContext = _this.subContext(node.state); + var getResult = function (r) { return r.get(subContext, trans) + .then(function (value) { return ({ token: r.token, value: value }); }); }; + nowait.forEach(getResult); + return acc.concat(wait.map(getResult)); + }, []); + // Wait for all the "WAIT" resolvables + return services.$q.all(promises); + }; + ResolveContext.prototype.injector = function () { + return this._injector || (this._injector = new UIInjectorImpl(this)); + }; + ResolveContext.prototype.findNode = function (resolvable) { + return find(this._path, function (node) { return inArray(node.resolvables, resolvable); }); + }; + /** + * Gets the async dependencies of a Resolvable + * + * Given a Resolvable, returns its dependencies as a Resolvable[] + */ + ResolveContext.prototype.getDependencies = function (resolvable) { + var _this = this; + var node = this.findNode(resolvable); + // Find which other resolvables are "visible" to the `resolvable` argument + // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) + var subPath = PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; + var availableResolvables = subPath + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) //all of subpath's resolvables + .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument + var getDependency = function (token) { + var matching = availableResolvables.filter(function (r) { return r.token === token; }); + if (matching.length) + return tail(matching); + var fromInjector = _this.injector().getNative(token); + if (isUndefined(fromInjector)) { + throw new Error("Could not find Dependency Injection token: " + stringify(token)); + } + return new Resolvable(token, function () { return fromInjector; }, [], fromInjector); + }; + return resolvable.deps.map(getDependency); + }; + return ResolveContext; +}()); +var UIInjectorImpl = /** @class */ (function () { + function UIInjectorImpl(context) { + this.context = context; + this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector; + } + UIInjectorImpl.prototype.get = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) { + if (this.context.getPolicy(resolvable).async === 'NOWAIT') { + return resolvable.get(this.context); + } + if (!resolvable.resolved) { + throw new Error("Resolvable async .get() not complete:" + stringify(resolvable.token)); + } + return resolvable.data; + } + return this.getNative(token); + }; + UIInjectorImpl.prototype.getAsync = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) + return resolvable.get(this.context); + return services.$q.when(this.native.get(token)); + }; + UIInjectorImpl.prototype.getNative = function (token) { + return this.native && this.native.get(token); + }; + return UIInjectorImpl; +}()); + +/** + * @coreapi + * @module transition + */ +/** for typedoc */ +/** @hidden */ +var stateSelf = prop("self"); +/** + * Represents a transition between two states. + * + * When navigating to a state, we are transitioning **from** the current state **to** the new state. + * + * This object contains all contextual information about the to/from states, parameters, resolves. + * It has information about all states being entered and exited as a result of the transition. + */ +var Transition = /** @class */ (function () { + /** + * Creates a new Transition object. + * + * If the target state is not valid, an error is thrown. + * + * @internalapi + * + * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath` + * encapsulates the "from state". + * @param targetState The target state and parameters being transitioned to (also, the transition options) + * @param router The [[UIRouter]] instance + */ + function Transition(fromPath, targetState, router) { + var _this = this; + /** @hidden */ + this._deferred = services.$q.defer(); + /** + * This promise is resolved or rejected based on the outcome of the Transition. + * + * When the transition is successful, the promise is resolved + * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error + */ + this.promise = this._deferred.promise; + /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */ + this._registeredHooks = {}; + /** @hidden */ + this._hookBuilder = new HookBuilder(this); + /** Checks if this transition is currently active/running. */ + this.isActive = function () { + return _this.router.globals.transition === _this; + }; + this.router = router; + this._targetState = targetState; + if (!targetState.valid()) { + throw new Error(targetState.error()); + } + // current() is assumed to come from targetState.options, but provide a naive implementation otherwise. + this._options = extend({ current: val(this) }, targetState.options()); + this.$id = router.transitionService._transitionCount++; + var toPath = PathUtils.buildToPath(fromPath, targetState); + this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState); + this.createTransitionHookRegFns(); + var onCreateHooks = this._hookBuilder.buildHooksForPhase(exports.TransitionHookPhase.CREATE); + TransitionHook.invokeHooks(onCreateHooks, function () { return null; }); + this.applyViewConfigs(router); + } + /** @hidden */ + Transition.prototype.onBefore = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onStart = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onExit = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onRetain = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onEnter = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onFinish = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onSuccess = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + Transition.prototype.onError = function (criteria, callback, options) { return; }; + /** @hidden + * Creates the transition-level hook registration functions + * (which can then be used to register hooks) + */ + Transition.prototype.createTransitionHookRegFns = function () { + var _this = this; + this.router.transitionService._pluginapi._getEvents() + .filter(function (type) { return type.hookPhase !== exports.TransitionHookPhase.CREATE; }) + .forEach(function (type) { return makeEvent(_this, _this.router.transitionService, type); }); + }; + /** @internalapi */ + Transition.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + Transition.prototype.applyViewConfigs = function (router) { + var enteringStates = this._treeChanges.entering.map(function (node) { return node.state; }); + PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates); + }; + /** + * @internalapi + * + * @returns the internal from [State] object + */ + Transition.prototype.$from = function () { + return tail(this._treeChanges.from).state; + }; + /** + * @internalapi + * + * @returns the internal to [State] object + */ + Transition.prototype.$to = function () { + return tail(this._treeChanges.to).state; + }; + /** + * Returns the "from state" + * + * Returns the state that the transition is coming *from*. + * + * @returns The state declaration object for the Transition's ("from state"). + */ + Transition.prototype.from = function () { + return this.$from().self; + }; + /** + * Returns the "to state" + * + * Returns the state that the transition is going *to*. + * + * @returns The state declaration object for the Transition's target state ("to state"). + */ + Transition.prototype.to = function () { + return this.$to().self; + }; + /** + * Gets the Target State + * + * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object. + * + * @returns the [[TargetState]] of this Transition + */ + Transition.prototype.targetState = function () { + return this._targetState; + }; + /** + * Determines whether two transitions are equivalent. + * @deprecated + */ + Transition.prototype.is = function (compare) { + if (compare instanceof Transition) { + // TODO: Also compare parameters + return this.is({ to: compare.$to().name, from: compare.$from().name }); + } + return !((compare.to && !matchState(this.$to(), compare.to)) || + (compare.from && !matchState(this.$from(), compare.from))); + }; + Transition.prototype.params = function (pathname) { + if (pathname === void 0) { pathname = "to"; } + return Object.freeze(this._treeChanges[pathname].map(prop("paramValues")).reduce(mergeR, {})); + }; + /** + * Creates a [[UIInjector]] Dependency Injector + * + * Returns a Dependency Injector for the Transition's target state (to state). + * The injector provides resolve values which the target state has access to. + * + * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2). + * + * #### Example: + * ```js + * .onEnter({ entering: 'myState' }, trans => { + * var myResolveValue = trans.injector().get('myResolve'); + * // Inject a global service from the global/native injector (if it exists) + * var MyService = trans.injector().get('MyService'); + * }) + * ``` + * + * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched. + * You can use [[UIInjector.getAsync]] to get a promise for the data. + * #### Example: + * ```js + * .onBefore({}, trans => { + * return trans.injector().getAsync('myResolve').then(myResolveValue => + * return myResolveValue !== 'ABORT'; + * }); + * }); + * ``` + * + * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to. + * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`. + * #### Example: + * ```js + * .onEnter({ to: 'foo.bar' }, trans => { + * // returns result of `foo` state's `data` resolve + * // even though `foo.bar` also has a `data` resolve + * var fooData = trans.injector('foo').get('data'); + * }); + * ``` + * + * If you need resolve data from the exiting states, pass `'from'` as `pathName`. + * The resolve data from the `from` path will be returned. + * #### Example: + * ```js + * .onExit({ exiting: 'foo.bar' }, trans => { + * // Gets the resolve value of `data` from the exiting state. + * var fooData = trans.injector(null, 'foo.bar').get('data'); + * }); + * ``` + * + * + * @param state Limits the resolves provided to only the resolves the provided state has access to. + * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states. + * + * @returns a [[UIInjector]] + */ + Transition.prototype.injector = function (state, pathName) { + if (pathName === void 0) { pathName = "to"; } + var path = this._treeChanges[pathName]; + if (state) + path = PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); + return new ResolveContext(path).injector(); + }; + /** + * Gets all available resolve tokens (keys) + * + * This method can be used in conjunction with [[injector]] to inspect the resolve values + * available to the Transition. + * + * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states + * in the Transition's [[TreeChanges.to]] path. + * + * #### Example: + * This example logs all resolve values + * ```js + * let tokens = trans.getResolveTokens(); + * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token))); + * ``` + * + * #### Example: + * This example creates promises for each resolve value. + * This triggers fetches of resolves (if any have not yet been fetched). + * When all promises have all settled, it logs the resolve values. + * ```js + * let tokens = trans.getResolveTokens(); + * let promise = tokens.map(token => trans.injector().getAsync(token)); + * Promise.all(promises).then(values => console.log("Resolved values: " + values)); + * ``` + * + * Note: Angular 1 users whould use `$q.all()` + * + * @param pathname resolve context's path name (e.g., `to` or `from`) + * + * @returns an array of resolve tokens (keys) + */ + Transition.prototype.getResolveTokens = function (pathname) { + if (pathname === void 0) { pathname = "to"; } + return new ResolveContext(this._treeChanges[pathname]).getTokens(); + }; + /** + * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition. + * + * #### Example: + * ```js + * transitionService.onBefore({}, transition => { + * transition.addResolvable({ + * token: 'myResolve', + * deps: ['MyService'], + * resolveFn: myService => myService.getData() + * }); + * }); + * ``` + * + * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]]) + * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) + */ + Transition.prototype.addResolvable = function (resolvable, state) { + if (state === void 0) { state = ""; } + resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable); + var stateName = (typeof state === "string") ? state : state.name; + var topath = this._treeChanges.to; + var targetNode = find(topath, function (node) { return node.state.name === stateName; }); + var resolveContext = new ResolveContext(topath); + resolveContext.addResolvables([resolvable], targetNode.state); + }; + /** + * Gets the transition from which this transition was redirected. + * + * If the current transition is a redirect, this method returns the transition that was redirected. + * + * #### Example: + * ```js + * let transitionA = $state.go('A').transition + * transitionA.onStart({}, () => $state.target('B')); + * $transitions.onSuccess({ to: 'B' }, (trans) => { + * trans.to().name === 'B'; // true + * trans.redirectedFrom() === transitionA; // true + * }); + * ``` + * + * @returns The previous Transition, or null if this Transition is not the result of a redirection + */ + Transition.prototype.redirectedFrom = function () { + return this._options.redirectedFrom || null; + }; + /** + * Gets the original transition in a redirect chain + * + * A transition might belong to a long chain of multiple redirects. + * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain. + * + * #### Example: + * ```js + * // states + * registry.register({ name: 'A', redirectTo: 'B' }); + * registry.register({ name: 'B', redirectTo: 'C' }); + * registry.register({ name: 'C', redirectTo: 'D' }); + * registry.register({ name: 'D' }); + * + * let transitionA = $state.go('A').transition + * + * $transitions.onSuccess({ to: 'D' }, (trans) => { + * trans.to().name === 'D'; // true + * trans.redirectedFrom().to().name === 'C'; // true + * trans.originalTransition() === transitionA; // true + * trans.originalTransition().to().name === 'A'; // true + * }); + * ``` + * + * @returns The original Transition that started a redirect chain + */ + Transition.prototype.originalTransition = function () { + var rf = this.redirectedFrom(); + return (rf && rf.originalTransition()) || this; + }; + /** + * Get the transition options + * + * @returns the options for this Transition. + */ + Transition.prototype.options = function () { + return this._options; + }; + /** + * Gets the states being entered. + * + * @returns an array of states that will be entered during this transition. + */ + Transition.prototype.entering = function () { + return map(this._treeChanges.entering, prop('state')).map(stateSelf); + }; + /** + * Gets the states being exited. + * + * @returns an array of states that will be exited during this transition. + */ + Transition.prototype.exiting = function () { + return map(this._treeChanges.exiting, prop('state')).map(stateSelf).reverse(); + }; + /** + * Gets the states being retained. + * + * @returns an array of states that are already entered from a previous Transition, that will not be + * exited during this Transition + */ + Transition.prototype.retained = function () { + return map(this._treeChanges.retained, prop('state')).map(stateSelf); + }; + /** + * Get the [[ViewConfig]]s associated with this Transition + * + * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects. + * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering"). + * + * @param pathname the name of the path to fetch views for: + * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`) + * @param state If provided, only returns the `ViewConfig`s for a single state in the path + * + * @returns a list of ViewConfig objects for the given path. + */ + Transition.prototype.views = function (pathname, state) { + if (pathname === void 0) { pathname = "entering"; } + var path = this._treeChanges[pathname]; + path = !state ? path : path.filter(propEq('state', state)); + return path.map(prop("views")).filter(identity).reduce(unnestR, []); + }; + Transition.prototype.treeChanges = function (pathname) { + return pathname ? this._treeChanges[pathname] : this._treeChanges; + }; + /** + * Creates a new transition that is a redirection of the current one. + * + * This transition can be returned from a [[TransitionService]] hook to + * redirect a transition to a new state and/or set of parameters. + * + * @internalapi + * + * @returns Returns a new [[Transition]] instance. + */ + Transition.prototype.redirect = function (targetState) { + var redirects = 1, trans = this; + while ((trans = trans.redirectedFrom()) != null) { + if (++redirects > 20) + throw new Error("Too many consecutive Transition redirects (20+)"); + } + var redirectOpts = { redirectedFrom: this, source: "redirect" }; + // If the original transition was caused by URL sync, then use { location: 'replace' } + // on the new transition (unless the target state explicitly specifies location: false). + // This causes the original url to be replaced with the url for the redirect target + // so the original url disappears from the browser history. + if (this.options().source === 'url' && targetState.options().location !== false) { + redirectOpts.location = 'replace'; + } + var newOptions = extend({}, this.options(), targetState.options(), redirectOpts); + targetState = targetState.withOptions(newOptions, true); + var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); + var originalEnteringNodes = this._treeChanges.entering; + var redirectEnteringNodes = newTransition._treeChanges.entering; + // --- Re-use resolve data from original transition --- + // When redirecting from a parent state to a child state where the parent parameter values haven't changed + // (because of the redirect), the resolves fetched by the original transition are still valid in the + // redirected transition. + // + // This allows you to define a redirect on a parent state which depends on an async resolve value. + // You can wait for the resolve, then redirect to a child state based on the result. + // The redirected transition does not have to re-fetch the resolve. + // --------------------------------------------------------- + var nodeIsReloading = function (reloadState) { return function (node) { + return reloadState && node.state.includes[reloadState.name]; + }; }; + // Find any "entering" nodes in the redirect path that match the original path and aren't being reloaded + var matchingEnteringNodes = PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, PathUtils.nonDynamicParams) + .filter(not(nodeIsReloading(targetState.options().reloadState))); + // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes. + matchingEnteringNodes.forEach(function (node, idx) { + node.resolvables = originalEnteringNodes[idx].resolvables; + }); + return newTransition; + }; + /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */ + Transition.prototype._changedParams = function () { + var tc = this._treeChanges; + /** Return undefined if it's not a "dynamic" transition, for the following reasons */ + // If user explicitly wants a reload + if (this._options.reload) + return undefined; + // If any states are exiting or entering + if (tc.exiting.length || tc.entering.length) + return undefined; + // If to/from path lengths differ + if (tc.to.length !== tc.from.length) + return undefined; + // If the to/from paths are different + var pathsDiffer = arrayTuples(tc.to, tc.from) + .map(function (tuple) { return tuple[0].state !== tuple[1].state; }) + .reduce(anyTrueR, false); + if (pathsDiffer) + return undefined; + // Find any parameter values that differ + var nodeSchemas = tc.to.map(function (node) { return node.paramSchema; }); + var _a = [tc.to, tc.from].map(function (path) { return path.map(function (x) { return x.paramValues; }); }), toValues = _a[0], fromValues = _a[1]; + var tuples = arrayTuples(nodeSchemas, toValues, fromValues); + return tuples.map(function (_a) { + var schema = _a[0], toVals = _a[1], fromVals = _a[2]; + return Param.changed(schema, toVals, fromVals); + }).reduce(unnestR, []); + }; + /** + * Returns true if the transition is dynamic. + * + * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed. + * + * @returns true if the Transition is dynamic + */ + Transition.prototype.dynamic = function () { + var changes = this._changedParams(); + return !changes ? false : changes.map(function (x) { return x.dynamic; }).reduce(anyTrueR, false); + }; + /** + * Returns true if the transition is ignored. + * + * A transition is ignored if no states are entered nor exited, and no parameter values have changed. + * + * @returns true if the Transition is ignored. + */ + Transition.prototype.ignored = function () { + return !!this._ignoredReason(); + }; + /** @hidden */ + Transition.prototype._ignoredReason = function () { + var pending = this.router.globals.transition; + var reloadState = this._options.reloadState; + var same = function (pathA, pathB) { + if (pathA.length !== pathB.length) + return false; + var matching = PathUtils.matching(pathA, pathB); + return pathA.length === matching.filter(function (node) { return !reloadState || !node.state.includes[reloadState.name]; }).length; + }; + var newTC = this.treeChanges(); + var pendTC = pending && pending.treeChanges(); + if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) + return "SameAsPending"; + if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) + return "SameAsCurrent"; + }; + /** + * Runs the transition + * + * This method is generally called from the [[StateService.transitionTo]] + * + * @internalapi + * + * @returns a promise for a successful transition. + */ + Transition.prototype.run = function () { + var _this = this; + var runAllHooks = TransitionHook.runAllHooks; + // Gets transition hooks array for the given phase + var getHooksFor = function (phase) { + return _this._hookBuilder.buildHooksForPhase(phase); + }; + // When the chain is complete, then resolve or reject the deferred + var transitionSuccess = function () { + trace.traceSuccess(_this.$to(), _this); + _this.success = true; + _this._deferred.resolve(_this.to()); + runAllHooks(getHooksFor(exports.TransitionHookPhase.SUCCESS)); + }; + var transitionError = function (reason) { + trace.traceError(reason, _this); + _this.success = false; + _this._deferred.reject(reason); + _this._error = reason; + runAllHooks(getHooksFor(exports.TransitionHookPhase.ERROR)); + }; + var runTransition = function () { + // Wait to build the RUN hook chain until the BEFORE hooks are done + // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object. + var allRunHooks = getHooksFor(exports.TransitionHookPhase.RUN); + var done = function () { return services.$q.when(undefined); }; + return TransitionHook.invokeHooks(allRunHooks, done); + }; + var startTransition = function () { + var globals = _this.router.globals; + globals.lastStartedTransitionId = _this.$id; + globals.transition = _this; + globals.transitionHistory.enqueue(_this); + trace.traceTransitionStart(_this); + return services.$q.when(undefined); + }; + var allBeforeHooks = getHooksFor(exports.TransitionHookPhase.BEFORE); + TransitionHook.invokeHooks(allBeforeHooks, startTransition) + .then(runTransition) + .then(transitionSuccess, transitionError); + return this.promise; + }; + /** + * Checks if the Transition is valid + * + * @returns true if the Transition is valid + */ + Transition.prototype.valid = function () { + return !this.error() || this.success !== undefined; + }; + /** + * Aborts this transition + * + * Imperative API to abort a Transition. + * This only applies to Transitions that are not yet complete. + */ + Transition.prototype.abort = function () { + // Do not set flag if the transition is already complete + if (isUndefined(this.success)) { + this._aborted = true; + } + }; + /** + * The Transition error reason. + * + * If the transition is invalid (and could not be run), returns the reason the transition is invalid. + * If the transition was valid and ran, but was not successful, returns the reason the transition failed. + * + * @returns an error message explaining why the transition is invalid, or the reason the transition failed. + */ + Transition.prototype.error = function () { + var state = this.$to(); + if (state.self.abstract) + return "Cannot transition to abstract state '" + state.name + "'"; + var paramDefs = state.parameters(), values$$1 = this.params(); + var invalidParams = paramDefs.filter(function (param) { return !param.validates(values$$1[param.id]); }); + if (invalidParams.length) { + return "Param values not valid for state '" + state.name + "'. Invalid params: [ " + invalidParams.map(function (param) { return param.id; }).join(', ') + " ]"; + } + if (this.success === false) + return this._error; + }; + /** + * A string representation of the Transition + * + * @returns A string representation of the Transition + */ + Transition.prototype.toString = function () { + var fromStateOrName = this.from(); + var toStateOrName = this.to(); + var avoidEmptyHash = function (params) { + return (params["#"] !== null && params["#"] !== undefined) ? params : omit(params, ["#"]); + }; + // (X) means the to state is invalid. + var id = this.$id, from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))), toValid = this.valid() ? "" : "(X) ", to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = stringify(avoidEmptyHash(this.params())); + return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; + }; + /** @hidden */ + Transition.diToken = Transition; + return Transition; +}()); + +/** + * Functions that manipulate strings + * + * Although these functions are exported, they are subject to change without notice. + * + * @module common_strings + */ /** */ +/** + * Returns a string shortened to a maximum length + * + * If the string is already less than the `max` length, return the string. + * Else return the string, shortened to `max - 3` and append three dots ("..."). + * + * @param max the maximum length of the string to return + * @param str the input string + */ +function maxLength(max, str) { + if (str.length <= max) + return str; + return str.substr(0, max - 3) + "..."; +} +/** + * Returns a string, with spaces added to the end, up to a desired str length + * + * If the string is already longer than the desired length, return the string. + * Else returns the string, with extra spaces on the end, such that it reaches `length` characters. + * + * @param length the desired length of the string to return + * @param str the input string + */ +function padString(length, str) { + while (str.length < length) + str += " "; + return str; +} +function kebobString(camelCase) { + return camelCase + .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char + .replace(/([A-Z])/g, function ($1) { return "-" + $1.toLowerCase(); }); // replace rest +} +function functionToString(fn) { + var fnStr = fnToString(fn); + var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); + var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; + var fnName = fn['name'] || ""; + if (fnName && toStr.match(/function \(/)) { + return 'function ' + fnName + toStr.substr(9); + } + return toStr; +} +function fnToString(fn) { + var _fn = isArray(fn) ? fn.slice(-1)[0] : fn; + return _fn && _fn.toString() || "undefined"; +} +var stringifyPatternFn = null; +var stringifyPattern = function (value) { + var isRejection = Rejection.isRejectionPromise; + stringifyPatternFn = stringifyPatternFn || pattern([ + [not(isDefined), val("undefined")], + [isNull, val("null")], + [isPromise, val("[Promise]")], + [isRejection, function (x) { return x._transitionRejection.toString(); }], + [is(Rejection), invoke("toString")], + [is(Transition), invoke("toString")], + [is(Resolvable), invoke("toString")], + [isInjectable, functionToString], + [val(true), identity] + ]); + return stringifyPatternFn(value); +}; +function stringify(o) { + var seen = []; + function format(val$$1) { + if (isObject(val$$1)) { + if (seen.indexOf(val$$1) !== -1) + return '[circular ref]'; + seen.push(val$$1); + } + return stringifyPattern(val$$1); + } + return JSON.stringify(o, function (key, val$$1) { return format(val$$1); }).replace(/\\"/g, '"'); +} +/** Returns a function that splits a string on a character or substring */ +var beforeAfterSubstr = function (char) { return function (str) { + if (!str) + return ["", ""]; + var idx = str.indexOf(char); + if (idx === -1) + return [str, ""]; + return [str.substr(0, idx), str.substr(idx + 1)]; +}; }; +var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); +var stripFile = function (str) { return str.replace(/\/[^/]*$/, ''); }; +var splitHash = beforeAfterSubstr("#"); +var splitQuery = beforeAfterSubstr("?"); +var splitEqual = beforeAfterSubstr("="); +var trimHashVal = function (str) { return str ? str.replace(/^#/, "") : ""; }; +/** + * Splits on a delimiter, but returns the delimiters in the array + * + * #### Example: + * ```js + * var splitOnSlashes = splitOnDelim('/'); + * splitOnSlashes("/foo"); // ["/", "foo"] + * splitOnSlashes("/foo/"); // ["/", "foo", "/"] + * ``` + */ +function splitOnDelim(delim) { + var re = new RegExp("(" + delim + ")", "g"); + return function (str) { + return str.split(re).filter(identity); + }; +} + +/** + * Reduce fn that joins neighboring strings + * + * Given an array of strings, returns a new array + * where all neighboring strings have been joined. + * + * #### Example: + * ```js + * let arr = ["foo", "bar", 1, "baz", "", "qux" ]; + * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ] + * ``` + */ +function joinNeighborsR(acc, x) { + if (isString(tail(acc)) && isString(x)) + return acc.slice(0, -1).concat(tail(acc) + x); + return pushR(acc, x); +} + +/** @module common */ /** for typedoc */ + +/** + * @coreapi + * @module params + */ +/** */ +/** + * A registry for parameter types. + * + * This registry manages the built-in (and custom) parameter types. + * + * The built-in parameter types are: + * + * - [[string]] + * - [[path]] + * - [[query]] + * - [[hash]] + * - [[int]] + * - [[bool]] + * - [[date]] + * - [[json]] + * - [[any]] + */ +var ParamTypes = /** @class */ (function () { + /** @internalapi */ + function ParamTypes() { + /** @hidden */ + this.enqueue = true; + /** @hidden */ + this.typeQueue = []; + /** @internalapi */ + this.defaultTypes = pick(ParamTypes.prototype, ["hash", "string", "query", "path", "int", "bool", "date", "json", "any"]); + // Register default types. Store them in the prototype of this.types. + var makeType = function (definition, name) { + return new ParamType(extend({ name: name }, definition)); + }; + this.types = inherit(map(this.defaultTypes, makeType), {}); + } + /** @internalapi */ + ParamTypes.prototype.dispose = function () { + this.types = {}; + }; + /** + * Registers a parameter type + * + * End users should call [[UrlMatcherFactory.type]], which delegates to this method. + */ + ParamTypes.prototype.type = function (name, definition, definitionFn) { + if (!isDefined(definition)) + return this.types[name]; + if (this.types.hasOwnProperty(name)) + throw new Error("A type named '" + name + "' has already been defined."); + this.types[name] = new ParamType(extend({ name: name }, definition)); + if (definitionFn) { + this.typeQueue.push({ name: name, def: definitionFn }); + if (!this.enqueue) + this._flushTypeQueue(); + } + return this; + }; + /** @internalapi */ + ParamTypes.prototype._flushTypeQueue = function () { + while (this.typeQueue.length) { + var type = this.typeQueue.shift(); + if (type.pattern) + throw new Error("You cannot override a type's .pattern at runtime."); + extend(this.types[type.name], services.$injector.invoke(type.def)); + } + }; + return ParamTypes; +}()); +/** @hidden */ +function initDefaultTypes() { + var makeDefaultType = function (def) { + var valToString = function (val$$1) { + return val$$1 != null ? val$$1.toString() : val$$1; + }; + var defaultTypeBase = { + encode: valToString, + decode: valToString, + is: is(String), + pattern: /.*/, + equals: function (a, b) { return a == b; }, + }; + return extend({}, defaultTypeBase, def); + }; + // Default Parameter Type Definitions + extend(ParamTypes.prototype, { + string: makeDefaultType({}), + path: makeDefaultType({ + pattern: /[^/]*/, + }), + query: makeDefaultType({}), + hash: makeDefaultType({ + inherit: false, + }), + int: makeDefaultType({ + decode: function (val$$1) { return parseInt(val$$1, 10); }, + is: function (val$$1) { + return !isNullOrUndefined(val$$1) && this.decode(val$$1.toString()) === val$$1; + }, + pattern: /-?\d+/, + }), + bool: makeDefaultType({ + encode: function (val$$1) { return val$$1 && 1 || 0; }, + decode: function (val$$1) { return parseInt(val$$1, 10) !== 0; }, + is: is(Boolean), + pattern: /0|1/, + }), + date: makeDefaultType({ + encode: function (val$$1) { + return !this.is(val$$1) ? undefined : [ + val$$1.getFullYear(), + ('0' + (val$$1.getMonth() + 1)).slice(-2), + ('0' + val$$1.getDate()).slice(-2), + ].join("-"); + }, + decode: function (val$$1) { + if (this.is(val$$1)) + return val$$1; + var match = this.capture.exec(val$$1); + return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; + }, + is: function (val$$1) { return val$$1 instanceof Date && !isNaN(val$$1.valueOf()); }, + equals: function (l, r) { + return ['getFullYear', 'getMonth', 'getDate'] + .reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); + }, + pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, + }), + json: makeDefaultType({ + encode: toJson, + decode: fromJson, + is: is(Object), + equals: equals, + pattern: /[^/]*/, + }), + // does not encode/decode + any: makeDefaultType({ + encode: identity, + decode: identity, + is: function () { return true; }, + equals: equals, + }), + }); +} +initDefaultTypes(); + +/** + * @coreapi + * @module params + */ +/** */ +/** @internalapi */ +var StateParams = /** @class */ (function () { + function StateParams(params) { + if (params === void 0) { params = {}; } + extend(this, params); + } + /** + * Merges a set of parameters with all parameters inherited between the common parents of the + * current state and a given destination state. + * + * @param {Object} newParams The set of parameters which will be composited with inherited params. + * @param {Object} $current Internal definition of object representing the current state. + * @param {Object} $to Internal definition of object representing state to transition to. + */ + StateParams.prototype.$inherit = function (newParams, $current, $to) { + var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = []; + for (var i in parents) { + if (!parents[i] || !parents[i].params) + continue; + parentParams = Object.keys(parents[i].params); + if (!parentParams.length) + continue; + for (var j in parentParams) { + if (inheritList.indexOf(parentParams[j]) >= 0) + continue; + inheritList.push(parentParams[j]); + inherited[parentParams[j]] = this[parentParams[j]]; + } + } + return extend({}, inherited, newParams); + }; + + return StateParams; +}()); + +/** @module path */ /** for typedoc */ + +/** @module resolve */ /** for typedoc */ + +/** @module state */ /** for typedoc */ +var parseUrl = function (url) { + if (!isString(url)) + return false; + var root$$1 = url.charAt(0) === '^'; + return { val: root$$1 ? url.substring(1) : url, root: root$$1 }; +}; +function nameBuilder(state) { + return state.name; +} +function selfBuilder(state) { + state.self.$$state = function () { return state; }; + return state.self; +} +function dataBuilder(state) { + if (state.parent && state.parent.data) { + state.data = state.self.data = inherit(state.parent.data, state.data); + } + return state.data; +} +var getUrlBuilder = function ($urlMatcherFactoryProvider, root$$1) { + return function urlBuilder(state) { + var stateDec = state; + // For future states, i.e., states whose name ends with `.**`, + // match anything that starts with the url prefix + if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { + stateDec.url += "{remainder:any}"; // match any path (.*) + } + var parsed = parseUrl(stateDec.url), parent = state.parent; + var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { + params: state.params || {}, + paramMap: function (paramConfig, isSearch) { + if (stateDec.reloadOnSearch === false && isSearch) + paramConfig = extend(paramConfig || {}, { dynamic: true }); + return paramConfig; + } + }); + if (!url) + return null; + if (!$urlMatcherFactoryProvider.isMatcher(url)) + throw new Error("Invalid url '" + url + "' in state '" + state + "'"); + return (parsed && parsed.root) ? url : ((parent && parent.navigable) || root$$1()).url.append(url); + }; +}; +var getNavigableBuilder = function (isRoot) { + return function navigableBuilder(state) { + return !isRoot(state) && state.url ? state : (state.parent ? state.parent.navigable : null); + }; +}; +var getParamsBuilder = function (paramFactory) { + return function paramsBuilder(state) { + var makeConfigParam = function (config, id) { return paramFactory.fromConfig(id, null, config); }; + var urlParams = (state.url && state.url.parameters({ inherit: false })) || []; + var nonUrlParams = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam)); + return urlParams.concat(nonUrlParams).map(function (p) { return [p.id, p]; }).reduce(applyPairs, {}); + }; +}; +function pathBuilder(state) { + return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; +} +function includesBuilder(state) { + var includes = state.parent ? extend({}, state.parent.includes) : {}; + includes[state.name] = true; + return includes; +} +/** + * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * validates the `resolve` property and converts it to a [[Resolvable]] array. + * + * resolve: input value can be: + * + * { + * // analyzed but not injected + * myFooResolve: function() { return "myFooData"; }, + * + * // function.toString() parsed, "DependencyName" dep as string (not min-safe) + * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() }, + * + * // Array split; "DependencyName" dep as string + * myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() }, + * + * // Array split; DependencyType dep as token (compared using ===) + * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() }, + * + * // val.$inject used as deps + * // where: + * // corgeResolve.$inject = ["DependencyName"]; + * // function corgeResolve(dep) { dep.fetchSometingAsPromise() } + * // then "DependencyName" dep as string + * myCorgeResolve: corgeResolve, + * + * // inject service by name + * // When a string is found, desugar creating a resolve that injects the named service + * myGraultResolve: "SomeService" + * } + * + * or: + * + * [ + * new Resolvable("myFooResolve", function() { return "myFooData" }), + * new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), + * { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } + * ] + */ +function resolvablesBuilder(state) { + /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */ + var objects2Tuples = function (resolveObj, resolvePolicies) { + return Object.keys(resolveObj || {}).map(function (token) { return ({ token: token, val: resolveObj[token], deps: undefined, policy: resolvePolicies[token] }); }); + }; + /** fetch DI annotations from a function or ng1-style array */ + var annotate = function (fn) { + var $injector = services.$injector; + // ng1 doesn't have an $injector until runtime. + // If the $injector doesn't exist, use "deferred" literal as a + // marker indicating they should be annotated when runtime starts + return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || "deferred"; + }; + /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ + var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; + /** true if the object looks like a provide literal, or a ng2 Provider */ + var isLikeNg2Provider = function (obj) { return !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass)); }; + /** true if the object looks like a tuple from obj2Tuples */ + var isTupleFromObj = function (obj) { return !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val))); }; + /** extracts the token from a Provider or provide literal */ + var token = function (p) { return p.provide || p.token; }; + /** Given a literal resolve or provider object, returns a Resolvable */ + var literal2Resolvable = pattern([ + [prop('resolveFn'), function (p) { return new Resolvable(token(p), p.resolveFn, p.deps, p.policy); }], + [prop('useFactory'), function (p) { return new Resolvable(token(p), p.useFactory, (p.deps || p.dependencies), p.policy); }], + [prop('useClass'), function (p) { return new Resolvable(token(p), function () { return new p.useClass(); }, [], p.policy); }], + [prop('useValue'), function (p) { return new Resolvable(token(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], + [prop('useExisting'), function (p) { return new Resolvable(token(p), identity, [p.useExisting], p.policy); }], + ]); + var tuple2Resolvable = pattern([ + [pipe(prop("val"), isString), function (tuple) { return new Resolvable(tuple.token, identity, [tuple.val], tuple.policy); }], + [pipe(prop("val"), isArray), function (tuple) { return new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], + [pipe(prop("val"), isFunction), function (tuple) { return new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], + ]); + var item2Resolvable = pattern([ + [is(Resolvable), function (r) { return r; }], + [isResolveLiteral, literal2Resolvable], + [isLikeNg2Provider, literal2Resolvable], + [isTupleFromObj, tuple2Resolvable], + [val(true), function (obj) { throw new Error("Invalid resolve value: " + stringify(obj)); }] + ]); + // If resolveBlock is already an array, use it as-is. + // Otherwise, assume it's an object and convert to an Array of tuples + var decl = state.resolve; + var items = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {}); + return items.map(item2Resolvable); +} +/** + * @internalapi A internal global service + * + * StateBuilder is a factory for the internal [[StateObject]] objects. + * + * When you register a state with the [[StateRegistry]], you register a plain old javascript object which + * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding + * [[StateObject]] object, which has an API and is used internally. + * + * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function + * using the [[builder]] method. + */ +var StateBuilder = /** @class */ (function () { + function StateBuilder(matcher, urlMatcherFactory) { + this.matcher = matcher; + var self = this; + var root$$1 = function () { return matcher.find(""); }; + var isRoot = function (state) { return state.name === ""; }; + function parentBuilder(state) { + if (isRoot(state)) + return null; + return matcher.find(self.parentName(state)) || root$$1(); + } + this.builders = { + name: [nameBuilder], + self: [selfBuilder], + parent: [parentBuilder], + data: [dataBuilder], + // Build a URLMatcher if necessary, either via a relative or absolute URL + url: [getUrlBuilder(urlMatcherFactory, root$$1)], + // Keep track of the closest ancestor state that has a URL (i.e. is navigable) + navigable: [getNavigableBuilder(isRoot)], + params: [getParamsBuilder(urlMatcherFactory.paramFactory)], + // Each framework-specific ui-router implementation should define its own `views` builder + // e.g., src/ng1/statebuilders/views.ts + views: [], + // Keep a full path from the root down to this state as this is needed for state activation. + path: [pathBuilder], + // Speed up $state.includes() as it's used a lot + includes: [includesBuilder], + resolvables: [resolvablesBuilder] + }; + } + /** + * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`). + * More than one BuilderFunction can be registered for a given property. + * + * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects. + * + * @param name The name of the State property being registered for. + * @param fn The BuilderFunction which will be used to build the State property + * @returns a function which deregisters the BuilderFunction + */ + StateBuilder.prototype.builder = function (name, fn) { + var builders = this.builders; + var array = builders[name] || []; + // Backwards compat: if only one builder exists, return it, else return whole arary. + if (isString(name) && !isDefined(fn)) + return array.length > 1 ? array : array[0]; + if (!isString(name) || !isFunction(fn)) + return; + builders[name] = array; + builders[name].push(fn); + return function () { return builders[name].splice(builders[name].indexOf(fn, 1)) && null; }; + }; + /** + * Builds all of the properties on an essentially blank State object, returning a State object which has all its + * properties and API built. + * + * @param state an uninitialized State object + * @returns the built State object + */ + StateBuilder.prototype.build = function (state) { + var _a = this, matcher = _a.matcher, builders = _a.builders; + var parent = this.parentName(state); + if (parent && !matcher.find(parent, undefined, false)) { + return null; + } + for (var key in builders) { + if (!builders.hasOwnProperty(key)) + continue; + var chain = builders[key].reduce(function (parentFn, step) { return function (_state) { return step(_state, parentFn); }; }, noop$1); + state[key] = chain(state); + } + return state; + }; + StateBuilder.prototype.parentName = function (state) { + // name = 'foo.bar.baz.**' + var name = state.name || ""; + // segments = ['foo', 'bar', 'baz', '.**'] + var segments = name.split('.'); + // segments = ['foo', 'bar', 'baz'] + var lastSegment = segments.pop(); + // segments = ['foo', 'bar'] (ignore .** segment for future states) + if (lastSegment === '**') + segments.pop(); + if (segments.length) { + if (state.parent) { + throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); + } + // 'foo.bar' + return segments.join("."); + } + if (!state.parent) + return ""; + return isString(state.parent) ? state.parent : state.parent.name; + }; + StateBuilder.prototype.name = function (state) { + var name = state.name; + if (name.indexOf('.') !== -1 || !state.parent) + return name; + var parentName = isString(state.parent) ? state.parent : state.parent.name; + return parentName ? parentName + "." + name : name; + }; + return StateBuilder; +}()); + +/** @module state */ /** for typedoc */ +var StateMatcher = /** @class */ (function () { + function StateMatcher(_states) { + this._states = _states; + } + StateMatcher.prototype.isRelative = function (stateName) { + stateName = stateName || ""; + return stateName.indexOf(".") === 0 || stateName.indexOf("^") === 0; + }; + StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { + if (matchGlob === void 0) { matchGlob = true; } + if (!stateOrName && stateOrName !== "") + return undefined; + var isStr = isString(stateOrName); + var name = isStr ? stateOrName : stateOrName.name; + if (this.isRelative(name)) + name = this.resolvePath(name, base); + var state = this._states[name]; + if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { + return state; + } + else if (isStr && matchGlob) { + var _states = values(this._states); + var matches = _states.filter(function (state) { + return state.__stateObjectCache.nameGlob && + state.__stateObjectCache.nameGlob.matches(name); + }); + if (matches.length > 1) { + console.log("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); + } + return matches[0]; + } + return undefined; + }; + StateMatcher.prototype.resolvePath = function (name, base) { + if (!base) + throw new Error("No reference point given for path '" + name + "'"); + var baseState = this.find(base); + var splitName = name.split("."), i = 0, pathLength = splitName.length, current = baseState; + for (; i < pathLength; i++) { + if (splitName[i] === "" && i === 0) { + current = baseState; + continue; + } + if (splitName[i] === "^") { + if (!current.parent) + throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); + current = current.parent; + continue; + } + break; + } + var relName = splitName.slice(i).join("."); + return current.name + (current.name && relName ? "." : "") + relName; + }; + return StateMatcher; +}()); + +/** @module state */ /** for typedoc */ +/** @internalapi */ +var StateQueueManager = /** @class */ (function () { + function StateQueueManager($registry, $urlRouter, states, builder, listeners) { + this.$registry = $registry; + this.$urlRouter = $urlRouter; + this.states = states; + this.builder = builder; + this.listeners = listeners; + this.queue = []; + this.matcher = $registry.matcher; + } + /** @internalapi */ + StateQueueManager.prototype.dispose = function () { + this.queue = []; + }; + StateQueueManager.prototype.register = function (stateDecl) { + var queue = this.queue; + var state = StateObject.create(stateDecl); + var name = state.name; + if (!isString(name)) + throw new Error("State must have a valid name"); + if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name)) + throw new Error("State '" + name + "' is already defined"); + queue.push(state); + this.flush(); + return state; + }; + StateQueueManager.prototype.flush = function () { + var _this = this; + var _a = this, queue = _a.queue, states = _a.states, builder = _a.builder; + var registered = [], // states that got registered + orphans = [], // states that don't yet have a parent registered + previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered + var getState = function (name) { + return _this.states.hasOwnProperty(name) && _this.states[name]; + }; + while (queue.length > 0) { + var state = queue.shift(); + var name_1 = state.name; + var result = builder.build(state); + var orphanIdx = orphans.indexOf(state); + if (result) { + var existingState = getState(name_1); + if (existingState && existingState.name === name_1) { + throw new Error("State '" + name_1 + "' is already defined"); + } + var existingFutureState = getState(name_1 + ".**"); + if (existingFutureState) { + // Remove future state of the same name + this.$registry.deregister(existingFutureState); + } + states[name_1] = state; + this.attachRoute(state); + if (orphanIdx >= 0) + orphans.splice(orphanIdx, 1); + registered.push(state); + continue; + } + var prev = previousQueueLength[name_1]; + previousQueueLength[name_1] = queue.length; + if (orphanIdx >= 0 && prev === queue.length) { + // Wait until two consecutive iterations where no additional states were dequeued successfully. + // throw new Error(`Cannot register orphaned state '${name}'`); + queue.push(state); + return states; + } + else if (orphanIdx < 0) { + orphans.push(state); + } + queue.push(state); + } + if (registered.length) { + this.listeners.forEach(function (listener) { return listener("registered", registered.map(function (s) { return s.self; })); }); + } + return states; + }; + StateQueueManager.prototype.attachRoute = function (state) { + if (state.abstract || !state.url) + return; + this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(state)); + }; + return StateQueueManager; +}()); + +/** + * @coreapi + * @module state + */ /** for typedoc */ +var StateRegistry = /** @class */ (function () { + /** @internalapi */ + function StateRegistry(_router) { + this._router = _router; + this.states = {}; + this.listeners = []; + this.matcher = new StateMatcher(this.states); + this.builder = new StateBuilder(this.matcher, _router.urlMatcherFactory); + this.stateQueue = new StateQueueManager(this, _router.urlRouter, this.states, this.builder, this.listeners); + this._registerRoot(); + } + /** @internalapi */ + StateRegistry.prototype._registerRoot = function () { + var rootStateDef = { + name: '', + url: '^', + views: null, + params: { + '#': { value: null, type: 'hash', dynamic: true } + }, + abstract: true + }; + var _root = this._root = this.stateQueue.register(rootStateDef); + _root.navigable = null; + }; + /** @internalapi */ + StateRegistry.prototype.dispose = function () { + var _this = this; + this.stateQueue.dispose(); + this.listeners = []; + this.get().forEach(function (state) { return _this.get(state) && _this.deregister(state); }); + }; + /** + * Listen for a State Registry events + * + * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry. + * + * #### Example: + * ```js + * let allStates = registry.get(); + * + * // Later, invoke deregisterFn() to remove the listener + * let deregisterFn = registry.onStatesChanged((event, states) => { + * switch(event) { + * case: 'registered': + * states.forEach(state => allStates.push(state)); + * break; + * case: 'deregistered': + * states.forEach(state => { + * let idx = allStates.indexOf(state); + * if (idx !== -1) allStates.splice(idx, 1); + * }); + * break; + * } + * }); + * ``` + * + * @param listener a callback function invoked when the registered states changes. + * The function receives two parameters, `event` and `state`. + * See [[StateRegistryListener]] + * @return a function that deregisters the listener + */ + StateRegistry.prototype.onStatesChanged = function (listener) { + this.listeners.push(listener); + return function deregisterListener() { + removeFrom(this.listeners)(listener); + }.bind(this); + }; + /** + * Gets the implicit root state + * + * Gets the root of the state tree. + * The root state is implicitly created by UI-Router. + * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]] + * + * @return the root [[StateObject]] + */ + StateRegistry.prototype.root = function () { + return this._root; + }; + /** + * Adds a state to the registry + * + * Registers a [[StateDeclaration]] or queues it for registration. + * + * Note: a state will be queued if the state's parent isn't yet registered. + * + * @param stateDefinition the definition of the state to register. + * @returns the internal [[StateObject]] object. + * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]). + * If the state was only queued, then the object is not fully built. + */ + StateRegistry.prototype.register = function (stateDefinition) { + return this.stateQueue.register(stateDefinition); + }; + /** @hidden */ + StateRegistry.prototype._deregisterTree = function (state) { + var _this = this; + var all$$1 = this.get().map(function (s) { return s.$$state(); }); + var getChildren = function (states) { + var children = all$$1.filter(function (s) { return states.indexOf(s.parent) !== -1; }); + return children.length === 0 ? children : children.concat(getChildren(children)); + }; + var children = getChildren([state]); + var deregistered = [state].concat(children).reverse(); + deregistered.forEach(function (state) { + var $ur = _this._router.urlRouter; + // Remove URL rule + $ur.rules().filter(propEq("state", state)).forEach($ur.removeRule.bind($ur)); + // Remove state from registry + delete _this.states[state.name]; + }); + return deregistered; + }; + /** + * Removes a state from the registry + * + * This removes a state from the registry. + * If the state has children, they are are also removed from the registry. + * + * @param stateOrName the state's name or object representation + * @returns {StateObject[]} a list of removed states + */ + StateRegistry.prototype.deregister = function (stateOrName) { + var _state = this.get(stateOrName); + if (!_state) + throw new Error("Can't deregister state; not found: " + stateOrName); + var deregisteredStates = this._deregisterTree(_state.$$state()); + this.listeners.forEach(function (listener) { return listener("deregistered", deregisteredStates.map(function (s) { return s.self; })); }); + return deregisteredStates; + }; + StateRegistry.prototype.get = function (stateOrName, base) { + var _this = this; + if (arguments.length === 0) + return Object.keys(this.states).map(function (name) { return _this.states[name].self; }); + var found = this.matcher.find(stateOrName, base); + return found && found.self || null; + }; + StateRegistry.prototype.decorator = function (name, func) { + return this.builder.builder(name, func); + }; + return StateRegistry; +}()); + +/** + * @coreapi + * @module url + */ +/** for typedoc */ +/** @hidden */ +function quoteRegExp(string, param) { + var surroundPattern = ['', ''], result = string.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&"); + if (!param) + return result; + switch (param.squash) { + case false: + surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; + break; + case true: + result = result.replace(/\/$/, ''); + surroundPattern = ['(?:\/(', ')|\/)?']; + break; + default: + surroundPattern = ["(" + param.squash + "|", ')?']; + break; + } + return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; +} +/** @hidden */ +var memoizeTo = function (obj, prop$$1, fn) { + return obj[prop$$1] = obj[prop$$1] || fn(); +}; +/** @hidden */ +var splitOnSlash = splitOnDelim('/'); +/** + * Matches URLs against patterns. + * + * Matches URLs against patterns and extracts named parameters from the path or the search + * part of the URL. + * + * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query) + * parameters. Multiple search parameter names are separated by '&'. Search parameters + * do not influence whether or not a URL is matched, but their values are passed through into + * the matched parameters returned by [[UrlMatcher.exec]]. + * + * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`) + * or colon placeholders (`/somePath/:param`). + * + * - *A parameter RegExp* may be defined for a param after a colon + * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder. + * The regexp must match for the url to be matched. + * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash. + * + * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]]. + * + * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters. + * See [[UrlMatcherFactory.type]] for more information. + * + * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`). + * A catch-all * parameter value will contain the remainder of the URL. + * + * --- + * + * Parameter names may contain only word characters (latin letters, digits, and underscore) and + * must be unique within the pattern (across both path and search parameters). + * A path parameter matches any number of characters other than '/'. For catch-all + * placeholders the path parameter matches any number of characters. + * + * Examples: + * + * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for + * trailing slashes, and patterns have to match the entire path, not just a prefix. + * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or + * '/user/bob/details'. The second path segment will be captured as the parameter 'id'. + * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax. + * * `'/user/{id:[^/]*}'` - Same as the previous example. + * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id + * parameter consists of 1 to 8 hex digits. + * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the + * path into the parameter 'path'. + * * `'/files/*path'` - ditto. + * * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined + * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start + * + */ +var UrlMatcher = /** @class */ (function () { + /** + * @param pattern The pattern to compile into a matcher. + * @param paramTypes The [[ParamTypes]] registry + * @param config A configuration object + * - `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`. + * - `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`. + */ + function UrlMatcher(pattern$$1, paramTypes, paramFactory, config) { + var _this = this; + this.config = config; + /** @hidden */ + this._cache = { path: [this] }; + /** @hidden */ + this._children = []; + /** @hidden */ + this._params = []; + /** @hidden */ + this._segments = []; + /** @hidden */ + this._compiled = []; + this.pattern = pattern$$1; + this.config = defaults(this.config, { + params: {}, + strict: true, + caseInsensitive: false, + paramMap: identity + }); + // Find all placeholders and create a compiled pattern, using either classic or curly syntax: + // '*' name + // ':' name + // '{' name '}' + // '{' name ':' regexp '}' + // The regular expression is somewhat complicated due to the need to allow curly braces + // inside the regular expression. The placeholder regexp breaks down as follows: + // ([:*])([\w\[\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case) + // \{([\w\[\]]+)(?:\:\s*( ... ))?\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case + // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either + // [^{}\\]+ - anything other than curly braces or backslash + // \\. - a backslash escape + // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms + var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, last = 0, m, patterns = []; + var checkParamErrors = function (id) { + if (!UrlMatcher.nameValidator.test(id)) + throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern$$1 + "'"); + if (find(_this._params, propEq('id', id))) + throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern$$1 + "'"); + }; + // Split into static segments separated by path parameter placeholders. + // The number of segments is always 1 more than the number of parameters. + var matchDetails = function (m, isSearch) { + // IE[78] returns '' for unmatched groups instead of null + var id = m[2] || m[3]; + var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); + var makeRegexpType = function (regexp) { return inherit(paramTypes.type(isSearch ? "query" : "path"), { + pattern: new RegExp(regexp, _this.config.caseInsensitive ? 'i' : undefined) + }); }; + return { + id: id, + regexp: regexp, + cfg: _this.config.params[id], + segment: pattern$$1.substring(last, m.index), + type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp) + }; + }; + var p, segment; + while ((m = placeholder.exec(pattern$$1))) { + p = matchDetails(m, false); + if (p.segment.indexOf('?') >= 0) + break; // we're into the search part + checkParamErrors(p.id); + this._params.push(paramFactory.fromPath(p.id, p.type, this.config.paramMap(p.cfg, false))); + this._segments.push(p.segment); + patterns.push([p.segment, tail(this._params)]); + last = placeholder.lastIndex; + } + segment = pattern$$1.substring(last); + // Find any search parameter names and remove them from the last segment + var i = segment.indexOf('?'); + if (i >= 0) { + var search = segment.substring(i); + segment = segment.substring(0, i); + if (search.length > 0) { + last = 0; + while ((m = searchPlaceholder.exec(search))) { + p = matchDetails(m, true); + checkParamErrors(p.id); + this._params.push(paramFactory.fromSearch(p.id, p.type, this.config.paramMap(p.cfg, true))); + last = placeholder.lastIndex; + // check if ?& + } + } + } + this._segments.push(segment); + this._compiled = patterns.map(function (pattern$$1) { return quoteRegExp.apply(null, pattern$$1); }).concat(quoteRegExp(segment)); + } + /** + * Creates a new concatenated UrlMatcher + * + * Builds a new UrlMatcher by appending another UrlMatcher to this one. + * + * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`. + */ + UrlMatcher.prototype.append = function (url) { + this._children.push(url); + url._cache = { + path: this._cache.path.concat(url), + parent: this, + pattern: null, + }; + return url; + }; + /** @hidden */ + UrlMatcher.prototype.isRoot = function () { + return this._cache.path[0] === this; + }; + /** Returns the input pattern string */ + UrlMatcher.prototype.toString = function () { + return this.pattern; + }; + /** + * Tests the specified url/path against this matcher. + * + * Tests if the given url matches this matcher's pattern, and returns an object containing the captured + * parameter values. Returns null if the path does not match. + * + * The returned object contains the values + * of any search parameters that are mentioned in the pattern, but their value may be null if + * they are not present in `search`. This means that search parameters are always treated + * as optional. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { + * x: '1', q: 'hello' + * }); + * // returns { id: 'bob', q: 'hello', r: null } + * ``` + * + * @param path The URL path to match, e.g. `$location.path()`. + * @param search URL search parameters, e.g. `$location.search()`. + * @param hash URL hash e.g. `$location.hash()`. + * @param options + * + * @returns The captured parameter values. + */ + UrlMatcher.prototype.exec = function (path, search, hash, options) { + var _this = this; + if (search === void 0) { search = {}; } + if (options === void 0) { options = {}; } + var match = memoizeTo(this._cache, 'pattern', function () { + return new RegExp([ + '^', + unnest(_this._cache.path.map(prop('_compiled'))).join(''), + _this.config.strict === false ? '\/?' : '', + '$' + ].join(''), _this.config.caseInsensitive ? 'i' : undefined); + }).exec(path); + if (!match) + return null; + //options = defaults(options, { isolate: false }); + var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values$$1 = {}; + if (nPathSegments !== match.length - 1) + throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); + function decodePathArray(string) { + var reverseString = function (str) { return str.split("").reverse().join(""); }; + var unquoteDashes = function (str) { return str.replace(/\\-/g, "-"); }; + var split = reverseString(string).split(/-(?!\\)/); + var allReversed = map(split, reverseString); + return map(allReversed, unquoteDashes).reverse(); + } + for (var i = 0; i < nPathSegments; i++) { + var param = pathParams[i]; + var value = match[i + 1]; + // if the param value matches a pre-replace pair, replace the value before decoding. + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + if (value && param.array === true) + value = decodePathArray(value); + if (isDefined(value)) + value = param.type.decode(value); + values$$1[param.id] = param.value(value); + } + searchParams.forEach(function (param) { + var value = search[param.id]; + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + if (isDefined(value)) + value = param.type.decode(value); + values$$1[param.id] = param.value(value); + }); + if (hash) + values$$1["#"] = hash; + return values$$1; + }; + /** + * @hidden + * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance. + * + * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the + * pattern has no parameters, an empty array is returned. + */ + UrlMatcher.prototype.parameters = function (opts) { + if (opts === void 0) { opts = {}; } + if (opts.inherit === false) + return this._params; + return unnest(this._cache.path.map(function (matcher) { return matcher._params; })); + }; + /** + * @hidden + * Returns a single parameter from this UrlMatcher by id + * + * @param id + * @param opts + * @returns {T|Param|any|boolean|UrlMatcher|null} + */ + UrlMatcher.prototype.parameter = function (id, opts) { + var _this = this; + if (opts === void 0) { opts = {}; } + var findParam = function () { + for (var _i = 0, _a = _this._params; _i < _a.length; _i++) { + var param = _a[_i]; + if (param.id === id) + return param; + } + }; + var parent = this._cache.parent; + return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null; + }; + /** + * Validates the input parameter values against this UrlMatcher + * + * Checks an object hash of parameters to validate their correctness according to the parameter + * types of this `UrlMatcher`. + * + * @param params The object hash of parameters to validate. + * @returns Returns `true` if `params` validates, otherwise `false`. + */ + UrlMatcher.prototype.validates = function (params) { + var validParamVal = function (param, val$$1) { + return !param || param.validates(val$$1); + }; + params = params || {}; + // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher + var paramSchema = this.parameters().filter(function (paramDef) { return params.hasOwnProperty(paramDef.id); }); + return paramSchema.map(function (paramDef) { return validParamVal(paramDef, params[paramDef.id]); }).reduce(allTrueR, true); + }; + /** + * Given a set of parameter values, creates a URL from this UrlMatcher. + * + * Creates a URL that matches this pattern by substituting the specified values + * for the path and search parameters. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); + * // returns '/user/bob?q=yes' + * ``` + * + * @param values the values to substitute for the parameters in this pattern. + * @returns the formatted URL (path and optionally search part). + */ + UrlMatcher.prototype.format = function (values$$1) { + if (values$$1 === void 0) { values$$1 = {}; } + // Build the full path of UrlMatchers (including all parent UrlMatchers) + var urlMatchers = this._cache.path; + // Extract all the static segments and Params (processed as ParamDetails) + // into an ordered array + var pathSegmentsAndParams = urlMatchers.map(UrlMatcher.pathSegmentsAndParams) + .reduce(unnestR, []) + .map(function (x) { return isString(x) ? x : getDetails(x); }); + // Extract the query params into a separate array + var queryParams = urlMatchers.map(UrlMatcher.queryParams) + .reduce(unnestR, []) + .map(getDetails); + var isInvalid = function (param) { return param.isValid === false; }; + if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) { + return null; + } + /** + * Given a Param, applies the parameter value, then returns detailed information about it + */ + function getDetails(param) { + // Normalize to typed value + var value = param.value(values$$1[param.id]); + var isValid = param.validates(value); + var isDefaultValue = param.isDefaultValue(value); + // Check if we're in squash mode for the parameter + var squash = isDefaultValue ? param.squash : false; + // Allow the Parameter's Type to encode the value + var encoded = param.type.encode(value); + return { param: param, value: value, isValid: isValid, isDefaultValue: isDefaultValue, squash: squash, encoded: encoded }; + } + // Build up the path-portion from the list of static segments and parameters + var pathString = pathSegmentsAndParams.reduce(function (acc, x) { + // The element is a static segment (a raw string); just append it + if (isString(x)) + return acc + x; + // Otherwise, it's a ParamDetails. + var squash = x.squash, encoded = x.encoded, param = x.param; + // If squash is === true, try to remove a slash from the path + if (squash === true) + return (acc.match(/\/$/)) ? acc.slice(0, -1) : acc; + // If squash is a string, use the string for the param value + if (isString(squash)) + return acc + squash; + if (squash !== false) + return acc; // ? + if (encoded == null) + return acc; + // If this parameter value is an array, encode the value using encodeDashes + if (isArray(encoded)) + return acc + map(encoded, UrlMatcher.encodeDashes).join("-"); + // If the parameter type is "raw", then do not encodeURIComponent + if (param.raw) + return acc + encoded; + // Encode the value + return acc + encodeURIComponent(encoded); + }, ""); + // Build the query string by applying parameter values (array or regular) + // then mapping to key=value, then flattening and joining using "&" + var queryString = queryParams.map(function (paramDetails) { + var param = paramDetails.param, squash = paramDetails.squash, encoded = paramDetails.encoded, isDefaultValue = paramDetails.isDefaultValue; + if (encoded == null || (isDefaultValue && squash !== false)) + return; + if (!isArray(encoded)) + encoded = [encoded]; + if (encoded.length === 0) + return; + if (!param.raw) + encoded = map(encoded, encodeURIComponent); + return encoded.map(function (val$$1) { return param.id + "=" + val$$1; }); + }).filter(identity).reduce(unnestR, []).join("&"); + // Concat the pathstring with the queryString (if exists) and the hashString (if exists) + return pathString + (queryString ? "?" + queryString : "") + (values$$1["#"] ? "#" + values$$1["#"] : ""); + }; + /** @hidden */ + UrlMatcher.encodeDashes = function (str) { + return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); + }; + /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */ + UrlMatcher.pathSegmentsAndParams = function (matcher) { + var staticSegments = matcher._segments; + var pathParams = matcher._params.filter(function (p) { return p.location === exports.DefType.PATH; }); + return arrayTuples(staticSegments, pathParams.concat(undefined)) + .reduce(unnestR, []) + .filter(function (x) { return x !== "" && isDefined(x); }); + }; + /** @hidden Given a matcher, return an array with the matcher's query params */ + UrlMatcher.queryParams = function (matcher) { + return matcher._params.filter(function (p) { return p.location === exports.DefType.SEARCH; }); + }; + /** + * Compare two UrlMatchers + * + * This comparison function converts a UrlMatcher into static and dynamic path segments. + * Each static path segment is a static string between a path separator (slash character). + * Each dynamic segment is a path parameter. + * + * The comparison function sorts static segments before dynamic ones. + */ + UrlMatcher.compare = function (a, b) { + /** + * Turn a UrlMatcher and all its parent matchers into an array + * of slash literals '/', string literals, and Param objects + * + * This example matcher matches strings like "/foo/:param/tail": + * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); + * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] + * + * Caches the result as `matcher._cache.segments` + */ + var segments = function (matcher) { + return matcher._cache.segments = matcher._cache.segments || + matcher._cache.path.map(UrlMatcher.pathSegmentsAndParams) + .reduce(unnestR, []) + .reduce(joinNeighborsR, []) + .map(function (x) { return isString(x) ? splitOnSlash(x) : x; }) + .reduce(unnestR, []); + }; + /** + * Gets the sort weight for each segment of a UrlMatcher + * + * Caches the result as `matcher._cache.weights` + */ + var weights = function (matcher) { + return matcher._cache.weights = matcher._cache.weights || + segments(matcher).map(function (segment) { + // Sort slashes first, then static strings, the Params + if (segment === '/') + return 1; + if (isString(segment)) + return 2; + if (segment instanceof Param) + return 3; + }); + }; + /** + * Pads shorter array in-place (mutates) + */ + var padArrays = function (l, r, padVal) { + var len = Math.max(l.length, r.length); + while (l.length < len) + l.push(padVal); + while (r.length < len) + r.push(padVal); + }; + var weightsA = weights(a), weightsB = weights(b); + padArrays(weightsA, weightsB, 0); + var cmp, i, pairs$$1 = arrayTuples(weightsA, weightsB); + for (i = 0; i < pairs$$1.length; i++) { + cmp = pairs$$1[i][0] - pairs$$1[i][1]; + if (cmp !== 0) + return cmp; + } + return 0; + }; + /** @hidden */ + UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; + return UrlMatcher; +}()); + +/** + * @internalapi + * @module url + */ /** for typedoc */ +/** + * Factory for [[UrlMatcher]] instances. + * + * The factory is available to ng1 services as + * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. + */ +var UrlMatcherFactory = /** @class */ (function () { + function UrlMatcherFactory() { + var _this = this; + /** @hidden */ this.paramTypes = new ParamTypes(); + /** @hidden */ this._isCaseInsensitive = false; + /** @hidden */ this._isStrictMode = true; + /** @hidden */ this._defaultSquashPolicy = false; + /** @hidden */ + this._getConfig = function (config) { + return extend({ strict: _this._isStrictMode, caseInsensitive: _this._isCaseInsensitive }, config); + }; + /** @internalapi Creates a new [[Param]] for a given location (DefType) */ + this.paramFactory = { + /** Creates a new [[Param]] from a CONFIG block */ + fromConfig: function (id, type, config) { + return new Param(id, type, config, exports.DefType.CONFIG, _this); + }, + /** Creates a new [[Param]] from a url PATH */ + fromPath: function (id, type, config) { + return new Param(id, type, config, exports.DefType.PATH, _this); + }, + /** Creates a new [[Param]] from a url SEARCH */ + fromSearch: function (id, type, config) { + return new Param(id, type, config, exports.DefType.SEARCH, _this); + }, + }; + extend(this, { UrlMatcher: UrlMatcher, Param: Param }); + } + /** @inheritdoc */ + UrlMatcherFactory.prototype.caseInsensitive = function (value) { + return this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive; + }; + /** @inheritdoc */ + UrlMatcherFactory.prototype.strictMode = function (value) { + return this._isStrictMode = isDefined(value) ? value : this._isStrictMode; + }; + /** @inheritdoc */ + UrlMatcherFactory.prototype.defaultSquashPolicy = function (value) { + if (isDefined(value) && value !== true && value !== false && !isString(value)) + throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); + return this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy; + }; + /** + * Creates a [[UrlMatcher]] for the specified pattern. + * + * @param pattern The URL pattern. + * @param config The config object hash. + * @returns The UrlMatcher. + */ + UrlMatcherFactory.prototype.compile = function (pattern, config) { + return new UrlMatcher(pattern, this.paramTypes, this.paramFactory, this._getConfig(config)); + }; + /** + * Returns true if the specified object is a [[UrlMatcher]], or false otherwise. + * + * @param object The object to perform the type check against. + * @returns `true` if the object matches the `UrlMatcher` interface, by + * implementing all the same methods. + */ + UrlMatcherFactory.prototype.isMatcher = function (object) { + // TODO: typeof? + if (!isObject(object)) + return false; + var result = true; + forEach(UrlMatcher.prototype, function (val, name) { + if (isFunction(val)) + result = result && (isDefined(object[name]) && isFunction(object[name])); + }); + return result; + }; + + /** + * Creates and registers a custom [[ParamType]] object + * + * A [[ParamType]] can be used to generate URLs with typed parameters. + * + * @param name The type name. + * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted. + * @param definitionFn A function that is injected before the app runtime starts. + * The result of this function should be a [[ParamTypeDefinition]]. + * The result is merged into the existing `definition`. + * See [[ParamType]] for information on the values accepted. + * + * @returns - if a type was registered: the [[UrlMatcherFactory]] + * - if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined + * + * Note: Register custom types *before using them* in a state definition. + * + * See [[ParamTypeDefinition]] for examples + */ + UrlMatcherFactory.prototype.type = function (name, definition, definitionFn) { + var type = this.paramTypes.type(name, definition, definitionFn); + return !isDefined(definition) ? type : this; + }; + + /** @hidden */ + UrlMatcherFactory.prototype.$get = function () { + this.paramTypes.enqueue = false; + this.paramTypes._flushTypeQueue(); + return this; + }; + + /** @internalapi */ + UrlMatcherFactory.prototype.dispose = function () { + this.paramTypes.dispose(); + }; + return UrlMatcherFactory; +}()); + +/** + * @coreapi + * @module url + */ /** */ +/** + * Creates a [[UrlRule]] + * + * Creates a [[UrlRule]] from a: + * + * - `string` + * - [[UrlMatcher]] + * - `RegExp` + * - [[StateObject]] + * @internalapi + */ +var UrlRuleFactory = /** @class */ (function () { + function UrlRuleFactory(router) { + this.router = router; + } + UrlRuleFactory.prototype.compile = function (str) { + return this.router.urlMatcherFactory.compile(str); + }; + UrlRuleFactory.prototype.create = function (what, handler) { + var _this = this; + var makeRule = pattern([ + [isString, function (_what) { return makeRule(_this.compile(_what)); }], + [is(UrlMatcher), function (_what) { return _this.fromUrlMatcher(_what, handler); }], + [isState, function (_what) { return _this.fromState(_what, _this.router); }], + [is(RegExp), function (_what) { return _this.fromRegExp(_what, handler); }], + [isFunction, function (_what) { return new BaseUrlRule(_what, handler); }], + ]); + var rule = makeRule(what); + if (!rule) + throw new Error("invalid 'what' in when()"); + return rule; + }; + /** + * A UrlRule which matches based on a UrlMatcher + * + * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]] + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]]) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, match => "/home/" + match.fooId + "/" + match.barId); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + * + * ## Handler as UrlMatcher + * + * If `handler` is a UrlMatcher, the handler matcher is used to create the new url. + * The `handler` UrlMatcher is formatted using the matched param from the first matcher. + * The url is replaced with the result. + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var handler = $umf.compile("/home/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, handler); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + */ + UrlRuleFactory.prototype.fromUrlMatcher = function (urlMatcher, handler) { + var _handler = handler; + if (isString(handler)) + handler = this.router.urlMatcherFactory.compile(handler); + if (is(UrlMatcher)(handler)) + _handler = function (match) { return handler.format(match); }; + function match(url) { + var match = urlMatcher.exec(url.path, url.search, url.hash); + return urlMatcher.validates(match) && match; + } + // Prioritize URLs, lowest to highest: + // - Some optional URL parameters, but none matched + // - No optional parameters in URL + // - Some optional parameters, some matched + // - Some optional parameters, all matched + function matchPriority(params) { + var optional = urlMatcher.parameters().filter(function (param) { return param.isOptional; }); + if (!optional.length) + return 0.000001; + var matched = optional.filter(function (param) { return params[param.id]; }); + return matched.length / optional.length; + } + var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: "URLMATCHER" }; + return extend(new BaseUrlRule(match, _handler), details); + }; + /** + * A UrlRule which matches a state by its url + * + * #### Example: + * ```js + * var rule = factory.fromState($state.get('foo'), router); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); + * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' } + * ``` + */ + UrlRuleFactory.prototype.fromState = function (state, router) { + /** + * Handles match by transitioning to matched state + * + * First checks if the router should start a new transition. + * A new transition is not required if the current state's URL + * and the new URL are already identical + */ + var handler = function (match) { + var $state = router.stateService; + var globals = router.globals; + if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { + $state.transitionTo(state, match, { inherit: true, source: "url" }); + } + }; + var details = { state: state, type: "STATE" }; + return extend(this.fromUrlMatcher(state.url, handler), details); + }; + /** + * A UrlRule which matches based on a regular expression + * + * The `handler` may be either a [[UrlRuleHandlerFn]] or a string. + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - regexp match array (from `regexp`) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, match => "/home/" + match[1]) + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + * + * ## Handler as string + * + * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked. + * The string is first interpolated using `string.replace()` style pattern. + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, "/home/$1") + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + */ + UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { + if (regexp.global || regexp.sticky) + throw new Error("Rule RegExp must not be global or sticky"); + /** + * If handler is a string, the url will be replaced by the string. + * If the string has any String.replace() style variables in it (like `$2`), + * they will be replaced by the captures from [[match]] + */ + var redirectUrlTo = function (match) { + // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern + return handler.replace(/\$(\$|\d{1,2})/, function (m, what) { + return match[what === '$' ? 0 : Number(what)]; + }); + }; + var _handler = isString(handler) ? redirectUrlTo : handler; + var match = function (url) { + return regexp.exec(url.path); + }; + var details = { regexp: regexp, type: "REGEXP" }; + return extend(new BaseUrlRule(match, _handler), details); + }; + UrlRuleFactory.isUrlRule = function (obj) { + return obj && ['type', 'match', 'handler'].every(function (key) { return isDefined(obj[key]); }); + }; + return UrlRuleFactory; +}()); +/** + * A base rule which calls `match` + * + * The value from the `match` function is passed through to the `handler`. + * @internalapi + */ +var BaseUrlRule = /** @class */ (function () { + function BaseUrlRule(match, handler) { + var _this = this; + this.match = match; + this.type = "RAW"; + this.matchPriority = function (match) { return 0 - _this.$id; }; + this.handler = handler || identity; + } + return BaseUrlRule; +}()); + +/** + * @internalapi + * @module url + */ +/** for typedoc */ +/** @hidden */ +function appendBasePath(url, isHtml5, absolute, baseHref) { + if (baseHref === '/') + return url; + if (isHtml5) + return stripFile(baseHref) + url; + if (absolute) + return baseHref.slice(1) + url; + return url; +} +/** @hidden */ +var prioritySort = function (a, b) { + return (b.priority || 0) - (a.priority || 0); +}; +/** @hidden */ +var typeSort = function (a, b) { + var weights = { "STATE": 4, "URLMATCHER": 4, "REGEXP": 3, "RAW": 2, "OTHER": 1 }; + return (weights[a.type] || 0) - (weights[b.type] || 0); +}; +/** @hidden */ +var urlMatcherSort = function (a, b) { + return !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher); +}; +/** @hidden */ +var idSort = function (a, b) { + // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL + var useMatchPriority = { STATE: true, URLMATCHER: true }; + var equal = useMatchPriority[a.type] && useMatchPriority[b.type]; + return equal ? 0 : (a.$id || 0) - (b.$id || 0); +}; +/** + * Default rule priority sorting function. + * + * Sorts rules by: + * + * - Explicit priority (set rule priority using [[UrlRulesApi.when]]) + * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1) + * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule. + * - Rule registration order (for rule types other than STATE and URLMATCHER) + * - Equally sorted State and UrlMatcher rules will each match the URL. + * Then, the *best* match is chosen based on how many parameter values were matched. + * + * @coreapi + */ +var defaultRuleSortFn; +defaultRuleSortFn = function (a, b) { + var cmp = prioritySort(a, b); + if (cmp !== 0) + return cmp; + cmp = typeSort(a, b); + if (cmp !== 0) + return cmp; + cmp = urlMatcherSort(a, b); + if (cmp !== 0) + return cmp; + return idSort(a, b); +}; +/** + * Updates URL and responds to URL changes + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. + * + * This class updates the URL when the state changes. + * It also responds to changes in the URL. + */ +var UrlRouter = /** @class */ (function () { + /** @hidden */ + function UrlRouter(router) { + /** @hidden */ this._sortFn = defaultRuleSortFn; + /** @hidden */ this._rules = []; + /** @hidden */ this.interceptDeferred = false; + /** @hidden */ this._id = 0; + /** @hidden */ this._sorted = false; + this._router = router; + this.urlRuleFactory = new UrlRuleFactory(router); + createProxyFunctions(val(UrlRouter.prototype), this, val(this)); + } + /** @internalapi */ + UrlRouter.prototype.dispose = function () { + this.listen(false); + this._rules = []; + delete this._otherwiseFn; + }; + /** @inheritdoc */ + UrlRouter.prototype.sort = function (compareFn) { + this._rules = this.stableSort(this._rules, this._sortFn = compareFn || this._sortFn); + this._sorted = true; + }; + UrlRouter.prototype.ensureSorted = function () { + this._sorted || this.sort(); + }; + UrlRouter.prototype.stableSort = function (arr, compareFn) { + var arrOfWrapper = arr.map(function (elem, idx) { return ({ elem: elem, idx: idx }); }); + arrOfWrapper.sort(function (wrapperA, wrapperB) { + var cmpDiff = compareFn(wrapperA.elem, wrapperB.elem); + return cmpDiff === 0 + ? wrapperA.idx - wrapperB.idx + : cmpDiff; + }); + return arrOfWrapper.map(function (wrapper) { return wrapper.elem; }); + }; + /** + * Given a URL, check all rules and return the best [[MatchResult]] + * @param url + * @returns {MatchResult} + */ + UrlRouter.prototype.match = function (url) { + var _this = this; + this.ensureSorted(); + url = extend({ path: '', search: {}, hash: '' }, url); + var rules = this.rules(); + if (this._otherwiseFn) + rules.push(this._otherwiseFn); + // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined + var checkRule = function (rule) { + var match = rule.match(url, _this._router); + return match && { match: match, rule: rule, weight: rule.matchPriority(match) }; + }; + // The rules are pre-sorted. + // - Find the first matching rule. + // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`. + // - Choose the rule with the highest match weight. + var best; + for (var i = 0; i < rules.length; i++) { + // Stop when there is a 'best' rule and the next rule sorts differently than it. + if (best && this._sortFn(rules[i], best.rule) !== 0) + break; + var current = checkRule(rules[i]); + // Pick the best MatchResult + best = (!best || current && current.weight > best.weight) ? current : best; + } + return best; + }; + /** @inheritdoc */ + UrlRouter.prototype.sync = function (evt) { + if (evt && evt.defaultPrevented) + return; + var router = this._router, $url = router.urlService, $state = router.stateService; + var url = { + path: $url.path(), search: $url.search(), hash: $url.hash(), + }; + var best = this.match(url); + var applyResult = pattern([ + [isString, function (newurl) { return $url.url(newurl, true); }], + [TargetState.isDef, function (def) { return $state.go(def.state, def.params, def.options); }], + [is(TargetState), function (target) { return $state.go(target.state(), target.params(), target.options()); }], + ]); + applyResult(best && best.rule.handler(best.match, url, router)); + }; + /** @inheritdoc */ + UrlRouter.prototype.listen = function (enabled) { + var _this = this; + if (enabled === false) { + this._stopFn && this._stopFn(); + delete this._stopFn; + } + else { + return this._stopFn = this._stopFn || this._router.urlService.onChange(function (evt) { return _this.sync(evt); }); + } + }; + /** + * Internal API. + * @internalapi + */ + UrlRouter.prototype.update = function (read) { + var $url = this._router.locationService; + if (read) { + this.location = $url.path(); + return; + } + if ($url.path() === this.location) + return; + $url.url(this.location, true); + }; + /** + * Internal API. + * + * Pushes a new location to the browser history. + * + * @internalapi + * @param urlMatcher + * @param params + * @param options + */ + UrlRouter.prototype.push = function (urlMatcher, params, options) { + var replace = options && !!options.replace; + this._router.urlService.url(urlMatcher.format(params || {}), replace); + }; + /** + * Builds and returns a URL with interpolated parameters + * + * #### Example: + * ```js + * matcher = $umf.compile("/about/:person"); + * params = { person: "bob" }; + * $bob = $urlRouter.href(matcher, params); + * // $bob == "/about/bob"; + * ``` + * + * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate. + * @param params An object of parameter values to fill the matcher's required parameters. + * @param options Options object. The options are: + * + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` + */ + UrlRouter.prototype.href = function (urlMatcher, params, options) { + var url = urlMatcher.format(params); + if (url == null) + return null; + options = options || { absolute: false }; + var cfg = this._router.urlService.config; + var isHtml5 = cfg.html5Mode(); + if (!isHtml5 && url !== null) { + url = "#" + cfg.hashPrefix() + url; + } + url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); + if (!options.absolute || !url) { + return url; + } + var slash = (!isHtml5 && url ? '/' : ''), port = cfg.port(); + port = (port === 80 || port === 443 ? '' : ':' + port); + return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); + }; + /** + * Manually adds a URL Rule. + * + * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]]. + * This api can be used directly for more control (to register a [[BaseUrlRule]], for example). + * Rules can be created using [[UrlRouter.urlRuleFactory]], or create manually as simple objects. + * + * A rule should have a `match` function which returns truthy if the rule matched. + * It should also have a `handler` function which is invoked if the rule is the best match. + * + * @return a function that deregisters the rule + */ + UrlRouter.prototype.rule = function (rule) { + var _this = this; + if (!UrlRuleFactory.isUrlRule(rule)) + throw new Error("invalid rule"); + rule.$id = this._id++; + rule.priority = rule.priority || 0; + this._rules.push(rule); + this._sorted = false; + return function () { return _this.removeRule(rule); }; + }; + /** @inheritdoc */ + UrlRouter.prototype.removeRule = function (rule) { + removeFrom(this._rules, rule); + }; + /** @inheritdoc */ + UrlRouter.prototype.rules = function () { + this.ensureSorted(); + return this._rules.slice(); + }; + /** @inheritdoc */ + UrlRouter.prototype.otherwise = function (handler) { + var handlerFn = getHandlerFn(handler); + this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn); + this._sorted = false; + }; + + /** @inheritdoc */ + UrlRouter.prototype.initial = function (handler) { + var handlerFn = getHandlerFn(handler); + var matchFn = function (urlParts, router) { + return router.globals.transitionHistory.size() === 0 && !!/^\/?$/.exec(urlParts.path); + }; + this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); + }; + + /** @inheritdoc */ + UrlRouter.prototype.when = function (matcher, handler, options) { + var rule = this.urlRuleFactory.create(matcher, handler); + if (isDefined(options && options.priority)) + rule.priority = options.priority; + this.rule(rule); + return rule; + }; + + /** @inheritdoc */ + UrlRouter.prototype.deferIntercept = function (defer) { + if (defer === undefined) + defer = true; + this.interceptDeferred = defer; + }; + + return UrlRouter; +}()); +function getHandlerFn(handler) { + if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) { + throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); + } + return isFunction(handler) ? handler : val(handler); +} + +/** + * @coreapi + * @module view + */ /** for typedoc */ +/** + * The View service + * + * This service pairs existing `ui-view` components (which live in the DOM) + * with view configs (from the state declaration objects: [[StateDeclaration.views]]). + * + * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]]. + * The views from exited states are deactivated via [[deactivateViewConfig]]. + * (See: the [[registerActivateViews]] Transition Hook) + * + * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]]. + * + * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]]) + * are configured with the matching [[ViewConfig]](s) + * + */ +var ViewService = /** @class */ (function () { + function ViewService() { + var _this = this; + this._uiViews = []; + this._viewConfigs = []; + this._viewConfigFactories = {}; + this._pluginapi = { + _rootViewContext: this._rootViewContext.bind(this), + _viewConfigFactory: this._viewConfigFactory.bind(this), + _registeredUIViews: function () { return _this._uiViews; }, + _activeViewConfigs: function () { return _this._viewConfigs; }, + }; + } + ViewService.prototype._rootViewContext = function (context) { + return this._rootContext = context || this._rootContext; + }; + + ViewService.prototype._viewConfigFactory = function (viewType, factory) { + this._viewConfigFactories[viewType] = factory; + }; + ViewService.prototype.createViewConfig = function (path, decl) { + var cfgFactory = this._viewConfigFactories[decl.$type]; + if (!cfgFactory) + throw new Error("ViewService: No view config factory registered for type " + decl.$type); + var cfgs = cfgFactory(path, decl); + return isArray(cfgs) ? cfgs : [cfgs]; + }; + /** + * Deactivates a ViewConfig. + * + * This function deactivates a `ViewConfig`. + * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired. + * + * @param viewConfig The ViewConfig view to deregister. + */ + ViewService.prototype.deactivateViewConfig = function (viewConfig) { + trace.traceViewServiceEvent("<- Removing", viewConfig); + removeFrom(this._viewConfigs, viewConfig); + }; + ViewService.prototype.activateViewConfig = function (viewConfig) { + trace.traceViewServiceEvent("-> Registering", viewConfig); + this._viewConfigs.push(viewConfig); + }; + ViewService.prototype.sync = function () { + var _this = this; + var uiViewsByFqn = this._uiViews.map(function (uiv) { return [uiv.fqn, uiv]; }).reduce(applyPairs, {}); + // Return a weighted depth value for a uiView. + // The depth is the nesting depth of ui-views (based on FQN; times 10,000) + // plus the depth of the state that is populating the uiView + function uiViewDepth(uiView) { + var stateDepth = function (context) { + return context && context.parent ? stateDepth(context.parent) + 1 : 1; + }; + return (uiView.fqn.split(".").length * 10000) + stateDepth(uiView.creationContext); + } + // Return the ViewConfig's context's depth in the context tree. + function viewConfigDepth(config) { + var context = config.viewDecl.$context, count = 0; + while (++count && context.parent) + context = context.parent; + return count; + } + // Given a depth function, returns a compare function which can return either ascending or descending order + var depthCompare = curry(function (depthFn, posNeg, left, right) { return posNeg * (depthFn(left) - depthFn(right)); }); + var matchingConfigPair = function (uiView) { + var matchingConfigs = _this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView)); + if (matchingConfigs.length > 1) { + // This is OK. Child states can target a ui-view that the parent state also targets (the child wins) + // Sort by depth and return the match from the deepest child + // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs); + matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending + } + return [uiView, matchingConfigs[0]]; + }; + var configureUIView = function (_a) { + var uiView = _a[0], viewConfig = _a[1]; + // If a parent ui-view is reconfigured, it could destroy child ui-views. + // Before configuring a child ui-view, make sure it's still in the active uiViews array. + if (_this._uiViews.indexOf(uiView) !== -1) + uiView.configUpdated(viewConfig); + }; + // Sort views by FQN and state depth. Process uiviews nearest the root first. + var pairs$$1 = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); + trace.traceViewSync(pairs$$1); + pairs$$1.forEach(configureUIView); + }; + + /** + * Registers a `ui-view` component + * + * When a `ui-view` component is created, it uses this method to register itself. + * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]]. + * + * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`, + * and what the view's state context is. + * + * Note: There is no corresponding `deregisterUIView`. + * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself. + * + * @param uiView The metadata for a UIView + * @return a de-registration function used when the view is destroyed. + */ + ViewService.prototype.registerUIView = function (uiView) { + trace.traceViewServiceUIViewEvent("-> Registering", uiView); + var uiViews = this._uiViews; + var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; + if (uiViews.filter(fqnAndTypeMatches).length) + trace.traceViewServiceUIViewEvent("!!!! duplicate uiView named:", uiView); + uiViews.push(uiView); + this.sync(); + return function () { + var idx = uiViews.indexOf(uiView); + if (idx === -1) { + trace.traceViewServiceUIViewEvent("Tried removing non-registered uiView", uiView); + return; + } + trace.traceViewServiceUIViewEvent("<- Deregistering", uiView); + removeFrom(uiViews)(uiView); + }; + }; + + /** + * Returns the list of views currently available on the page, by fully-qualified name. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.available = function () { + return this._uiViews.map(prop("fqn")); + }; + /** + * Returns the list of views on the page containing loaded content. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.active = function () { + return this._uiViews.filter(prop("$config")).map(prop("name")); + }; + /** + * Normalizes a view's name from a state.views configuration block. + * + * This should be used by a framework implementation to calculate the values for + * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. + * + * @param context the context object (state declaration) that the view belongs to + * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] + * + * @returns the normalized uiViewName and uiViewContextAnchor that the view targets + */ + ViewService.normalizeUIViewTarget = function (context, rawViewName) { + if (rawViewName === void 0) { rawViewName = ""; } + // TODO: Validate incoming view name with a regexp to allow: + // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , + // "@" , "$default@^" , "!$default.$default" , "!foo.bar" + var viewAtContext = rawViewName.split("@"); + var uiViewName = viewAtContext[0] || "$default"; // default to unnamed view + var uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : "^"; // default to parent context + // Handle relative view-name sugar syntax. + // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], + var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); + if (relativeViewNameSugar) { + // Clobbers existing contextAnchor (rawViewName validation will fix this) + uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" + uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" + } + if (uiViewName.charAt(0) === '!') { + uiViewName = uiViewName.substr(1); + uiViewContextAnchor = ""; // target absolutely from root + } + // handle parent relative targeting "^.^.^" + var relativeMatch = /^(\^(?:\.\^)*)$/; + if (relativeMatch.exec(uiViewContextAnchor)) { + var anchor = uiViewContextAnchor.split(".").reduce((function (anchor, x) { return anchor.parent; }), context); + uiViewContextAnchor = anchor.name; + } + else if (uiViewContextAnchor === '.') { + uiViewContextAnchor = context.name; + } + return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + }; + /** + * Given a ui-view and a ViewConfig, determines if they "match". + * + * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in + * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of. + * + * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or + * can be a segmented ui-view path, describing a portion of a ui-view fqn. + * + * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type + * + * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if: + * - the ui-view's name matches the ViewConfig's target name + * - the ui-view's context matches the ViewConfig's anchor + * + * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if: + * - There exists a parent ui-view where: + * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name + * - the parent ui-view's context matches the ViewConfig's anchor + * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn + * + * Example: + * + * DOM: + * + * + * + * + * + * + * + * + * + * uiViews: [ + * { fqn: "$default", creationContext: { name: "" } }, + * { fqn: "$default.foo", creationContext: { name: "A" } }, + * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } } + * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } } + * ] + * + * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar": + * + * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" } + * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" } + * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" } + * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" } + * + * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because: + * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ] + * - There exists a parent ui-view (which has fqn: "$default.foo") where: + * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name + * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A" + * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match + * the tail of the ui-view's fqn "default.bar" + * + * @internalapi + */ + ViewService.matches = function (uiViewsByFqn, uiView) { return function (viewConfig) { + // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc + if (uiView.$type !== viewConfig.viewDecl.$type) + return false; + // Split names apart from both viewConfig and uiView into segments + var vc = viewConfig.viewDecl; + var vcSegments = vc.$uiViewName.split("."); + var uivSegments = uiView.fqn.split("."); + // Check if the tails of the segment arrays match. ex, these arrays' tails match: + // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] + if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length))) + return false; + // Now check if the fqn ending at the first segment of the viewConfig matches the context: + // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? + var negOffset = (1 - vcSegments.length) || undefined; + var fqnToFirstSegment = uivSegments.slice(0, negOffset).join("."); + var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; + return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); + }; }; + return ViewService; +}()); + +/** + * @coreapi + * @module core + */ /** */ +/** + * Global router state + * + * This is where we hold the global mutable state such as current state, current + * params, current transition, etc. + */ +var UIRouterGlobals = /** @class */ (function () { + function UIRouterGlobals() { + /** + * Current parameter values + * + * The parameter values from the latest successful transition + */ + this.params = new StateParams(); + /** @internalapi */ + this.lastStartedTransitionId = -1; + /** @internalapi */ + this.transitionHistory = new Queue([], 1); + /** @internalapi */ + this.successfulTransitions = new Queue([], 1); + } + UIRouterGlobals.prototype.dispose = function () { + this.transitionHistory.clear(); + this.successfulTransitions.clear(); + this.transition = null; + }; + return UIRouterGlobals; +}()); + +/** + * @coreapi + * @module url + */ /** */ +/** @hidden */ +var makeStub = function (keys) { + return keys.reduce(function (acc, key) { return (acc[key] = notImplemented(key), acc); }, { dispose: noop$1 }); +}; +/** @hidden */ var locationServicesFns = ["url", "path", "search", "hash", "onChange"]; +/** @hidden */ var locationConfigFns = ["port", "protocol", "host", "baseHref", "html5Mode", "hashPrefix"]; +/** @hidden */ var umfFns = ["type", "caseInsensitive", "strictMode", "defaultSquashPolicy"]; +/** @hidden */ var rulesFns = ["sort", "when", "initial", "otherwise", "rules", "rule", "removeRule"]; +/** @hidden */ var syncFns = ["deferIntercept", "listen", "sync", "match"]; +/** + * API for URL management + */ +var UrlService = /** @class */ (function () { + /** @hidden */ + function UrlService(router, lateBind) { + if (lateBind === void 0) { lateBind = true; } + this.router = router; + this.rules = {}; + this.config = {}; + // proxy function calls from UrlService to the LocationService/LocationConfig + var locationServices = function () { return router.locationService; }; + createProxyFunctions(locationServices, this, locationServices, locationServicesFns, lateBind); + var locationConfig = function () { return router.locationConfig; }; + createProxyFunctions(locationConfig, this.config, locationConfig, locationConfigFns, lateBind); + var umf = function () { return router.urlMatcherFactory; }; + createProxyFunctions(umf, this.config, umf, umfFns); + var urlRouter = function () { return router.urlRouter; }; + createProxyFunctions(urlRouter, this.rules, urlRouter, rulesFns); + createProxyFunctions(urlRouter, this, urlRouter, syncFns); + } + UrlService.prototype.url = function (newurl, replace, state) { return; }; + + /** @inheritdoc */ + UrlService.prototype.path = function () { return; }; + + /** @inheritdoc */ + UrlService.prototype.search = function () { return; }; + + /** @inheritdoc */ + UrlService.prototype.hash = function () { return; }; + + /** @inheritdoc */ + UrlService.prototype.onChange = function (callback) { return; }; + + /** + * Returns the current URL parts + * + * This method returns the current URL components as a [[UrlParts]] object. + * + * @returns the current url parts + */ + UrlService.prototype.parts = function () { + return { path: this.path(), search: this.search(), hash: this.hash() }; + }; + UrlService.prototype.dispose = function () { }; + /** @inheritdoc */ + UrlService.prototype.sync = function (evt) { return; }; + /** @inheritdoc */ + UrlService.prototype.listen = function (enabled) { return; }; + + /** @inheritdoc */ + UrlService.prototype.deferIntercept = function (defer) { return; }; + /** @inheritdoc */ + UrlService.prototype.match = function (urlParts) { return; }; + /** @hidden */ + UrlService.locationServiceStub = makeStub(locationServicesFns); + /** @hidden */ + UrlService.locationConfigStub = makeStub(locationConfigFns); + return UrlService; +}()); + +/** + * @coreapi + * @module core + */ /** */ +/** @hidden */ +var _routerInstance = 0; +/** + * The master class used to instantiate an instance of UI-Router. + * + * UI-Router (for each specific framework) will create an instance of this class during bootstrap. + * This class instantiates and wires the UI-Router services together. + * + * After a new instance of the UIRouter class is created, it should be configured for your app. + * For instance, app states should be registered with the [[UIRouter.stateRegistry]]. + * + * --- + * + * Normally the framework code will bootstrap UI-Router. + * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling + * [[UrlService.listen]] then [[UrlService.sync]]. + */ +var UIRouter = /** @class */ (function () { + /** + * Creates a new `UIRouter` object + * + * @param locationService a [[LocationServices]] implementation + * @param locationConfig a [[LocationConfig]] implementation + * @internalapi + */ + function UIRouter(locationService, locationConfig) { + if (locationService === void 0) { locationService = UrlService.locationServiceStub; } + if (locationConfig === void 0) { locationConfig = UrlService.locationConfigStub; } + this.locationService = locationService; + this.locationConfig = locationConfig; + /** @hidden */ this.$id = _routerInstance++; + /** @hidden */ this._disposed = false; + /** @hidden */ this._disposables = []; + /** Provides trace information to the console */ + this.trace = trace; + /** Provides services related to ui-view synchronization */ + this.viewService = new ViewService(); + /** Provides services related to Transitions */ + this.transitionService = new TransitionService(this); + /** Global router state */ + this.globals = new UIRouterGlobals(); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlMatcherFactory = new UrlMatcherFactory(); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlRouter = new UrlRouter(this); + /** Provides a registry for states, and related registration services */ + this.stateRegistry = new StateRegistry(this); + /** Provides services related to states */ + this.stateService = new StateService(this); + /** Provides services related to the URL */ + this.urlService = new UrlService(this); + /** @hidden */ + this._plugins = {}; + this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); + this.globals.$current = this.stateRegistry.root(); + this.globals.current = this.globals.$current.self; + this.disposable(this.globals); + this.disposable(this.stateService); + this.disposable(this.stateRegistry); + this.disposable(this.transitionService); + this.disposable(this.urlRouter); + this.disposable(locationService); + this.disposable(locationConfig); + } + /** Registers an object to be notified when the router is disposed */ + UIRouter.prototype.disposable = function (disposable) { + this._disposables.push(disposable); + }; + /** + * Disposes this router instance + * + * When called, clears resources retained by the router by calling `dispose(this)` on all + * registered [[disposable]] objects. + * + * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only. + * + * @param disposable (optional) the disposable to dispose + */ + UIRouter.prototype.dispose = function (disposable) { + var _this = this; + if (disposable && isFunction(disposable.dispose)) { + disposable.dispose(this); + return undefined; + } + this._disposed = true; + this._disposables.slice().forEach(function (d) { + try { + typeof d.dispose === 'function' && d.dispose(_this); + removeFrom(_this._disposables, d); + } + catch (ignored) { } + }); + }; + /** + * Adds a plugin to UI-Router + * + * This method adds a UI-Router Plugin. + * A plugin can enhance or change UI-Router behavior using any public API. + * + * #### Example: + * ```js + * import { MyCoolPlugin } from "ui-router-cool-plugin"; + * + * var plugin = router.addPlugin(MyCoolPlugin); + * ``` + * + * ### Plugin authoring + * + * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object. + * + * The plugin can implement its functionality using any of the public APIs of [[UIRouter]]. + * For example, it may configure router options or add a Transition Hook. + * + * The plugin can then be published as a separate module. + * + * #### Example: + * ```js + * export class MyAuthPlugin implements UIRouterPlugin { + * constructor(router: UIRouter, options: any) { + * this.name = "MyAuthPlugin"; + * let $transitions = router.transitionService; + * let $state = router.stateService; + * + * let authCriteria = { + * to: (state) => state.data && state.data.requiresAuth + * }; + * + * function authHook(transition: Transition) { + * let authService = transition.injector().get('AuthService'); + * if (!authService.isAuthenticated()) { + * return $state.target('login'); + * } + * } + * + * $transitions.onStart(authCriteria, authHook); + * } + * } + * ``` + * + * @param plugin one of: + * - a plugin class which implements [[UIRouterPlugin]] + * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance + * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance + * @param options options to pass to the plugin class/factory + * @returns the registered plugin instance + */ + UIRouter.prototype.plugin = function (plugin, options) { + if (options === void 0) { options = {}; } + var pluginInstance = new plugin(this, options); + if (!pluginInstance.name) + throw new Error("Required property `name` missing on plugin: " + pluginInstance); + this._disposables.push(pluginInstance); + return this._plugins[pluginInstance.name] = pluginInstance; + }; + UIRouter.prototype.getPlugin = function (pluginName) { + return pluginName ? this._plugins[pluginName] : values(this._plugins); + }; + return UIRouter; +}()); + +/** @module hooks */ /** */ +function addCoreResolvables(trans) { + trans.addResolvable({ token: UIRouter, deps: [], resolveFn: function () { return trans.router; }, data: trans.router }, ""); + trans.addResolvable({ token: Transition, deps: [], resolveFn: function () { return trans; }, data: trans }, ""); + trans.addResolvable({ token: '$transition$', deps: [], resolveFn: function () { return trans; }, data: trans }, ""); + trans.addResolvable({ token: '$stateParams', deps: [], resolveFn: function () { return trans.params(); }, data: trans.params() }, ""); + trans.entering().forEach(function (state) { + trans.addResolvable({ token: '$state$', deps: [], resolveFn: function () { return state; }, data: state }, state); + }); +} +var registerAddCoreResolvables = function (transitionService) { + return transitionService.onCreate({}, addCoreResolvables); +}; + +/** @module hooks */ /** */ +/** + * A [[TransitionHookFn]] that redirects to a different state or params + * + * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);` + * + * See [[StateDeclaration.redirectTo]] + */ +var redirectToHook = function (trans) { + var redirect = trans.to().redirectTo; + if (!redirect) + return; + var $state = trans.router.stateService; + function handleResult(result) { + if (!result) + return; + if (result instanceof TargetState) + return result; + if (isString(result)) + return $state.target(result, trans.params(), trans.options()); + if (result['state'] || result['params']) + return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options()); + } + if (isFunction(redirect)) { + return services.$q.when(redirect(trans)).then(handleResult); + } + return handleResult(redirect); +}; +var registerRedirectToHook = function (transitionService) { + return transitionService.onStart({ to: function (state) { return !!state.redirectTo; } }, redirectToHook); +}; + +/** + * A factory which creates an onEnter, onExit or onRetain transition hook function + * + * The returned function invokes the (for instance) state.onEnter hook when the + * state is being entered. + * + * @hidden + */ +function makeEnterExitRetainHook(hookName) { + return function (transition, state) { + var _state = state.$$state(); + var hookFn = _state[hookName]; + return hookFn(transition, state); + }; +} +/** + * The [[TransitionStateHookFn]] for onExit + * + * When the state is being exited, the state's .onExit function is invoked. + * + * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);` + * + * See: [[IHookRegistry.onExit]] + */ +var onExitHook = makeEnterExitRetainHook('onExit'); +var registerOnExitHook = function (transitionService) { + return transitionService.onExit({ exiting: function (state) { return !!state.onExit; } }, onExitHook); +}; +/** + * The [[TransitionStateHookFn]] for onRetain + * + * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked. + * + * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);` + * + * See: [[IHookRegistry.onRetain]] + */ +var onRetainHook = makeEnterExitRetainHook('onRetain'); +var registerOnRetainHook = function (transitionService) { + return transitionService.onRetain({ retained: function (state) { return !!state.onRetain; } }, onRetainHook); +}; +/** + * The [[TransitionStateHookFn]] for onEnter + * + * When the state is being entered, the state's .onEnter function is invoked. + * + * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);` + * + * See: [[IHookRegistry.onEnter]] + */ +var onEnterHook = makeEnterExitRetainHook('onEnter'); +var registerOnEnterHook = function (transitionService) { + return transitionService.onEnter({ entering: function (state) { return !!state.onEnter; } }, onEnterHook); +}; + +/** @module hooks */ +/** for typedoc */ +/** + * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path + * + * Registered using `transitionService.onStart({}, eagerResolvePath);` + * + * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var eagerResolvePath = function (trans) { + return new ResolveContext(trans.treeChanges().to) + .resolvePath("EAGER", trans) + .then(noop$1); +}; +var registerEagerResolvePath = function (transitionService) { + return transitionService.onStart({}, eagerResolvePath, { priority: 1000 }); +}; +/** + * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path + * + * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState);` + * + * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var lazyResolveState = function (trans, state) { + return new ResolveContext(trans.treeChanges().to) + .subContext(state.$$state()) + .resolvePath("LAZY", trans) + .then(noop$1); +}; +var registerLazyResolveState = function (transitionService) { + return transitionService.onEnter({ entering: val(true) }, lazyResolveState, { priority: 1000 }); +}; + +/** @module hooks */ /** for typedoc */ +/** + * A [[TransitionHookFn]] which waits for the views to load + * + * Registered using `transitionService.onStart({}, loadEnteringViews);` + * + * Allows the views to do async work in [[ViewConfig.load]] before the transition continues. + * In angular 1, this includes loading the templates. + */ +var loadEnteringViews = function (transition) { + var $q = services.$q; + var enteringViews = transition.views("entering"); + if (!enteringViews.length) + return; + return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(noop$1); +}; +var registerLoadEnteringViews = function (transitionService) { + return transitionService.onFinish({}, loadEnteringViews); +}; +/** + * A [[TransitionHookFn]] which activates the new views when a transition is successful. + * + * Registered using `transitionService.onSuccess({}, activateViews);` + * + * After a transition is complete, this hook deactivates the old views from the previous state, + * and activates the new views from the destination state. + * + * See [[ViewService]] + */ +var activateViews = function (transition) { + var enteringViews = transition.views("entering"); + var exitingViews = transition.views("exiting"); + if (!enteringViews.length && !exitingViews.length) + return; + var $view = transition.router.viewService; + exitingViews.forEach(function (vc) { return $view.deactivateViewConfig(vc); }); + enteringViews.forEach(function (vc) { return $view.activateViewConfig(vc); }); + $view.sync(); +}; +var registerActivateViews = function (transitionService) { + return transitionService.onSuccess({}, activateViews); +}; + +/** + * A [[TransitionHookFn]] which updates global UI-Router state + * + * Registered using `transitionService.onBefore({}, updateGlobalState);` + * + * Before a [[Transition]] starts, updates the global value of "the current transition" ([[Globals.transition]]). + * After a successful [[Transition]], updates the global values of "the current state" + * ([[Globals.current]] and [[Globals.$current]]) and "the current param values" ([[Globals.params]]). + * + * See also the deprecated properties: + * [[StateService.transition]], [[StateService.current]], [[StateService.params]] + */ +var updateGlobalState = function (trans) { + var globals = trans.router.globals; + var transitionSuccessful = function () { + globals.successfulTransitions.enqueue(trans); + globals.$current = trans.$to(); + globals.current = globals.$current.self; + copy(trans.params(), globals.params); + }; + var clearCurrentTransition = function () { + // Do not clear globals.transition if a different transition has started in the meantime + if (globals.transition === trans) + globals.transition = null; + }; + trans.onSuccess({}, transitionSuccessful, { priority: 10000 }); + trans.promise.then(clearCurrentTransition, clearCurrentTransition); +}; +var registerUpdateGlobalState = function (transitionService) { + return transitionService.onCreate({}, updateGlobalState); +}; + +/** + * A [[TransitionHookFn]] which updates the URL after a successful transition + * + * Registered using `transitionService.onSuccess({}, updateUrl);` + */ +var updateUrl = function (transition) { + var options = transition.options(); + var $state = transition.router.stateService; + var $urlRouter = transition.router.urlRouter; + // Dont update the url in these situations: + // The transition was triggered by a URL sync (options.source === 'url') + // The user doesn't want the url to update (options.location === false) + // The destination state, and all parents have no navigable url + if (options.source !== 'url' && options.location && $state.$current.navigable) { + var urlOptions = { replace: options.location === 'replace' }; + $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions); + } + $urlRouter.update(true); +}; +var registerUpdateUrl = function (transitionService) { + return transitionService.onSuccess({}, updateUrl, { priority: 9999 }); +}; + +/** + * A [[TransitionHookFn]] that performs lazy loading + * + * When entering a state "abc" which has a `lazyLoad` function defined: + * - Invoke the `lazyLoad` function (unless it is already in process) + * - Flag the hook function as "in process" + * - The function should return a promise (that resolves when lazy loading is complete) + * - Wait for the promise to settle + * - If the promise resolves to a [[LazyLoadResult]], then register those states + * - Flag the hook function as "not in process" + * - If the hook was successful + * - Remove the `lazyLoad` function from the state declaration + * - If all the hooks were successful + * - Retry the transition (by returning a TargetState) + * + * ``` + * .state('abc', { + * component: 'fooComponent', + * lazyLoad: () => System.import('./fooComponent') + * }); + * ``` + * + * See [[StateDeclaration.lazyLoad]] + */ +var lazyLoadHook = function (transition) { + var router = transition.router; + function retryTransition() { + if (transition.originalTransition().options().source !== 'url') { + // The original transition was not triggered via url sync + // The lazy state should be loaded now, so re-try the original transition + var orig = transition.targetState(); + return router.stateService.target(orig.identifier(), orig.params(), orig.options()); + } + // The original transition was triggered via url sync + // Run the URL rules and find the best match + var $url = router.urlService; + var result = $url.match($url.parts()); + var rule = result && result.rule; + // If the best match is a state, redirect the transition (instead + // of calling sync() which supersedes the current transition) + if (rule && rule.type === "STATE") { + var state = rule.state; + var params = result.match; + return router.stateService.target(state, params, transition.options()); + } + // No matching state found, so let .sync() choose the best non-state match/otherwise + router.urlService.sync(); + } + var promises = transition.entering() + .filter(function (state) { return !!state.$$state().lazyLoad; }) + .map(function (state) { return lazyLoadState(transition, state); }); + return services.$q.all(promises).then(retryTransition); +}; +var registerLazyLoadHook = function (transitionService) { + return transitionService.onBefore({ entering: function (state) { return !!state.lazyLoad; } }, lazyLoadHook); +}; +/** + * Invokes a state's lazy load function + * + * @param transition a Transition context + * @param state the state to lazy load + * @returns A promise for the lazy load result + */ +function lazyLoadState(transition, state) { + var lazyLoadFn = state.$$state().lazyLoad; + // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked + var promise = lazyLoadFn['_promise']; + if (!promise) { + var success = function (result) { + delete state.lazyLoad; + delete state.$$state().lazyLoad; + delete lazyLoadFn['_promise']; + return result; + }; + var error = function (err) { + delete lazyLoadFn['_promise']; + return services.$q.reject(err); + }; + promise = lazyLoadFn['_promise'] = + services.$q.when(lazyLoadFn(transition, state)) + .then(updateStateRegistry) + .then(success, error); + } + /** Register any lazy loaded state definitions */ + function updateStateRegistry(result) { + if (result && Array.isArray(result.states)) { + result.states.forEach(function (state) { return transition.router.stateRegistry.register(state); }); + } + return result; + } + return promise; +} + +/** + * This class defines a type of hook, such as `onBefore` or `onEnter`. + * Plugins can define custom hook types, such as sticky states does for `onInactive`. + * + * @interalapi + */ +var TransitionEventType = /** @class */ (function () { + function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + this.name = name; + this.hookPhase = hookPhase; + this.hookOrder = hookOrder; + this.criteriaMatchPath = criteriaMatchPath; + this.reverseSort = reverseSort; + this.getResultHandler = getResultHandler; + this.getErrorHandler = getErrorHandler; + this.synchronous = synchronous; + } + return TransitionEventType; +}()); + +/** @module hooks */ /** */ +/** + * A [[TransitionHookFn]] that skips a transition if it should be ignored + * + * This hook is invoked at the end of the onBefore phase. + * + * If the transition should be ignored (because no parameter or states changed) + * then the transition is ignored and not processed. + */ +function ignoredHook(trans) { + var ignoredReason = trans._ignoredReason(); + if (!ignoredReason) + return; + trace.traceTransitionIgnored(trans); + var pending = trans.router.globals.transition; + // The user clicked a link going back to the *current state* ('A') + // However, there is also a pending transition in flight (to 'B') + // Abort the transition to 'B' because the user now wants to be back at 'A'. + if (ignoredReason === 'SameAsCurrent' && pending) { + pending.abort(); + } + return Rejection.ignored().toPromise(); +} +var registerIgnoredTransitionHook = function (transitionService) { + return transitionService.onBefore({}, ignoredHook, { priority: -9999 }); +}; + +/** @module hooks */ /** */ +/** + * A [[TransitionHookFn]] that rejects the Transition if it is invalid + * + * This hook is invoked at the end of the onBefore phase. + * If the transition is invalid (for example, param values do not validate) + * then the transition is rejected. + */ +function invalidTransitionHook(trans) { + if (!trans.valid()) { + throw new Error(trans.error()); + } +} +var registerInvalidTransitionHook = function (transitionService) { + return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 }); +}; + +/** + * @coreapi + * @module transition + */ +/** for typedoc */ +/** + * The default [[Transition]] options. + * + * Include this object when applying custom defaults: + * let reloadOpts = { reload: true, notify: true } + * let options = defaults(theirOpts, customDefaults, defaultOptions); + */ +var defaultTransOpts = { + location: true, + relative: null, + inherit: false, + notify: true, + reload: false, + custom: {}, + current: function () { return null; }, + source: "unknown" +}; +/** + * This class provides services related to Transitions. + * + * - Most importantly, it allows global Transition Hooks to be registered. + * - It allows the default transition error handler to be set. + * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]). + * + * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. + */ +var TransitionService = /** @class */ (function () { + /** @hidden */ + function TransitionService(_router) { + /** @hidden */ + this._transitionCount = 0; + /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */ + this._eventTypes = []; + /** @hidden The registered transition hooks */ + this._registeredHooks = {}; + /** @hidden The paths on a criteria object */ + this._criteriaPaths = {}; + this._router = _router; + this.$view = _router.viewService; + this._deregisterHookFns = {}; + this._pluginapi = createProxyFunctions(val(this), {}, val(this), [ + '_definePathType', + '_defineEvent', + '_getPathTypes', + '_getEvents', + 'getHooks', + ]); + this._defineCorePaths(); + this._defineCoreEvents(); + this._registerCoreTransitionHooks(); + } + /** + * Registers a [[TransitionHookFn]], called *while a transition is being constructed*. + * + * Registers a transition lifecycle hook, which is invoked during transition construction. + * + * This low level hook should only be used by plugins. + * This can be a useful time for plugins to add resolves or mutate the transition as needed. + * The Sticky States plugin uses this hook to modify the treechanges. + * + * ### Lifecycle + * + * `onCreate` hooks are invoked *while a transition is being constructed*. + * + * ### Return value + * + * The hook's return value is ignored + * + * @internalapi + * @param criteria defines which Transitions the Hook should be invoked for. + * @param callback the hook function which will be invoked. + * @param options the registration options + * @returns a function which deregisters the hook. + */ + TransitionService.prototype.onCreate = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onBefore = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onStart = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onExit = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onRetain = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onEnter = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onFinish = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onSuccess = function (criteria, callback, options) { return; }; + /** @inheritdoc */ + TransitionService.prototype.onError = function (criteria, callback, options) { return; }; + /** + * dispose + * @internalapi + */ + TransitionService.prototype.dispose = function (router) { + values(this._registeredHooks).forEach(function (hooksArray) { return hooksArray.forEach(function (hook) { + hook._deregistered = true; + removeFrom(hooksArray, hook); + }); }); + }; + /** + * Creates a new [[Transition]] object + * + * This is a factory function for creating new Transition objects. + * It is used internally by the [[StateService]] and should generally not be called by application code. + * + * @param fromPath the path to the current state (the from state) + * @param targetState the target state (destination) + * @returns a Transition + */ + TransitionService.prototype.create = function (fromPath, targetState) { + return new Transition(fromPath, targetState, this._router); + }; + /** @hidden */ + TransitionService.prototype._defineCoreEvents = function () { + var Phase = exports.TransitionHookPhase; + var TH = TransitionHook; + var paths = this._criteriaPaths; + var NORMAL_SORT = false, REVERSE_SORT = true; + var ASYNCHRONOUS = false, SYNCHRONOUS = true; + this._defineEvent("onCreate", Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); + this._defineEvent("onBefore", Phase.BEFORE, 0, paths.to); + this._defineEvent("onStart", Phase.RUN, 0, paths.to); + this._defineEvent("onExit", Phase.RUN, 100, paths.exiting, REVERSE_SORT); + this._defineEvent("onRetain", Phase.RUN, 200, paths.retained); + this._defineEvent("onEnter", Phase.RUN, 300, paths.entering); + this._defineEvent("onFinish", Phase.RUN, 400, paths.to); + this._defineEvent("onSuccess", Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent("onError", Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + }; + /** @hidden */ + TransitionService.prototype._defineCorePaths = function () { + var STATE = exports.TransitionHookScope.STATE, TRANSITION = exports.TransitionHookScope.TRANSITION; + this._definePathType("to", TRANSITION); + this._definePathType("from", TRANSITION); + this._definePathType("exiting", STATE); + this._definePathType("retained", STATE); + this._definePathType("entering", STATE); + }; + /** @hidden */ + TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + var eventType = new TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous); + this._eventTypes.push(eventType); + makeEvent(this, this, eventType); + }; + + /** @hidden */ + TransitionService.prototype._getEvents = function (phase) { + var transitionHookTypes = isDefined(phase) ? + this._eventTypes.filter(function (type) { return type.hookPhase === phase; }) : + this._eventTypes.slice(); + return transitionHookTypes.sort(function (l, r) { + var cmpByPhase = l.hookPhase - r.hookPhase; + return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase; + }); + }; + /** + * Adds a Path to be used as a criterion against a TreeChanges path + * + * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. + * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` + * Each state in the exiting path is checked against the criteria and returned as part of the match. + * + * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. + * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` + * Only the tail of the `to` path is checked against the criteria and returned as part of the match. + * + * @hidden + */ + TransitionService.prototype._definePathType = function (name, hookScope) { + this._criteriaPaths[name] = { name: name, scope: hookScope }; + }; + /** * @hidden */ + TransitionService.prototype._getPathTypes = function () { + return this._criteriaPaths; + }; + /** @hidden */ + TransitionService.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + /** @hidden */ + TransitionService.prototype._registerCoreTransitionHooks = function () { + var fns = this._deregisterHookFns; + fns.addCoreResolves = registerAddCoreResolvables(this); + fns.ignored = registerIgnoredTransitionHook(this); + fns.invalid = registerInvalidTransitionHook(this); + // Wire up redirectTo hook + fns.redirectTo = registerRedirectToHook(this); + // Wire up onExit/Retain/Enter state hooks + fns.onExit = registerOnExitHook(this); + fns.onRetain = registerOnRetainHook(this); + fns.onEnter = registerOnEnterHook(this); + // Wire up Resolve hooks + fns.eagerResolve = registerEagerResolvePath(this); + fns.lazyResolve = registerLazyResolveState(this); + // Wire up the View management hooks + fns.loadViews = registerLoadEnteringViews(this); + fns.activateViews = registerActivateViews(this); + // Updates global state after a transition + fns.updateGlobals = registerUpdateGlobalState(this); + // After globals.current is updated at priority: 10000 + fns.updateUrl = registerUpdateUrl(this); + // Lazy load state trees + fns.lazyLoad = registerLazyLoadHook(this); + }; + return TransitionService; +}()); + +/** + * @coreapi + * @module state + */ +/** */ +/** + * Provides state related service functions + * + * This class provides services related to ui-router states. + * An instance of this class is located on the global [[UIRouter]] object. + */ +var StateService = /** @class */ (function () { + /** @internalapi */ + function StateService(router) { + this.router = router; + /** @internalapi */ + this.invalidCallbacks = []; + /** @hidden */ + this._defaultErrorHandler = function $defaultErrorHandler($error$) { + if ($error$ instanceof Error && $error$.stack) { + console.error($error$); + console.error($error$.stack); + } + else if ($error$ instanceof Rejection) { + console.error($error$.toString()); + if ($error$.detail && $error$.detail.stack) + console.error($error$.detail.stack); + } + else { + console.error($error$); + } + }; + var getters = ['current', '$current', 'params', 'transition']; + var boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters))); + createProxyFunctions(val(StateService.prototype), this, val(this), boundFns); + } + Object.defineProperty(StateService.prototype, "transition", { + /** + * The [[Transition]] currently in progress (or null) + * + * This is a passthrough through to [[UIRouterGlobals.transition]] + */ + get: function () { return this.router.globals.transition; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(StateService.prototype, "params", { + /** + * The latest successful state parameters + * + * This is a passthrough through to [[UIRouterGlobals.params]] + */ + get: function () { return this.router.globals.params; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(StateService.prototype, "current", { + /** + * The current [[StateDeclaration]] + * + * This is a passthrough through to [[UIRouterGlobals.current]] + */ + get: function () { return this.router.globals.current; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(StateService.prototype, "$current", { + /** + * The current [[StateObject]] + * + * This is a passthrough through to [[UIRouterGlobals.$current]] + */ + get: function () { return this.router.globals.$current; }, + enumerable: true, + configurable: true + }); + /** @internalapi */ + StateService.prototype.dispose = function () { + this.defaultErrorHandler(noop$1); + this.invalidCallbacks = []; + }; + /** + * Handler for when [[transitionTo]] is called with an invalid state. + * + * Invokes the [[onInvalid]] callbacks, in natural order. + * Each callback's return value is checked in sequence until one of them returns an instance of TargetState. + * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises. + * + * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned. + * + * @internalapi + */ + StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { + var _this = this; + var fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath); + var globals = this.router.globals; + var latestThing = function () { return globals.transitionHistory.peekTail(); }; + var latest = latestThing(); + var callbackQueue = new Queue(this.invalidCallbacks.slice()); + var injector = new ResolveContext(fromPath).injector(); + var checkForRedirect = function (result) { + if (!(result instanceof TargetState)) { + return; + } + var target = result; + // Recreate the TargetState, in case the state is now defined. + target = _this.target(target.identifier(), target.params(), target.options()); + if (!target.valid()) { + return Rejection.invalid(target.error()).toPromise(); + } + if (latestThing() !== latest) { + return Rejection.superseded().toPromise(); + } + return _this.transitionTo(target.identifier(), target.params(), target.options()); + }; + function invokeNextCallback() { + var nextCallback = callbackQueue.dequeue(); + if (nextCallback === undefined) + return Rejection.invalid(toState.error()).toPromise(); + var callbackResult = services.$q.when(nextCallback(toState, fromState, injector)); + return callbackResult.then(checkForRedirect).then(function (result) { return result || invokeNextCallback(); }); + } + return invokeNextCallback(); + }; + /** + * Registers an Invalid State handler + * + * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]] + * has been called with an invalid state reference parameter + * + * Example: + * ```js + * stateService.onInvalid(function(to, from, injector) { + * if (to.name() === 'foo') { + * let lazyLoader = injector.get('LazyLoadService'); + * return lazyLoader.load('foo') + * .then(() => stateService.target('foo')); + * } + * }); + * ``` + * + * @param {function} callback invoked when the toState is invalid + * This function receives the (invalid) toState, the fromState, and an injector. + * The function may optionally return a [[TargetState]] or a Promise for a TargetState. + * If one is returned, it is treated as a redirect. + * + * @returns a function which deregisters the callback + */ + StateService.prototype.onInvalid = function (callback) { + this.invalidCallbacks.push(callback); + return function deregisterListener() { + removeFrom(this.invalidCallbacks)(callback); + }.bind(this); + }; + /** + * Reloads the current state + * + * A method that force reloads the current state, or a partial state hierarchy. + * All resolves are re-resolved, and components reinstantiated. + * + * #### Example: + * ```js + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * $state.reload(); + * } + * }); + * ``` + * + * Note: `reload()` is just an alias for: + * + * ```js + * $state.transitionTo($state.current, $state.params, { + * reload: true, inherit: false + * }); + * ``` + * + * @param reloadState A state name or a state object. + * If present, this state and all its children will be reloaded, but ancestors will not reload. + * + * #### Example: + * ```js + * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item' + * //and current state is 'contacts.detail.item' + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * //will reload 'contact.detail' and nested 'contact.detail.item' states + * $state.reload('contact.detail'); + * } + * }); + * ``` + * + * @returns A promise representing the state of the new transition. See [[StateService.go]] + */ + StateService.prototype.reload = function (reloadState) { + return this.transitionTo(this.current, this.params, { + reload: isDefined(reloadState) ? reloadState : true, + inherit: false, + notify: false, + }); + }; + + /** + * Transition to a different state and/or parameters + * + * Convenience method for transitioning to a new state. + * + * `$state.go` calls `$state.transitionTo` internally but automatically sets options to + * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`. + * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`). + * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters + * inherit from the current parameter values (because of `inherit: true`). + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.go('contact.detail'); + * }; + * }); + * ``` + * + * @param to Absolute state name, state object, or relative state path (relative to current state). + * + * Some examples: + * + * - `$state.go('contact.detail')` - will go to the `contact.detail` state + * - `$state.go('^')` - will go to the parent state + * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state + * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state + * + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. + * + * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`). + * This allows, for example, going to a sibling state that shares parameters defined by a parent state. + * + * @param options Transition options + * + * @returns {promise} A promise representing the state of the new transition. + */ + StateService.prototype.go = function (to, params, options) { + var defautGoOpts = { relative: this.$current, inherit: true }; + var transOpts = defaults(options, defautGoOpts, defaultTransOpts); + return this.transitionTo(to, params, transOpts); + }; + + /** + * Creates a [[TargetState]] + * + * This is a factory method for creating a TargetState + * + * This may be returned from a Transition Hook to redirect a transition, for example. + */ + StateService.prototype.target = function (identifier, params, options) { + if (options === void 0) { options = {}; } + // If we're reloading, find the state object to reload from + if (isObject(options.reload) && !options.reload.name) + throw new Error('Invalid reload state object'); + var reg = this.router.stateRegistry; + options.reloadState = options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); + if (options.reload && !options.reloadState) + throw new Error("No such reload state '" + (isString(options.reload) ? options.reload : options.reload.name) + "'"); + return new TargetState(this.router.stateRegistry, identifier, params, options); + }; + + StateService.prototype.getCurrentPath = function () { + var _this = this; + var globals = this.router.globals; + var latestSuccess = globals.successfulTransitions.peekTail(); + var rootPath = function () { return [new PathNode(_this.router.stateRegistry.root())]; }; + return latestSuccess ? latestSuccess.treeChanges().to : rootPath(); + }; + /** + * Low-level method for transitioning to a new state. + * + * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations. + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.transitionTo('contact.detail'); + * }; + * }); + * ``` + * + * @param to State name or state object. + * @param toParams A map of the parameters that will be sent to the state, + * will populate $stateParams. + * @param options Transition options + * + * @returns A promise representing the state of the new transition. See [[go]] + */ + StateService.prototype.transitionTo = function (to, toParams, options) { + var _this = this; + if (toParams === void 0) { toParams = {}; } + if (options === void 0) { options = {}; } + var router = this.router; + var globals = router.globals; + options = defaults(options, defaultTransOpts); + var getCurrent = function () { + return globals.transition; + }; + options = extend(options, { current: getCurrent }); + var ref = this.target(to, toParams, options); + var currentPath = this.getCurrentPath(); + if (!ref.exists()) + return this._handleInvalidTargetState(currentPath, ref); + if (!ref.valid()) + return silentRejection(ref.error()); + /** + * Special handling for Ignored, Aborted, and Redirected transitions + * + * The semantics for the transition.run() promise and the StateService.transitionTo() + * promise differ. For instance, the run() promise may be rejected because it was + * IGNORED, but the transitionTo() promise is resolved because from the user perspective + * no error occurred. Likewise, the transition.run() promise may be rejected because of + * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. + */ + var rejectedTransitionHandler = function (transition) { return function (error) { + if (error instanceof Rejection) { + var isLatest = router.globals.lastStartedTransitionId === transition.$id; + if (error.type === exports.RejectType.IGNORED) { + isLatest && router.urlRouter.update(); + // Consider ignored `Transition.run()` as a successful `transitionTo` + return services.$q.when(globals.current); + } + var detail = error.detail; + if (error.type === exports.RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) { + // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully + // by returning the promise for the new (redirect) `Transition.run()`. + var redirect = transition.redirect(detail); + return redirect.run().catch(rejectedTransitionHandler(redirect)); + } + if (error.type === exports.RejectType.ABORTED) { + isLatest && router.urlRouter.update(); + return services.$q.reject(error); + } + } + var errorHandler = _this.defaultErrorHandler(); + errorHandler(error); + return services.$q.reject(error); + }; }; + var transition = this.router.transitionService.create(currentPath, ref); + var transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); + silenceUncaughtInPromise(transitionToPromise); // issue #2676 + // Return a promise for the transition, which also has the transition object on it. + return extend(transitionToPromise, { transition: transition }); + }; + + /** + * Checks if the current state *is* the provided state + * + * Similar to [[includes]] but only checks for the full state name. + * If params is supplied then it will be tested for strict equality against the current + * active params object, so all params must match with none missing and no extras. + * + * #### Example: + * ```js + * $state.$current.name = 'contacts.details.item'; + * + * // absolute name + * $state.is('contact.details.item'); // returns true + * $state.is(contactDetailItemStateObject); // returns true + * ``` + * + * // relative name (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + * ```html + *
Item
+ * ``` + * + * @param stateOrName The state name (absolute or relative) or state object you'd like to check. + * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like + * to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns Returns true if it is the state. + */ + StateService.prototype.is = function (stateOrName, params, options) { + options = defaults(options, { relative: this.$current }); + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!isDefined(state)) + return undefined; + if (this.$current !== state) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return Param.equals(schema, Param.values(schema, params), this.params); + }; + + /** + * Checks if the current state *includes* the provided state + * + * A method to determine if the current active state is equal to or is the child of the + * state stateName. If any params are passed then they will be tested for a match as well. + * Not all the parameters need to be passed, just the ones you'd like to test for equality. + * + * #### Example when `$state.$current.name === 'contacts.details.item'` + * ```js + * // Using partial names + * $state.includes("contacts"); // returns true + * $state.includes("contacts.details"); // returns true + * $state.includes("contacts.details.item"); // returns true + * $state.includes("contacts.list"); // returns false + * $state.includes("about"); // returns false + * ``` + * + * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`: + * ```js + * $state.includes("*.details.*.*"); // returns true + * $state.includes("*.details.**"); // returns true + * $state.includes("**.item.**"); // returns true + * $state.includes("*.details.item.url"); // returns true + * $state.includes("*.details.*.url"); // returns true + * $state.includes("*.details.*"); // returns false + * $state.includes("item.**"); // returns false + * ``` + * + * @param stateOrName A partial name, relative name, glob pattern, + * or state object to be searched for within the current state name. + * @param params A param object, e.g. `{sectionId: section.id}`, + * that you'd like to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it does include the state + */ + StateService.prototype.includes = function (stateOrName, params, options) { + options = defaults(options, { relative: this.$current }); + var glob = isString(stateOrName) && Glob.fromString(stateOrName); + if (glob) { + if (!glob.matches(this.$current.name)) + return false; + stateOrName = this.$current.name; + } + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes; + if (!isDefined(state)) + return undefined; + if (!isDefined(include[state.name])) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return Param.equals(schema, Param.values(schema, params), this.params); + }; + + /** + * Generates a URL for a state and parameters + * + * Returns the url for the given state populated with the given params. + * + * #### Example: + * ```js + * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); + * ``` + * + * @param stateOrName The state name or state object you'd like to generate a url from. + * @param params An object of parameter values to fill the state's required parameters. + * @param options Options object. The options are: + * + * @returns {string} compiled state url + */ + StateService.prototype.href = function (stateOrName, params, options) { + var defaultHrefOpts = { + lossy: true, + inherit: true, + absolute: false, + relative: this.$current, + }; + options = defaults(options, defaultHrefOpts); + params = params || {}; + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!isDefined(state)) + return null; + if (options.inherit) + params = this.params.$inherit(params, this.$current, state); + var nav = (state && options.lossy) ? state.navigable : state; + if (!nav || nav.url === undefined || nav.url === null) { + return null; + } + return this.router.urlRouter.href(nav.url, params, { + absolute: options.absolute, + }); + }; + + /** + * Sets or gets the default [[transitionTo]] error handler. + * + * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition. + * This includes errors caused by resolves and transition hooks. + * + * Note: + * This handler does not receive certain Transition rejections. + * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]]. + * + * The built-in default error handler logs the error to the console. + * + * You can provide your own custom handler. + * + * #### Example: + * ```js + * stateService.defaultErrorHandler(function() { + * // Do not log transitionTo errors + * }); + * ``` + * + * @param handler a global error handler function + * @returns the current global error handler + */ + StateService.prototype.defaultErrorHandler = function (handler) { + return this._defaultErrorHandler = handler || this._defaultErrorHandler; + }; + StateService.prototype.get = function (stateOrName, base) { + var reg = this.router.stateRegistry; + if (arguments.length === 0) + return reg.get(); + return reg.get(stateOrName, base || this.$current); + }; + /** + * Lazy loads a state + * + * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function. + * + * @param stateOrName the state that should be lazy loaded + * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc) + * Note: If no transition is provided, a noop transition is created using the from the current state to the current state. + * This noop transition is not actually run. + * + * @returns a promise to lazy load + */ + StateService.prototype.lazyLoad = function (stateOrName, transition) { + var state = this.get(stateOrName); + if (!state || !state.lazyLoad) + throw new Error("Can not lazy load " + stateOrName); + var currentPath = this.getCurrentPath(); + var target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath); + transition = transition || this.router.transitionService.create(currentPath, target); + return lazyLoadState(transition, state); + }; + return StateService; +}()); + +/** + * # Transition subsystem + * + * This module contains APIs related to a Transition. + * + * See: + * - [[TransitionService]] + * - [[Transition]] + * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]] + * + * @coreapi + * @preferred + * @module transition + */ /** for typedoc */ + +/** + * @internalapi + * @module vanilla + */ +/** */ +/** + * An angular1-like promise api + * + * This object implements four methods similar to the + * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This API provides native ES6 promise support wrapped as a $q-like API. + * Internally, UI-Router uses this $q object to perform promise operations. + * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular. + * + * $q-like promise api + */ +var $q = { + /** Normalizes a value as a promise */ + when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, + /** Normalizes a value as a promise rejection */ + reject: function (val) { return new Promise(function (resolve, reject) { reject(val); }); }, + /** @returns a deferred object, which has `resolve` and `reject` functions */ + defer: function () { + var deferred = {}; + deferred.promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + return deferred; + }, + /** Like Promise.all(), but also supports object key/promise notation like $q */ + all: function (promises) { + if (isArray(promises)) { + return Promise.all(promises); + } + if (isObject(promises)) { + // Convert promises map to promises array. + // When each promise resolves, map it to a tuple { key: key, val: val } + var chain = Object.keys(promises) + .map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); + // Then wait for all promises to resolve, and convert them back to an object + return $q.all(chain).then(function (values) { + return values.reduce(function (acc, tuple) { acc[tuple.key] = tuple.val; return acc; }, {}); + }); + } + } +}; + +/** + * @internalapi + * @module vanilla + */ +/** */ +// globally available injectables +var globals = {}; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; +var ARGUMENT_NAMES = /([^\s,]+)/g; +/** + * A basic angular1-like injector api + * + * This object implements four methods similar to the + * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This object provides a naive implementation of a globally scoped dependency injection system. + * It supports the following DI approaches: + * + * ### Function parameter names + * + * A function's `.toString()` is called, and the parameter names are parsed. + * This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS. + * + * ```js + * function injectedFunction(FooService, BarService) { + * // FooService and BarService are injected + * } + * ``` + * + * ### Function annotation + * + * A function may be annotated with an array of dependency names as the `$inject` property. + * + * ```js + * injectedFunction.$inject = [ 'FooService', 'BarService' ]; + * function injectedFunction(fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * } + * ``` + * + * ### Array notation + * + * An array provides the names of the dependencies to inject (as strings). + * The function is the last element of the array. + * + * ```js + * [ 'FooService', 'BarService', function (fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * }] + * ``` + * + * @type {$InjectorLike} + */ +var $injector = { + /** Gets an object from DI based on a string token */ + get: function (name) { return globals[name]; }, + /** Returns true if an object named `name` exists in global DI */ + has: function (name) { return $injector.get(name) != null; }, + /** + * Injects a function + * + * @param fn the function to inject + * @param context the function's `this` binding + * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` + */ + invoke: function (fn, context, locals) { + var all = extend({}, globals, locals || {}); + var params = $injector.annotate(fn); + var ensureExist = assertPredicate(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); + var args = params.filter(ensureExist).map(function (x) { return all[x]; }); + if (isFunction(fn)) + return fn.apply(context, args); + else + return fn.slice(-1)[0].apply(context, args); + }, + /** + * Returns a function's dependencies + * + * Analyzes a function (or array) and returns an array of DI tokens that the function requires. + * @return an array of `string`s + */ + annotate: function (fn) { + if (!isInjectable(fn)) + throw new Error("Not an injectable function: " + fn); + if (fn && fn.$inject) + return fn.$inject; + if (isArray(fn)) + return fn.slice(0, -1); + var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); + var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); + return result || []; + } +}; + +/** + * @internalapi + * @module vanilla + */ +/** */ +var keyValsToObjectR = function (accum, _a) { + var key = _a[0], val = _a[1]; + if (!accum.hasOwnProperty(key)) { + accum[key] = val; + } + else if (isArray(accum[key])) { + accum[key].push(val); + } + else { + accum[key] = [accum[key], val]; + } + return accum; +}; +var getParams = function (queryString) { + return queryString.split("&").filter(identity).map(splitEqual).reduce(keyValsToObjectR, {}); +}; +function parseUrl$1(url) { + var orEmptyString = function (x) { return x || ""; }; + var _a = splitHash(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; + var _b = splitQuery(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; + return { path: path, search: search, hash: hash, url: url }; +} +var buildUrl = function (loc) { + var path = loc.path(); + var searchObject = loc.search(); + var hash = loc.hash(); + var search = Object.keys(searchObject).map(function (key) { + var param = searchObject[key]; + var vals = isArray(param) ? param : [param]; + return vals.map(function (val) { return key + "=" + val; }); + }).reduce(unnestR, []).join("&"); + return path + (search ? "?" + search : "") + (hash ? "#" + hash : ""); +}; +function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { + return function (router) { + var service = router.locationService = new serviceClass(router); + var configuration = router.locationConfig = new configurationClass(router, isHtml5); + function dispose(router) { + router.dispose(service); + router.dispose(configuration); + } + return { name: name, service: service, configuration: configuration, dispose: dispose }; + }; +} + +/** + * @internalapi + * @module vanilla + */ /** */ +/** A base `LocationServices` */ +var BaseLocationServices = /** @class */ (function () { + function BaseLocationServices(router, fireAfterUpdate) { + var _this = this; + this.fireAfterUpdate = fireAfterUpdate; + this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; + this._listeners = []; + this.hash = function () { return parseUrl$1(_this._get()).hash; }; + this.path = function () { return parseUrl$1(_this._get()).path; }; + this.search = function () { return getParams(parseUrl$1(_this._get()).search); }; + this._location = root.location; + this._history = root.history; + } + BaseLocationServices.prototype.url = function (url, replace) { + if (replace === void 0) { replace = true; } + if (isDefined(url) && url !== this._get()) { + this._set(null, null, url, replace); + if (this.fireAfterUpdate) { + this._listeners.forEach(function (cb) { return cb({ url: url }); }); + } + } + return buildUrl(this); + }; + BaseLocationServices.prototype.onChange = function (cb) { + var _this = this; + this._listeners.push(cb); + return function () { return removeFrom(_this._listeners, cb); }; + }; + BaseLocationServices.prototype.dispose = function (router) { + deregAll(this._listeners); + }; + return BaseLocationServices; +}()); + +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @internalapi + * @module vanilla + */ +/** */ +/** A `LocationServices` that uses the browser hash "#" to get/set the current location */ +var HashLocationService = /** @class */ (function (_super) { + __extends(HashLocationService, _super); + function HashLocationService(router) { + var _this = _super.call(this, router, false) || this; + root.addEventListener('hashchange', _this._listener, false); + return _this; + } + HashLocationService.prototype._get = function () { + return trimHashVal(this._location.hash); + }; + HashLocationService.prototype._set = function (state, title, url, replace) { + this._location.hash = url; + }; + HashLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + root.removeEventListener('hashchange', this._listener); + }; + return HashLocationService; +}(BaseLocationServices)); + +var __extends$1 = (undefined && undefined.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * @internalapi + * @module vanilla + */ +/** */ +/** A `LocationServices` that gets/sets the current location from an in-memory object */ +var MemoryLocationService = /** @class */ (function (_super) { + __extends$1(MemoryLocationService, _super); + function MemoryLocationService(router) { + return _super.call(this, router, true) || this; + } + MemoryLocationService.prototype._get = function () { + return this._url; + }; + MemoryLocationService.prototype._set = function (state, title, url, replace) { + this._url = url; + }; + return MemoryLocationService; +}(BaseLocationServices)); + +var __extends$2 = (undefined && undefined.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +/** + * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis + * + * Uses `history.pushState` and `history.replaceState` + */ +var PushStateLocationService = /** @class */ (function (_super) { + __extends$2(PushStateLocationService, _super); + function PushStateLocationService(router) { + var _this = _super.call(this, router, true) || this; + _this._config = router.urlService.config; + root.addEventListener('popstate', _this._listener, false); + return _this; + } + + /** + * Gets the base prefix without: + * - trailing slash + * - trailing filename + * - protocol and hostname + * + * If , this returns '/base'. + * If , this returns '/base'. + * + * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element + */ + PushStateLocationService.prototype._getBasePrefix = function () { + return stripFile(this._config.baseHref()); + }; + PushStateLocationService.prototype._get = function () { + var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; + search = splitQuery(search)[1]; // strip ? if found + hash = splitHash(hash)[1]; // strip # if found + var basePrefix = this._getBasePrefix(); + var exactMatch = pathname === this._config.baseHref(); + var startsWith = pathname.startsWith(basePrefix); + pathname = exactMatch ? '/' : startsWith ? pathname.substring(basePrefix.length) : pathname; + return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : ''); + }; + PushStateLocationService.prototype._set = function (state, title, url, replace) { + var fullUrl = this._getBasePrefix() + url; + if (replace) { + this._history.replaceState(state, title, fullUrl); + } + else { + this._history.pushState(state, title, fullUrl); + } + }; + PushStateLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + root.removeEventListener('popstate', this._listener); + }; + return PushStateLocationService; +}(BaseLocationServices)); + +/** A `LocationConfig` mock that gets/sets all config from an in-memory object */ +var MemoryLocationConfig = /** @class */ (function () { + function MemoryLocationConfig() { + var _this = this; + this._baseHref = ''; + this._port = 80; + this._protocol = "http"; + this._host = "localhost"; + this._hashPrefix = ""; + this.port = function () { return _this._port; }; + this.protocol = function () { return _this._protocol; }; + this.host = function () { return _this._host; }; + this.baseHref = function () { return _this._baseHref; }; + this.html5Mode = function () { return false; }; + this.hashPrefix = function (newval) { return isDefined(newval) ? _this._hashPrefix = newval : _this._hashPrefix; }; + this.dispose = noop$1; + } + return MemoryLocationConfig; +}()); + +/** + * @internalapi + * @module vanilla + */ +/** */ +/** A `LocationConfig` that delegates to the browser's `location` object */ +var BrowserLocationConfig = /** @class */ (function () { + function BrowserLocationConfig(router, _isHtml5) { + if (_isHtml5 === void 0) { _isHtml5 = false; } + this._isHtml5 = _isHtml5; + this._baseHref = undefined; + this._hashPrefix = ""; + } + BrowserLocationConfig.prototype.port = function () { + if (location.port) { + return Number(location.port); + } + return this.protocol() === 'https' ? 443 : 80; + }; + BrowserLocationConfig.prototype.protocol = function () { + return location.protocol.replace(/:/g, ''); + }; + BrowserLocationConfig.prototype.host = function () { + return location.hostname; + }; + BrowserLocationConfig.prototype.html5Mode = function () { + return this._isHtml5; + }; + BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { + return isDefined(newprefix) ? this._hashPrefix = newprefix : this._hashPrefix; + }; + + BrowserLocationConfig.prototype.baseHref = function (href) { + return isDefined(href) ? this._baseHref = href : + isDefined(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref(); + }; + BrowserLocationConfig.prototype.applyDocumentBaseHref = function () { + var baseTag = document.getElementsByTagName("base")[0]; + return this._baseHref = baseTag ? baseTag.href.substr(location.origin.length) : ""; + }; + BrowserLocationConfig.prototype.dispose = function () { }; + return BrowserLocationConfig; +}()); + +/** + * @internalapi + * @module vanilla + */ +/** */ +function servicesPlugin(router) { + services.$injector = $injector; + services.$q = $q; + return { name: "vanilla.services", $q: $q, $injector: $injector, dispose: function () { return null; } }; +} +/** A `UIRouterPlugin` uses the browser hash to get/set the current location */ +var hashLocationPlugin = locationPluginFactory('vanilla.hashBangLocation', false, HashLocationService, BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ +var pushStateLocationPlugin = locationPluginFactory("vanilla.pushStateLocation", true, PushStateLocationService, BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ +var memoryLocationPlugin = locationPluginFactory("vanilla.memoryLocation", false, MemoryLocationService, MemoryLocationConfig); + +/** + * @internalapi + * @module vanilla + */ +/** */ + +/** + * # Core classes and interfaces + * + * The classes and interfaces that are core to ui-router and do not belong + * to a more specific subsystem (such as resolve). + * + * @coreapi + * @preferred + * @module core + */ /** for typedoc */ +/** @internalapi */ +var UIRouterPluginBase = /** @class */ (function () { + function UIRouterPluginBase() { + } + UIRouterPluginBase.prototype.dispose = function (router) { }; + return UIRouterPluginBase; +}()); + +/** + * @coreapi + * @module common + */ /** */ + + + +var index$1 = Object.freeze({ + root: root, + fromJson: fromJson, + toJson: toJson, + forEach: forEach, + extend: extend, + equals: equals, + identity: identity, + noop: noop$1, + createProxyFunctions: createProxyFunctions, + inherit: inherit, + inArray: inArray, + _inArray: _inArray, + removeFrom: removeFrom, + _removeFrom: _removeFrom, + pushTo: pushTo, + _pushTo: _pushTo, + deregAll: deregAll, + defaults: defaults, + mergeR: mergeR, + ancestors: ancestors, + pick: pick, + omit: omit, + pluck: pluck, + filter: filter, + find: find, + mapObj: mapObj, + map: map, + values: values, + allTrueR: allTrueR, + anyTrueR: anyTrueR, + unnestR: unnestR, + flattenR: flattenR, + pushR: pushR, + uniqR: uniqR, + unnest: unnest, + flatten: flatten, + assertPredicate: assertPredicate, + assertMap: assertMap, + assertFn: assertFn, + pairs: pairs, + arrayTuples: arrayTuples, + applyPairs: applyPairs, + tail: tail, + copy: copy, + _extend: _extend, + silenceUncaughtInPromise: silenceUncaughtInPromise, + silentRejection: silentRejection, + notImplemented: notImplemented, + services: services, + Glob: Glob, + curry: curry, + compose: compose, + pipe: pipe, + prop: prop, + propEq: propEq, + parse: parse, + not: not, + and: and, + or: or, + all: all, + any: any, + is: is, + eq: eq, + val: val, + invoke: invoke, + pattern: pattern, + isUndefined: isUndefined, + isDefined: isDefined, + isNull: isNull, + isNullOrUndefined: isNullOrUndefined, + isFunction: isFunction, + isNumber: isNumber, + isString: isString, + isObject: isObject, + isArray: isArray, + isDate: isDate, + isRegExp: isRegExp, + isState: isState, + isInjectable: isInjectable, + isPromise: isPromise, + Queue: Queue, + maxLength: maxLength, + padString: padString, + kebobString: kebobString, + functionToString: functionToString, + fnToString: fnToString, + stringify: stringify, + beforeAfterSubstr: beforeAfterSubstr, + hostRegex: hostRegex, + stripFile: stripFile, + splitHash: splitHash, + splitQuery: splitQuery, + splitEqual: splitEqual, + trimHashVal: trimHashVal, + splitOnDelim: splitOnDelim, + joinNeighborsR: joinNeighborsR, + get Category () { return exports.Category; }, + Trace: Trace, + trace: trace, + get DefType () { return exports.DefType; }, + Param: Param, + ParamTypes: ParamTypes, + StateParams: StateParams, + ParamType: ParamType, + PathNode: PathNode, + PathUtils: PathUtils, + resolvePolicies: resolvePolicies, + defaultResolvePolicy: defaultResolvePolicy, + Resolvable: Resolvable, + NATIVE_INJECTOR_TOKEN: NATIVE_INJECTOR_TOKEN, + ResolveContext: ResolveContext, + resolvablesBuilder: resolvablesBuilder, + StateBuilder: StateBuilder, + StateObject: StateObject, + StateMatcher: StateMatcher, + StateQueueManager: StateQueueManager, + StateRegistry: StateRegistry, + StateService: StateService, + TargetState: TargetState, + get TransitionHookPhase () { return exports.TransitionHookPhase; }, + get TransitionHookScope () { return exports.TransitionHookScope; }, + HookBuilder: HookBuilder, + matchState: matchState, + RegisteredHook: RegisteredHook, + makeEvent: makeEvent, + get RejectType () { return exports.RejectType; }, + Rejection: Rejection, + Transition: Transition, + TransitionHook: TransitionHook, + TransitionEventType: TransitionEventType, + defaultTransOpts: defaultTransOpts, + TransitionService: TransitionService, + UrlMatcher: UrlMatcher, + UrlMatcherFactory: UrlMatcherFactory, + UrlRouter: UrlRouter, + UrlRuleFactory: UrlRuleFactory, + BaseUrlRule: BaseUrlRule, + UrlService: UrlService, + ViewService: ViewService, + UIRouterGlobals: UIRouterGlobals, + UIRouter: UIRouter, + $q: $q, + $injector: $injector, + BaseLocationServices: BaseLocationServices, + HashLocationService: HashLocationService, + MemoryLocationService: MemoryLocationService, + PushStateLocationService: PushStateLocationService, + MemoryLocationConfig: MemoryLocationConfig, + BrowserLocationConfig: BrowserLocationConfig, + keyValsToObjectR: keyValsToObjectR, + getParams: getParams, + parseUrl: parseUrl$1, + buildUrl: buildUrl, + locationPluginFactory: locationPluginFactory, + servicesPlugin: servicesPlugin, + hashLocationPlugin: hashLocationPlugin, + pushStateLocationPlugin: pushStateLocationPlugin, + memoryLocationPlugin: memoryLocationPlugin, + UIRouterPluginBase: UIRouterPluginBase +}); + +function getNg1ViewConfigFactory() { + var templateFactory = null; + return function (path, view) { + templateFactory = templateFactory || services.$injector.get("$templateFactory"); + return [new Ng1ViewConfig(path, view, templateFactory)]; + }; +} +var hasAnyKey = function (keys, obj) { + return keys.reduce(function (acc, key) { return acc || isDefined(obj[key]); }, false); +}; +/** + * This is a [[StateBuilder.builder]] function for angular1 `views`. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * handles the `views` property with logic specific to @uirouter/angularjs (ng1). + * + * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object + * and applies the state-level configuration to a view named `$default`. + */ +function ng1ViewsBuilder(state) { + // Do not process root state + if (!state.parent) + return {}; + var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys); + // Do not allow a state to have both state-level props and also a `views: {}` property. + // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state. + // However, the `$default` approach should not be mixed with a separate `views: ` block. + if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) { + throw new Error("State '" + state.name + "' has a 'views' object. " + + "It cannot also have \"view properties\" at the state level. " + + "Move the following properties into a view (in the 'views' object): " + + (" " + allViewKeys.filter(function (key) { return isDefined(state[key]); }).join(", "))); + } + var views = {}, viewsObject = state.views || { "$default": pick(state, allViewKeys) }; + forEach(viewsObject, function (config, name) { + // Account for views: { "": { template... } } + name = name || "$default"; + // Account for views: { header: "headerComponent" } + if (isString(config)) + config = { component: config }; + // Make a shallow copy of the config object + config = extend({}, config); + // Do not allow a view to mix props for component-style view with props for template/controller-style view + if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { + throw new Error("Cannot combine: " + compKeys.join("|") + " with: " + nonCompKeys.join("|") + " in stateview: '" + name + "@" + state.name + "'"); + } + config.resolveAs = config.resolveAs || '$resolve'; + config.$type = "ng1"; + config.$context = state; + config.$name = name; + var normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name); + config.$uiViewName = normalized.uiViewName; + config.$uiViewContextAnchor = normalized.uiViewContextAnchor; + views[name] = config; + }); + return views; +} +var id$1 = 0; +var Ng1ViewConfig = /** @class */ (function () { + function Ng1ViewConfig(path, viewDecl, factory) { + var _this = this; + this.path = path; + this.viewDecl = viewDecl; + this.factory = factory; + this.$id = id$1++; + this.loaded = false; + this.getTemplate = function (uiView, context) { + return _this.component ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) : _this.template; + }; + } + Ng1ViewConfig.prototype.load = function () { + var _this = this; + var $q = services.$q; + var context = new ResolveContext(this.path); + var params = this.path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {}); + var promises = { + template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), + controller: $q.when(this.getController(context)) + }; + return $q.all(promises).then(function (results) { + trace.traceViewServiceEvent("Loaded", _this); + _this.controller = results.controller; + extend(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } + return _this; + }); + }; + /** + * Gets the controller for a view configuration. + * + * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller. + */ + Ng1ViewConfig.prototype.getController = function (context) { + var provider = this.viewDecl.controllerProvider; + if (!isInjectable(provider)) + return this.viewDecl.controller; + var deps = services.$injector.annotate(provider); + var providerFn = isArray(provider) ? tail(provider) : provider; + var resolvable = new Resolvable("", providerFn, deps); + return resolvable.get(context); + }; + return Ng1ViewConfig; +}()); + +/** @module view */ +/** for typedoc */ +/** + * Service which manages loading of templates from a ViewConfig. + */ +var TemplateFactory = /** @class */ (function () { + function TemplateFactory() { + var _this = this; + /** @hidden */ this._useHttp = ng.version.minor < 3; + /** @hidden */ this.$get = ['$http', '$templateCache', '$injector', function ($http, $templateCache, $injector) { + _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); + _this.$http = $http; + _this.$templateCache = $templateCache; + return _this; + }]; + } + /** @hidden */ + TemplateFactory.prototype.useHttpService = function (value) { + this._useHttp = value; + }; + + /** + * Creates a template from a configuration object. + * + * @param config Configuration object for which to load a template. + * The following properties are search in the specified order, and the first one + * that is defined is used to create the template: + * + * @param params Parameters to pass to the template function. + * @param context The resolve context associated with the template's view + * + * @return {string|object} The template html as a string, or a promise for + * that string,or `null` if no template is configured. + */ + TemplateFactory.prototype.fromConfig = function (config, params, context) { + var defaultTemplate = ""; + var asTemplate = function (result) { return services.$q.when(result).then(function (str) { return ({ template: str }); }); }; + var asComponent = function (result) { return services.$q.when(result).then(function (str) { return ({ component: str }); }); }; + return (isDefined(config.template) ? asTemplate(this.fromString(config.template, params)) : + isDefined(config.templateUrl) ? asTemplate(this.fromUrl(config.templateUrl, params)) : + isDefined(config.templateProvider) ? asTemplate(this.fromProvider(config.templateProvider, params, context)) : + isDefined(config.component) ? asComponent(config.component) : + isDefined(config.componentProvider) ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) : + asTemplate(defaultTemplate)); + }; + + /** + * Creates a template from a string or a function returning a string. + * + * @param template html template as a string or function that returns an html template as a string. + * @param params Parameters to pass to the template function. + * + * @return {string|object} The template html as a string, or a promise for that + * string. + */ + TemplateFactory.prototype.fromString = function (template, params) { + return isFunction(template) ? template(params) : template; + }; + + /** + * Loads a template from the a URL via `$http` and `$templateCache`. + * + * @param {string|Function} url url of the template to load, or a function + * that returns a url. + * @param {Object} params Parameters to pass to the url function. + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromUrl = function (url, params) { + if (isFunction(url)) + url = url(params); + if (url == null) + return null; + if (this._useHttp) { + return this.$http.get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) + .then(function (response) { + return response.data; + }); + } + return this.$templateRequest(url); + }; + + /** + * Creates a template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromProvider = function (provider, params, context) { + var deps = services.$injector.annotate(provider); + var providerFn = isArray(provider) ? tail(provider) : provider; + var resolvable = new Resolvable("", providerFn, deps); + return resolvable.get(context); + }; + + /** + * Creates a component's template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string} The template html as a string: "". + */ + TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { + var deps = services.$injector.annotate(provider); + var providerFn = isArray(provider) ? tail(provider) : provider; + var resolvable = new Resolvable("", providerFn, deps); + return resolvable.get(context); + }; + + /** + * Creates a template from a component's name + * + * This implements route-to-component. + * It works by retrieving the component (directive) metadata from the injector. + * It analyses the component's bindings, then constructs a template that instantiates the component. + * The template wires input and output bindings to resolves or from the parent component. + * + * @param uiView {object} The parent ui-view (for binding outputs to callbacks) + * @param context The ResolveContext (for binding outputs to callbacks returned from resolves) + * @param component {string} Component's name in camel case. + * @param bindings An object defining the component's bindings: {foo: '<'} + * @return {string} The template as a string: "". + */ + TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { + bindings = bindings || {}; + // Bind once prefix + var prefix = ng.version.minor >= 3 ? "::" : ""; + // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` + var kebob = function (camelCase) { + var kebobed = kebobString(camelCase); + return /^(x|data)-/.exec(kebobed) ? "x-" + kebobed : kebobed; + }; + var attributeTpl = function (input) { + var name = input.name, type = input.type; + var attrName = kebob(name); + // If the ui-view has an attribute which matches a binding on the routed component + // then pass that attribute through to the routed component template. + // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:` + if (uiView.attr(attrName) && !bindings[name]) + return attrName + "='" + uiView.attr(attrName) + "'"; + var resolveName = bindings[name] || name; + // Pre-evaluate the expression for "@" bindings by enclosing in {{ }} + // some-attr="{{ ::$resolve.someResolveName }}" + if (type === '@') + return attrName + "='{{" + prefix + "$resolve." + resolveName + "}}'"; + // Wire "&" callbacks to resolves that return a callback function + // Get the result of the resolve (should be a function) and annotate it to get its arguments. + // some-attr="$resolve.someResolveResultName(foo, bar)" + if (type === '&') { + var res = context.getResolvable(resolveName); + var fn = res && res.data; + var args = fn && services.$injector.annotate(fn) || []; + // account for array style injection, i.e., ['foo', function(foo) {}] + var arrayIdxStr = isArray(fn) ? "[" + (fn.length - 1) + "]" : ''; + return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(",") + ")'"; + } + // some-attr="::$resolve.someResolveName" + return attrName + "='" + prefix + "$resolve." + resolveName + "'"; + }; + var attrs = getComponentBindings(component).map(attributeTpl).join(" "); + var kebobName = kebob(component); + return "<" + kebobName + " " + attrs + ">"; + }; + + return TemplateFactory; +}()); +// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') +function getComponentBindings(name) { + var cmpDefs = services.$injector.get(name + "Directive"); // could be multiple + if (!cmpDefs || !cmpDefs.length) + throw new Error("Unable to find component named '" + name + "'"); + return cmpDefs.map(getBindings).reduce(unnestR, []); +} +// Given a directive definition, find its object input attributes +// Use different properties, depending on the type of directive (component, bindToController, normal) +var getBindings = function (def) { + if (isObject(def.bindToController)) + return scopeBindings(def.bindToController); + return scopeBindings(def.scope); +}; +// for ng 1.2 style, process the scope: { input: "=foo" } +// for ng 1.3 through ng 1.5, process the component's bindToController: { input: "=foo" } object +var scopeBindings = function (bindingsObj) { return Object.keys(bindingsObj || {}) + .map(function (key) { return [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])]; }) + .filter(function (tuple) { return isDefined(tuple) && isArray(tuple[1]); }) + .map(function (tuple) { return ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }); }); }; + +/** @module ng1 */ /** for typedoc */ +/** + * The Angular 1 `StateProvider` + * + * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely + * on state. + * + * A state corresponds to a "place" in the application in terms of the overall UI and + * navigation. A state describes (via the controller / template / view properties) what + * the UI looks like and does at that place. + * + * States often have things in common, and the primary way of factoring out these + * commonalities in this model is via the state hierarchy, i.e. parent/child states aka + * nested states. + * + * The `$stateProvider` provides interfaces to declare these states for your app. + */ +var StateProvider = /** @class */ (function () { + function StateProvider(stateRegistry, stateService) { + this.stateRegistry = stateRegistry; + this.stateService = stateService; + createProxyFunctions(val(StateProvider.prototype), this, val(this)); + } + /** + * Decorates states when they are registered + * + * Allows you to extend (carefully) or override (at your own peril) the + * `stateBuilder` object used internally by [[StateRegistry]]. + * This can be used to add custom functionality to ui-router, + * for example inferring templateUrl based on the state name. + * + * When passing only a name, it returns the current (original or decorated) builder + * function that matches `name`. + * + * The builder functions that can be decorated are listed below. Though not all + * necessarily have a good use case for decoration, that is up to you to decide. + * + * In addition, users can attach custom decorators, which will generate new + * properties within the state's internal definition. There is currently no clear + * use-case for this beyond accessing internal states (i.e. $state.$current), + * however, expect this to become increasingly relevant as we introduce additional + * meta-programming features. + * + * **Warning**: Decorators should not be interdependent because the order of + * execution of the builder functions in non-deterministic. Builder functions + * should only be dependent on the state definition object and super function. + * + * + * Existing builder functions and current return values: + * + * - **parent** `{object}` - returns the parent state object. + * - **data** `{object}` - returns state data, including any inherited data that is not + * overridden by own values (if any). + * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} + * or `null`. + * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is + * navigable). + * - **params** `{object}` - returns an array of state params that are ensured to + * be a super-set of parent's params. + * - **views** `{object}` - returns a views object where each key is an absolute view + * name (i.e. "viewName@stateName") and each value is the config object + * (template, controller) for the view. Even when you don't use the views object + * explicitly on a state config, one is still created for you internally. + * So by decorating this builder function you have access to decorating template + * and controller properties. + * - **ownParams** `{object}` - returns an array of params that belong to the state, + * not including any params defined by ancestor states. + * - **path** `{string}` - returns the full path from the root down to this state. + * Needed for state activation. + * - **includes** `{object}` - returns an object that includes every state that + * would pass a `$state.includes()` test. + * + * #### Example: + * Override the internal 'views' builder with a function that takes the state + * definition, and a reference to the internal function being overridden: + * ```js + * $stateProvider.decorator('views', function (state, parent) { + * let result = {}, + * views = parent(state); + * + * angular.forEach(views, function (config, name) { + * let autoName = (state.name + '.' + name).replace('.', '/'); + * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; + * result[name] = config; + * }); + * return result; + * }); + * + * $stateProvider.state('home', { + * views: { + * 'contact.list': { controller: 'ListController' }, + * 'contact.item': { controller: 'ItemController' } + * } + * }); + * ``` + * + * + * ```js + * // Auto-populates list and item views with /partials/home/contact/list.html, + * // and /partials/home/contact/item.html, respectively. + * $state.go('home'); + * ``` + * + * @param {string} name The name of the builder function to decorate. + * @param {object} func A function that is responsible for decorating the original + * builder function. The function receives two parameters: + * + * - `{object}` - state - The state config object. + * - `{object}` - super - The original builder function. + * + * @return {object} $stateProvider - $stateProvider instance + */ + StateProvider.prototype.decorator = function (name, func) { + return this.stateRegistry.decorator(name, func) || this; + }; + StateProvider.prototype.state = function (name, definition) { + if (isObject(name)) { + definition = name; + } + else { + definition.name = name; + } + this.stateRegistry.register(definition); + return this; + }; + /** + * Registers an invalid state handler + * + * This is a passthrough to [[StateService.onInvalid]] for ng1. + */ + StateProvider.prototype.onInvalid = function (callback) { + return this.stateService.onInvalid(callback); + }; + return StateProvider; +}()); + +/** @module ng1 */ /** */ +/** + * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`, + * `onRetain` callback hooks on a [[Ng1StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * ensures that those hooks are injectable for @uirouter/angularjs (ng1). + */ +var getStateHookBuilder = function (hookName) { + return function stateHookBuilder(state, parentFn) { + var hook = state[hookName]; + var pathname = hookName === 'onExit' ? 'from' : 'to'; + function decoratedNg1Hook(trans, state) { + var resolveContext = new ResolveContext(trans.treeChanges(pathname)); + var locals = extend(getLocals(resolveContext), { $state$: state, $transition$: trans }); + return services.$injector.invoke(hook, this, locals); + } + return hook ? decoratedNg1Hook : undefined; + }; +}; + +/** + * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service + */ +var Ng1LocationServices = /** @class */ (function () { + function Ng1LocationServices($locationProvider) { + // .onChange() registry + this._urlListeners = []; + this.$locationProvider = $locationProvider; + var _lp = val($locationProvider); + createProxyFunctions(_lp, this, _lp, ['hashPrefix']); + } + Ng1LocationServices.prototype.dispose = function () { }; + Ng1LocationServices.prototype.onChange = function (callback) { + var _this = this; + this._urlListeners.push(callback); + return function () { return removeFrom(_this._urlListeners)(callback); }; + }; + Ng1LocationServices.prototype.html5Mode = function () { + var html5Mode = this.$locationProvider.html5Mode(); + html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode; + return html5Mode && this.$sniffer.history; + }; + Ng1LocationServices.prototype.url = function (newUrl, replace, state) { + if (replace === void 0) { replace = false; } + if (newUrl) + this.$location.url(newUrl); + if (replace) + this.$location.replace(); + if (state) + this.$location.state(state); + return this.$location.url(); + }; + Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser) { + var _this = this; + this.$location = $location; + this.$sniffer = $sniffer; + // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange + $rootScope.$on("$locationChangeSuccess", function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); + var _loc = val($location); + var _browser = val($browser); + // Bind these LocationService functions to $location + createProxyFunctions(_loc, this, _loc, ["replace", "path", "search", "hash"]); + // Bind these LocationConfig functions to $location + createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']); + // Bind these LocationConfig functions to $browser + createProxyFunctions(_browser, this, _browser, ['baseHref']); + }; + /** + * Applys ng1-specific path parameter encoding + * + * The Angular 1 `$location` service is a bit weird. + * It doesn't allow slashes to be encoded/decoded bi-directionally. + * + * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 + * + * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F + * + * @param router + */ + Ng1LocationServices.monkeyPatchPathParameterType = function (router) { + var pathType = router.urlMatcherFactory.type('path'); + pathType.encode = function (val) { + return val != null ? val.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : val; + }; + pathType.decode = function (val) { + return val != null ? val.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : val; + }; + }; + return Ng1LocationServices; +}()); + +/** @module url */ /** */ +/** + * Manages rules for client-side URL + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. + * + * This class manages the router rules for what to do when the URL changes. + * + * This provider remains for backwards compatibility. + * + * @deprecated + */ +var UrlRouterProvider = /** @class */ (function () { + /** @hidden */ + function UrlRouterProvider(router) { + this._router = router; + this._urlRouter = router.urlRouter; + } + /** @hidden */ + UrlRouterProvider.prototype.$get = function () { + var urlRouter = this._urlRouter; + urlRouter.update(true); + if (!urlRouter.interceptDeferred) + urlRouter.listen(); + return urlRouter; + }; + /** + * Registers a url handler function. + * + * Registers a low level url handler (a `rule`). + * A rule detects specific URL patterns and returns a redirect, or performs some action. + * + * If a rule returns a string, the URL is replaced with the string, and all rules are fired again. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // Here's an example of how you might allow case insensitive urls + * $urlRouterProvider.rule(function ($injector, $location) { + * var path = $location.path(), + * normalized = path.toLowerCase(); + * + * if (path !== normalized) { + * return normalized; + * } + * }); + * }); + * ``` + * + * @param ruleFn + * Handler function that takes `$injector` and `$location` services as arguments. + * You can use them to detect a url and return a different url as a string. + * + * @return [[UrlRouterProvider]] (`this`) + */ + UrlRouterProvider.prototype.rule = function (ruleFn) { + var _this = this; + if (!isFunction(ruleFn)) + throw new Error("'rule' must be a function"); + var match = function () { + return ruleFn(services.$injector, _this._router.locationService); + }; + var rule = new BaseUrlRule(match, identity); + this._urlRouter.rule(rule); + return this; + }; + + /** + * Defines the path or behavior to use when no url can be matched. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // if the path doesn't match any of the urls you configured + * // otherwise will take care of routing the user to the + * // specified url + * $urlRouterProvider.otherwise('/index'); + * + * // Example of using function rule as param + * $urlRouterProvider.otherwise(function ($injector, $location) { + * return '/a/valid/url'; + * }); + * }); + * ``` + * + * @param rule + * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`. + * The function version is passed two params: `$injector` and `$location` services, and should return a url string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + UrlRouterProvider.prototype.otherwise = function (rule) { + var _this = this; + var urlRouter = this._urlRouter; + if (isString(rule)) { + urlRouter.otherwise(rule); + } + else if (isFunction(rule)) { + urlRouter.otherwise(function () { return rule(services.$injector, _this._router.locationService); }); + } + else { + throw new Error("'rule' must be a string or function"); + } + return this; + }; + + /** + * Registers a handler for a given url matching. + * + * If the handler is a string, it is + * treated as a redirect, and is interpolated according to the syntax of match + * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). + * + * If the handler is a function, it is injectable. + * It gets invoked if `$location` matches. + * You have the option of inject the match object as `$match`. + * + * The handler can return + * + * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` + * will continue trying to find another one that matches. + * - **string** which is treated as a redirect and passed to `$location.url()` + * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * $urlRouterProvider.when($state.url, function ($match, $stateParams) { + * if ($state.$current.navigable !== state || + * !equalForKeys($match, $stateParams) { + * $state.transitionTo(state, $match, false); + * } + * }); + * }); + * ``` + * + * @param what A pattern string to match, compiled as a [[UrlMatcher]]. + * @param handler The path (or function that returns a path) that you want to redirect your user to. + * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]] + * + * Note: the handler may also invoke arbitrary code, such as `$state.go()` + */ + UrlRouterProvider.prototype.when = function (what, handler) { + if (isArray(handler) || isFunction(handler)) { + handler = UrlRouterProvider.injectableHandler(this._router, handler); + } + this._urlRouter.when(what, handler); + return this; + }; + + UrlRouterProvider.injectableHandler = function (router, handler) { + return function (match) { + return services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); + }; + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router']); + * + * app.config(function ($urlRouterProvider) { + * // Prevent $urlRouter from automatically intercepting URL changes; + * $urlRouterProvider.deferIntercept(); + * }) + * + * app.run(function (MyService, $urlRouter, $http) { + * $http.get("/stuff").then(function(resp) { + * MyService.doStuff(resp.data); + * $urlRouter.listen(); + * $urlRouter.sync(); + * }); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlRouterProvider.prototype.deferIntercept = function (defer) { + this._urlRouter.deferIntercept(defer); + }; + + return UrlRouterProvider; +}()); + +/** + * # Angular 1 types + * + * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc. + * The customizations to the core types for Angular UI-Router are documented here. + * + * The optional [[$resolve]] service is also documented here. + * + * @module ng1 + * @preferred + */ +/** for typedoc */ +ng.module("ui.router.angular1", []); +var mod_init = ng.module('ui.router.init', []); +var mod_util = ng.module('ui.router.util', ['ng', 'ui.router.init']); +var mod_rtr = ng.module('ui.router.router', ['ui.router.util']); +var mod_state = ng.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']); +var mod_main = ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); +var mod_cmpt = ng.module('ui.router.compat', ['ui.router']); // tslint:disable-line +var router = null; +$uiRouter.$inject = ['$locationProvider']; +/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ +function $uiRouter($locationProvider) { + // Create a new instance of the Router when the $uiRouterProvider is initialized + router = this.router = new UIRouter(); + router.stateProvider = new StateProvider(router.stateRegistry, router.stateService); + // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties + router.stateRegistry.decorator("views", ng1ViewsBuilder); + router.stateRegistry.decorator("onExit", getStateHookBuilder("onExit")); + router.stateRegistry.decorator("onRetain", getStateHookBuilder("onRetain")); + router.stateRegistry.decorator("onEnter", getStateHookBuilder("onEnter")); + router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory()); + var ng1LocationService = router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider); + Ng1LocationServices.monkeyPatchPathParameterType(router); + // backwards compat: also expose router instance as $uiRouterProvider.router + router['router'] = router; + router['$get'] = $get; + $get.$inject = ['$location', '$browser', '$sniffer', '$rootScope', '$http', '$templateCache']; + function $get($location, $browser, $sniffer, $rootScope, $http, $templateCache) { + ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser); + delete router['router']; + delete router['$get']; + return router; + } + return router; +} +var getProviderFor = function (serviceName) { return ['$uiRouterProvider', function ($urp) { + var service = $urp.router[serviceName]; + service["$get"] = function () { return service; }; + return service; + }]; }; +// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) +runBlock.$inject = ['$injector', '$q', '$uiRouter']; +function runBlock($injector, $q, $uiRouter) { + services.$injector = $injector; + services.$q = $q; + // The $injector is now available. + // Find any resolvables that had dependency annotation deferred + $uiRouter.stateRegistry.get() + .map(function (x) { return x.$$state().resolvables; }) + .reduce(unnestR, []) + .filter(function (x) { return x.deps === "deferred"; }) + .forEach(function (resolvable) { return resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi); }); +} +// $urlRouter service and $urlRouterProvider +var getUrlRouterProvider = function (uiRouter) { + return uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter); +}; +// $state service and $stateProvider +// $urlRouter service and $urlRouterProvider +var getStateProvider = function () { + return extend(router.stateProvider, { $get: function () { return router.stateService; } }); +}; +watchDigests.$inject = ['$rootScope']; +function watchDigests($rootScope) { + $rootScope.$watch(function () { trace.approximateDigests++; }); +} +mod_init.provider("$uiRouter", $uiRouter); +mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); +mod_util.provider('$urlService', getProviderFor('urlService')); +mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); +mod_util.provider('$templateFactory', function () { return new TemplateFactory(); }); +mod_state.provider('$stateRegistry', getProviderFor('stateRegistry')); +mod_state.provider('$uiRouterGlobals', getProviderFor('globals')); +mod_state.provider('$transitions', getProviderFor('transitionService')); +mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); +mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); +mod_main.factory('$view', function () { return router.viewService; }); +mod_main.service("$trace", function () { return trace; }); +mod_main.run(watchDigests); +mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); +mod_state.run(['$state', function ($state) { }]); +mod_rtr.run(['$urlRouter', function ($urlRouter) { }]); +mod_init.run(runBlock); +/** @hidden TODO: find a place to move this */ +var getLocals = function (ctx) { + var tokens = ctx.getTokens().filter(isString); + var tuples = tokens.map(function (key) { + var resolvable = ctx.getResolvable(key); + var waitPolicy = ctx.getPolicy(resolvable).async; + return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data]; + }); + return tuples.reduce(applyPairs, {}); +}; + +/** + * # Angular 1 injectable services + * + * This is a list of the objects which can be injected using angular's injector. + * + * There are three different kind of injectable objects: + * + * ## **Provider** objects + * #### injectable into a `.config()` block during configtime + * + * - [[$uiRouterProvider]]: The UI-Router instance + * - [[$stateProvider]]: State registration + * - [[$transitionsProvider]]: Transition hooks + * - [[$urlServiceProvider]]: All URL related public APIs + * + * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling + * - [[$urlRouterProvider]]: (deprecated) Url matching rules + * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config + * + * ## **Service** objects + * #### injectable globally during runtime + * + * - [[$uiRouter]]: The UI-Router instance + * - [[$trace]]: Enable transition trace/debug + * - [[$transitions]]: Transition hooks + * - [[$state]]: Imperative state related APIs + * - [[$stateRegistry]]: State registration + * - [[$urlService]]: All URL related public APIs + * - [[$uiRouterGlobals]]: Global variables + * - [[$uiViewScroll]]: Scroll an element into view + * + * - [[$stateParams]]: (deprecated) Global state param values + * - [[$urlRouter]]: (deprecated) URL synchronization + * - [[$urlMatcherFactory]]: (deprecated) URL parsing config + * + * ## **Per-Transition** objects + * + * - These kind of objects are injectable into: + * - Resolves ([[Ng1StateDeclaration.resolve]]), + * - Transition Hooks ([[TransitionService.onStart]], etc), + * - Routed Controllers ([[Ng1ViewDeclaration.controller]]) + * + * #### Different instances are injected based on the [[Transition]] + * + * - [[$transition$]]: The current Transition object + * - [[$stateParams]]: State param values for pending Transition (deprecated) + * - Any resolve data defined using [[Ng1StateDeclaration.resolve]] + * + * @ng1api + * @preferred + * @module injectables + */ /** */ +/** + * The current (or pending) State Parameters + * + * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition. + * + * The values are not updated until *after* a `Transition` successfully completes. + * + * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running. + * + * ### Deprecation warning: + * + * The value injected for `$stateParams` is different depending on where it is injected. + * + * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`. + * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`. + * + * Because of these confusing details, this service is deprecated. + * + * ### Instead of using the global `$stateParams` service object, + * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]] + * + * ```js + * MyService.$inject = ['$uiRouterGlobals']; + * function MyService($uiRouterGlobals) { + * return { + * paramValues: function () { + * return $uiRouterGlobals.params; + * } + * } + * } + * ``` + * + * ### Instead of using the per-transition `$stateParams` object, + * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]] + * + * ```js + * MyController.$inject = ['$transition$']; + * function MyController($transition$) { + * var username = $transition$.params().username; + * // .. do something with username + * } + * ``` + * + * --- + * + * This object can be injected into other services. + * + * #### Deprecated Example: + * ```js + * SomeService.$inject = ['$http', '$stateParams']; + * function SomeService($http, $stateParams) { + * return { + * getUser: function() { + * return $http.get('/api/users/' + $stateParams.username); + * } + * } + * }; + * angular.service('SomeService', SomeService); + * ``` + * @deprecated + */ + +/** + * # Angular 1 Directives + * + * These are the directives included in UI-Router for Angular 1. + * These directives are used in templates to create viewports and link/navigate to states. + * + * @ng1api + * @preferred + * @module directives + */ /** for typedoc */ +/** @hidden */ +function parseStateRef(ref) { + var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/), parsed; + if (paramsOnly) + ref = '(' + paramsOnly[1] + ')'; + parsed = ref.replace(/\n/g, " ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); + if (!parsed || parsed.length !== 4) + throw new Error("Invalid state ref '" + ref + "'"); + return { state: parsed[1] || null, paramExpr: parsed[3] || null }; +} +/** @hidden */ +function stateContext(el) { + var $uiView = el.parent().inheritedData('$uiView'); + var path = parse('$cfg.path')($uiView); + return path ? tail(path).state.name : undefined; +} +/** @hidden */ +function processedDef($state, $element, def) { + var uiState = def.uiState || $state.current.name; + var uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {}); + var href = $state.href(uiState, def.uiStateParams, uiStateOpts); + return { uiState: uiState, uiStateParams: def.uiStateParams, uiStateOpts: uiStateOpts, href: href }; +} +/** @hidden */ +function getTypeInfo(el) { + // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. + var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; + var isForm = el[0].nodeName === "FORM"; + return { + attr: isForm ? "action" : (isSvg ? 'xlink:href' : 'href'), + isAnchor: el.prop("tagName").toUpperCase() === "A", + clickable: !isForm + }; +} +/** @hidden */ +function clickHook(el, $state, $timeout, type, getDef) { + return function (e) { + var button = e.which || e.button, target = getDef(); + if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) { + // HACK: This is to allow ng-clicks to be processed before the transition is initiated: + var transition = $timeout(function () { + $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); + }); + e.preventDefault(); + // if the state has no URL, ignore one preventDefault from the directive. + var ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0; + e.preventDefault = function () { + if (ignorePreventDefaultCount-- <= 0) + $timeout.cancel(transition); + }; + } + }; +} +/** @hidden */ +function defaultOpts(el, $state) { + return { + relative: stateContext(el) || $state.$current, + inherit: true, + source: "sref" + }; +} +/** @hidden */ +function bindEvents(element, scope, hookFn, uiStateOpts) { + var events; + if (uiStateOpts) { + events = uiStateOpts.events; + } + if (!isArray(events)) { + events = ['click']; + } + var on = element.on ? 'on' : 'bind'; + for (var _i = 0, events_1 = events; _i < events_1.length; _i++) { + var event_1 = events_1[_i]; + element[on](event_1, hookFn); + } + scope.$on('$destroy', function () { + var off = element.off ? 'off' : 'unbind'; + for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { + var event_2 = events_2[_i]; + element[off](event_2, hookFn); + } + }); +} +/** + * `ui-sref`: A directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of the `ui-sref` is the name of the state to link to. + * + * #### Example: + * This will activate the `home` state when the link is clicked. + * ```html + * Home + * ``` + * + * ### Relative Links + * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]). + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create a relative `ui-sref` which always targets the same destination. + * + * #### Example: + * Both these links are relative to the parent state, even when a child state is currently active. + * ```html + * child 1 state + * child 2 state + * ``` + * + * This link activates the parent state. + * ```html + * Return + * ``` + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * #### Example: + * Assuming the `users` state has a url of `/users/` + * ```html + * Users + * ``` + * + * ### Parameter Values + * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state. + * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses. + * The content inside the parentheses is an expression, evaluated to the parameter values. + * + * #### Example: + * This example renders a list of links to users. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ user.displayName }} + *
  • + * ``` + * + * Note: + * The parameter values expression is `$watch`ed for updates. + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-sref-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Examples + * If you have the following template: + * + * ```html + * Home + * About + * Next page + * + * + * ``` + * + * Then (assuming the current state is `contacts`) the rendered html including hrefs would be: + * + * ```html + * Home + * About + * Next page + * + *
      + *
    • + * Joe + *
    • + *
    • + * Alice + *
    • + *
    • + * Bob + *
    • + *
    + * + * Home + * ``` + * + * ### Notes + * + * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses. + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * + * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). + * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. + */ +var uiSref; +uiSref = ['$uiRouter', '$timeout', + function $StateRefDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var hookFn; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var ref = parseStateRef(attrs.uiSref); + rawDef.uiState = ref.state; + rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {}; + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + if (ref.paramExpr) { + scope.$watch(ref.paramExpr, function (val) { + rawDef.uiStateParams = extend({}, val); + update(); + }, true); + rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr)); + } + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + } + }; + }]; +/** + * `ui-state`: A fully dynamic directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.** + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to. + * **This is in contrast with `ui-sref`, which takes a state name as a string literal.** + * + * #### Example: + * Create a list of links. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Relative Links + * If the expression evaluates to a relative path, it is processed like [[uiSref]]. + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create relative `ui-state` which always targets the same destination. + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * ### Parameter Values + * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state. + * Param values should be provided using the `ui-state-params` attribute. + * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression. + * + * #### Example: + * This example renders a list of links with param values. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-state-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Notes + * + * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`. + * However, it might be simpler to use [[uiSref]] parameter-only links. + * + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * ``` + */ +var uiState; +uiState = ['$uiRouter', '$timeout', + function $StateRefDynamicDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var hookFn; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts']; + var watchDeregFns = inputAttrs.reduce(function (acc, attr) { return (acc[attr] = noop$1, acc); }, {}); + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + inputAttrs.forEach(function (field) { + rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null; + attrs.$observe(field, function (expr) { + watchDeregFns[field](); + watchDeregFns[field] = scope.$watch(expr, function (newval) { + rawDef[field] = newval; + update(); + }, true); + }); + }); + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + } + }; + }]; +/** + * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active + * + * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the + * related directive's state is active (and remove them when it is inactive). + * + * The primary use-case is to highlight the active link in navigation menus, + * distinguishing it from the inactive menu items. + * + * ### Linking to a `ui-sref` or `ui-state` + * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element. + * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**. + * + * ### Matching + * + * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**. + * This is a "fuzzy match" which uses [[StateService.includes]]. + * + * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active). + * This is an "exact match" which uses [[StateService.is]]. + * + * ### Parameter values + * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted. + * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted. + * + * #### Example: + * ```html + *
  • + * {{ user.lastName }} + *
  • + * ``` + * + * ### Examples + * + * Given the following template: + * #### Example: + * ```html + * + * ``` + * + * When the app state is `app.user` (or any child state), + * and contains the state parameter "user" with value "bilbobaggins", + * the resulting HTML will appear as (note the 'active' class): + * + * ```html + * + * ``` + * + * ### Glob mode + * + * It is possible to pass `ui-sref-active` an expression that evaluates to an object. + * The objects keys represent active class names and values represent the respective state names/globs. + * `ui-sref-active` will match if the current active state **includes** any of + * the specified state names/globs, even the abstract ones. + * + * #### Example: + * Given the following template, with "admin" being an abstract state: + * ```html + *
    + * Roles + *
    + * ``` + * + * When the current state is "admin.roles" the "active" class will be applied to both the
    and elements. + * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. + * + * ### Notes: + * + * - The class name is interpolated **once** during the directives link time (any further changes to the + * interpolated value are ignored). + * + * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` + */ +var uiSrefActive; +uiSrefActive = ['$state', '$stateParams', '$interpolate', '$uiRouter', + function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { + return { + restrict: "A", + controller: ['$scope', '$element', '$attrs', + function ($scope, $element, $attrs) { + var states = [], activeEqClass, uiSrefActive; + // There probably isn't much point in $observing this + // uiSrefActive and uiSrefActiveEq share the same directive object with some + // slight difference in logic routing + activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope); + try { + uiSrefActive = $scope.$eval($attrs.uiSrefActive); + } + catch (e) { + // Do nothing. uiSrefActive is not a valid expression. + // Fall back to using $interpolate below + } + uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope); + if (isObject(uiSrefActive)) { + forEach(uiSrefActive, function (stateOrName, activeClass) { + if (isString(stateOrName)) { + var ref = parseStateRef(stateOrName); + addState(ref.state, $scope.$eval(ref.paramExpr), activeClass); + } + }); + } + // Allow uiSref to communicate with uiSrefActive[Equals] + this.$$addStateInfo = function (newState, newParams) { + // we already got an explicit state provided by ui-sref-active, so we + // shadow the one that comes from ui-sref + if (isObject(uiSrefActive) && states.length > 0) { + return; + } + var deregister = addState(newState, newParams, uiSrefActive); + update(); + return deregister; + }; + function updateAfterTransition(trans) { + trans.promise.then(update, noop$1); + } + $scope.$on('$stateChangeSuccess', update); + $scope.$on('$destroy', $uiRouter.transitionService.onStart({}, updateAfterTransition)); + if ($uiRouter.globals.transition) { + updateAfterTransition($uiRouter.globals.transition); + } + function addState(stateName, stateParams, activeClass) { + var state = $state.get(stateName, stateContext($element)); + var stateInfo = { + state: state || { name: stateName }, + params: stateParams, + activeClass: activeClass + }; + states.push(stateInfo); + return function removeState() { + removeFrom(states)(stateInfo); + }; + } + // Update route state + function update() { + var splitClasses = function (str) { + return str.split(/\s/).filter(identity); + }; + var getClasses = function (stateList) { + return stateList.map(function (x) { return x.activeClass; }).map(splitClasses).reduce(unnestR, []); + }; + var allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(uniqR, []); + var fuzzyClasses = getClasses(states.filter(function (x) { return $state.includes(x.state.name, x.params); })); + var exactlyMatchesAny = !!states.filter(function (x) { return $state.is(x.state.name, x.params); }).length; + var exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : []; + var addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []); + var removeClasses = allClasses.filter(function (cls) { return !inArray(addClasses, cls); }); + $scope.$evalAsync(function () { + addClasses.forEach(function (className) { return $element.addClass(className); }); + removeClasses.forEach(function (className) { return $element.removeClass(className); }); + }); + } + update(); + }] + }; + }]; +ng.module('ui.router.state') + .directive('uiSref', uiSref) + .directive('uiSrefActive', uiSrefActive) + .directive('uiSrefActiveEq', uiSrefActive) + .directive('uiState', uiState); + +/** @module ng1 */ /** for typedoc */ +/** + * `isState` Filter: truthy if the current state is the parameter + * + * Translates to [[StateService.is]] `$state.is("stateName")`. + * + * #### Example: + * ```html + *
    show if state is 'stateName'
    + * ``` + */ +$IsStateFilter.$inject = ['$state']; +function $IsStateFilter($state) { + var isFilter = function (state, params, options) { + return $state.is(state, params, options); + }; + isFilter.$stateful = true; + return isFilter; +} +/** + * `includedByState` Filter: truthy if the current state includes the parameter + * + * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`. + * + * #### Example: + * ```html + *
    show if state includes 'fullOrPartialStateName'
    + * ``` + */ +$IncludedByStateFilter.$inject = ['$state']; +function $IncludedByStateFilter($state) { + var includesFilter = function (state, params, options) { + return $state.includes(state, params, options); + }; + includesFilter.$stateful = true; + return includesFilter; +} +ng.module('ui.router.state') + .filter('isState', $IsStateFilter) + .filter('includedByState', $IncludedByStateFilter); + +/** + * @ng1api + * @module directives + */ /** for typedoc */ +/** + * `ui-view`: A viewport directive which is filled in by a view from the active state. + * + * ### Attributes + * + * - `name`: (Optional) A view name. + * The name should be unique amongst the other views in the same state. + * You can have views of the same name that live in different states. + * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]). + * + * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated. + * Uses [[$uiViewScroll]] to do the scrolling. + * + * - `onload`: Expression to evaluate whenever the view updates. + * + * #### Example: + * A view can be unnamed or named. + * ```html + * + *
    + * + * + *
    + * + * + * + * ``` + * + * You can only have one unnamed view within any template (or root html). If you are only using a + * single view and it is unnamed then you can populate it like so: + * + * ```html + *
    + * $stateProvider.state("home", { + * template: "

    HELLO!

    " + * }) + * ``` + * + * The above is a convenient shortcut equivalent to specifying your view explicitly with the + * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name: + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * But typically you'll only use the views property if you name your view or have more than one view + * in the same template. There's not really a compelling reason to name a view if its the only one, + * but you could if you wanted, like so: + * + * ```html + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "main": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * Really though, you'll use views to set up multiple views: + * + * ```html + *
    + *
    + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * }, + * "chart": { + * template: "" + * }, + * "data": { + * template: "" + * } + * } + * }) + * ``` + * + * #### Examples for `autoscroll`: + * ```html + * + * + * + * + * + * + * + * ``` + * + * Resolve data: + * + * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this + * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template. + * + * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the + * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which + * depends on `$resolve` data. + * + * #### Example: + * ```js + * $stateProvider.state('home', { + * template: '', + * resolve: { + * user: function(UserService) { return UserService.fetchUser(); } + * } + * }); + * ``` + */ +var uiView; +uiView = ['$view', '$animate', '$uiViewScroll', '$interpolate', '$q', + function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { + function getRenderer(attrs, scope) { + return { + enter: function (element, target, cb) { + if (ng.version.minor > 2) { + $animate.enter(element, null, target).then(cb); + } + else { + $animate.enter(element, null, target, cb); + } + }, + leave: function (element, cb) { + if (ng.version.minor > 2) { + $animate.leave(element).then(cb); + } + else { + $animate.leave(element, cb); + } + } + }; + } + function configsEqual(config1, config2) { + return config1 === config2; + } + var rootData = { + $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, + $uiView: {} + }; + var directive = { + count: 0, + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function (tElement, tAttrs, $transclude) { + return function (scope, $element, attrs) { + var previousEl, currentEl, currentScope, unregister, onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(attrs, scope), viewConfig = undefined, inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var activeUIView = { + $type: 'ng1', + id: directive.count++, + name: name, + fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + "." + name : name, + config: null, + configUpdated: configUpdatedCallback, + get creationContext() { + var fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited); + // Allow + // See https://github.com/angular-ui/ui-router/issues/3355 + var fromParentTag = parse('$uiView.creationContext')(inherited); + return fromParentTagConfig || fromParentTag; + } + }; + trace.traceUIViewEvent("Linking", activeUIView); + function configUpdatedCallback(config) { + if (config && !(config instanceof Ng1ViewConfig)) + return; + if (configsEqual(viewConfig, config)) + return; + trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context); + viewConfig = config; + updateView(config); + } + $element.data('$uiView', { $uiView: activeUIView }); + updateView(); + unregister = $view.registerUIView(activeUIView); + scope.$on("$destroy", function () { + trace.traceUIViewEvent("Destroying/Unregistering", activeUIView); + unregister(); + }); + function cleanupLastView() { + if (previousEl) { + trace.traceUIViewEvent("Removing (previous) el", previousEl.data('$uiView')); + previousEl.remove(); + previousEl = null; + } + if (currentScope) { + trace.traceUIViewEvent("Destroying scope", activeUIView); + currentScope.$destroy(); + currentScope = null; + } + if (currentEl) { + var _viewData_1 = currentEl.data('$uiViewAnim'); + trace.traceUIViewEvent("Animate out", _viewData_1); + renderer.leave(currentEl, function () { + _viewData_1.$$animLeave.resolve(); + previousEl = null; + }); + previousEl = currentEl; + currentEl = null; + } + } + function updateView(config) { + var newScope = scope.$new(); + var animEnter = $q.defer(), animLeave = $q.defer(); + var $uiViewData = { + $cfg: config, + $uiView: activeUIView, + }; + var $uiViewAnim = { + $animEnter: animEnter.promise, + $animLeave: animLeave.promise, + $$animLeave: animLeave + }; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoading + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {string} viewName Name of the view. + */ + newScope.$emit('$viewContentLoading', name); + var cloned = $transclude(newScope, function (clone) { + clone.data('$uiViewAnim', $uiViewAnim); + clone.data('$uiView', $uiViewData); + renderer.enter(clone, $element, function onUIViewEnter() { + animEnter.resolve(); + if (currentScope) + currentScope.$emit('$viewContentAnimationEnded'); + if (isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) { + $uiViewScroll(clone); + } + }); + cleanupLastView(); + }); + currentEl = cloned; + currentScope = newScope; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoaded + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description * + * Fired once the view is **loaded**, *after* the DOM is rendered. + * + * @param {Object} event Event object. + */ + currentScope.$emit('$viewContentLoaded', config || viewConfig); + currentScope.$eval(onloadExp); + } + }; + } + }; + return directive; + }]; +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout']; +/** @hidden */ +function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q, $timeout) { + var getControllerAs = parse('viewDecl.controllerAs'); + var getResolveAs = parse('viewDecl.resolveAs'); + return { + restrict: 'ECA', + priority: -400, + compile: function (tElement) { + var initial = tElement.html(); + tElement.empty(); + return function (scope, $element) { + var data = $element.data('$uiView'); + if (!data) { + $element.html(initial); + $compile($element.contents())(scope); + return; + } + var cfg = data.$cfg || { viewDecl: {}, getTemplate: ng_from_import.noop }; + var resolveCtx = cfg.path && new ResolveContext(cfg.path); + $element.html(cfg.getTemplate($element, resolveCtx) || initial); + trace.traceUIViewFill(data.$uiView, $element.html()); + var link = $compile($element.contents()); + var controller = cfg.controller; + var controllerAs = getControllerAs(cfg); + var resolveAs = getResolveAs(cfg); + var locals = resolveCtx && getLocals(resolveCtx); + scope[resolveAs] = locals; + if (controller) { + var controllerInstance = $controller(controller, extend({}, locals, { $scope: scope, $element: $element })); + if (controllerAs) { + scope[controllerAs] = controllerInstance; + scope[controllerAs][resolveAs] = locals; + } + // TODO: Use $view service as a central point for registering component-level hooks + // Then, when a component is created, tell the $view service, so it can invoke hooks + // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element }); + // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); + $element.data('$ngControllerController', controllerInstance); + $element.children().data('$ngControllerController', controllerInstance); + registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); + } + // Wait for the component to appear in the DOM + if (isString(cfg.viewDecl.component)) { + var cmp_1 = cfg.viewDecl.component; + var kebobName = kebobString(cmp_1); + var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", "i"); + var getComponentController = function () { + var directiveEl = [].slice.call($element[0].children) + .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); + return directiveEl && ng.element(directiveEl).data("$" + cmp_1 + "Controller"); + }; + var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { + if (!ctrlInstance) + return; + registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); + deregisterWatch_1(); + }); + } + link(scope); + }; + } + }; +} +/** @hidden */ +var hasComponentImpl = typeof ng.module('ui.router')['component'] === 'function'; +/** @hidden incrementing id */ +var _uiCanExitId = 0; +/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ +function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { + // Call $onInit() ASAP + if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) { + controllerInstance.$onInit(); + } + var viewState = tail(cfg.path).state.self; + var hookOptions = { bind: controllerInstance }; + // Add component-level hook for onParamsChange + if (isFunction(controllerInstance.uiOnParamsChanged)) { + var resolveContext = new ResolveContext(cfg.path); + var viewCreationTrans_1 = resolveContext.getResolvable('$transition$').data; + // Fire callback on any successful transition + var paramsUpdated = function ($transition$) { + // Exit early if the $transition$ is the same as the view was created within. + // Exit early if the $transition$ will exit the state the view is for. + if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) + return; + var toParams = $transition$.params("to"); + var fromParams = $transition$.params("from"); + var toSchema = $transition$.treeChanges().to.map(function (node) { return node.paramSchema; }).reduce(unnestR, []); + var fromSchema = $transition$.treeChanges().from.map(function (node) { return node.paramSchema; }).reduce(unnestR, []); + // Find the to params that have different values than the from params + var changedToParams = toSchema.filter(function (param) { + var idx = fromSchema.indexOf(param); + return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]); + }); + // Only trigger callback if a to param has changed or is new + if (changedToParams.length) { + var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); + // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. + var newValues = filter(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); + controllerInstance.uiOnParamsChanged(newValues, $transition$); + } + }; + $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions)); + } + // Add component-level hook for uiCanExit + if (isFunction(controllerInstance.uiCanExit)) { + var id_1 = _uiCanExitId++; + var cacheProp_1 = '_uiCanExitIds'; + // Returns true if a redirect transition already answered truthy + var prevTruthyAnswer_1 = function (trans) { + return !!trans && (trans[cacheProp_1] && trans[cacheProp_1][id_1] === true || prevTruthyAnswer_1(trans.redirectedFrom())); + }; + // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition + var wrappedHook = function (trans) { + var promise, ids = trans[cacheProp_1] = trans[cacheProp_1] || {}; + if (!prevTruthyAnswer_1(trans)) { + promise = $q.when(controllerInstance.uiCanExit(trans)); + promise.then(function (val) { return ids[id_1] = (val !== false); }); + } + return promise; + }; + var criteria = { exiting: viewState.name }; + $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions)); + } +} +ng.module('ui.router.state').directive('uiView', uiView); +ng.module('ui.router.state').directive('uiView', $ViewDirectiveFill); + +/** @module ng1 */ /** */ +/** @hidden */ +function $ViewScrollProvider() { + var useAnchorScroll = false; + this.useAnchorScroll = function () { + useAnchorScroll = true; + }; + this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) { + if (useAnchorScroll) { + return $anchorScroll; + } + return function ($element) { + return $timeout(function () { + $element[0].scrollIntoView(); + }, 0, false); + }; + }]; +} +ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); + +/** + * Main entry point for angular 1.x build + * @module ng1 + */ /** */ +var index = "ui.router"; + +exports['default'] = index; +exports.core = index$1; +exports.watchDigests = watchDigests; +exports.getLocals = getLocals; +exports.getNg1ViewConfigFactory = getNg1ViewConfigFactory; +exports.ng1ViewsBuilder = ng1ViewsBuilder; +exports.Ng1ViewConfig = Ng1ViewConfig; +exports.StateProvider = StateProvider; +exports.UrlRouterProvider = UrlRouterProvider; +exports.root = root; +exports.fromJson = fromJson; +exports.toJson = toJson; +exports.forEach = forEach; +exports.extend = extend; +exports.equals = equals; +exports.identity = identity; +exports.noop = noop$1; +exports.createProxyFunctions = createProxyFunctions; +exports.inherit = inherit; +exports.inArray = inArray; +exports._inArray = _inArray; +exports.removeFrom = removeFrom; +exports._removeFrom = _removeFrom; +exports.pushTo = pushTo; +exports._pushTo = _pushTo; +exports.deregAll = deregAll; +exports.defaults = defaults; +exports.mergeR = mergeR; +exports.ancestors = ancestors; +exports.pick = pick; +exports.omit = omit; +exports.pluck = pluck; +exports.filter = filter; +exports.find = find; +exports.mapObj = mapObj; +exports.map = map; +exports.values = values; +exports.allTrueR = allTrueR; +exports.anyTrueR = anyTrueR; +exports.unnestR = unnestR; +exports.flattenR = flattenR; +exports.pushR = pushR; +exports.uniqR = uniqR; +exports.unnest = unnest; +exports.flatten = flatten; +exports.assertPredicate = assertPredicate; +exports.assertMap = assertMap; +exports.assertFn = assertFn; +exports.pairs = pairs; +exports.arrayTuples = arrayTuples; +exports.applyPairs = applyPairs; +exports.tail = tail; +exports.copy = copy; +exports._extend = _extend; +exports.silenceUncaughtInPromise = silenceUncaughtInPromise; +exports.silentRejection = silentRejection; +exports.notImplemented = notImplemented; +exports.services = services; +exports.Glob = Glob; +exports.curry = curry; +exports.compose = compose; +exports.pipe = pipe; +exports.prop = prop; +exports.propEq = propEq; +exports.parse = parse; +exports.not = not; +exports.and = and; +exports.or = or; +exports.all = all; +exports.any = any; +exports.is = is; +exports.eq = eq; +exports.val = val; +exports.invoke = invoke; +exports.pattern = pattern; +exports.isUndefined = isUndefined; +exports.isDefined = isDefined; +exports.isNull = isNull; +exports.isNullOrUndefined = isNullOrUndefined; +exports.isFunction = isFunction; +exports.isNumber = isNumber; +exports.isString = isString; +exports.isObject = isObject; +exports.isArray = isArray; +exports.isDate = isDate; +exports.isRegExp = isRegExp; +exports.isState = isState; +exports.isInjectable = isInjectable; +exports.isPromise = isPromise; +exports.Queue = Queue; +exports.maxLength = maxLength; +exports.padString = padString; +exports.kebobString = kebobString; +exports.functionToString = functionToString; +exports.fnToString = fnToString; +exports.stringify = stringify; +exports.beforeAfterSubstr = beforeAfterSubstr; +exports.hostRegex = hostRegex; +exports.stripFile = stripFile; +exports.splitHash = splitHash; +exports.splitQuery = splitQuery; +exports.splitEqual = splitEqual; +exports.trimHashVal = trimHashVal; +exports.splitOnDelim = splitOnDelim; +exports.joinNeighborsR = joinNeighborsR; +exports.Trace = Trace; +exports.trace = trace; +exports.Param = Param; +exports.ParamTypes = ParamTypes; +exports.StateParams = StateParams; +exports.ParamType = ParamType; +exports.PathNode = PathNode; +exports.PathUtils = PathUtils; +exports.resolvePolicies = resolvePolicies; +exports.defaultResolvePolicy = defaultResolvePolicy; +exports.Resolvable = Resolvable; +exports.NATIVE_INJECTOR_TOKEN = NATIVE_INJECTOR_TOKEN; +exports.ResolveContext = ResolveContext; +exports.resolvablesBuilder = resolvablesBuilder; +exports.StateBuilder = StateBuilder; +exports.StateObject = StateObject; +exports.StateMatcher = StateMatcher; +exports.StateQueueManager = StateQueueManager; +exports.StateRegistry = StateRegistry; +exports.StateService = StateService; +exports.TargetState = TargetState; +exports.HookBuilder = HookBuilder; +exports.matchState = matchState; +exports.RegisteredHook = RegisteredHook; +exports.makeEvent = makeEvent; +exports.Rejection = Rejection; +exports.Transition = Transition; +exports.TransitionHook = TransitionHook; +exports.TransitionEventType = TransitionEventType; +exports.defaultTransOpts = defaultTransOpts; +exports.TransitionService = TransitionService; +exports.UrlMatcher = UrlMatcher; +exports.UrlMatcherFactory = UrlMatcherFactory; +exports.UrlRouter = UrlRouter; +exports.UrlRuleFactory = UrlRuleFactory; +exports.BaseUrlRule = BaseUrlRule; +exports.UrlService = UrlService; +exports.ViewService = ViewService; +exports.UIRouterGlobals = UIRouterGlobals; +exports.UIRouter = UIRouter; +exports.$q = $q; +exports.$injector = $injector; +exports.BaseLocationServices = BaseLocationServices; +exports.HashLocationService = HashLocationService; +exports.MemoryLocationService = MemoryLocationService; +exports.PushStateLocationService = PushStateLocationService; +exports.MemoryLocationConfig = MemoryLocationConfig; +exports.BrowserLocationConfig = BrowserLocationConfig; +exports.keyValsToObjectR = keyValsToObjectR; +exports.getParams = getParams; +exports.parseUrl = parseUrl$1; +exports.buildUrl = buildUrl; +exports.locationPluginFactory = locationPluginFactory; +exports.servicesPlugin = servicesPlugin; +exports.hashLocationPlugin = hashLocationPlugin; +exports.pushStateLocationPlugin = pushStateLocationPlugin; +exports.memoryLocationPlugin = memoryLocationPlugin; +exports.UIRouterPluginBase = UIRouterPluginBase; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=angular-ui-router.js.map diff --git a/webchat/video/video.html b/webchat/video/video.html new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html new file mode 100644 index 000000000..e69de29bb From 143fa04e3ab4d1998545f076a8138131e3acf5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 2 Dec 2018 19:33:24 -0300 Subject: [PATCH 010/237] Add $urlRouterProvider --- webchat/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 0e4d330c8..108e4ce22 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -5,7 +5,7 @@ 'ui.router', ]); - app.config(function($stateProvider) { + app.config(function($stateProvider, $urlRouterProvider) { $stateProvider .state("webchat", { abstract: true, @@ -51,7 +51,11 @@ controller: "LoginController as controller", }, }, - }) + }); + + $urlRouterProvider.otherwise("/"); + + }); (function main() { From dcdbbe25639eec75dce5c29c4f276594abf6d5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 2 Dec 2018 19:35:50 -0300 Subject: [PATCH 011/237] Add redirect to call view --- frontend/sw.js | 2 +- webchat/app.js | 9 +++++++++ webchat/call/call.html | 0 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 webchat/call/call.html diff --git a/frontend/sw.js b/frontend/sw.js index b8bb9a801..a745db7a7 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -7,7 +7,7 @@ importScripts('app/firebase-config.js'); importScripts('app/config.js'); // if the line number of the code below changes, modify the /ecis script. - const CACHE_SUFIX = 'webchat'; + const CACHE_SUFIX = 'webchat-ui-router'; let messaging; diff --git a/webchat/app.js b/webchat/app.js index 108e4ce22..530a733a9 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -34,6 +34,15 @@ }, }, }) + .state("webchat.call", { + url: "/call", + views: { + content: { + templateUrl: "app/video/call.html", + controller: "CallController as controller", + }, + }, + }) .state("webchat.video", { url: "/video", views: { diff --git a/webchat/call/call.html b/webchat/call/call.html new file mode 100644 index 000000000..e69de29bb From b8a2facfadcedf1162bfc0bca2e9dcf9b96b43c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 2 Dec 2018 08:24:55 -0300 Subject: [PATCH 012/237] Change CACHE_SUFIX to be master --- frontend/sw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/sw.js b/frontend/sw.js index a745db7a7..4bca0fe8a 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -7,7 +7,7 @@ importScripts('app/firebase-config.js'); importScripts('app/config.js'); // if the line number of the code below changes, modify the /ecis script. - const CACHE_SUFIX = 'webchat-ui-router'; + const CACHE_SUFIX = 'master'; let messaging; From 993bd3bded089ad51dabe716de203af9f6039b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 2 Dec 2018 08:26:52 -0300 Subject: [PATCH 013/237] Remove some whitespaces --- webchat/app.js | 1 - webchat/index.html | 1 - 2 files changed, 2 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 530a733a9..e61ac56e4 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -64,7 +64,6 @@ $urlRouterProvider.otherwise("/"); - }); (function main() { diff --git a/webchat/index.html b/webchat/index.html index d8ab61237..1c4ec9d8d 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -70,6 +70,5 @@ - From 413cf0e6203d1499c19a2e8ccfd14d61a880fa18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 4 Dec 2018 17:07:11 -0300 Subject: [PATCH 014/237] Set esversion on jshint to es6 --- .jshintrc | 3 ++- webchat/app.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.jshintrc b/.jshintrc index 1404a8ba8..eca7516f7 100644 --- a/.jshintrc +++ b/.jshintrc @@ -24,5 +24,6 @@ "jsonpatch", "CryptoJS", "firebase" - ] + ], + "esversion": 6 } \ No newline at end of file diff --git a/webchat/app.js b/webchat/app.js index e61ac56e4..511b89597 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -66,7 +66,10 @@ }); - (function main() { + const main = () => { console.log("app running"); - })(); + }; + + main(); + })(); \ No newline at end of file From 50b4ed7990d8e20f0ddcb03567270bcac1e9c63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 4 Dec 2018 17:08:41 -0300 Subject: [PATCH 015/237] Add states constant to app --- webchat/app.js | 33 +++++++++++++++++++++++---------- webchat/index.html | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 511b89597..728972f9b 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -1,13 +1,26 @@ -'use strict'; - (function() { - var app = angular.module('app', [ + 'use strict'; + + const app = angular.module('webchat', [ 'ui.router', ]); - app.config(function($stateProvider, $urlRouterProvider) { + const rootName = 'webchat'; + app.constant('WEBCHAT', { + states: { + abstract: 'webchat', + home: `${rootName}.home`, + call: `${rootName}.call`, + chat: `${rootName}.chat`, + video: `${rootName}.video`, + login: 'login', + }, + currentUser: null, + }); + + app.config((WEBCHAT, $stateProvider, $urlRouterProvider) => { $stateProvider - .state("webchat", { + .state(WEBCHAT.states.abstract, { abstract: true, views: { main: { @@ -16,7 +29,7 @@ }, }, }) - .state("webchat.home", { + .state(WEBCHAT.states.home, { url: "/", views: { content: { @@ -25,7 +38,7 @@ }, }, }) - .state("webchat.chat", { + .state(WEBCHAT.states.chat, { url: "/chat", views: { content: { @@ -34,7 +47,7 @@ }, }, }) - .state("webchat.call", { + .state(WEBCHAT.states.call, { url: "/call", views: { content: { @@ -43,7 +56,7 @@ }, }, }) - .state("webchat.video", { + .state(WEBCHAT.states.video, { url: "/video", views: { content: { @@ -52,7 +65,7 @@ }, }, }) - .state("login", { + .state(WEBCHAT.states.login, { url: "/login", views: { main: { diff --git a/webchat/index.html b/webchat/index.html index 1c4ec9d8d..a88e35a65 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -26,7 +26,7 @@ - +
    From 20cd25e5b2704188022e205c64b7fc6cdddfeed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 4 Dec 2018 17:11:12 -0300 Subject: [PATCH 016/237] Add views controller structure --- webchat/auth/loginController.js | 17 +++++++++++++++++ webchat/call/callController.js | 17 +++++++++++++++++ webchat/chat/chatController.js | 17 +++++++++++++++++ webchat/home/home.html | 1 + webchat/home/homeController.js | 17 +++++++++++++++++ webchat/index.html | 6 ++++++ webchat/video/videoController.js | 17 +++++++++++++++++ webchat/webchat/webchat.html | 2 ++ webchat/webchat/webchatController.js | 17 +++++++++++++++++ 9 files changed, 111 insertions(+) create mode 100644 webchat/auth/loginController.js create mode 100644 webchat/call/callController.js create mode 100644 webchat/chat/chatController.js create mode 100644 webchat/home/homeController.js create mode 100644 webchat/video/videoController.js create mode 100644 webchat/webchat/webchatController.js diff --git a/webchat/auth/loginController.js b/webchat/auth/loginController.js new file mode 100644 index 000000000..d708404ba --- /dev/null +++ b/webchat/auth/loginController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('LoginController', function LoginController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('LoginController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file diff --git a/webchat/call/callController.js b/webchat/call/callController.js new file mode 100644 index 000000000..5a745dc66 --- /dev/null +++ b/webchat/call/callController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('CallController', function CallController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('CallController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file diff --git a/webchat/chat/chatController.js b/webchat/chat/chatController.js new file mode 100644 index 000000000..134b76a4a --- /dev/null +++ b/webchat/chat/chatController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('ChatController', function ChatController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('ChatController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file diff --git a/webchat/home/home.html b/webchat/home/home.html index e69de29bb..987cac423 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -0,0 +1 @@ +

    HOME

    \ No newline at end of file diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js new file mode 100644 index 000000000..835647edf --- /dev/null +++ b/webchat/home/homeController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('HomeController', function HomeController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('HomeController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index a88e35a65..16f8692d2 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -70,5 +70,11 @@ + + + + + + diff --git a/webchat/video/videoController.js b/webchat/video/videoController.js new file mode 100644 index 000000000..cdfd422f4 --- /dev/null +++ b/webchat/video/videoController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('VideoController', function VideoController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('VideoController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html index e69de29bb..74aab521f 100644 --- a/webchat/webchat/webchat.html +++ b/webchat/webchat/webchat.html @@ -0,0 +1,2 @@ +

    WEBCHAT

    +
    \ No newline at end of file diff --git a/webchat/webchat/webchatController.js b/webchat/webchat/webchatController.js new file mode 100644 index 000000000..dccb31f83 --- /dev/null +++ b/webchat/webchat/webchatController.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('WebchatController', function WebchatController ($scope, $state) { + const controller = this; + + const main = () => { + console.log('WebchatController running'); + }; + + main(); + + }); + +})(); \ No newline at end of file From 0a6bf18e998b555c93c9aa420dcb569b73b5b96b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 4 Dec 2018 17:54:24 -0300 Subject: [PATCH 017/237] Change general (WEBCHAT) constant to specific (STATE) constant --- webchat/app.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 728972f9b..4e7c5b621 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -6,21 +6,18 @@ ]); const rootName = 'webchat'; - app.constant('WEBCHAT', { - states: { + app.constant('STATES', { abstract: 'webchat', home: `${rootName}.home`, call: `${rootName}.call`, chat: `${rootName}.chat`, video: `${rootName}.video`, login: 'login', - }, - currentUser: null, - }); + }); - app.config((WEBCHAT, $stateProvider, $urlRouterProvider) => { + app.config((STATES, $stateProvider, $urlRouterProvider) => { $stateProvider - .state(WEBCHAT.states.abstract, { + .state(STATES.abstract, { abstract: true, views: { main: { @@ -29,7 +26,7 @@ }, }, }) - .state(WEBCHAT.states.home, { + .state(STATES.home, { url: "/", views: { content: { @@ -38,7 +35,7 @@ }, }, }) - .state(WEBCHAT.states.chat, { + .state(STATES.chat, { url: "/chat", views: { content: { @@ -47,7 +44,7 @@ }, }, }) - .state(WEBCHAT.states.call, { + .state(STATES.call, { url: "/call", views: { content: { @@ -56,7 +53,7 @@ }, }, }) - .state(WEBCHAT.states.video, { + .state(STATES.video, { url: "/video", views: { content: { @@ -65,7 +62,7 @@ }, }, }) - .state(WEBCHAT.states.login, { + .state(STATES.login, { url: "/login", views: { main: { From a16fac62285a52c7ba975bce4af012663287a4fc Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 5 Dec 2018 13:00:26 -0300 Subject: [PATCH 018/237] Add compatible sed to ecis script --- ecis | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ecis b/ecis index c7f42fbbe..3de40ca3a 100755 --- a/ecis +++ b/ecis @@ -77,10 +77,11 @@ function set_config_file { url=$3; service_name=$4; - sed -i "$line s|.*| $service: '$url',|" $FRONTEND_CONFIG_FILE - sed -i "$line s|.*| $service: '$url',|" $SUPPORT_CONFIG_FILE - sed -i "$line s|.*| $service: '$url',|" $LANDINGPAGE_CONFIG_FILE - sed -i "$line s|.*| $service: '$url',|" $WEBCHAT_CONFIG_FILE + tmpfile=$(mktemp) + sed "$line s|.*| $service: '$url',|" $FRONTEND_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $FRONTEND_CONFIG_FILE + sed "$line s|.*| $service: '$url',|" $SUPPORT_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $SUPPORT_CONFIG_FILE + sed "$line s|.*| $service: '$url',|" $LANDINGPAGE_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $LANDINGPAGE_CONFIG_FILE + sed "$line s|.*| $service: '$url',|" $WEBCHAT_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $WEBCHAT_CONFIG_FILE catch_error $? "Frontend will use ${bold}$url${_bold} as $service_name." catch_error $? "Support will use ${bold}$url${_bold} as $service_name." @@ -91,7 +92,7 @@ function set_backend_url { service="BACKEND_URL"; line=4; service_name="backend"; - set_config_file $line $service $url $service_name; + set_config_file $line $service $url $service_name; } function set_landingpage_url { @@ -127,18 +128,20 @@ function set_webchat_url { } function set_app_version_config { - sed -i "9s|.*| APP_VERSION: '$1'|" $FRONTEND_CONFIG_FILE + tmpfile=$(mktemp) + sed "9s|.*| APP_VERSION: '$1'|" $FRONTEND_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $FRONTEND_CONFIG_FILE catch_error $? "APP VERSION on Frontend $1" - sed -i "9s|.*| APP_VERSION: '$1'|" $SUPPORT_CONFIG_FILE + sed "9s|.*| APP_VERSION: '$1'|" $SUPPORT_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $SUPPORT_CONFIG_FILE catch_error $? "APP VERSION on Support $1" - sed -i "9s|.*| APP_VERSION: '$1'|" $LANDINGPAGE_CONFIG_FILE + sed "9s|.*| APP_VERSION: '$1'|" $LANDINGPAGE_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $LANDINGPAGE_CONFIG_FILE catch_error $? "APP VERSION on LandingPage $1" - sed -i "9s|.*| APP_VERSION: '$1'|" $WEBCHAT_CONFIG_FILE + sed "9s|.*| APP_VERSION: '$1'|" $WEBCHAT_CONFIG_FILE > "$tmpfile" && mv "$tmpfile" $WEBCHAT_CONFIG_FILE catch_error $? "APP VERSION on LandingPage $1" } function set_cache_suffix_sw { - sed -i "10s|.*| const CACHE_SUFIX = '$1';|" $SW_FILE + tmpfile=$(mktemp) + sed "10s|.*| const CACHE_SUFIX = '$1';|" $SW_FILE > "$tmpfile" && mv "$tmpfile" $SW_FILE catch_error $? "CACHE_SUFIX on SW $1" } @@ -251,7 +254,7 @@ case "$1" in if [ "$3" == "--clean" ]; then rm -rf node_modules bower_components fi - + if [ ! -e node_modules ]; then yarn add package.json catch_error $? "Node modules installed with success" @@ -276,7 +279,7 @@ case "$1" in echo "=========== Starting Backend Tests ===========" source $PY_ENV/bin/activate setup_app_version "master" - + cd backend echo 'FIREBASE_URL = "FIREBASE_URL"' > firebase_config.py echo 'SERVER_KEY = "SERVER_KEY"' >> firebase_config.py @@ -342,9 +345,9 @@ case "$1" in DOMAIN="$APP_NAME.appspot.com" BACKEND_DOMAIN="backend-dot-$DOMAIN" - + ENVIRONMENT="development" - read -p "${bold}Choose which environment to use: (development) ${_bold} " NEW_ENVIRONMENT + read -p "${bold}Choose which environment to use: (development) ${_bold} " NEW_ENVIRONMENT if [ "$NEW_ENVIRONMENT" != "" ]; then ENVIRONMENT=$NEW_ENVIRONMENT fi From 3c9dfce91d6cb158c889384e9baf2f76759a4f49 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 5 Dec 2018 13:04:46 -0300 Subject: [PATCH 019/237] Add icons, logo and base login.css --- webchat/auth/login.css | 49 ++++++++++++++++++++++ webchat/icons/facebook-icon.svg | 37 ++++++++++++++++ webchat/icons/google-icon.svg | 72 ++++++++++++++++++++++++++++++++ webchat/icons/twitter-icon.svg | 38 +++++++++++++++++ webchat/images/logowithname.png | Bin 0 -> 82243 bytes 5 files changed, 196 insertions(+) create mode 100644 webchat/auth/login.css create mode 100644 webchat/icons/facebook-icon.svg create mode 100644 webchat/icons/google-icon.svg create mode 100644 webchat/icons/twitter-icon.svg create mode 100644 webchat/images/logowithname.png diff --git a/webchat/auth/login.css b/webchat/auth/login.css new file mode 100644 index 000000000..f89c09150 --- /dev/null +++ b/webchat/auth/login.css @@ -0,0 +1,49 @@ +.login-btn { + margin: 0 0 1em auto; + text-align: left; + color: white; + width: 100%; +} + +.login-btn md-icon { + margin: 0 0.5em; + color: white; +} + +.login-text { + text-align: justify; +} + +.login-form { + margin: 1em 0; +} + +.login-card { + max-height: 96vh; + padding: 2em; +} + +.limit-width { + max-width: 480px; +} + +img.ec-logo { + width: 80%; + margin: 1em; +} + +.login-card-footer { + background-color: #E6E6E6; +} + +@media screen and (max-width: 320px) { + #login-logo { + width: 80%; + } +} + +@media screen and (max-width: 420px) { + .login-card-content { + width: 92%; + } +} diff --git a/webchat/icons/facebook-icon.svg b/webchat/icons/facebook-icon.svg new file mode 100644 index 000000000..1b9d17dae --- /dev/null +++ b/webchat/icons/facebook-icon.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webchat/icons/google-icon.svg b/webchat/icons/google-icon.svg new file mode 100644 index 000000000..800402771 --- /dev/null +++ b/webchat/icons/google-icon.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webchat/icons/twitter-icon.svg b/webchat/icons/twitter-icon.svg new file mode 100644 index 000000000..ecc520f50 --- /dev/null +++ b/webchat/icons/twitter-icon.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webchat/images/logowithname.png b/webchat/images/logowithname.png new file mode 100644 index 0000000000000000000000000000000000000000..f27b230718ac9cc754154cddd71fb71a6f06fd7c GIT binary patch literal 82243 zcmeFYc{r4B)BrrTkRquhTaid1vSb~}5)vY^7umP$24j$tY$f|PWZ$#zL?l_pzAstF z*akC9hMD=E(eHh)>-+z^zQ5k*k9y2=?)yIHKKnWM9j^0K?fltmXF(v)dG*K2&p;sB zK@f<_o9+zoOP1KhWZ*wGPn8#*dagE}KCj%ZK@VTMT3TOMcYbAS{mlB+YlvHqwH$~- zaaCRUp}z0*)*M5enO8bLzKt%FE_U)>^NQ}?!!5>`>shoP$aHM$BdiIkWSR`JjT;F&^dZ4WaRAQ$zdv^E#o`n?)N1Bl zsHH8NKmz;=?94hpdzH2SG7=t${W2p#PsT|RO*a^vA-i9sNn4rP?j(IjD|9uY=Ir-s z9>o|PLah@U0i_0(E>b_mzfmoS5vwdO-X>s@VBH&Zh2q!td#9seZ7{xvU7Y50I$Qd| z;4&FtI^KIRe*$zIL7w`NPus*y#tGPLIL8FX={(yknN()FOatYQRa2?39Vt!?ooT3l zUzjtgIK5V$C;kjrV@_joI3JYpaaT?WE0ID;{(haCLS|5uOw-1eO?(0<={Z2q5qbTn ze*l>hl%AQ+WB^5P4`}V(@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~?p(gTjTyQx^Ee2(m8?sbgPQ~Dl4jUb8sVsc^aVU7YhL@Hy`kD%#6q z%*D5y^jtJ-<}8oR1`{}Cy48-P`qW^YapNT= Date: Wed, 12 Dec 2018 09:11:47 -0300 Subject: [PATCH 020/237] Add login page and loginCard component --- webchat/app.js | 12 +++++- webchat/auth/login.css | 53 ++++++++++++++------------ webchat/auth/login.html | 3 ++ webchat/auth/loginCard.html | 66 +++++++++++++++++++++++++++++++++ webchat/auth/loginCard.js | 35 +++++++++++++++++ webchat/auth/loginController.js | 6 ++- webchat/ecis.css | 10 +++++ webchat/home/home.html | 2 +- webchat/home/homeController.js | 4 +- webchat/index.html | 16 +++++--- 10 files changed, 172 insertions(+), 35 deletions(-) create mode 100644 webchat/auth/loginCard.html create mode 100644 webchat/auth/loginCard.js create mode 100644 webchat/ecis.css diff --git a/webchat/app.js b/webchat/app.js index 4e7c5b621..b337c66df 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -3,6 +3,7 @@ const app = angular.module('webchat', [ 'ui.router', + 'ngMaterial' ]); const rootName = 'webchat'; @@ -15,7 +16,14 @@ login: 'login', }); - app.config((STATES, $stateProvider, $urlRouterProvider) => { + app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider) => { + $mdIconProvider.fontSet('md', 'material-icons'); + $mdThemingProvider.theme('docs-dark'); + $mdThemingProvider.theme('input') + .primaryPalette('green'); + $mdThemingProvider.theme('dialogTheme') + .primaryPalette('teal'); + $stateProvider .state(STATES.abstract, { abstract: true, @@ -82,4 +90,4 @@ main(); -})(); \ No newline at end of file +})(); diff --git a/webchat/auth/login.css b/webchat/auth/login.css index f89c09150..38537839a 100644 --- a/webchat/auth/login.css +++ b/webchat/auth/login.css @@ -1,35 +1,46 @@ +img.ec-logo { + width: 80%; + margin: 1em; +} + +.limit-width { + max-width: 480px; +} + .login-btn { margin: 0 0 1em auto; - text-align: left; - color: white; width: 100%; } .login-btn md-icon { - margin: 0 0.5em; color: white; + margin-right: 0.5em; + text-align: center; } -.login-text { - text-align: justify; +#login-invite-icon { + font-size: 1.3em; + line-height: 24px; + margin-left: 0.3em; } -.login-form { - margin: 1em 0; +#login-google-icon { + margin-left: 0.5em; } -.login-card { - max-height: 96vh; - padding: 2em; +#login-google-icon svg { + height: auto; + width: 1.3em; + line-height: auto; + margin: 0.155em 0.2em; } -.limit-width { - max-width: 480px; +.login-text { + text-align: justify; } -img.ec-logo { - width: 80%; - margin: 1em; +.login-form { + margin: 1em 0; } .login-card-footer { @@ -37,13 +48,7 @@ img.ec-logo { } @media screen and (max-width: 320px) { - #login-logo { - width: 80%; - } -} - -@media screen and (max-width: 420px) { - .login-card-content { - width: 92%; - } + img.ec-logo { + width: 60%; + } } diff --git a/webchat/auth/login.html b/webchat/auth/login.html index e69de29bb..98e7f132c 100644 --- a/webchat/auth/login.html +++ b/webchat/auth/login.html @@ -0,0 +1,3 @@ + + + diff --git a/webchat/auth/loginCard.html b/webchat/auth/loginCard.html new file mode 100644 index 000000000..0318e4277 --- /dev/null +++ b/webchat/auth/loginCard.html @@ -0,0 +1,66 @@ + +
    + + + + diff --git a/webchat/auth/loginCard.js b/webchat/auth/loginCard.js new file mode 100644 index 000000000..4133fe15d --- /dev/null +++ b/webchat/auth/loginCard.js @@ -0,0 +1,35 @@ +'use strict'; + +(function() { + function LoginCardController() { + let ctrl = this; + ctrl.user = {}; + + ctrl.signIn = () => { + // login with AuthService + ctrl.onLogin(); + } + + ctrl.$onInit = () => { + if (angular.isUndefined(ctrl.email) || ctrl.email === null) + ctrl.email = true; + if (angular.isUndefined(ctrl.google) || ctrl.google === null) + ctrl.google = true; + if (angular.isUndefined(ctrl.email) || ctrl.invite === null) + ctrl.invite = true; + } + } + + angular.module('webchat') + .component('loginCard', { + templateUrl: 'app/auth/loginCard.html', + controller: LoginCardController, + controllerAs: 'ctrl', + bindings: { + email: '<', + google: '<', + invite: '<', + onLogin: '&', + }, + }); +})(); diff --git a/webchat/auth/loginController.js b/webchat/auth/loginController.js index d708404ba..62f4a103f 100644 --- a/webchat/auth/loginController.js +++ b/webchat/auth/loginController.js @@ -6,6 +6,10 @@ webchat.controller('LoginController', function LoginController ($scope, $state) { const controller = this; + controller.success = () => { + console.log('Login done'); + } + const main = () => { console.log('LoginController running'); }; @@ -14,4 +18,4 @@ }); -})(); \ No newline at end of file +})(); diff --git a/webchat/ecis.css b/webchat/ecis.css new file mode 100644 index 000000000..8fd349696 --- /dev/null +++ b/webchat/ecis.css @@ -0,0 +1,10 @@ +ec-content { + display: grid; + align-items: center; + justify-items: center; + position: relative; + min-height: 100vh; + width: 100%; + margin: 0; + overflow: auto; +} diff --git a/webchat/home/home.html b/webchat/home/home.html index 987cac423..09fe625b0 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1 +1 @@ -

    HOME

    \ No newline at end of file +

    HOME

    diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 835647edf..2b45eef1c 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -8,10 +8,12 @@ const main = () => { console.log('HomeController running'); + console.log('Redirecting to login'); + $state.go('login') }; main(); }); -})(); \ No newline at end of file +})(); diff --git a/webchat/index.html b/webchat/index.html index 16f8692d2..e51d8a7f9 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -6,7 +6,7 @@ Plataforma CIS - + @@ -23,18 +23,20 @@ - + + +
    - + + From 467719bbf094d9d46b5a6f5bb2bd11edb04dbdce Mon Sep 17 00:00:00 2001 From: Pedro Espindula Date: Wed, 12 Dec 2018 11:28:23 -0300 Subject: [PATCH 021/237] Remove Call and Video states --- webchat/app.js | 20 -------------------- webchat/call/call.html | 0 webchat/call/callController.js | 17 ----------------- webchat/index.html | 2 -- webchat/video/video.html | 0 webchat/video/videoController.js | 17 ----------------- 6 files changed, 56 deletions(-) delete mode 100644 webchat/call/call.html delete mode 100644 webchat/call/callController.js delete mode 100644 webchat/video/video.html delete mode 100644 webchat/video/videoController.js diff --git a/webchat/app.js b/webchat/app.js index 4e7c5b621..bb4b54815 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -9,9 +9,7 @@ app.constant('STATES', { abstract: 'webchat', home: `${rootName}.home`, - call: `${rootName}.call`, chat: `${rootName}.chat`, - video: `${rootName}.video`, login: 'login', }); @@ -44,24 +42,6 @@ }, }, }) - .state(STATES.call, { - url: "/call", - views: { - content: { - templateUrl: "app/video/call.html", - controller: "CallController as controller", - }, - }, - }) - .state(STATES.video, { - url: "/video", - views: { - content: { - templateUrl: "app/video/video.html", - controller: "VideoController as controller", - }, - }, - }) .state(STATES.login, { url: "/login", views: { diff --git a/webchat/call/call.html b/webchat/call/call.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/webchat/call/callController.js b/webchat/call/callController.js deleted file mode 100644 index 5a745dc66..000000000 --- a/webchat/call/callController.js +++ /dev/null @@ -1,17 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('CallController', function CallController ($scope, $state) { - const controller = this; - - const main = () => { - console.log('CallController running'); - }; - - main(); - - }); - -})(); \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index 16f8692d2..10f21a1b0 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -71,10 +71,8 @@ - - diff --git a/webchat/video/video.html b/webchat/video/video.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/webchat/video/videoController.js b/webchat/video/videoController.js deleted file mode 100644 index cdfd422f4..000000000 --- a/webchat/video/videoController.js +++ /dev/null @@ -1,17 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('VideoController', function VideoController ($scope, $state) { - const controller = this; - - const main = () => { - console.log('VideoController running'); - }; - - main(); - - }); - -})(); \ No newline at end of file From f6875b369c2190e27e0022ca13df615fd3857f63 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 17 Dec 2018 11:38:43 -0300 Subject: [PATCH 022/237] Remove console.log statements --- webchat/auth/loginController.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/webchat/auth/loginController.js b/webchat/auth/loginController.js index 62f4a103f..91bad4ded 100644 --- a/webchat/auth/loginController.js +++ b/webchat/auth/loginController.js @@ -7,11 +7,9 @@ const controller = this; controller.success = () => { - console.log('Login done'); } const main = () => { - console.log('LoginController running'); }; main(); From f2d5a3b8584d765257ebdc1f9b9ffeea5050ffe8 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 17 Dec 2018 11:39:10 -0300 Subject: [PATCH 023/237] Use lodash.isUndefined and fix const declaration --- webchat/auth/loginCard.js | 8 ++++---- webchat/index.html | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/webchat/auth/loginCard.js b/webchat/auth/loginCard.js index 4133fe15d..3300908e4 100644 --- a/webchat/auth/loginCard.js +++ b/webchat/auth/loginCard.js @@ -2,7 +2,7 @@ (function() { function LoginCardController() { - let ctrl = this; + const ctrl = this; ctrl.user = {}; ctrl.signIn = () => { @@ -11,11 +11,11 @@ } ctrl.$onInit = () => { - if (angular.isUndefined(ctrl.email) || ctrl.email === null) + if (_.isUndefined(ctrl.email) || ctrl.email === null) ctrl.email = true; - if (angular.isUndefined(ctrl.google) || ctrl.google === null) + if (_.isUndefined(ctrl.google) || ctrl.google === null) ctrl.google = true; - if (angular.isUndefined(ctrl.email) || ctrl.invite === null) + if (_.isUndefined(ctrl.email) || ctrl.invite === null) ctrl.invite = true; } } diff --git a/webchat/index.html b/webchat/index.html index e51d8a7f9..6db25b624 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -67,6 +67,7 @@ + From 6bd74c948442fc453c6b572758e9bec70f17123a Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 17 Dec 2018 11:40:04 -0300 Subject: [PATCH 024/237] Use css grid and remove commented code --- webchat/auth/login.css | 19 +++++--- webchat/auth/loginCard.html | 93 +++++++++++++++---------------------- 2 files changed, 51 insertions(+), 61 deletions(-) diff --git a/webchat/auth/login.css b/webchat/auth/login.css index 38537839a..671fdf4e3 100644 --- a/webchat/auth/login.css +++ b/webchat/auth/login.css @@ -1,10 +1,10 @@ img.ec-logo { - width: 80%; - margin: 1em; + width: 80%; + margin: 1em; } .limit-width { - max-width: 480px; + max-width: 480px; } .login-btn { @@ -40,15 +40,22 @@ img.ec-logo { } .login-form { + display: grid; + grid-template-areas: "email" "password" "submit"; + align-items: center; margin: 1em 0; } +.login-form-submit { + justify-self: right; +} + .login-card-footer { background-color: #E6E6E6; } @media screen and (max-width: 320px) { - img.ec-logo { - width: 60%; - } + img.ec-logo { + width: 60%; + } } diff --git a/webchat/auth/loginCard.html b/webchat/auth/loginCard.html index 0318e4277..189375e71 100644 --- a/webchat/auth/loginCard.html +++ b/webchat/auth/loginCard.html @@ -1,66 +1,49 @@ From 7cb3b466cd4cf53f904ac2ca7780f6153accaa7d Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 19 Dec 2018 11:52:42 -0300 Subject: [PATCH 025/237] Import authService and firebase for login --- webchat/app.js | 61 ++++++++++++++++++++++++++++++++++++++++++++-- webchat/index.html | 10 ++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index b337c66df..0b65f4d4b 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -3,7 +3,8 @@ const app = angular.module('webchat', [ 'ui.router', - 'ngMaterial' + 'ngMaterial', + 'firebase' ]); const rootName = 'webchat'; @@ -16,7 +17,8 @@ login: 'login', }); - app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider) => { + app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider, + $httpProvider) => { $mdIconProvider.fontSet('md', 'material-icons'); $mdThemingProvider.theme('docs-dark'); $mdThemingProvider.theme('input') @@ -81,9 +83,64 @@ }); $urlRouterProvider.otherwise("/"); + $httpProvider.interceptors.push('BearerAuthInterceptor'); }); + app.factory('BearerAuthInterceptor', function ($injector, $q, $state) { + return { + request: function(config) { + var AuthService = $injector.get('AuthService'); + config.headers = config.headers || {}; + if (AuthService.isLoggedIn()) { + return AuthService.getUserToken().then(token => { + config.headers.Authorization = 'Bearer ' + token; + + var API_URL = "/api/"; + var FIRST_POSITION = 0; + var requestToApi = config.url.indexOf(API_URL) == FIRST_POSITION; + + if (!_.isEmpty(AuthService.getCurrentUser().institutions) && requestToApi) { + config.headers['Institution-Authorization'] = AuthService.getCurrentUser().current_institution.key; + } + + Utils.updateBackendUrl(config); + return config || $q.when(config); + }); + } + + Utils.updateBackendUrl(config); + return config || $q.when(config); + }, + response: function(response) { + var app_version = response.headers("app_version"); + var AuthService = $injector.get('AuthService'); + AuthService.setAppVersion(app_version); + return response || $q.when(response); + }, + responseError: function(rejection) { + var AuthService = $injector.get('AuthService'); + if (rejection.status === 401) { + if (AuthService.isLoggedIn()) { + AuthService.logout(); + rejection.data.msg = "Sua sessão expirou!"; + } else { + $state.go("signin"); + } + } else if(rejection.status === 403) { + rejection.data.msg = "Você não tem permissão para realizar esta operação!"; + } else { + $state.go("error", { + "msg": rejection.data.msg || "Desculpa! Ocorreu um erro.", + "status": rejection.status + }); + } + return $q.reject(rejection); + } + }; + }); + + const main = () => { console.log("app running"); }; diff --git a/webchat/index.html b/webchat/index.html index 6db25b624..02cdd812e 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -68,6 +68,7 @@ + @@ -81,5 +82,14 @@ + + + + + + + + + From 565b4474d38620e82016cc628b8bb937ee293cb9 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 19 Dec 2018 11:53:25 -0300 Subject: [PATCH 026/237] Update css usage on login form --- webchat/auth/login.css | 32 +++++++++++++++++++------------- webchat/auth/loginCard.html | 4 ++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/webchat/auth/login.css b/webchat/auth/login.css index 671fdf4e3..cf9b1cd01 100644 --- a/webchat/auth/login.css +++ b/webchat/auth/login.css @@ -1,6 +1,6 @@ img.ec-logo { width: 80%; - margin: 1em; + margin: 0.8em; } .limit-width { @@ -8,7 +8,7 @@ img.ec-logo { } .login-btn { - margin: 0 0 1em auto; + margin: 0; width: 100%; } @@ -24,17 +24,6 @@ img.ec-logo { margin-left: 0.3em; } -#login-google-icon { - margin-left: 0.5em; -} - -#login-google-icon svg { - height: auto; - width: 1.3em; - line-height: auto; - margin: 0.155em 0.2em; -} - .login-text { text-align: justify; } @@ -46,10 +35,20 @@ img.ec-logo { margin: 1em 0; } +.form { + margin: 0.4em; +} + .login-form-submit { justify-self: right; } +.login-card { + display: grid; + max-height: 80vmax; + padding: 0; +} + .login-card-footer { background-color: #E6E6E6; } @@ -59,3 +58,10 @@ img.ec-logo { width: 60%; } } + +@media screen and (orientation: landscape) { + + .limit-width { + width: 360px; + } +} diff --git a/webchat/auth/loginCard.html b/webchat/auth/loginCard.html index 189375e71..f8b33e290 100644 --- a/webchat/auth/loginCard.html +++ b/webchat/auth/loginCard.html @@ -4,12 +4,12 @@ From e27c20d230ce1ac09030cb0aba85333e4891f665 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:07:12 -0300 Subject: [PATCH 097/237] Remove nonexistent state from app.js --- webchat/app.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index ae679f4f9..cc51f7a30 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -110,10 +110,7 @@ } else if(rejection.status === 403) { rejection.data.msg = "Você não tem permissão para realizar esta operação!"; } else { - $state.go("error", { - "msg": rejection.data.msg || "Desculpa! Ocorreu um erro.", - "status": rejection.status - }); + $state.go(STATES.home); } return $q.reject(rejection); } From 1215653a2c4d0b3ac3582536af5ab09792a2c6d8 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:19:01 -0300 Subject: [PATCH 098/237] Use inline array annotation --- webchat/auth/authService.js | 6 +++--- webchat/auth/loginCard.js | 2 +- webchat/auth/loginController.js | 5 +++-- webchat/utils/httpService.js | 4 ++-- webchat/utils/messageService.js | 4 ++-- webchat/utils/user.js | 4 ++-- webchat/utils/userService.js | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index cae94ea7d..c129644e5 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -3,8 +3,8 @@ const app = angular.module("webchat"); - app.service("AuthService", function AuthService($q, $state, $window, UserService, MessageService, - User, STATES) { + app.service("AuthService", ['$q', '$state', '$window', 'UserService', 'MessageService', 'User', 'STATES', + function AuthService($q, $state, $window, UserService, MessageService, User, STATES) { const service = this; const authObj = firebase.auth(); @@ -199,5 +199,5 @@ } init(); - }); + }]); })(); diff --git a/webchat/auth/loginCard.js b/webchat/auth/loginCard.js index f5738bab8..8c15a8dd4 100644 --- a/webchat/auth/loginCard.js +++ b/webchat/auth/loginCard.js @@ -41,7 +41,7 @@ angular.module('webchat') .component('loginCard', { templateUrl: 'app/auth/loginCard.html', - controller: LoginCardController, + controller: ['AuthService', 'MessageService', LoginCardController], controllerAs: 'ctrl', bindings: { email: '<', diff --git a/webchat/auth/loginController.js b/webchat/auth/loginController.js index c5f613c20..9dc326f9b 100644 --- a/webchat/auth/loginController.js +++ b/webchat/auth/loginController.js @@ -3,7 +3,8 @@ const webchat = angular.module('webchat'); - webchat.controller('LoginController', function LoginController (AuthService, $state, STATES) { + webchat.controller('LoginController', ['AuthService', '$state', 'STATES', + function LoginController(AuthService, $state, STATES) { const controller = this; controller.success = () => { @@ -15,5 +16,5 @@ $state.go(STATES.home); } } - }); + }]); })(); diff --git a/webchat/utils/httpService.js b/webchat/utils/httpService.js index 0bc05d13d..22cb860cc 100644 --- a/webchat/utils/httpService.js +++ b/webchat/utils/httpService.js @@ -3,7 +3,7 @@ (function () { const app = angular.module('webchat'); - app.service('HttpService', function HttpService($http) { + app.service('HttpService', ['$http', function HttpService($http) { const service = this; const POST = 'POST'; @@ -39,5 +39,5 @@ data: data }).then(response => response.data); } - }); + }]); })(); diff --git a/webchat/utils/messageService.js b/webchat/utils/messageService.js index d9bfc533d..001b710e2 100644 --- a/webchat/utils/messageService.js +++ b/webchat/utils/messageService.js @@ -3,7 +3,7 @@ (function() { const app = angular.module("webchat"); - app.service("MessageService", function MessageService($mdToast, $mdDialog) { + app.service("MessageService", ['$mdToast', '$mdDialog', function MessageService($mdToast, $mdDialog) { const service = this; const msg = { @@ -61,5 +61,5 @@ clickOutsideToClose:true }); } - }); + }]); })(); diff --git a/webchat/utils/user.js b/webchat/utils/user.js index efdafa6d2..b9d0b4b07 100644 --- a/webchat/utils/user.js +++ b/webchat/utils/user.js @@ -2,7 +2,7 @@ (function () { const app = angular.module('webchat'); - app.factory('User', () => { + app.factory('User', [() => { function User(data) { data = data || {}; _.extend(this, data); @@ -71,5 +71,5 @@ } return User; - }) + }]) })(); diff --git a/webchat/utils/userService.js b/webchat/utils/userService.js index 3b55a5ce7..86e0f776a 100644 --- a/webchat/utils/userService.js +++ b/webchat/utils/userService.js @@ -3,7 +3,7 @@ (function() { const app = angular.module("webchat"); - app.service("UserService", function UserService(HttpService) { + app.service("UserService", ['HttpService', function UserService(HttpService) { const service = this; const USER_URI = "/api/user"; @@ -15,5 +15,5 @@ service.load = function load() { return HttpService.get(USER_URI); }; - }); + }]); })(); From cacc84f74b6a8afbe4939906d1732ee41beee2a1 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:31:35 -0300 Subject: [PATCH 099/237] Use inline array annotation --- webchat/auth/authService.js | 11 +++-------- webchat/utils/httpService.js | 4 ++-- webchat/utils/messageService.js | 4 ++-- webchat/utils/user.js | 4 ++-- webchat/utils/userService.js | 4 ++-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index 6e4d95675..71f26a31c 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -3,8 +3,8 @@ const app = angular.module("webchat"); - app.service("AuthService", function AuthService($q, $state, $window, UserService, MessageService, - User, STATES) { + app.service("AuthService", ['$q', '$state', '$window', 'UserService', 'MessageService', 'User', 'STATES', + function AuthService($q, $state, $window, UserService, MessageService, User, STATES) { const service = this; const authObj = firebase.auth(); @@ -164,11 +164,6 @@ $window.localStorage.userInfo = JSON.stringify(userInfo); }; - service.resetPassword = function resetPassword(email) { - return authObj.sendPasswordResetEmail(email); - - }; - service.$onLogout = function $onLogout(callback) { onLogoutListeners.push(callback); }; @@ -202,5 +197,5 @@ } init(); - }); + }]); })(); diff --git a/webchat/utils/httpService.js b/webchat/utils/httpService.js index 0bc05d13d..22cb860cc 100644 --- a/webchat/utils/httpService.js +++ b/webchat/utils/httpService.js @@ -3,7 +3,7 @@ (function () { const app = angular.module('webchat'); - app.service('HttpService', function HttpService($http) { + app.service('HttpService', ['$http', function HttpService($http) { const service = this; const POST = 'POST'; @@ -39,5 +39,5 @@ data: data }).then(response => response.data); } - }); + }]); })(); diff --git a/webchat/utils/messageService.js b/webchat/utils/messageService.js index d9bfc533d..001b710e2 100644 --- a/webchat/utils/messageService.js +++ b/webchat/utils/messageService.js @@ -3,7 +3,7 @@ (function() { const app = angular.module("webchat"); - app.service("MessageService", function MessageService($mdToast, $mdDialog) { + app.service("MessageService", ['$mdToast', '$mdDialog', function MessageService($mdToast, $mdDialog) { const service = this; const msg = { @@ -61,5 +61,5 @@ clickOutsideToClose:true }); } - }); + }]); })(); diff --git a/webchat/utils/user.js b/webchat/utils/user.js index efdafa6d2..b9d0b4b07 100644 --- a/webchat/utils/user.js +++ b/webchat/utils/user.js @@ -2,7 +2,7 @@ (function () { const app = angular.module('webchat'); - app.factory('User', () => { + app.factory('User', [() => { function User(data) { data = data || {}; _.extend(this, data); @@ -71,5 +71,5 @@ } return User; - }) + }]) })(); diff --git a/webchat/utils/userService.js b/webchat/utils/userService.js index 3b55a5ce7..86e0f776a 100644 --- a/webchat/utils/userService.js +++ b/webchat/utils/userService.js @@ -3,7 +3,7 @@ (function() { const app = angular.module("webchat"); - app.service("UserService", function UserService(HttpService) { + app.service("UserService", ['HttpService', function UserService(HttpService) { const service = this; const USER_URI = "/api/user"; @@ -15,5 +15,5 @@ service.load = function load() { return HttpService.get(USER_URI); }; - }); + }]); })(); From 35fa213d3b2842795fdf7dd0e7b398fa39472abf Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:32:25 -0300 Subject: [PATCH 100/237] Change nonexistent state to STATES.home on app.js --- webchat/app.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index ae679f4f9..cc51f7a30 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -110,10 +110,7 @@ } else if(rejection.status === 403) { rejection.data.msg = "Você não tem permissão para realizar esta operação!"; } else { - $state.go("error", { - "msg": rejection.data.msg || "Desculpa! Ocorreu um erro.", - "status": rejection.status - }); + $state.go(STATES.home); } return $q.reject(rejection); } From 1d3bc0b25d24d07fb1c3a258e67f9c500ca66f1a Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:52:36 -0300 Subject: [PATCH 101/237] Use let/const, inline array annotation on app.js --- webchat/app.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index cc51f7a30..a9498f8c0 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -67,18 +67,19 @@ }); - app.factory('BearerAuthInterceptor', function (STATES, $injector, $q, $state) { + app.factory('BearerAuthInterceptor', ['STATES', '$injector', '$q', '$state', + function (STATES, $injector, $q, $state) { return { request: function(config) { - var AuthService = $injector.get('AuthService'); + const AuthService = $injector.get('AuthService'); config.headers = config.headers || {}; if (AuthService.isLoggedIn()) { return AuthService.getUserToken().then(token => { config.headers.Authorization = 'Bearer ' + token; - var API_URL = "/api/"; - var FIRST_POSITION = 0; - var requestToApi = config.url.indexOf(API_URL) == FIRST_POSITION; + const API_URL = "/api/"; + const FIRST_POSITION = 0; + const requestToApi = config.url.indexOf(API_URL) == FIRST_POSITION; if (!_.isEmpty(AuthService.getCurrentUser().institutions) && requestToApi) { config.headers['Institution-Authorization'] = AuthService.getCurrentUser().current_institution.key; @@ -93,13 +94,13 @@ return config || $q.when(config); }, response: function(response) { - var app_version = response.headers("app_version"); - var AuthService = $injector.get('AuthService'); + const app_version = response.headers("app_version"); + const AuthService = $injector.get('AuthService'); AuthService.setAppVersion(app_version); return response || $q.when(response); }, responseError: function(rejection) { - var AuthService = $injector.get('AuthService'); + const AuthService = $injector.get('AuthService'); if (rejection.status === 401) { if (AuthService.isLoggedIn()) { AuthService.logout(); @@ -115,7 +116,7 @@ return $q.reject(rejection); } }; - }); + }]); app.run(function authInterceptor(STATES, AuthService, $transitions, $state) { const ignored_routes = [ From 661aec6910cf115675edd53526c2f2fe65c3bd58 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 09:59:44 -0300 Subject: [PATCH 102/237] Update index.html to import authService and deps --- webchat/index.html | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/webchat/index.html b/webchat/index.html index 10f21a1b0..fe273409b 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -6,7 +6,7 @@ Plataforma CIS - + @@ -23,18 +23,18 @@ - +
    - + + @@ -74,5 +76,13 @@ + + + + + + + + From 57f86ebe1b4fecf59c70f0ee350f2431b644a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 10:44:58 -0300 Subject: [PATCH 103/237] Fix typo on header inline array dependency injection --- webchat/components/header/ecis-header.component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/header/ecis-header.component.js b/webchat/components/header/ecis-header.component.js index 1507ca242..e29386463 100644 --- a/webchat/components/header/ecis-header.component.js +++ b/webchat/components/header/ecis-header.component.js @@ -4,7 +4,7 @@ angular.module('webchat').component('ecisHeader', { templateUrl: "app/components/header/ecis-header.html", controller: [ - $mdSidenav, + '$mdSidenav', headerController, ], controllerAs: "headerCtrl", From c0b6ee0cacbabe1d7934ebfe613aa3644e2f1295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:04:31 -0300 Subject: [PATCH 104/237] Add WebchatService --- webchat/home/homeController.js | 7 +++-- webchat/index.html | 3 +++ webchat/services/WebchatService.js | 39 ++++++++++++++++++++++++++++ webchat/webchat/webchatController.js | 11 +++----- 4 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 webchat/services/WebchatService.js diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 6243e6760..07545e209 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,9 +3,12 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', function HomeController () { + webchat.controller('HomeController', ['WebchatService', function HomeController (WebchatService) { const homeCtrl = this; - }); + homeCtrl.user = WebchatService.getCurrentUser(); + homeCtrl.contacts = WebchatService.getContacts(); + + }]); })(); \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index 1ee9da09d..7872b77e0 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -77,10 +77,13 @@ + + + diff --git a/webchat/services/WebchatService.js b/webchat/services/WebchatService.js new file mode 100644 index 000000000..b5a7caa3d --- /dev/null +++ b/webchat/services/WebchatService.js @@ -0,0 +1,39 @@ +(function () { + 'use strict'; + + angular.module("webchat").service('WebchatService',function WebchatService() { + const WebchatService = this; + + WebchatService.getContacts = () => [ + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"}, + ]; + + WebchatService.getCurrentUser = () => ( + {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"} + ); + + }); +})(); \ No newline at end of file diff --git a/webchat/webchat/webchatController.js b/webchat/webchat/webchatController.js index a1fd3c816..885d3720b 100644 --- a/webchat/webchat/webchatController.js +++ b/webchat/webchat/webchatController.js @@ -3,15 +3,10 @@ const webchat = angular.module('webchat'); - webchat.controller('WebchatController', function WebchatController () { + webchat.controller('WebchatController', ['WebchatService', function WebchatController (WebchatService) { const webchatCtrl = this; - webchatCtrl.user = { - name: "Name", - description: "Description", - avatar: "https://www.w3schools.com/howto/img_avatar.png", - }; - - }); + webchatCtrl.user = WebchatService.getCurrentUser(); + }]); })(); \ No newline at end of file From 8cc1bfedfe060e0af0c9dec32a1687ec186c1a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:05:14 -0300 Subject: [PATCH 105/237] Add utils.js --- webchat/index.html | 1 + webchat/utils/utils.js | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 webchat/utils/utils.js diff --git a/webchat/index.html b/webchat/index.html index 7872b77e0..73441b848 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -76,6 +76,7 @@ + diff --git a/webchat/utils/utils.js b/webchat/utils/utils.js new file mode 100644 index 000000000..d6322f40e --- /dev/null +++ b/webchat/utils/utils.js @@ -0,0 +1,55 @@ +"use strict"; + +const Utils = { + + /** + * Identify all the indexes where a substring occurs inside another string + * @param {string} substring to be searched + * @param {string} fullString that contains the searched substring + * @returns {[number]} a list of indexes where the substring occurs + */ + getIndexesOf : function getIndexesOf(substring, fullString) { + const indexes = []; + if (substring.length !== 0) { + let startIndex = 0, index; + while((index = fullString.indexOf(substring, startIndex)) > -1) { + indexes.push(index); + startIndex = index + substring.length; + } + } + return indexes; + }, + + /** + * Limit the specified string if its size is bigger than the specified limit + * @param {string} stringToLimit string that will be limited if necessary + * @param {number} limit max string size + * @returns {string} the sliced string, followed by ellipsis, or the original one + */ + limitString : function limitString(stringToLimit, limit) { + if(stringToLimit && stringToLimit.length > limit) { + const undefinedIndex = -1; + const endIndexesOfLast = this.getIndexesOf("
    ", stringToLimit); + const indexOfLastAboveLimit = endIndexesOfLast.findIndex((index) => index >= limit); + if(indexOfLastAboveLimit !== undefinedIndex) { + const shiftToCloseTag = 4; + limit = endIndexesOfLast[indexOfLastAboveLimit] + shiftToCloseTag; + } + return stringToLimit.substring(0, limit+1) + "..."; + } else { + return stringToLimit; + } + }, + + /** + * This function indicate if the screen are in mobile device size. + * @returns {boolean} True if the screen is smaller or equal to 960 pixels and false in otherwise. + */ + isMobileScreen: function isMobileScreen(mobileScreenSize) { + if (mobileScreenSize) { + return screen.width <= mobileScreenSize; + } + + return screen.width <= 960; + }, +}; \ No newline at end of file From 096b11f66339bc93f61cfbb39a9294fecf5fdee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:07:46 -0300 Subject: [PATCH 106/237] Add char limitation to user description --- .../user-description/user-description.component.js | 5 +++++ webchat/components/user-description/user-description.html | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webchat/components/user-description/user-description.component.js b/webchat/components/user-description/user-description.component.js index ca87cb18d..5c33c70e3 100644 --- a/webchat/components/user-description/user-description.component.js +++ b/webchat/components/user-description/user-description.component.js @@ -18,6 +18,11 @@ function userDescriptionController() { const userDescriptionCtrl = this; + + userDescriptionCtrl.charLimitName = Utils.isMobileScreen() ? 15 : 25; + userDescriptionCtrl.charLimitDescription = Utils.isMobileScreen() ? 20 : 35; + userDescriptionCtrl.limitString = (string, charLimit) => Utils.limitString(string, charLimit); + } })(); \ No newline at end of file diff --git a/webchat/components/user-description/user-description.html b/webchat/components/user-description/user-description.html index ac2061261..188f78a35 100644 --- a/webchat/components/user-description/user-description.html +++ b/webchat/components/user-description/user-description.html @@ -1,7 +1,7 @@
    - {{userDescriptionCtrl.name}} - {{userDescriptionCtrl.description}} + {{userDescriptionCtrl.limitString(userDescriptionCtrl.name, userDescriptionCtrl.charLimitName)}} + {{userDescriptionCtrl.limitString(userDescriptionCtrl.description, userDescriptionCtrl.charLimitDescription)}}
    \ No newline at end of file From dddcf5335467ce9ba8d14b91b5bb55b16d7e148b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:14:27 -0300 Subject: [PATCH 107/237] Fix content view size --- webchat/styles/custom.css | 4 ---- webchat/webchat/webchat.html | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index adcb28566..08befa124 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -3,10 +3,6 @@ display: flex; } -#content { - display: flex; -} - .hide-scrollbar::-webkit-scrollbar { display: none; } diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html index f19d55998..031be9b3a 100644 --- a/webchat/webchat/webchat.html +++ b/webchat/webchat/webchat.html @@ -1,2 +1,2 @@ -
    \ No newline at end of file +
    \ No newline at end of file From dd6181f2d6f4434d73fc9c138222aab50d061896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:15:50 -0300 Subject: [PATCH 108/237] Add expansive search bar component --- .../expansive-search-bar.component.js | 25 +++++++++++++++++++ .../expansive-search-bar.css | 14 +++++++++++ .../expansive-search-bar.html | 4 +++ webchat/index.html | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 webchat/components/expansive-search-bar/expansive-search-bar.component.js create mode 100644 webchat/components/expansive-search-bar/expansive-search-bar.css create mode 100644 webchat/components/expansive-search-bar/expansive-search-bar.html diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.component.js b/webchat/components/expansive-search-bar/expansive-search-bar.component.js new file mode 100644 index 000000000..71b03e8d7 --- /dev/null +++ b/webchat/components/expansive-search-bar/expansive-search-bar.component.js @@ -0,0 +1,25 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("expansiveSearchBar", { + templateUrl: "app/components/expansive-search-bar/expansive-search-bar.html", + controller: expansiveSearchBarController, + controllerAs: "expansiveSearchBarCtrl", + bindings: { + className: "@", + style: "@", + ariaLabel: "@", + searchQuery: "=" + }, + }); + + function expansiveSearchBarController() { + const expansiveSearchBarCtrl = this; + + expansiveSearchBarCtrl.isExpanded = false; + + expansiveSearchBarCtrl.toggleSearch = () => expansiveSearchBarCtrl.isExpanded = !expansiveSearchBarCtrl.isExpanded; + + } + +})(); \ No newline at end of file diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.css b/webchat/components/expansive-search-bar/expansive-search-bar.css new file mode 100644 index 000000000..1ed406721 --- /dev/null +++ b/webchat/components/expansive-search-bar/expansive-search-bar.css @@ -0,0 +1,14 @@ +.search-container { + display: flex; + flex-direction: row; + display: 100%; +} + +.expansive-search-input { + width: 100%; + border-radius: 50px; + padding: 0 20px; + background-color: #EEEEEE; + border: none; + outline: none; +} \ No newline at end of file diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html new file mode 100644 index 000000000..75b80046f --- /dev/null +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -0,0 +1,4 @@ +
    + + +
    diff --git a/webchat/index.html b/webchat/index.html index 73441b848..4f5f6c17f 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -31,6 +31,7 @@ + @@ -89,5 +90,6 @@ + From ddf998c90509babd89289a6d4183865e9755825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:22:48 -0300 Subject: [PATCH 109/237] Add contacts-list component --- webchat/components/contacts/contacts.css | 9 ++++++++ .../contacts/list/contacts-list.component.js | 22 +++++++++++++++++++ .../contacts/list/contacts-list.html | 4 ++++ webchat/index.html | 3 +++ 4 files changed, 38 insertions(+) create mode 100644 webchat/components/contacts/contacts.css create mode 100644 webchat/components/contacts/list/contacts-list.component.js create mode 100644 webchat/components/contacts/list/contacts-list.html diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css new file mode 100644 index 000000000..e0be23644 --- /dev/null +++ b/webchat/components/contacts/contacts.css @@ -0,0 +1,9 @@ +.contacts-list { + overflow-y: scroll; + flex: 1; +} + +.user-contact { + font-size: 1.5em; + line-height: 1em; +} \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.component.js b/webchat/components/contacts/list/contacts-list.component.js new file mode 100644 index 000000000..6401a10cb --- /dev/null +++ b/webchat/components/contacts/list/contacts-list.component.js @@ -0,0 +1,22 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("contactsList", { + templateUrl: "app/components/contacts/list/contacts-list.html", + controller: contactsListController, + controllerAs: "contactsListCtrl", + bindings: { + className: "@", + style: "@", + ariaLabel: "@", + searchQuery: "<", + contacts: "<" + }, + }); + + function contactsListController() { + const contactsListCtrl = this; + + } + +})(); \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html new file mode 100644 index 000000000..efa26276b --- /dev/null +++ b/webchat/components/contacts/list/contacts-list.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index 4f5f6c17f..2a67e8f39 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -31,6 +31,7 @@ + @@ -90,6 +91,8 @@ + + From ebfd206efb2e09b96ba4c78eb00a7cfdf9b76f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:23:31 -0300 Subject: [PATCH 110/237] Add contacts-toolbar component --- webchat/components/contacts/contacts.css | 6 ++++- .../toolbar/contacts-toolbar.component.js | 25 +++++++++++++++++++ .../contacts/toolbar/contacts-toolbar.html | 2 ++ webchat/index.html | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 webchat/components/contacts/toolbar/contacts-toolbar.component.js create mode 100644 webchat/components/contacts/toolbar/contacts-toolbar.html diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css index e0be23644..d0df95d71 100644 --- a/webchat/components/contacts/contacts.css +++ b/webchat/components/contacts/contacts.css @@ -6,4 +6,8 @@ .user-contact { font-size: 1.5em; line-height: 1em; -} \ No newline at end of file +} + +.close-button { + margin-left: auto; +} diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.component.js b/webchat/components/contacts/toolbar/contacts-toolbar.component.js new file mode 100644 index 000000000..36b698321 --- /dev/null +++ b/webchat/components/contacts/toolbar/contacts-toolbar.component.js @@ -0,0 +1,25 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("contactsToolbar", { + templateUrl: "app/components/contacts/toolbar/contacts-toolbar.html", + controller: contactsToolbarController, + controllerAs: "contactsToolbarCtrl", + bindings: { + className: "@", + style: "@", + ariaLabel: "@", + searchQuery: "=" + }, + }); + + function contactsToolbarController($mdSidenav) { + const contactsToolbarCtrl = this; + + contactsToolbarCtrl.toggleNavbar = (componentId) => { + $mdSidenav(componentId).toggle(); + }; + + } + +})(); \ No newline at end of file diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.html b/webchat/components/contacts/toolbar/contacts-toolbar.html new file mode 100644 index 000000000..de2f69010 --- /dev/null +++ b/webchat/components/contacts/toolbar/contacts-toolbar.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index 2a67e8f39..070fbd065 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -93,6 +93,7 @@ + From 3d93e0928f69c5cb30331cfea7024d7dd04ad243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:25:04 -0300 Subject: [PATCH 111/237] Add contacts-sidenav component --- .../sidenav/contacts-sidenav.component.js | 22 +++++++++++++++++++ .../contacts/sidenav/contacts-sidenav.html | 9 ++++++++ webchat/index.html | 1 + 3 files changed, 32 insertions(+) create mode 100644 webchat/components/contacts/sidenav/contacts-sidenav.component.js create mode 100644 webchat/components/contacts/sidenav/contacts-sidenav.html diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.component.js b/webchat/components/contacts/sidenav/contacts-sidenav.component.js new file mode 100644 index 000000000..692279e4d --- /dev/null +++ b/webchat/components/contacts/sidenav/contacts-sidenav.component.js @@ -0,0 +1,22 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("contactsSidenav", { + templateUrl: "app/components/contacts/sidenav/contacts-sidenav.html", + controller: contactsSidenavController, + controllerAs: "contactsSidenavCtrl", + bindings: { + className: "@", + style: "@", + ariaLabel: "@", + contacts: "<", + }, + }); + + function contactsSidenavController() { + const contactsSidenavCtrl = this; + contactsSidenavCtrl.searchQuery = ""; + + } + +})(); \ No newline at end of file diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.html b/webchat/components/contacts/sidenav/contacts-sidenav.html new file mode 100644 index 000000000..715970b72 --- /dev/null +++ b/webchat/components/contacts/sidenav/contacts-sidenav.html @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index 070fbd065..066e0165b 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -94,6 +94,7 @@ + From 68174db8805989d329574f6442b28607b9043a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 11:25:57 -0300 Subject: [PATCH 112/237] Add contacts sidenav to view --- webchat/components/header/ecis-header.component.js | 3 +++ webchat/components/header/ecis-header.html | 2 +- webchat/home/home.html | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webchat/components/header/ecis-header.component.js b/webchat/components/header/ecis-header.component.js index e29386463..73a21057f 100644 --- a/webchat/components/header/ecis-header.component.js +++ b/webchat/components/header/ecis-header.component.js @@ -20,5 +20,8 @@ function headerController ($mdSidenav) { const headerCtrl = this; + headerCtrl.toggleNavbar = (componentId) => { + $mdSidenav(componentId).toggle(); + }; } })(); diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index 5dc8af2b5..647bfbd5a 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -1,5 +1,5 @@
    - + diff --git a/webchat/home/home.html b/webchat/home/home.html index 987cac423..dc026e10a 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1 +1 @@ -

    HOME

    \ No newline at end of file + \ No newline at end of file From 047f6b81e1dc91caeb58fe05e52d9859157654ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 13:04:40 -0300 Subject: [PATCH 113/237] Add alphabetical order by name and then by description in contacts-list --- webchat/components/contacts/list/contacts-list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index efa26276b..9e3410061 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,4 +1,4 @@ - + \ No newline at end of file From 692a24f33bd790e59e01e18f339fb0ce8016570e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 15 Jan 2019 13:34:37 -0300 Subject: [PATCH 114/237] Move inline style to custom.css --- webchat/styles/custom.css | 5 +++++ webchat/webchat/webchat.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index 08befa124..f497be6c6 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -3,6 +3,11 @@ display: flex; } +#content { + display: flex; + height: 100%; +} + .hide-scrollbar::-webkit-scrollbar { display: none; } diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html index 031be9b3a..f19d55998 100644 --- a/webchat/webchat/webchat.html +++ b/webchat/webchat/webchat.html @@ -1,2 +1,2 @@ -
    \ No newline at end of file +
    \ No newline at end of file From f1d10ebd2c80c6f476a95fd80add7ffc180ef379 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 14:44:29 -0300 Subject: [PATCH 115/237] Add error state * Add serviceWorker * Add $locationProvider to remove hash on url --- webchat/app.js | 46 +++++++++++++++++++++++++++--- webchat/ecis.css | 48 ++++++++++++++++++++++++++++++++ webchat/error/error.css | 25 +++++++++++++++++ webchat/error/error.html | 23 +++++++++++++++ webchat/error/errorController.js | 21 ++++++++++++++ webchat/index.html | 6 +++- webchat/sw.js | 20 +++++++++++++ 7 files changed, 184 insertions(+), 5 deletions(-) create mode 100644 webchat/ecis.css create mode 100644 webchat/error/error.css create mode 100644 webchat/error/error.html create mode 100644 webchat/error/errorController.js create mode 100644 webchat/sw.js diff --git a/webchat/app.js b/webchat/app.js index a9498f8c0..acb5f50b7 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -13,10 +13,11 @@ home: `${rootName}.home`, chat: `${rootName}.chat`, login: 'login', + error: 'error', }); app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider, - $httpProvider) => { + $httpProvider, $locationProvider) => { $mdIconProvider.fontSet('md', 'material-icons'); $mdThemingProvider.theme('docs-dark'); $mdThemingProvider.theme('input') @@ -59,12 +60,38 @@ templateUrl: "app/auth/login.html", controller: "LoginController as controller", }, + } + }) + .state(STATES.error, { + url: '/error', + views: { + main: { + templateUrl: 'app/error/error.html', + controller: 'ErrorController as errorCtrl', + }, }, - }); - $urlRouterProvider.otherwise("/"); - $httpProvider.interceptors.push('BearerAuthInterceptor'); + params: { + 'msg': 'Desculpe! Ocorreu um erro.', + 'status': '500' + }, + }) + + $urlRouterProvider.otherwise(($injector, $location) => { + const state = $injector.get('$state'); + state.go(STATES.error, { + // msg: `Página não encontrada! "${$location.$location.$$absUrl}"`, + msg: `Página não encontrada! "${$location.path()}"`, + status: '404' + }) + + return; + }); + + $httpProvider.interceptors.push('BearerAuthInterceptor'); + $locationProvider.html5Mode(true); + $locationProvider.hashPrefix(''); }); app.factory('BearerAuthInterceptor', ['STATES', '$injector', '$q', '$state', @@ -121,6 +148,7 @@ app.run(function authInterceptor(STATES, AuthService, $transitions, $state) { const ignored_routes = [ STATES.login, + STATES.error, ]; $transitions.onStart({ @@ -131,4 +159,14 @@ $state.go(STATES.login); }); }); + + function initServiceWorker() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('app/sw.js'); + } + } + + (function() { + initServiceWorker(); + })(); })(); diff --git a/webchat/ecis.css b/webchat/ecis.css new file mode 100644 index 000000000..10fb2e018 --- /dev/null +++ b/webchat/ecis.css @@ -0,0 +1,48 @@ +body, html { + height: 100%; + width: 100%; +} + +#webchat { + height: 100%; +} + +ec-content { + display: grid; + align-items: center; + justify-items: center; + position: relative; + height: 100%; + width: 100%; + margin: 0; + overflow: auto; +} + +.ec-card { + display: grid; + max-width: 480px; + margin: 0.6em; + box-shadow: 0 1px 3px 0 rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 2px 1px -1px rgba(0,0,0,.12); + background-color: white; + color: black; + border-radius: 2px; + overflow: hidden; +} + +.ec-card > card-header { + background-color: #009688; + color: white; + display: grid; +} + +.ec-card > card-header > h1 { + font-size: 1.2em; + margin: 0.6em; +} + +.ec-card > card-content { + display: grid; + margin: 0.4em; + padding: 0.6em; + justify-items: center; +} diff --git a/webchat/error/error.css b/webchat/error/error.css new file mode 100644 index 000000000..a78a74bd9 --- /dev/null +++ b/webchat/error/error.css @@ -0,0 +1,25 @@ +error-page-background { + width: 100%; + height: calc(32% + 2.2em); + position: absolute; + align-self: start; +} + +error-card { + align-self: center; + justify-self: center; + z-index: 10; +} + +error-buttons { + display: grid; + grid-template-columns: 1fr 1fr; + justify-items: end; + margin-left: auto; +} + +error-card > card-content > p { + justify-self: start; + text-align: justify; + word-break: break-all; +} diff --git a/webchat/error/error.html b/webchat/error/error.html new file mode 100644 index 000000000..c023b3064 --- /dev/null +++ b/webchat/error/error.html @@ -0,0 +1,23 @@ + + + + + + +

    ERRO {{errorCtrl.status}}

    +
    + +

    Ocorreu um erro ao acessar esta informação.

    +

    {{ errorCtrl.msg }}

    + + + + Voltar + + + Reportar erro + + +
    +
    diff --git a/webchat/error/errorController.js b/webchat/error/errorController.js new file mode 100644 index 000000000..9ede5b42b --- /dev/null +++ b/webchat/error/errorController.js @@ -0,0 +1,21 @@ +'use strict'; + +(function() { + const app = angular.module('webchat'); + + app.controller('ErrorController', ['$state', '$stateParams', '$window', 'STATES', + function ErrorController($state, $stateParams, $window, STATES) { + const errorCtrl = this; + + errorCtrl.msg = $stateParams.msg; + errorCtrl.status = $stateParams.status; + + errorCtrl.goToHome = function goToHome() { + $state.go(STATES.home); + }; + + errorCtrl.goToReport = function goToReport() { + $window.open('http://support.plataformacis.org/report'); + } + }]); +})(); diff --git a/webchat/index.html b/webchat/index.html index fe273409b..5c6e4d9c6 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -24,11 +24,13 @@ + + -
    +
    + + diff --git a/webchat/sw.js b/webchat/sw.js new file mode 100644 index 000000000..b21277ea2 --- /dev/null +++ b/webchat/sw.js @@ -0,0 +1,20 @@ +(function () { + self.addEventListener('fetch', (event) => { + console.log(event); + if (event.request.url === 'http://localhost:8082/api/events?page=0&limit=15') { + event.respondWith( + fetch(event.request).then((response) => { + console.log("response event", response); + const errorConfig = { + status: 404, + statusText: "statusText", + }; + const errorData = { + msg: "erro mock" + }; + return new Response(JSON.stringify(errorData), errorConfig); + }) + ); + }; + }); +})(); From ce7ee153af1bd8184c4537c8e697b122aa974236 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 14:48:59 -0300 Subject: [PATCH 116/237] Add error state on BearerAuthInterceptor --- webchat/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webchat/app.js b/webchat/app.js index acb5f50b7..a71bf3b3d 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -138,7 +138,10 @@ } else if(rejection.status === 403) { rejection.data.msg = "Você não tem permissão para realizar esta operação!"; } else { - $state.go(STATES.home); + $state.go(STATES.error, { + msg: rejection.data.msg || "Desculpa! Ocorreu um erro.", + status: rejection.status + }); } return $q.reject(rejection); } From 170dc37dcc34ee358f38d3116ad813e4ac24facf Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 14:55:49 -0300 Subject: [PATCH 117/237] Remove comment --- webchat/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webchat/app.js b/webchat/app.js index a71bf3b3d..db360f42d 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -81,7 +81,6 @@ const state = $injector.get('$state'); state.go(STATES.error, { - // msg: `Página não encontrada! "${$location.$location.$$absUrl}"`, msg: `Página não encontrada! "${$location.path()}"`, status: '404' }) From 6bea2d3432cb168a145d04c5a6dd4848c3195bdc Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 15:11:01 -0300 Subject: [PATCH 118/237] Remove hashPrefix on app.js --- webchat/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webchat/app.js b/webchat/app.js index db360f42d..b52aba92c 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -90,7 +90,6 @@ $httpProvider.interceptors.push('BearerAuthInterceptor'); $locationProvider.html5Mode(true); - $locationProvider.hashPrefix(''); }); app.factory('BearerAuthInterceptor', ['STATES', '$injector', '$q', '$state', From 44c9a9bcb88090c1497b09157a76ef021e395d8d Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 15:56:18 -0300 Subject: [PATCH 119/237] Remove commented code on error.html --- webchat/error/error.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/webchat/error/error.html b/webchat/error/error.html index c023b3064..4f20bf9a4 100644 --- a/webchat/error/error.html +++ b/webchat/error/error.html @@ -9,8 +9,6 @@

    ERRO {{errorCtrl.status}}

    Ocorreu um erro ao acessar esta informação.

    {{ errorCtrl.msg }}

    - Voltar From 0cc41a9060dacc0ea1d54386421d75808452d637 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 15:59:23 -0300 Subject: [PATCH 120/237] Add Utils.getApiPath --- webchat/utils/utils.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/webchat/utils/utils.js b/webchat/utils/utils.js index 44d9b1753..fe9ab4101 100644 --- a/webchat/utils/utils.js +++ b/webchat/utils/utils.js @@ -12,4 +12,17 @@ const Utils = { config.url = config.url.replace(restApiRegex, restApiUrl + '/api/$1'); }, + + /** + * Extract an api path from url + * @param {string} url that contains the api request + * @returns the path if it exists, or the url, otherwise + */ + getApiPath : function getApiPath(url) { + if (_.isNil(url) || _.isNil(url.split)) { + return url; + } + + return '/' + url.split('/').splice(3).join('/'); + }, }; From 714195f5fd2f94215b6ac7ab5950bd901cf739e9 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 16:00:20 -0300 Subject: [PATCH 121/237] Set response_status on backend 404 error --- backend/handlers/erro_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/handlers/erro_handler.py b/backend/handlers/erro_handler.py index d77b34238..9e8dbbace 100644 --- a/backend/handlers/erro_handler.py +++ b/backend/handlers/erro_handler.py @@ -19,3 +19,4 @@ def get(self): "msg": "Not found", "status": 404 })) + self.response.set_status(404) From 8ef47da919d90f24df05fdba2a0586166056d5da Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 16:04:54 -0300 Subject: [PATCH 122/237] Add 404 redirect on backend error * Remove sw.js --- webchat/app.js | 15 +++++---------- webchat/index.html | 1 - webchat/sw.js | 20 -------------------- 3 files changed, 5 insertions(+), 31 deletions(-) delete mode 100644 webchat/sw.js diff --git a/webchat/app.js b/webchat/app.js index b52aba92c..38ffae8e9 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -135,6 +135,11 @@ } } else if(rejection.status === 403) { rejection.data.msg = "Você não tem permissão para realizar esta operação!"; + } else if(rejection.status === 404) { + $state.go(STATES.error, { + msg: `URL não encontrada! "${Utils.getApiPath(rejection.config.url)}"`, + status: '404' + }); } else { $state.go(STATES.error, { msg: rejection.data.msg || "Desculpa! Ocorreu um erro.", @@ -160,14 +165,4 @@ $state.go(STATES.login); }); }); - - function initServiceWorker() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('app/sw.js'); - } - } - - (function() { - initServiceWorker(); - })(); })(); diff --git a/webchat/index.html b/webchat/index.html index 5c6e4d9c6..cce7e4797 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -73,7 +73,6 @@ - diff --git a/webchat/sw.js b/webchat/sw.js deleted file mode 100644 index b21277ea2..000000000 --- a/webchat/sw.js +++ /dev/null @@ -1,20 +0,0 @@ -(function () { - self.addEventListener('fetch', (event) => { - console.log(event); - if (event.request.url === 'http://localhost:8082/api/events?page=0&limit=15') { - event.respondWith( - fetch(event.request).then((response) => { - console.log("response event", response); - const errorConfig = { - status: 404, - statusText: "statusText", - }; - const errorData = { - msg: "erro mock" - }; - return new Response(JSON.stringify(errorData), errorConfig); - }) - ); - }; - }); -})(); From 5a77e904337a7c6dd0ef7aedb4b5e8ccc40f261f Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 16:11:15 -0300 Subject: [PATCH 123/237] Change goToReport to use Config.SUPPORT_URL --- webchat/error/errorController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/error/errorController.js b/webchat/error/errorController.js index 9ede5b42b..5bd1d4f7a 100644 --- a/webchat/error/errorController.js +++ b/webchat/error/errorController.js @@ -15,7 +15,7 @@ }; errorCtrl.goToReport = function goToReport() { - $window.open('http://support.plataformacis.org/report'); + $window.open(`${Config.SUPPORT_URL}/report`); } }]); })(); From 9d44eb067b132297366f898a91e5b29de0f2a69f Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Jan 2019 16:46:35 -0300 Subject: [PATCH 124/237] Add errorController.test --- .../test/specs/error/errorController.test.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 webchat/test/specs/error/errorController.test.js diff --git a/webchat/test/specs/error/errorController.test.js b/webchat/test/specs/error/errorController.test.js new file mode 100644 index 000000000..71868be6e --- /dev/null +++ b/webchat/test/specs/error/errorController.test.js @@ -0,0 +1,40 @@ +'use strict'; + +(describe('Test errorController', () => { + let error, ctrl, state, states, params; + + error = { + status: 418, + msg: 'Test error' + } + + params = error; + + beforeEach(module('webchat')); + + beforeEach(inject(($controller, $state, STATES) => { + state = $state; + states = STATES; + + ctrl = $controller('ErrorController', { + $stateParams: params + }) + })); + + it('"Voltar" button should send back to STATES.home', () => { + spyOn(state, 'go').and.callThrough(); + ctrl.goToHome(); + expect(state.go).toHaveBeenCalledWith(states.home); + }) + + it('"Reportar erro" should send to CONFIG.SUPPORT_URL/report', () => { + spyOn(window, 'open').and.callThrough(); + ctrl.goToReport(); + expect(window.open).toHaveBeenCalledWith(`${Config.SUPPORT_URL}/report`); + }) + + it('should have error status and error msg', () => { + expect(ctrl.msg).toEqual(error.msg); + expect(ctrl.status).toEqual(error.status); + }) +})); From 5a94de5072713aa3b4554d5109b49497ba5eb889 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 16 Jan 2019 10:46:29 -0300 Subject: [PATCH 125/237] Use new css rules and remove unused bindings --- webchat/auth/login.css | 21 +++------------ webchat/auth/login.html | 2 +- webchat/auth/loginCard.html | 54 ++++++++++++++----------------------- webchat/auth/loginCard.js | 9 ------- 4 files changed, 25 insertions(+), 61 deletions(-) diff --git a/webchat/auth/login.css b/webchat/auth/login.css index 7b4e1934e..fd7ebc9c6 100644 --- a/webchat/auth/login.css +++ b/webchat/auth/login.css @@ -1,13 +1,3 @@ -login-card { - display: grid; - max-width: 480px; - margin: 0.6em; - box-shadow: 0 1px 3px 0 rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 2px 1px -1px rgba(0,0,0,.12); - background-color: white; - color: black; - border-radius: 2px; -} - .smooth-if.ng-enter, .smooth-if.ng-leave { transition: 1s ease-in-out all; } @@ -39,17 +29,15 @@ md-progress-circular > svg > path { stroke: #009688; } -login-card-content { - display: grid; +card-content.login-card-content { padding: 0.6em; margin: 0 1em; - justify-items: center; } img#login-logo { justify-self: center; - width: 70%; - margin: 0.8em 0; + width: 70%; + margin: 0.8em 0; } login-email-form { @@ -118,8 +106,7 @@ login-card-footer { width: 50%; } - login-card-content { - display: grid; + card-content.login-card-content { margin: 0; padding: 0; } diff --git a/webchat/auth/login.html b/webchat/auth/login.html index 646002b3c..7ba07bf11 100644 --- a/webchat/auth/login.html +++ b/webchat/auth/login.html @@ -1,3 +1,3 @@ - + diff --git a/webchat/auth/loginCard.html b/webchat/auth/loginCard.html index 22dbc95e9..549ffd588 100644 --- a/webchat/auth/loginCard.html +++ b/webchat/auth/loginCard.html @@ -1,51 +1,37 @@ - - - + -
    + + Esqueceu a senha? -
    + diff --git a/webchat/auth/loginCard.js b/webchat/auth/loginCard.js index 8c15a8dd4..68fc69fb5 100644 --- a/webchat/auth/loginCard.js +++ b/webchat/auth/loginCard.js @@ -27,12 +27,6 @@ } ctrl.$onInit = () => { - if (_.isNil(ctrl.email)) - ctrl.email = true; - if (_.isNil(ctrl.google)) - ctrl.google = true; - if (_.isNil(ctrl.invite)) - ctrl.invite = true; if (_.isNil(ctrl.onLogin)) ctrl.onLogin = () => {}; } @@ -44,9 +38,6 @@ controller: ['AuthService', 'MessageService', LoginCardController], controllerAs: 'ctrl', bindings: { - email: '<', - google: '<', - invite: '<', onLogin: '&', }, }); From da2727559b8de1abe6504e7c88745af060fbce25 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 16 Jan 2019 11:03:17 -0300 Subject: [PATCH 126/237] Fix loginCard tests and add resetPassword test --- webchat/test/specs/auth/loginCard.test.js | 53 +++++++++++++---------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/webchat/test/specs/auth/loginCard.test.js b/webchat/test/specs/auth/loginCard.test.js index 8149e08c9..336d57f33 100644 --- a/webchat/test/specs/auth/loginCard.test.js +++ b/webchat/test/specs/auth/loginCard.test.js @@ -1,7 +1,9 @@ 'use strict'; (describe('Test LoginCardController', () => { - let scope, authService, ctrl, q, user; + let scope, authService, ctrl, q; + + const user = { name: 'User', active: 'true' }; beforeEach(module('webchat')); @@ -10,35 +12,42 @@ q = $q; scope = $rootScope.$new(); ctrl = $componentController('loginCard', { $scope: scope }); - user = { name: 'User', active: 'true' }; - authService.logout(); ctrl.$onInit(); - spyOn(authService, 'loginWithEmailAndPassword').and.callFake(() => { - return q.when(AuthService.login(user)); - }); - spyOn(authService, 'loginWithGoogle').and.callFake(() => { - return q.when(AuthService.login(user)); - }); - spyOn(ctrl, 'signIn').and.callThrough(); + spyOn(ctrl, 'onLogin'); expect(authService.isLoggedIn()).toBe(false); })) - it('should log in and call onLogin after logging in with email and password', () => { - ctrl.signIn(); - scope.$digest(); - expect(authService.loginWithEmailAndPassword).toHaveBeenCalled(); + it('should take to main frontend page on "Esqueci minha senha"', () => { + spyOn(window, 'open').and.callThrough(); + ctrl.resetPassword(); + expect(window.open).toHaveBeenCalledWith(Config.FRONTEND_URL); }) - it('should log in and call onLogin after logging in with google', () => { - ctrl.loginWithGoogle(); - scope.$digest(); - expect(authService.loginWithGoogle).toHaveBeenCalled(); - }) + describe('login functions', () => { + it('should log in and call onLogin after logging in with email and password', () => { + spyOn(authService, 'loginWithEmailAndPassword').and.callFake(() => { + return q.when(authService.login(user)); + }); + spyOn(ctrl, 'signIn').and.callThrough(); + ctrl.signIn(); + scope.$digest(); + expect(authService.loginWithEmailAndPassword).toHaveBeenCalled(); + }) + + it('should log in and call onLogin after logging in with google', () => { + spyOn(authService, 'loginWithGoogle').and.callFake(() => { + return q.when(authService.login(user)); + }); + ctrl.loginWithGoogle(); + scope.$digest(); + expect(authService.loginWithGoogle).toHaveBeenCalled(); + }) - afterEach(() => { - expect(authService.isLoggedIn()).toBe(true); - expect(ctrl.onLogin).toHaveBeenCalledWith(); + afterEach(() => { + expect(authService.isLoggedIn()).toBe(true); + expect(ctrl.onLogin).toHaveBeenCalledWith(); + }) }) })); From 89e8b0f589b6da540730a56ca42f4e8793afea18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 13:32:16 -0300 Subject: [PATCH 127/237] Adds NavbarManagementService --- .../contacts/toolbar/contacts-toolbar.component.js | 11 +++++++---- .../contacts/toolbar/contacts-toolbar.html | 2 +- webchat/components/header/ecis-header.component.js | 8 ++++---- webchat/components/header/ecis-header.html | 2 +- webchat/index.html | 1 + webchat/services/NavbarManagementService.js | 12 ++++++++++++ 6 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 webchat/services/NavbarManagementService.js diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.component.js b/webchat/components/contacts/toolbar/contacts-toolbar.component.js index 36b698321..13f08a557 100644 --- a/webchat/components/contacts/toolbar/contacts-toolbar.component.js +++ b/webchat/components/contacts/toolbar/contacts-toolbar.component.js @@ -3,7 +3,10 @@ angular.module("webchat").component("contactsToolbar", { templateUrl: "app/components/contacts/toolbar/contacts-toolbar.html", - controller: contactsToolbarController, + controller: [ + 'NavbarManagementService', + contactsToolbarController, + ], controllerAs: "contactsToolbarCtrl", bindings: { className: "@", @@ -13,11 +16,11 @@ }, }); - function contactsToolbarController($mdSidenav) { + function contactsToolbarController(NavbarManagementService) { const contactsToolbarCtrl = this; - contactsToolbarCtrl.toggleNavbar = (componentId) => { - $mdSidenav(componentId).toggle(); + contactsToolbarCtrl.toggleNavbar = () => { + NavbarManagementService.toggleSidenav('left'); }; } diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.html b/webchat/components/contacts/toolbar/contacts-toolbar.html index de2f69010..f89d720a3 100644 --- a/webchat/components/contacts/toolbar/contacts-toolbar.html +++ b/webchat/components/contacts/toolbar/contacts-toolbar.html @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/webchat/components/header/ecis-header.component.js b/webchat/components/header/ecis-header.component.js index 73a21057f..332d5b513 100644 --- a/webchat/components/header/ecis-header.component.js +++ b/webchat/components/header/ecis-header.component.js @@ -4,7 +4,7 @@ angular.module('webchat').component('ecisHeader', { templateUrl: "app/components/header/ecis-header.html", controller: [ - '$mdSidenav', + 'NavbarManagementService', headerController, ], controllerAs: "headerCtrl", @@ -17,11 +17,11 @@ }, }); - function headerController ($mdSidenav) { + function headerController (NavbarManagementService) { const headerCtrl = this; - headerCtrl.toggleNavbar = (componentId) => { - $mdSidenav(componentId).toggle(); + headerCtrl.toggleNavbar = () => { + NavbarManagementService.toggleSidenav('left'); }; } })(); diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index 647bfbd5a..9cfe60a06 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -1,5 +1,5 @@
    - + diff --git a/webchat/index.html b/webchat/index.html index 066e0165b..c0ff3f274 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -81,6 +81,7 @@ + diff --git a/webchat/services/NavbarManagementService.js b/webchat/services/NavbarManagementService.js new file mode 100644 index 000000000..b3fc897cf --- /dev/null +++ b/webchat/services/NavbarManagementService.js @@ -0,0 +1,12 @@ +(function () { + 'use strict'; + + angular.module("webchat").service('NavbarManagementService', ['$mdSidenav', function NavbarManagementService($mdSidenav) { + const NavbarManagementService = this; + + this.toggleSidenav = (sidenavId) => { + $mdSidenav(sidenavId).toggle(); + }; + + }]); +})(); \ No newline at end of file From ce389945366fdea328bb55edb1f362a650cc92e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 13:40:24 -0300 Subject: [PATCH 128/237] Fix contacts list scroll on navbar --- webchat/components/contacts/contacts.css | 1 + webchat/components/contacts/list/contacts-list.html | 10 ++++++---- .../components/contacts/sidenav/contacts-sidenav.html | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css index d0df95d71..ed7ad3830 100644 --- a/webchat/components/contacts/contacts.css +++ b/webchat/components/contacts/contacts.css @@ -1,6 +1,7 @@ .contacts-list { overflow-y: scroll; flex: 1; + height: 100%; } .user-contact { diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 9e3410061..1da8dc287 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,4 +1,6 @@ - - - - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.html b/webchat/components/contacts/sidenav/contacts-sidenav.html index 715970b72..6959b75f5 100644 --- a/webchat/components/contacts/sidenav/contacts-sidenav.html +++ b/webchat/components/contacts/sidenav/contacts-sidenav.html @@ -5,5 +5,5 @@ md-whiteframe="4" style="height: 100%; width: 100%;"> - + \ No newline at end of file From 5431e9171aa7880430ac3227ba2e37366ebe078d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 13:59:10 -0300 Subject: [PATCH 129/237] Fix another bug related to contacts-list scroll on mobile --- webchat/components/contacts/contacts.css | 7 +++++-- webchat/components/contacts/list/contacts-list.html | 2 +- webchat/components/contacts/sidenav/contacts-sidenav.html | 4 ++-- webchat/styles/custom.css | 4 ++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css index ed7ad3830..4b1f99c03 100644 --- a/webchat/components/contacts/contacts.css +++ b/webchat/components/contacts/contacts.css @@ -1,7 +1,10 @@ .contacts-list { - overflow-y: scroll; + overflow: hidden; flex: 1; - height: 100%; +} + +.contacts-list-container { + overflow-y: scroll; } .user-contact { diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 1da8dc287..dff35d86d 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,4 +1,4 @@ - + diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.html b/webchat/components/contacts/sidenav/contacts-sidenav.html index 6959b75f5..88d02a1af 100644 --- a/webchat/components/contacts/sidenav/contacts-sidenav.html +++ b/webchat/components/contacts/sidenav/contacts-sidenav.html @@ -3,7 +3,7 @@ md-component-id="left" md-is-locked-open="$mdMedia('gt-md')" md-whiteframe="4" - style="height: 100%; width: 100%;"> + style="height: 100%; width: 100%; display: flex"> - + \ No newline at end of file diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index f497be6c6..d3faf3b91 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -37,4 +37,8 @@ .no-margin { margin: 0; +} + +.fill-height { + height: 100%; } \ No newline at end of file From df2349390737dbd8ddfd50f574c04937056a2e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 14:21:02 -0300 Subject: [PATCH 130/237] Add simple-fade-in and simple-fade-out animations --- .../expansive-search-bar.css | 10 ++++++++++ .../expansive-search-bar.html | 2 +- webchat/styles/custom.css | 20 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.css b/webchat/components/expansive-search-bar/expansive-search-bar.css index 1ed406721..f8df9d914 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.css +++ b/webchat/components/expansive-search-bar/expansive-search-bar.css @@ -11,4 +11,14 @@ background-color: #EEEEEE; border: none; outline: none; +} + +.expansive-search-input.ng-enter { + animation-name: simple-fade-in; + animation-duration: 0.25s; +} + +.expansive-search-input.ng-leave { + animation-name: simple-fade-out; + animation-duration: 0.25s; } \ No newline at end of file diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html index 75b80046f..41ce38462 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.html +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -1,4 +1,4 @@
    - +
    diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index d3faf3b91..87c72ecb8 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -1,6 +1,8 @@ #webchat { height: 100vh; display: flex; + animation-name: simple-fade-in; + animation-duration: 2s; } #content { @@ -41,4 +43,22 @@ .fill-height { height: 100%; +} + +@keyframes simple-fade-in { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +@keyframes simple-fade-out { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } } \ No newline at end of file From c858347d9cf4eef668dd17df53b6d35707e42160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 14:50:05 -0300 Subject: [PATCH 131/237] Changes close button position and icon to improve ux --- webchat/components/contacts/contacts.css | 6 +++++- webchat/components/contacts/toolbar/contacts-toolbar.html | 4 ++-- .../expansive-search-bar/expansive-search-bar.html | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css index 4b1f99c03..aa8969e73 100644 --- a/webchat/components/contacts/contacts.css +++ b/webchat/components/contacts/contacts.css @@ -13,5 +13,9 @@ } .close-button { - margin-left: auto; + margin-right: auto; } + +.contacts-search { + margin-left: auto; +} \ No newline at end of file diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.html b/webchat/components/contacts/toolbar/contacts-toolbar.html index f89d720a3..d903788c5 100644 --- a/webchat/components/contacts/toolbar/contacts-toolbar.html +++ b/webchat/components/contacts/toolbar/contacts-toolbar.html @@ -1,2 +1,2 @@ - - \ No newline at end of file + + diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html index 41ce38462..3c845cbb1 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.html +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -1,4 +1,4 @@
    - +
    From 6ef21a50df3056349d1f31642a6ff4b7317d1213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 15:23:59 -0300 Subject: [PATCH 132/237] Fix non filling screen navbar on opening page --- webchat/styles/custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index 87c72ecb8..805eadc8f 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -1,5 +1,5 @@ #webchat { - height: 100vh; + min-height: 100vh; display: flex; animation-name: simple-fade-in; animation-duration: 2s; From d061184400571182cbb61901a48e77ff657338a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 15:27:20 -0300 Subject: [PATCH 133/237] Fix overflow showing on content --- webchat/styles/custom.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index 805eadc8f..3f15e4615 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -1,5 +1,10 @@ +html { + overflow: hidden +} + #webchat { min-height: 100vh; + overflow: hidden; display: flex; animation-name: simple-fade-in; animation-duration: 2s; @@ -8,6 +13,7 @@ #content { display: flex; height: 100%; + overflow: hidden; } .hide-scrollbar::-webkit-scrollbar { From 1a5639c0cc1d8ae1e8fcdafc24d115e117fabc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 16 Jan 2019 16:09:49 -0300 Subject: [PATCH 134/237] Fix hidding chrome navigation bar hiding when scrolling on mobile --- webchat/styles/custom.css | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index 3f15e4615..d73b5aaf5 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -1,9 +1,9 @@ -html { - overflow: hidden +html, body { + height: 100%; + max-height: 100%; } #webchat { - min-height: 100vh; overflow: hidden; display: flex; animation-name: simple-fade-in; @@ -11,6 +11,9 @@ html { } #content { + flex: 1; + min-height: 100%; + max-height: 100%; display: flex; height: 100%; overflow: hidden; From c1b29865298c45fdd76b2f4935a3d67212158f9a Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 16 Jan 2019 16:49:09 -0300 Subject: [PATCH 135/237] Add basic chat and chatClient --- webchat/utils/chat.js | 92 +++++++++++++++++++++++ webchat/utils/chatClient.js | 146 ++++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 webchat/utils/chat.js create mode 100644 webchat/utils/chatClient.js diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js new file mode 100644 index 000000000..191db8258 --- /dev/null +++ b/webchat/utils/chat.js @@ -0,0 +1,92 @@ +'use strict'; +(function () { + const app = angular.module('webchat'); + + app.factory('Chat', [() => { + function Chat() { + this.rpc = new RTCPeerConnection([ + { url: 'stun:stun.l.google.com:19302' } + ]); + this.eventHandlers = {}; + this.pendingCandidates = []; + this.tempRemote = {}; + } + + Chat.prototype.emit = function(eventName, e) { + if (this.eventHandlers[eventName]) { + this.eventHandlers[eventName].forEach((f) => { + f(e); + }); + } + } + + Chat.prototype.on = function(eventName, f) { + if (!this.eventHandlers[eventName]) { + this.eventHandlers[eventName] = []; + } + this.eventHandlers[eventName].push(f); + } + + Chat.prototype.receiveCandidate = function(candidate) { + if (this.rpc.remoteDescription == null) { + this.pendingCandidates.push(candidate); + return; + } + const rtcCandidate = new RTCIceCandidate(candidate); + + this.rpc.addIceCandidate(rtcCandidate); + } + + Chat.prototype.handleDataChannel = function(e) { + const chat = this; + e.channel.onmessage = channelEv => chat.emit('msg-received', channelEv); + } + + Chat.prototype.init = function(stream) { + stream.getTracks().forEach(t => this.rpc.addTrack(t, stream)); + // this.rpc.addTrack(stream.getTracks()[1], stream); + this.sendChannel = this.rpc.createDataChannel('sendChannel'); + this.rpc.ondatachannel = this.handleDataChannel.bind(this); + this.rpc.ontrack = this.handleTrack.bind(this); + this.rpc.onicecandidate = e => this.emit('ice-candidate', e); + } + + Chat.prototype.offer = function() { + this.rpc.createOffer().then(offer => { + this.rpc.setLocalDescription(offer).then(() => { + return offer; + }) + }); + } + + Chat.prototype.setTempRemote = function(remote) { + this.tempRemote = remote; + } + + Chat.prototype.setRemote = function(remote) { + this.rpc.setRemoteDescription(remote); + } + + Chat.prototype.accept = function() { + this.rpc.createAnswer().then(answer => { + this.rpc.setLocalDescription(answer).then(() => { + if (this.pendingCandidates > 0) { + this.pendingCandidates.forEach(c => this.receiveCandidate(c)); + } + return answer; + }) + }); + } + + Chat.prototype.handleTrack = function(e) { + this.emit('track-received', e); + } + + Chat.prototype.sendMessage = function(message) { + this.sendChannel.send(message); + this.emit('msg-sent', message); + } + + return Chat; + }]) +})(); diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js new file mode 100644 index 000000000..a4dd6faa6 --- /dev/null +++ b/webchat/utils/chatClient.js @@ -0,0 +1,146 @@ +'use strict'; +(function () { + const app = angular.module('webchat'); + + app.factory('ChatClient', [(Chat, UserService) => { + const hostname = 'localhost'; + const port = 8090; + + function ChatClient(id) { + this.id = id; + this.ws = new WebSocket(`ws://${hostname}:${port}`); + // maps event name to function + this.eventHandlers = {}; + // maps id to remote descriptions + this.remotes = {}; + // maps id to Chat + this.chats = {}; + // + this.users = {}; + + this.ws.onopen = () => { + const user = { + type: 'signin', + name: this.id, + }; + this.ws.send(JSON.stringify(user)); + this.requestUsers(); + }; + // we have to explictly pass a function with the event argument + // otherwise "this" will refer to the websocket instead of the Client object + // i.e.: this.ws.onmessage = handleWebSocket + // /\_____ this inside here will be the websocket + // we could also bind (this) back + // this.ws.onmessage = this.handleWebSocket(this); <-- also works + this.ws.onmessage = e => this.handleWebSocket(e); + } + + ChatClient.prototype.createChat = function(id) { + const chat = new Chat(); + this.chats[id] = chat; + this.emit('chat-created', { id, chat }); + return chat; + } + + ChatClient.prototype.handleWebSocket = function(e) { + const data = JSON.parse(e.data); + if (data.type === 'offer') { + const chat = this.createChat(data.name); + chat.setTempRemote(data); + this.emit('offer-received', data.name); + } else if (data.type === 'answer') { + this.handleAnswer(data); + } else if (data.candidate) { + this.addIceCandidate(data); + } else if (data.type === 'userList') { + this.handleUserListUpdate(data.users); + } else { + this.emit('ws-message', e); + } + } + + ChatClient.prototype.emit = function(eventName, e) { + if (this.eventHandlers[eventName]) { + this.eventHandlers[eventName].forEach((f) => { + f(e); + }); + } + } + + ChatClient.prototype.on = function(eventName, f) { + if (!this.eventHandlers[eventName]) { + this.eventHandlers[eventName] = []; + } + this.eventHandlers[eventName].push(f); + } + + ChatClient.prototype.addIceCandidate = function(e) { + if (this.chats[e.name]) { + this.chats[e.name].receiveCandidate(e.candidate); + } + } + + ChatClient.prototype.acceptChat = function(id, stream) { + const chat = this.chats[id]; + chat.setRemote(chat.tempRemote); + chat.init(stream).then(() => { + chat.accept().then(connection => { + this.ws.send(JSON.stringify({ + type: connection.type, + sdp: connection.sdp, + name: this.id, + dest: id, + })) + chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(id, e)); + }); + }) + } + + ChatClient.prototype.handleDiscoveredIceCandidates = function(id, e) { + if (e.candidate) { + const msg = { + type: 'newCandidate', + name: this.id, + dest: id, + candidate: e.candidate, + }; + this.ws.send(JSON.stringify(msg)); + } + } + + ChatClient.prototype.handleAnswer = function(data) { + const chat = this.chats[data.name]; + chat.setRemote(data); + } + + ChatClient.prototype.call = function(dest, stream) { + const chat = this.createChat(dest); + chat.init(stream).then(() => { + chat.offer().then(connection => { + const requestObj = { + name: this.id, + dest, + type: connection.type, + sdp: connection.sdp, + }; + this.ws.send(JSON.stringify(requestObj)); + chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(dest, e)); + }); + }); + } + + ChatClient.prototype.requestUsers = function() { + this.ws.send(JSON.stringify({ + name: this.id, + type: 'requestUsers', + })); + } + + ChatClient.prototype.handleUserListUpdate = function(users) { + this.users = users; + this.emit('userListUpdate', users); + } + + return ChatClient; + }]) +})(); From 98a01d0f856e8e1385ad5b7524d326424145cc04 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 17 Jan 2019 10:46:13 -0300 Subject: [PATCH 136/237] Working calls --- webchat/auth/authService.js | 18 ++++++++-- webchat/home/home.html | 18 ++++++++++ webchat/home/homeController.js | 61 +++++++++++++++++++++++++++++++--- webchat/index.html | 4 +++ webchat/utils/chat.js | 23 +++++++------ webchat/utils/chatClient.js | 48 ++++++++++++-------------- 6 files changed, 128 insertions(+), 44 deletions(-) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index c129644e5..3acef1857 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -3,8 +3,8 @@ const app = angular.module("webchat"); - app.service("AuthService", ['$q', '$state', '$window', 'UserService', 'MessageService', 'User', 'STATES', - function AuthService($q, $state, $window, UserService, MessageService, User, STATES) { + app.service("AuthService", ['$q', '$state', '$window', 'UserService', 'MessageService', 'User', 'STATES', 'ChatClient', + function AuthService($q, $state, $window, UserService, MessageService, User, STATES, ChatClient) { const service = this; const authObj = firebase.auth(); @@ -13,7 +13,7 @@ let resolveTokenPromise; let loadTokenPromise; let refreshInterval; - let isLoadingUser; + let chatClient; const provider = new firebase.auth.GoogleAuthProvider(); /** @@ -77,6 +77,12 @@ } }); + Object.defineProperty(service, 'chatClient', { + get: function() { + return chatClient; + } + }); + // It receives the app version and verify if it matches with // the actual frontend version, setting up the private variable // versionAvailable with true, if matches, or false, otherwise. @@ -123,6 +129,7 @@ if (user.emailVerified) { return user.getIdToken(true).then(function(idToken) { return service.setupUser(idToken, user.emailVerified).then(function success(userInfo) { + chatClient = new ChatClient(userInfo.key); return userInfo; }); }); @@ -175,6 +182,10 @@ return false; }; + service.getChatClient = () => { + return chatClient; + } + /** * Execute each function stored to be thriggered when user logout * is called. @@ -195,6 +206,7 @@ if ($window.localStorage.userInfo) { const parse = JSON.parse($window.localStorage.userInfo); userInfo = new User(parse); + chatClient = new ChatClient(userInfo.key); } } diff --git a/webchat/home/home.html b/webchat/home/home.html index 09fe625b0..bedaca286 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1 +1,19 @@

    HOME

    +
    + {{controller.userList}} +
    + + + + + diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 712a01eaf..ea586b36a 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,15 +3,68 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', function HomeController ($scope, $state) { + webchat.controller('HomeController', function HomeController (ChatClient, AuthService, UserService) { const controller = this; - const main = () => { + controller.userList = {}; + controller.users = AuthService.chatClient.users; + controller.client = {}; + controller.currentChat = {}; + controller.remoteClient = {}; + + controller.$onInit = () => { console.log('HomeController running'); + controller.client = AuthService.getChatClient(); + controller.remoteClient = new ChatClient('remote-me'); + controller.getUserList(); + controller.client.on('userListUpdate', controller.getUserList); + controller.remoteClient.on('offer-received', callPrompt); + controller.client.on('chat-created', e => { + e.chat.on('msg-received', ev => { + console.log(ev); + }) + + e.chat.on('track-received', ev => { + document.getElementById('video-remote').srcObject = ev.streams[0]; + }) + }) + controller.remoteClient.on('chat-created', e => { + e.chat.on('msg-received', ev => { + console.log(ev); + }) + }) }; - main(); + controller.updateUsers = () => { + controller.client.requestUsers(); + } - }); + controller.call = () => { + navigator.mediaDevices.getUserMedia({ video: {width: 640, height: 480} }).then(stream => { + controller.client.call('remote-me', stream); + // angular.element not working here + document.getElementById('video-selfie').srcObject = stream; + }); + } + controller.getUserList = () => { + let parsedList = {}; + controller.users.forEach(userKey => { + UserService.getUser(userKey).then((res) => { + parsedList[userKey] = res.name; + }); + }); + + controller.userList = parsedList; + } + + function callPrompt(id) { + const answer = confirm(`${id} has called. accept?`); + if (answer) { + navigator.mediaDevices.getUserMedia({ video: { width: 640, height: 480 } }).then(stream => { + controller.remoteClient.acceptCall(id, stream); + }); + } + } + }); })(); diff --git a/webchat/index.html b/webchat/index.html index 0d30084a1..301aefa1b 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -89,5 +89,9 @@ + + + + diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index 191db8258..d1c2a1f5f 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -44,7 +44,6 @@ Chat.prototype.init = function(stream) { stream.getTracks().forEach(t => this.rpc.addTrack(t, stream)); - // this.rpc.addTrack(stream.getTracks()[1], stream); this.sendChannel = this.rpc.createDataChannel('sendChannel'); this.rpc.ondatachannel = this.handleDataChannel.bind(this); this.rpc.ontrack = this.handleTrack.bind(this); @@ -52,8 +51,8 @@ } Chat.prototype.offer = function() { - this.rpc.createOffer().then(offer => { - this.rpc.setLocalDescription(offer).then(() => { + return this.rpc.createOffer().then(offer => { + return this.rpc.setLocalDescription(offer).then(() => { return offer; }) }); @@ -68,14 +67,16 @@ } Chat.prototype.accept = function() { - this.rpc.createAnswer().then(answer => { - this.rpc.setLocalDescription(answer).then(() => { - if (this.pendingCandidates > 0) { - this.pendingCandidates.forEach(c => this.receiveCandidate(c)); - } - return answer; - }) - }); + return this.rpc.setRemoteDescription(this.tempRemote).then(() => { + return this.rpc.createAnswer().then(answer => { + return this.rpc.setLocalDescription(answer).then(() => { + if (this.pendingCandidates > 0) { + this.pendingCandidates.forEach(c => this.receiveCandidate(c)); + } + return answer; + }) + }); + }) } Chat.prototype.handleTrack = function(e) { diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index a4dd6faa6..0d36c8ed6 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -2,7 +2,7 @@ (function () { const app = angular.module('webchat'); - app.factory('ChatClient', [(Chat, UserService) => { + app.factory('ChatClient', ['Chat', (Chat) => { const hostname = 'localhost'; const port = 8090; @@ -24,7 +24,6 @@ name: this.id, }; this.ws.send(JSON.stringify(user)); - this.requestUsers(); }; // we have to explictly pass a function with the event argument // otherwise "this" will refer to the websocket instead of the Client object @@ -80,20 +79,18 @@ } } - ChatClient.prototype.acceptChat = function(id, stream) { + ChatClient.prototype.acceptCall = function(id, stream) { const chat = this.chats[id]; - chat.setRemote(chat.tempRemote); - chat.init(stream).then(() => { - chat.accept().then(connection => { - this.ws.send(JSON.stringify({ - type: connection.type, - sdp: connection.sdp, - name: this.id, - dest: id, - })) - chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(id, e)); - }); - }) + chat.init(stream) + chat.accept().then(connection => { + this.ws.send(JSON.stringify({ + type: connection.type, + sdp: connection.sdp, + name: this.id, + dest: id, + })) + chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(id, e)); + }); } ChatClient.prototype.handleDiscoveredIceCandidates = function(id, e) { @@ -115,17 +112,16 @@ ChatClient.prototype.call = function(dest, stream) { const chat = this.createChat(dest); - chat.init(stream).then(() => { - chat.offer().then(connection => { - const requestObj = { - name: this.id, - dest, - type: connection.type, - sdp: connection.sdp, - }; - this.ws.send(JSON.stringify(requestObj)); - chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(dest, e)); - }); + chat.init(stream) + chat.offer().then(connection => { + const requestObj = { + name: this.id, + dest, + type: connection.type, + sdp: connection.sdp, + }; + this.ws.send(JSON.stringify(requestObj)); + chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(dest, e)); }); } From e5d26a97a535532326ad1998f9f9b9d0ce6658cf Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 17 Jan 2019 15:03:40 -0300 Subject: [PATCH 137/237] Pre push --- webchat/home/home.html | 5 +++- webchat/home/homeController.js | 43 +++++++++++++++++----------------- webchat/utils/chat.js | 29 ++++++++++++++++------- webchat/utils/chatClient.js | 43 +++++++++++++++++----------------- 4 files changed, 67 insertions(+), 53 deletions(-) diff --git a/webchat/home/home.html b/webchat/home/home.html index bedaca286..4eb4a454c 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -2,7 +2,10 @@

    HOME

    {{controller.userList}}
    - + +msg + +
    +

    Não há contatos online no momento.

    \ No newline at end of file From 2b4b640a9e10331e8f6421afc0a15f7b05345902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 23 Jan 2019 13:50:47 -0300 Subject: [PATCH 149/237] Removes mocks and uses AuthService to get current user --- webchat/home/homeController.js | 1 - webchat/services/WebchatService.js | 15 +-------------- webchat/webchat/webchatController.js | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 07545e209..12c7cf36d 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -6,7 +6,6 @@ webchat.controller('HomeController', ['WebchatService', function HomeController (WebchatService) { const homeCtrl = this; - homeCtrl.user = WebchatService.getCurrentUser(); homeCtrl.contacts = WebchatService.getContacts(); }]); diff --git a/webchat/services/WebchatService.js b/webchat/services/WebchatService.js index a1c614e03..6977c4a15 100644 --- a/webchat/services/WebchatService.js +++ b/webchat/services/WebchatService.js @@ -4,20 +4,7 @@ angular.module("webchat").service('WebchatService', function WebchatService() { const WebchatService = this; - WebchatService.getCurrentUser = () => ( - {name: "Name", description: "Description", avatar: "https://www.w3schools.com/howto/img_avatar.png"} - ); - - WebchatService.getContacts = () => { - const contactsList = []; - const numContacts = 30; - - for (let i = 0; i < numContacts; i++) { - contactsList.push(WebchatService.getCurrentUser()); - } - - return contactsList; - }; + WebchatService.getContacts = () => []; }); diff --git a/webchat/webchat/webchatController.js b/webchat/webchat/webchatController.js index 885d3720b..338dcd989 100644 --- a/webchat/webchat/webchatController.js +++ b/webchat/webchat/webchatController.js @@ -3,10 +3,10 @@ const webchat = angular.module('webchat'); - webchat.controller('WebchatController', ['WebchatService', function WebchatController (WebchatService) { + webchat.controller('WebchatController', ['AuthService', function WebchatController (AuthService) { const webchatCtrl = this; - webchatCtrl.user = WebchatService.getCurrentUser(); + webchatCtrl.user = AuthService.getCurrentUser(); }]); })(); \ No newline at end of file From 37dc57fc17eba41dffdf0ec0d07650b2ccf13efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 23 Jan 2019 13:54:39 -0300 Subject: [PATCH 150/237] Fix non-filling screen visual bug --- webchat/styles/custom.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index d73b5aaf5..7b060f208 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -1,6 +1,7 @@ html, body { height: 100%; max-height: 100%; + overflow: hidden; } #webchat { @@ -8,6 +9,7 @@ html, body { display: flex; animation-name: simple-fade-in; animation-duration: 2s; + min-height: 100%; } #content { From 117494827fee7f1ebf402311f0431516ab3babb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 23 Jan 2019 15:32:42 -0300 Subject: [PATCH 151/237] Fix user description injections --- .../components/contacts/list/contacts-list.html | 2 +- webchat/components/header/ecis-header.html | 2 +- webchat/images/avatar.png | Bin 0 -> 78128 bytes 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 webchat/images/avatar.png diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 841c4a3e4..674f1f1ee 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,6 +1,6 @@ - +

    Não há contatos online no momento.

    diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index 9cfe60a06..36cd998f1 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -1,6 +1,6 @@
    - +
    \ No newline at end of file diff --git a/webchat/images/avatar.png b/webchat/images/avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..6805897b8ea59665a9e87542c77fd90892f812c3 GIT binary patch literal 78128 zcmZ5p2|QHm`#-ANa+}gzzrsxj>6UIrDr78OB1KwJmd4&fwz7mww_*w@Qd2}L${N|1 zrid^oOSUW_vSpX7|K~lkx&QO|+)p*t|NI@puoXIcH4kIh zvQG5h(#7zJ?3;i4;g4mGdyl(d*m?!@AD_HYTt8LK2 zRz7!3)XL+QyLiLDHYJx|xQZ*-U*5NdaQbc1mI=nfL2OH1%kDKRD)+{V{cbR8VyOAs z;h5D!;c0CNZZj2gGc9w!!Dg8ITGP`(AtHtmL(ju5RH;>q@}W;%#?;=C(O){B$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c#lZelwOnJ=Yg z4AgiHjSP)Ppt|fG6cq8nTcO-;{R4j|7JnJljC?cj+iTtGAw9%~VFbUzQ^o5^HEPw~ zP-mySamO_j?Q=XXc!4o}T;!L1y2l(fgKk@Z_yN6b!wO9~nlQsw+b5=fc$nhb?}+PI zKZEu|Bgb~Q_v<0kOldG%y}FQ+SJjmK$v(>X`SUT+HHnFAbde%g^!4wmsKj0ph6Zvj zrG0$mmdL!Jm9O1*$P&DhhmJ{EGdH2Vd13tw8RUms%EVUo6NUeLCboY$0Qkc9r76&( zpO~3-x+F2FhuQ2&Zwxc-Yodpj6IBsK?({t?%m+;5ajDkdw55oo{ZAJ0 zixmE=n%)Xr5RsH$ASTT!8%w_X=|33akD-Ldj>-MIi+O4i(Uq=Pn-#9sBS)S5hd${* z6?vbOJ`XPk@YyGnwemf*IrskXu(^xCdfHPQK>xs3sp(3~u<|tHF=Xc5B88eNNBIx1 zBX-*jaxY>lEr!8sNs$lq3QbcRf3+mao|>k@DZVV_(1?-_`SPw{$W3>TBa)n-EXpk^ zHBC(vAn691DIt#3R4XZI|8LDU!bj=g#^_V$4Od3X|1U;htGC* zkLxDxW;hToss8By?#{iBHYfNp{X|Y!@=x+)&AFW~f@hP+^E5Sz9On6bbHCi#*P15S zKrk{VnygREZ<+i&b%gM?m_Qp2zB_Yo2Us9b)9aKtW`_9{bSmwNC0?sZ;fSD>mmZa#9uEp#W zFp?UxDcSLN+>7B94HsATb?nTY@XR~jL^-*rvc>Lr z?DVWPyL$J7D3BQz(3bwa$2L;%fHE{{u2tC4&F} literal 0 HcmV?d00001 From 0f2fc7bc28d4a2377c7bec6b16c45f99c9460931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 23 Jan 2019 15:37:47 -0300 Subject: [PATCH 152/237] Add logout function to header --- webchat/components/header/ecis-header.component.js | 7 ++++++- webchat/components/header/ecis-header.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webchat/components/header/ecis-header.component.js b/webchat/components/header/ecis-header.component.js index dac382759..ba5766684 100644 --- a/webchat/components/header/ecis-header.component.js +++ b/webchat/components/header/ecis-header.component.js @@ -12,6 +12,7 @@ angular.module('webchat').component('ecisHeader', { templateUrl: "app/components/header/ecis-header.html", controller: [ + 'AuthService', 'NavbarManagementService', headerController, ], @@ -21,11 +22,15 @@ }, }); - function headerController (NavbarManagementService) { + function headerController (AuthService, NavbarManagementService) { const headerCtrl = this; headerCtrl.toggleNavbar = () => { NavbarManagementService.toggleSidenav('left'); }; + + headerCtrl.logout = () => { + AuthService.logout(); + }; } })(); diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index 36cd998f1..f155fc5d7 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -2,5 +2,5 @@ - +
    \ No newline at end of file From e54c5a5d15cf9792ceb969c3d835f3f02993ddba Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 24 Jan 2019 09:42:51 -0300 Subject: [PATCH 153/237] Add new call logic * Call requests are now exchanged before RPC offers are sent --- webchat/utils/chat.js | 20 +++++-------- webchat/utils/chatClient.js | 60 ++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index d82561263..48e84710f 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -10,7 +10,7 @@ this.rpc = new RTCPeerConnection([{ url: 'stun:stun.l.google.com:19302', url: 'stun:stun2.l.google.com:19302', - url: 'stun:stun3.l.google.com:19302' + url: 'stun:stun3.l.google.com:19302', }]); this.eventHandlers = {}; stream.getTracks().forEach(t => { @@ -20,9 +20,8 @@ this.sendChannel = this.rpc.createDataChannel('sendChannel'); this.rpc.ondatachannel = this.handleDataChannel.bind(this); this.rpc.ontrack = e => this.emit('track-received', e); - this.rpc.oniceconnectionstatechange = this.iceConnectionCB.bind(this); - this.rpc.onsignalingstatechange = this.stateCB.bind(this); - this.currentMessages; + this.rpc.oniceconnectionstatechange = this.iceConnectionCB; + this.rpc.onsignalingstatechange = this.stateCB; } Chat.prototype.emit = function(eventName, e) { @@ -43,7 +42,6 @@ Chat.prototype.receiveCandidate = function(candidate) { console.log('candidate received', candidate); const rtcCandidate = new RTCIceCandidate(candidate); - this.rpc.addIceCandidate(rtcCandidate); } @@ -58,12 +56,12 @@ }; } - Chat.prototype.iceConnectionCB = function() { - console.log(`Ice connection changed to ${this.rpc.iceConnectionState}`) + Chat.prototype.iceConnectionCB = function(ev) { + console.log('ice connection changed', ev.target.iceConnectionState) } - Chat.prototype.stateCB = function() { - console.log(`State connection changed to ${this.rpc.signalingState}`) + Chat.prototype.stateCB = function(ev) { + console.log('state changed', ev.target.signalingState); } Chat.prototype.offer = function() { @@ -78,10 +76,6 @@ }); } - Chat.prototype.setTempRemote = function(remote) { - this.tempRemote = remote; - } - Chat.prototype.setRemote = function(remote) { this.rpc.setRemoteDescription(remote); } diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index bccd114f4..58a57a958 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -11,12 +11,12 @@ this.ws = new WebSocket(`ws://${hostname}:${port}`); // maps event name to function this.eventHandlers = {}; - // maps id to remote descriptions - this.remotes = {}; // maps id to Chat this.chats = {}; // this.users = {}; + // + this.stream = undefined; this.ws.onopen = () => { const user = { @@ -43,9 +43,13 @@ ChatClient.prototype.handleWebSocket = function (e) { const data = JSON.parse(e.data); - if (data.type === 'offer') { - this.remotes[data.name] = data; - this.emit('offer-received', data.name); + console.log('ws event: ', data.type); + if (data.type === 'callRequest') { + this.emit('call-requested', data.name); + } else if (data.type === 'callAnswer') { + this.offerRpc(data.name); + } else if (data.type === 'offer') { + this.answerRpc(data); } else if (data.type === 'answer') { this.handleAnswer(data); } else if (data.candidate) { @@ -57,6 +61,10 @@ } } + ChatClient.prototype.handleAnswer = function(msg) { + this.chats[msg.name].setRemote(msg); + } + ChatClient.prototype.emit = function (eventName, e) { if (this.eventHandlers[eventName]) { this.eventHandlers[eventName].forEach((f) => { @@ -73,17 +81,17 @@ } ChatClient.prototype.addIceCandidate = function (e) { - console.log('ws candidate received', e); if (this.chats[e.name]) { this.chats[e.name].receiveCandidate(e.candidate); } } - ChatClient.prototype.acceptCall = function (id, stream) { - const remote = this.remotes[id]; - const chat = this.createChat(id, stream); + ChatClient.prototype.answerRpc = function (msg) { + const id = msg.name; + console.log('offer received, answering ', id); + const chat = this.chats[id]; chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(id, e)); - chat.accept(remote).then(connection => { + chat.accept(msg).then(connection => { this.ws.send(JSON.stringify({ type: connection.type, sdp: connection.sdp, @@ -106,13 +114,9 @@ } } - ChatClient.prototype.handleAnswer = function (data) { - const chat = this.chats[data.name]; - chat.setRemote(data); - } - - ChatClient.prototype.call = function (dest, stream) { - const chat = this.createChat(dest, stream); + ChatClient.prototype.offerRpc = function (dest) { + console.log('call accepted, offering', dest); + const chat = this.chats[dest]; chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(dest, e)); chat.offer().then(connection => { const requestObj = { @@ -137,6 +141,28 @@ this.emit('user-list-update', users); } + ChatClient.prototype.call = function (dest, stream) { + this.stream = this.stream || stream; + this.chats[dest] = this.createChat(dest, this.stream); + + this.ws.send(JSON.stringify({ + name: this.id, + dest: dest, + type: 'callRequest' + })) + } + + ChatClient.prototype.acceptCall = function (id, stream) { + this.stream = this.stream || stream; + this.createChat(id, this.stream); + + this.ws.send(JSON.stringify({ + name: this.id, + dest: id, + type: 'callAnswer' + })) + } + return ChatClient; }]) })(); From 0b338125914393ff06ab3e124c4c9799177eb868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Mon, 28 Jan 2019 08:50:53 -0300 Subject: [PATCH 154/237] Add Utils.getIndexesOf() test when there is no substring match --- webchat/test/specs/utils/utils.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webchat/test/specs/utils/utils.test.js b/webchat/test/specs/utils/utils.test.js index 42d55e3b5..a184bc28c 100644 --- a/webchat/test/specs/utils/utils.test.js +++ b/webchat/test/specs/utils/utils.test.js @@ -10,6 +10,13 @@ const indexes = Utils.getIndexesOf(substring, string); expect(indexes).toEqual([5,17,25]); }); + + it('should return an empty array', () => { + const string = 'test substring other'; + const substring = 'X'; + const indexes = Utils.getIndexesOf(substring, string); + expect(indexes).toEqual([]); + }); }); describe('limitString()', function () { From b4091841c22e99c193f866f765499c78951e95e2 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 24 Jan 2019 09:56:41 -0300 Subject: [PATCH 155/237] Refactor chatClient to es6 class and add jsdoc --- webchat/app.js | 6 + webchat/utils/chat.js | 2 +- webchat/utils/chatClient.js | 436 ++++++++++++++++++++++++------------ 3 files changed, 305 insertions(+), 139 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 38ffae8e9..4e6dc7c6f 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -16,6 +16,12 @@ error: 'error', }); + app.constant('WEBSOCKET', { + hostname: window.location.hostname, + port: 8090, + maxRetries: 5, + }); + app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) => { $mdIconProvider.fontSet('md', 'material-icons'); diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index 48e84710f..76c386351 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -16,7 +16,7 @@ stream.getTracks().forEach(t => { this.rpc.addTrack(t, stream) }); - this.rpc.onicecandidate = e => this.emit('ice-candidate', e); + this.rpc.onicecandidate = e => this.emit('ice-candidate-discovered', e); this.sendChannel = this.rpc.createDataChannel('sendChannel'); this.rpc.ondatachannel = this.handleDataChannel.bind(this); this.rpc.ontrack = e => this.emit('track-received', e); diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 58a57a958..d89329547 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -2,165 +2,325 @@ (function () { const app = angular.module('webchat'); - app.factory('ChatClient', ['Chat', (Chat) => { - const hostname = window.location.hostname; - const port = 8090; - - function ChatClient(id) { - this.id = id; - this.ws = new WebSocket(`ws://${hostname}:${port}`); - // maps event name to function - this.eventHandlers = {}; - // maps id to Chat - this.chats = {}; - // - this.users = {}; - // - this.stream = undefined; - - this.ws.onopen = () => { - const user = { - type: 'signin', - name: this.id, + app.factory('ChatClient', ['Chat', 'WEBSOCKET', (Chat, WEBSOCKET) => { + const ChatClient = class ChatClient { + /** + * Create a new ChatClient (WebRTC wrapper), + * and automatically start a WebSocket connection. + * The ChatClient also mediates connections by Chat objects + * before a RPC connection is succesfully completed. + * @param {string} id - firebase id of the user + */ + constructor(id) { + this.id = id; + this.ws = {}; + this.retries = 0; + this.eventHandlers = {}; + this.chats = {}; + this.users = {}; + this.stream = undefined; + this.startWebsocket(); + } + + /** + * Starts a new connection with the websocket server. + */ + startWebsocket() { + const websocket = `ws://${WEBSOCKET.hostname}:${WEBSOCKET.port}`; + this.ws = new WebSocket(websocket); + + // Sends a signin message to the websocket as soon as the websocket connects + this.ws.onopen = () => { + this.sendToWebsocket('signin', '', {}); + this.retries = 0; }; - this.ws.send(JSON.stringify(user)); - }; - // we have to explictly pass a function with the event argument - // otherwise "this" will refer to the websocket instead of the Client object - // i.e.: this.ws.onmessage = handleWebSocket - // /\_____ this inside here will be the websocket - // we could also bind (this) back - // this.ws.onmessage = this.handleWebSocket(this); <-- also works - this.ws.onmessage = e => this.handleWebSocket(e); - } - ChatClient.prototype.createChat = function (id, stream) { - const chat = new Chat(stream, this.id); - this.chats[id] = chat; - this.emit('chat-created', { id, chat }); - return chat; - } + // Listen to the websocket messages, treating those as "events" + this.ws.onmessage = e => this.handleWebSocket(e); - ChatClient.prototype.handleWebSocket = function (e) { - const data = JSON.parse(e.data); - console.log('ws event: ', data.type); - if (data.type === 'callRequest') { - this.emit('call-requested', data.name); - } else if (data.type === 'callAnswer') { - this.offerRpc(data.name); - } else if (data.type === 'offer') { - this.answerRpc(data); - } else if (data.type === 'answer') { - this.handleAnswer(data); - } else if (data.candidate) { - this.addIceCandidate(data); - } else if (data.type === 'userList') { - this.handleUserListUpdate(data.users); - } else { - this.emit('ws-message', e); + // Retry connection when closed or refused + this.ws.onclose = () => { + this.retryWebSocket(); + } } - } - ChatClient.prototype.handleAnswer = function(msg) { - this.chats[msg.name].setRemote(msg); - } + /** + * Retries a new connection with the websocket server, + * with a maximum number of WEBSOCKET.maxRetries (5); + */ + retryWebSocket() { + if (this.retries < WEBSOCKET.maxRetries) { + this.retries += 1; + console.log('Retrying connection, retry: ', this.retries); + setTimeout(function () { + this.startWebsocket() + }.bind(this), 5000) + } + } - ChatClient.prototype.emit = function (eventName, e) { - if (this.eventHandlers[eventName]) { - this.eventHandlers[eventName].forEach((f) => { - f(e); - }); + /** + * Mimics node's on/emit event handlers. + * Raises an event. + * @param {string} eventName - name of the event + * @param {object} e - event data + */ + emit(eventName, e) { + if (this.eventHandlers[eventName]) { + this.eventHandlers[eventName].forEach((f) => { + f(e); + }); + } } - } - ChatClient.prototype.on = function (eventName, f) { - if (!this.eventHandlers[eventName]) { - this.eventHandlers[eventName] = []; + /** + * Mimics node's on/emit event handlers. + * Adds a callback to an event. + * @param {string} eventName - name of the event + * @param {Function} f - function to be called when event is raised. + */ + on(eventName, f) { + if (!this.eventHandlers[eventName]) { + this.eventHandlers[eventName] = []; + } + this.eventHandlers[eventName].push(f); } - this.eventHandlers[eventName].push(f); - } - ChatClient.prototype.addIceCandidate = function (e) { - if (this.chats[e.name]) { - this.chats[e.name].receiveCandidate(e.candidate); + /** + * Sends a message (JSON string) to another user via the websocket + * @param {string} type - type of message + * @param {string} to - id of the user to send a message to + * @param {object} data - contents of the message + */ + sendToWebsocket(type, to, data) { + const msg = { type, from: this.id, to, data } + this.ws.send(JSON.stringify(msg)); } - } - ChatClient.prototype.answerRpc = function (msg) { - const id = msg.name; - console.log('offer received, answering ', id); - const chat = this.chats[id]; - chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(id, e)); - chat.accept(msg).then(connection => { - this.ws.send(JSON.stringify({ - type: connection.type, - sdp: connection.sdp, - name: this.id, - dest: id, - })) - }); - } + /** + * Create a new Chat object associated to an id of another user + * @param {string} id - firebase id of the other user + * @param {MediaStream} stream - a Video/Audio stream for the connection + * + * @returns {Chat} a chat object of this connection + * @fires ChatClient#chat-created + */ + createChat(id, stream) { + const chat = new Chat(stream, this.id); + this.chats[id] = chat; - ChatClient.prototype.handleDiscoveredIceCandidates = function (id, e) { - if (e.candidate) { - console.log('candidate discovered', e.candidate); - const msg = { - type: 'newCandidate', - name: this.id, - dest: id, - candidate: e.candidate, - }; - this.ws.send(JSON.stringify(msg)); + /** + * Event when a new chat is created. + * + * @event ChatClient#chat-created + * @property {string} id - id of the other user associated with this chat + * @property {Chat} chat - Chat object + */ + this.emit('chat-created', { id, chat }); + return chat; } - } - ChatClient.prototype.offerRpc = function (dest) { - console.log('call accepted, offering', dest); - const chat = this.chats[dest]; - chat.on('ice-candidate', e => this.handleDiscoveredIceCandidates(dest, e)); - chat.offer().then(connection => { - const requestObj = { - name: this.id, - dest, - type: connection.type, - sdp: connection.sdp, - }; - this.ws.send(JSON.stringify(requestObj)); - }); - } + /** + * Handles events sent by the websocket server, + * parsing the string content on {e.data} as a javascript regular object. + * @param {MessageEvent} e - websocket event + * + * @listens websocket#call-request + * @listens websocket#call-answer + * @listens websocket#rpc-offer + * @listens websocket#rpc-answer + * @listens websocket#ice-candidate-received + * @listens websocket#user-list-update + */ + handleWebSocket(event) { + const msg = JSON.parse(event.data); + console.log('ws event: ', msg.type); + console.log(msg); - ChatClient.prototype.requestUsers = function () { - this.ws.send(JSON.stringify({ - name: this.id, - type: 'requestUsers', - })); - } + switch (msg.type) { + case 'call-request': + this.handleCallRequest(msg); + break; + case 'call-answer': + this.handleCallAnswer(msg); + break; + case 'rpc-offer': + this.handleRpcOffer(msg); + break; + case 'rpc-answer': + this.handleRpcAnswer(msg); + break; + case 'ice-candidate-received': + this.handleCandidateReceived(msg); + break; + case 'user-list-update': + this.handleUserListUpdate(msg); + break; + default: + this.emit('ws-message', msg); + break; + } + } - ChatClient.prototype.handleUserListUpdate = function (users) { - this.users = users; - this.emit('user-list-update', users); - } + /** + * Handles a websocket call request message. + * @param {object} msg - websocket message + * @property {string} type - 'call-request' + * @property {string} id - id of the user who has requested the call. + * @property {object} data - {} + * + * @fires ChatClient#call-requested + */ + handleCallRequest(msg) { + /** + * Event when a call has been request by another user + * + * @event ChatClient#call-requested + * @property {string} id - id of the user who has request the call + */ + this.emit('call-requested', msg.id); + } + + /** + * Handles a websocket callAnswer event. + * Creates a new Chat object, + * and sends back a message to that user with RPC details. + * @param {object} msg - websocket message + * @property {string} type - 'call-answer' + * @property {string} id - id of the user who has accepted the call. + * @property {object} data - {} + * @listens Chat#ice-candidate-discovered + */ + handleCallAnswer(msg) { + const to = msg.id; + const chat = this.chats[to]; + chat.on('ice-candidate-discovered', candidate => this.handleDiscoveredIceCandidates(to, candidate)); + chat.offer().then(connection => { + this.sendToWebsocket('rpc-offer', to, connection); + }); + } - ChatClient.prototype.call = function (dest, stream) { - this.stream = this.stream || stream; - this.chats[dest] = this.createChat(dest, this.stream); + /** + * Event when a RPC offer has been received. + * + * @event websocket#rpc-offer + */ + /** + * Handles a websocket offer message. + * Gets the relevant Chat object, + * accepts that RPC connection, + * and sends a message back to the offerer. + * @param {object} msg - websocket message + * @property {string} type - 'rpc-offer' + * @property {string} id - id of the user who has offered + * @property {object} data - RPC object, with type='offer' and sdp + * @listens Chat#ice-candidate-discovered + */ + handleRpcOffer(msg) { + const id = msg.id; + console.log('offer received, answering ', id); + const chat = this.chats[id]; + chat.on('ice-candidate-discovered', e => this.handleDiscoveredIceCandidates(id, e)); + chat.accept(msg.data).then(connection => { + this.sendToWebsocket('rpc-answer', id, connection); + }); + } - this.ws.send(JSON.stringify({ - name: this.id, - dest: dest, - type: 'callRequest' - })) - } + /** + * Handles a RPC answer. + * Gets the related chat, + * and completes the connection. + * @param {object} msg - websocket message + * @property {String} type - 'rpc-answer' + * @property {string} id - id of the user who has answered + * @property {object} data - RPC object, with type='answer' and sdp + */ + handleRpcAnswer(msg) { + this.chats[msg.id].setRemote(msg.data); + } - ChatClient.prototype.acceptCall = function (id, stream) { - this.stream = this.stream || stream; - this.createChat(id, this.stream); + /** + * Event when a ICE candidate has been received. + * + * @event websocket#ice-candidate-received + */ + /** + * Handles ICE candidate messages from the websocket. + * Gets the associated chat, + * and adds the candidate to that RPC. + * @param {object} msg - websocket message. + * @property {String} type - newCandidate + * @property {string} id - id of the user who has sent the candidates + * @property {candidate} candidate - a ICE candidate to be added by the RPC connection + */ + handleCandidateReceived(msg) { + if (this.chats[msg.id]) { + this.chats[msg.id].receiveCandidate(msg.data); + } + } + + /** + * Event when the list of online users has been updated. + * + * @event websocket#userList + * @property {string} type - userList + * @property {[string]} users - list of users id currently online + */ + /** + * Handles a websocket userList message, + * propagating that data back as a ChatClient proper event. + * @param {object} data - event data + * @listens websocket#user-list-update + * @fires ChatClient#user-list-updated + */ + handleUserListUpdate(msg) { + this.users = msg.data; + /** + * @event ChatClient#user-list-updated + * @property {[string]} users - list of users id currently online + */ + this.emit('user-list-updated', this.users); + } + + /** + * Handles chat event from discovered ice candidates. + * @param {string} id - id of the user to be sent candidates + * @param {object} event - event containing the candidate info + */ + handleDiscoveredIceCandidates(id, event) { + if (event.candidate) { + console.log('candidate discovered', event.candidate); + this.sendToWebsocket('ice-candidate', id, event.candidate); + } + } - this.ws.send(JSON.stringify({ - name: this.id, - dest: id, - type: 'callAnswer' - })) + /** + * Calls another user. + * @param {string} id - id of the user to request a call + * @param {MediaStream} stream - MediaStream video/audio object of the caller + */ + requestCall(id, stream) { + this.stream = this.stream || stream; + this.chats[id] = this.createChat(id, this.stream); + this.sendToWebsocket('call-request', id, {}); + } + + /** + * Accepts a call from another user. + * @param {string} id - id of the user who has called. + * @param {MediaStream} stream - MediaStream video/audio object of the answerer + */ + acceptCall(id, stream) { + this.stream = this.stream || stream; + this.createChat(id, this.stream); + this.sendToWebsocket('call-answer', id, {}); + } + + /** + * Requests the websocket a list of online users. + */ + requestUsers() { + this.sendToWebsocket('user-list-request', '', {}); + } } return ChatClient; From aaa3bfab18fa60d39bbe97afcab0b824b7712e00 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 09:47:46 -0300 Subject: [PATCH 156/237] Refactor chat and chatMessage to es6 classes --- webchat/utils/chat.js | 183 +++++++++++++++++------------------ webchat/utils/chatMessage.js | 14 +-- 2 files changed, 99 insertions(+), 98 deletions(-) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index 76c386351..d0c7615b9 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -3,115 +3,114 @@ const app = angular.module('webchat'); app.factory('Chat', ['ChatMessage', (ChatMessage) => { - let messages = []; - - function Chat(stream, selfId) { - this.selfId = selfId; - this.rpc = new RTCPeerConnection([{ - url: 'stun:stun.l.google.com:19302', - url: 'stun:stun2.l.google.com:19302', - url: 'stun:stun3.l.google.com:19302', - }]); - this.eventHandlers = {}; - stream.getTracks().forEach(t => { - this.rpc.addTrack(t, stream) - }); - this.rpc.onicecandidate = e => this.emit('ice-candidate-discovered', e); - this.sendChannel = this.rpc.createDataChannel('sendChannel'); - this.rpc.ondatachannel = this.handleDataChannel.bind(this); - this.rpc.ontrack = e => this.emit('track-received', e); - this.rpc.oniceconnectionstatechange = this.iceConnectionCB; - this.rpc.onsignalingstatechange = this.stateCB; - } - - Chat.prototype.emit = function(eventName, e) { - if (this.eventHandlers[eventName]) { - this.eventHandlers[eventName].forEach((f) => { - f(e); + const Chat = class Chat { + constructor(stream, selfId) { + this.selfId = selfId; + this.rpc = new RTCPeerConnection([{ + url: 'stun:stun.l.google.com:19302', + url: 'stun:stun2.l.google.com:19302', + url: 'stun:stun3.l.google.com:19302', + }]); + this.eventHandlers = {}; + stream.getTracks().forEach(t => { + this.rpc.addTrack(t, stream) }); + this.rpc.onicecandidate = e => this.emit('ice-candidate-discovered', e); + this.sendChannel = this.rpc.createDataChannel('sendChannel'); + this.rpc.ondatachannel = this.handleDataChannel.bind(this); + this.rpc.ontrack = e => this.emit('track-received', e); + this.rpc.oniceconnectionstatechange = this.handleIceConnectionState.bind(this); + this.rpc.onsignalingstatechange = this.handleState.bind(this); + this._currentMessages = []; } - } - Chat.prototype.on = function(eventName, f) { - if (!this.eventHandlers[eventName]) { - this.eventHandlers[eventName] = []; + emit(eventName, e) { + if (this.eventHandlers[eventName]) { + this.eventHandlers[eventName].forEach((f) => { + f(e); + }); + } } - this.eventHandlers[eventName].push(f); - } - - Chat.prototype.receiveCandidate = function(candidate) { - console.log('candidate received', candidate); - const rtcCandidate = new RTCIceCandidate(candidate); - this.rpc.addIceCandidate(rtcCandidate); - } - Chat.prototype.handleDataChannel = function(e) { - const chat = this; - e.channel.onmessage = channelEv => { - if (channelEv.data) { - const msg = new ChatMessage(channelEv.data); - chat.currentMessages.push(msg); - chat.emit('msg-list-updated', this.currentMessages) + on(eventName, f) { + if (!this.eventHandlers[eventName]) { + this.eventHandlers[eventName] = []; } - }; - } + this.eventHandlers[eventName].push(f); + } - Chat.prototype.iceConnectionCB = function(ev) { - console.log('ice connection changed', ev.target.iceConnectionState) - } + receiveCandidate(candidate) { + console.log('candidate received', candidate); + const rtcCandidate = new RTCIceCandidate(candidate); + this.rpc.addIceCandidate(rtcCandidate); + } - Chat.prototype.stateCB = function(ev) { - console.log('state changed', ev.target.signalingState); - } + handleDataChannel(e) { + const chat = this; + e.channel.onmessage = channelEv => { + if (channelEv.data) { + const msg = new ChatMessage(channelEv.data); + chat._currentMessages.push(msg); + chat.emit('msg-list-updated', chat.currentMessages) + } + }; + } - Chat.prototype.offer = function() { - return this.rpc.createOffer().then(offer => { - return this.rpc.setLocalDescription(offer).then(() => { - return offer; - }).catch(e => { - console.log('Erro em local description apos offer', e); - }); - }).catch(e => { - console.log('Erro em offer', e); - }); - } + handleIceConnectionState(ev) { + this.emit('ice-connection-changed', ev.target.iceConnectionState) + } - Chat.prototype.setRemote = function(remote) { - this.rpc.setRemoteDescription(remote); - } + handleState(ev) { + this.emit('state-changed', ev.target.signalingState) + } - Chat.prototype.accept = function(remote) { - return this.rpc.setRemoteDescription(remote).then(() => { - return this.rpc.createAnswer().then(answer => { - return this.rpc.setLocalDescription(answer).then(() => { - return answer; - }) + offer() { + return this.rpc.createOffer().then(offer => { + return this.rpc.setLocalDescription(offer).then(() => { + return offer; + }).catch(e => { + console.log('Erro em local description apos offer', e); + }); }).catch(e => { - console.log('Erro em answer', e); + console.log('Erro em offer', e); }); - }) - } + } - Chat.prototype.handleTrack = function(e) { - this.emit('track-received', e); - } + setRemote(remote) { + this.rpc.setRemoteDescription(remote); + } - Chat.prototype.sendMessage = function(message) { - const msgString = JSON.stringify({ - sender: this.selfId, - timestamp: Date.now(), - msg: message, - type: 'text', - }) - this.sendChannel.send(msgString); - messages.push(new ChatMessage(msgString)); - } + accept(remote) { + return this.rpc.setRemoteDescription(remote).then(() => { + return this.rpc.createAnswer().then(answer => { + return this.rpc.setLocalDescription(answer).then(() => { + return answer; + }) + }).catch(e => { + console.log('Erro em answer', e); + }); + }) + } + + handleTrack(e) { + this.emit('track-received', e); + } - Object.defineProperty(Chat.prototype, 'currentMessages', { - get: () => { - return messages.sort((p, n) => p.timestamp - n.timestamp); + sendMessage(message) { + const msgString = JSON.stringify({ + sender: this.selfId, + timestamp: Date.now(), + msg: message, + type: 'text', + }) + this.sendChannel.send(msgString); + this._currentMessages.push(new ChatMessage(msgString)); } - }) + + get currentMessages() { + return this._currentMessages.sort((p, n) => p.timestamp - n.timestamp); + } + } return Chat; }]) diff --git a/webchat/utils/chatMessage.js b/webchat/utils/chatMessage.js index a891eec15..b72e1ba11 100644 --- a/webchat/utils/chatMessage.js +++ b/webchat/utils/chatMessage.js @@ -4,12 +4,14 @@ const app = angular.module('webchat') app.factory('ChatMessage', [() => { - function ChatMessage(jsonString) { - const parsed = JSON.parse(jsonString); - this.sender = parsed.sender; - this.timestamp = parsed.timestamp; - this.msg = parsed.msg; - this.type = 'text'; + const ChatMessage = class ChatMessage { + constructor(jsonString) { + const parsed = JSON.parse(jsonString); + this.sender = parsed.sender; + this.timestamp = parsed.timestamp; + this.msg = parsed.msg; + this.type = 'text'; + } } return ChatMessage; From 9c76483c1b03b8bc764f911d5fc0ff7ba358eddd Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 12:04:39 -0300 Subject: [PATCH 157/237] Add jsdoc to chat.js --- webchat/utils/chat.js | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index d0c7615b9..005991028 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -4,6 +4,12 @@ app.factory('Chat', ['ChatMessage', (ChatMessage) => { const Chat = class Chat { + /** + * Creates a new Chat object, which will handle a webrtc peer connection, + * its events and video/audio/data channels functionality. + * @param {MediaStream} stream - video/audio stream object + * @param {string} selfId - firebase id of the current user + */ constructor(stream, selfId) { this.selfId = selfId; this.rpc = new RTCPeerConnection([{ @@ -24,6 +30,12 @@ this._currentMessages = []; } + /** + * Mimics node's on/emit event handlers. + * Raises an event. + * @param {string} eventName - name of the event + * @param {object} e - event data + */ emit(eventName, e) { if (this.eventHandlers[eventName]) { this.eventHandlers[eventName].forEach((f) => { @@ -32,6 +44,12 @@ } } + /** + * Mimics node's on/emit event handlers. + * Adds a callback to an event. + * @param {string} eventName - name of the event + * @param {Function} f - function to be called when event is raised. + */ on(eventName, f) { if (!this.eventHandlers[eventName]) { this.eventHandlers[eventName] = []; @@ -39,31 +57,79 @@ this.eventHandlers[eventName].push(f); } + /** + * Adds an ice candidate to the current connection, + * received from the websocket signaling server. + * @param {Object} candidate - RTCIceCandidate to be added to this connection + */ receiveCandidate(candidate) { console.log('candidate received', candidate); const rtcCandidate = new RTCIceCandidate(candidate); this.rpc.addIceCandidate(rtcCandidate); } + /** + * Handles data channel events from the RTC Peer Connection. + * Currently only message (text) events are handled, + * raising a msg-list-updated event. + * @param {Event} e - data channel event to be handled + * + * @fires Chat#msg-list-updated + */ handleDataChannel(e) { const chat = this; e.channel.onmessage = channelEv => { if (channelEv.data) { const msg = new ChatMessage(channelEv.data); chat._currentMessages.push(msg); + + /** + * Event when the currentMessages property has been updated. + * + * @event Chat#msg-list-updated + * @property [ChatMessage] - current list of ChatMessages + */ chat.emit('msg-list-updated', chat.currentMessages) } }; } + /** + * Handles a ice connection state change event, + * propagating it back as another event through the Chat object. + * Usefull for detecting when a connection is being attempted, + * disconnected or otherwise closed for some reason. + * Possible states are: + * 'new', 'checking', 'connected/completed', 'failed/disconnected/closed',. + * + * https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState + * + * @param {Event} ev - full event of a ice connection state change. + * Its target is the current Remote Peer connection. + * + * @fires Chat#ice-connection-changed + */ handleIceConnectionState(ev) { this.emit('ice-connection-changed', ev.target.iceConnectionState) } + /** + * Handles a state connection change event, + * propagating it back as another event through the Chat object. + * + * @param {Event} ev - full event of a connection state change. + * Its target is the current Remote Peer connection. + * + * @fires Chat#state-changed + */ handleState(ev) { this.emit('state-changed', ev.target.signalingState) } + /** + * Starts a new RPC as the offerer, resolve the promise with the session object. + * + */ offer() { return this.rpc.createOffer().then(offer => { return this.rpc.setLocalDescription(offer).then(() => { @@ -76,10 +142,19 @@ }); } + /** + * Adds a new remote session object (answer) as the remote description of current Chat. + * Used to set the remote description when started as the offerer. + * @param {string} remote - remote session object. + */ setRemote(remote) { this.rpc.setRemoteDescription(remote); } + /** + * Starts a new RPC accepting a remote offer, resolves the promise with the answer object. + * @param {objet} remote - remote ssion object. + */ accept(remote) { return this.rpc.setRemoteDescription(remote).then(() => { return this.rpc.createAnswer().then(answer => { @@ -92,10 +167,20 @@ }) } + /** + * Handles a track added event and propagantes it back through the Chat object. + * The video/audio object can be obtained through e.streams[0]. + * @param {Event} e - event which contains the stream object and its tracks. + */ handleTrack(e) { this.emit('track-received', e); } + /** + * Sends a ChatMessage to the other user through the data channel. + * Adds Date.now() as the timestamp. + * @param {string} message - Message contents to be sent + */ sendMessage(message) { const msgString = JSON.stringify({ sender: this.selfId, From a9498977758f85d51d581afeec223bcfcccae6ca Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 14:30:23 -0300 Subject: [PATCH 158/237] Remove testing files from PR branch --- webchat/home/home.html | 29 ----------- webchat/home/homeController.js | 90 ++-------------------------------- 2 files changed, 4 insertions(+), 115 deletions(-) diff --git a/webchat/home/home.html b/webchat/home/home.html index 8a4309336..09fe625b0 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1,30 +1 @@ -

    HOME

    -
    - - - {{ usr }} - - -
    -
    - -

    {{ controller.getName(msg.sender)}}

    -

    {{ msg.msg }} ({{ controller.formatTime(msg.timestamp) }})

    -
    -
    - -Send - - -
    diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 368e33af4..712a01eaf 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,97 +3,15 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', function HomeController (AuthService, UserService) { + webchat.controller('HomeController', function HomeController ($scope, $state) { const controller = this; - controller.userList = {}; - controller.client = {}; - controller.chat = {}; - controller.dest = ''; - controller.msg = ''; - controller.msgList = () => { - return controller.chat.currentMessages; - }; - - controller.sendMessage = () => { - controller.chat.sendMessage(controller.msg); - controller.msg = ''; - } - - controller.$onInit = () => { + const main = () => { console.log('HomeController running'); - controller.client = AuthService.getChatClient(); - controller.getUserList(controller.client.users); - controller.client.on('offer-received', callPrompt); - controller.client.on('user-list-update', controller.getUserList); - controller.client.on('chat-created', e => { - controller.chat = e.chat; - - controller.chat.on('msg-list-updated', ev => { - }) - - controller.chat.on('track-received', ev => { - console.log('track received', ev) - document.getElementById('video-remote').srcObject = ev.streams[0]; - }) - }) }; - controller.updateUsers = () => { - controller.client.requestUsers(); - } - - controller.getName = (id) => { - return this.userList[id]; - } - - controller.formatTime = (timestamp) => { - const date = new Date(timestamp); - return date.toLocaleTimeString(); - } + main(); - controller.call = (id) => { - getMedia().then(stream => { - controller.client.call(id, stream); - // angular.element not working here - document.getElementById('video-selfie').srcObject = stream; - }); - } - - controller.getUserList = (users) => { - let parsedList = {}; - if (users.forEach) { - users.forEach(userKey => { - UserService.getUser(userKey).then((res) => { - parsedList[userKey] = res.name; - }); - }); - - } - - controller.userList = parsedList; - } - - function callPrompt(id) { - const answer = confirm(`${id} has called. accept?`); - if (answer) { - getMedia().then(stream => { - controller.client.acceptCall(id, stream); - document.getElementById('video-selfie').srcObject = stream; - }); - } - } - - function getMedia() { - return new Promise((resolve, reject) => { - let stream = new MediaStream(); - navigator.mediaDevices.getUserMedia({video:true}).then(s => { - stream = s; - resolve(stream) - }).catch(_ => { - resolve(stream); - }) - }) - } }); + })(); From 559263ae022a4e741714a67d223e4809d08162d0 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 15:47:16 -0300 Subject: [PATCH 159/237] Add height:100% to #webchat selector --- webchat/styles/custom.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css index 7b060f208..49eab056c 100644 --- a/webchat/styles/custom.css +++ b/webchat/styles/custom.css @@ -10,6 +10,7 @@ html, body { animation-name: simple-fade-in; animation-duration: 2s; min-height: 100%; + height: 100%; } #content { @@ -72,4 +73,4 @@ html, body { 100% { opacity: 0; } -} \ No newline at end of file +} From bc96343f78880d76f4f72de200b69e7b8a642169 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 16:00:07 -0300 Subject: [PATCH 160/237] Change function parameter names on on/emit --- webchat/utils/chat.js | 14 +++++++------- webchat/utils/chatClient.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index 005991028..9ebcaa481 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -34,12 +34,12 @@ * Mimics node's on/emit event handlers. * Raises an event. * @param {string} eventName - name of the event - * @param {object} e - event data + * @param {object} event - event data */ - emit(eventName, e) { + emit(eventName, event) { if (this.eventHandlers[eventName]) { - this.eventHandlers[eventName].forEach((f) => { - f(e); + this.eventHandlers[eventName].forEach((callback) => { + callback(event); }); } } @@ -48,13 +48,13 @@ * Mimics node's on/emit event handlers. * Adds a callback to an event. * @param {string} eventName - name of the event - * @param {Function} f - function to be called when event is raised. + * @param {Function} callback - function to be called when event is raised. */ - on(eventName, f) { + on(eventName, callback) { if (!this.eventHandlers[eventName]) { this.eventHandlers[eventName] = []; } - this.eventHandlers[eventName].push(f); + this.eventHandlers[eventName].push(callback); } /** diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index d89329547..c283d969a 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -62,12 +62,12 @@ * Mimics node's on/emit event handlers. * Raises an event. * @param {string} eventName - name of the event - * @param {object} e - event data + * @param {object} event - event data */ - emit(eventName, e) { + emit(eventName, event) { if (this.eventHandlers[eventName]) { - this.eventHandlers[eventName].forEach((f) => { - f(e); + this.eventHandlers[eventName].forEach((callback) => { + callback(event); }); } } @@ -76,13 +76,13 @@ * Mimics node's on/emit event handlers. * Adds a callback to an event. * @param {string} eventName - name of the event - * @param {Function} f - function to be called when event is raised. + * @param {Function} callback - function to be called when event is raised. */ - on(eventName, f) { + on(eventName, callback) { if (!this.eventHandlers[eventName]) { this.eventHandlers[eventName] = []; } - this.eventHandlers[eventName].push(f); + this.eventHandlers[eventName].push(callback); } /** From e5036e7f990099a706283b143e05a033cc0bd820 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 16:02:00 -0300 Subject: [PATCH 161/237] Fix typo on session in chat.js --- webchat/utils/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index 9ebcaa481..d520c10f9 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -153,7 +153,7 @@ /** * Starts a new RPC accepting a remote offer, resolves the promise with the answer object. - * @param {objet} remote - remote ssion object. + * @param {objet} remote - remote session object. */ accept(remote) { return this.rpc.setRemoteDescription(remote).then(() => { From 76fe37ebd7c11eb50f8d290a61c0f20b31e033c1 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Jan 2019 18:02:25 -0300 Subject: [PATCH 162/237] Add webchat constants back --- webchat/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webchat/app.js b/webchat/app.js index 38a55763b..30a8ec0c0 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -17,6 +17,12 @@ error: 'error', }); + app.constant('WEBSOCKET', { + hostname: window.location.hostname, + port: 8090, + maxRetries: 5, + }); + app.config((STATES, $mdIconProvider, $mdThemingProvider, $stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) => { $mdIconProvider.fontSet('md', 'material-icons'); From 1c802a4449af213e4143c2367043aeb96f61bd18 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Jan 2019 13:38:49 -0300 Subject: [PATCH 163/237] Add emptyStream (default stream) to chats * canvas.captureStream has low support % --- webchat/auth/authService.js | 2 +- webchat/utils/chat.js | 5 +++++ webchat/utils/chatClient.js | 40 +++++++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index 3acef1857..510ea57c6 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -206,7 +206,7 @@ if ($window.localStorage.userInfo) { const parse = JSON.parse($window.localStorage.userInfo); userInfo = new User(parse); - chatClient = new ChatClient(userInfo.key); + chatClient = new ChatClient(userInfo.key, userInfo.photo_url); } } diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index d520c10f9..ff0a75a3c 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -12,6 +12,7 @@ */ constructor(stream, selfId) { this.selfId = selfId; + this._selfStream = stream; this.rpc = new RTCPeerConnection([{ url: 'stun:stun.l.google.com:19302', url: 'stun:stun2.l.google.com:19302', @@ -30,6 +31,10 @@ this._currentMessages = []; } + get selfStream() { + return this._selfStream; + } + /** * Mimics node's on/emit event handlers. * Raises an event. diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index c283d969a..6359c461b 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -3,6 +3,26 @@ const app = angular.module('webchat'); app.factory('ChatClient', ['Chat', 'WEBSOCKET', (Chat, WEBSOCKET) => { + const createEmptyStream = (avatarUrl) => { + return new Promise((resolve, reject) => { + if (avatarUrl.indexOf('avatar.png') >= 0) { + avatarUrl = 'http://www.gravatar.com/avatar' + } + + const canvas = Object.assign(document.createElement('canvas'), { width: 320, height: 320 }); + const ctx = canvas.getContext('2d'); + const avatar = new Image(); + avatar.crossOrigin = 'anonymous'; + + avatar.onload = () => { + ctx.drawImage(avatar, 0, 0, 320, 320); + const stream = canvas.captureStream(1); + resolve(stream); + } + avatar.src = avatarUrl; + }); + } + const ChatClient = class ChatClient { /** * Create a new ChatClient (WebRTC wrapper), @@ -10,16 +30,22 @@ * The ChatClient also mediates connections by Chat objects * before a RPC connection is succesfully completed. * @param {string} id - firebase id of the user + * @param {string} avatarUrl - url of the user avatar */ - constructor(id) { + constructor(id, avatarUrl) { this.id = id; this.ws = {}; this.retries = 0; this.eventHandlers = {}; this.chats = {}; this.users = {}; - this.stream = undefined; this.startWebsocket(); + this._emptyStream; + createEmptyStream(avatarUrl).then(s => this._emptyStream = s); + } + + get emptyStream() { + return this._emptyStream; } /** @@ -298,9 +324,8 @@ * @param {string} id - id of the user to request a call * @param {MediaStream} stream - MediaStream video/audio object of the caller */ - requestCall(id, stream) { - this.stream = this.stream || stream; - this.chats[id] = this.createChat(id, this.stream); + requestCall(id, stream = this.emptyStream) { + this.chats[id] = this.createChat(id, stream); this.sendToWebsocket('call-request', id, {}); } @@ -309,9 +334,8 @@ * @param {string} id - id of the user who has called. * @param {MediaStream} stream - MediaStream video/audio object of the answerer */ - acceptCall(id, stream) { - this.stream = this.stream || stream; - this.createChat(id, this.stream); + acceptCall(id, stream = this.emptyStream) { + this.createChat(id, stream); this.sendToWebsocket('call-answer', id, {}); } From 0177e705e35701ba7356b5e5bfaac4b729492ef2 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Jan 2019 13:44:24 -0300 Subject: [PATCH 164/237] Add sendServerMessage method --- webchat/utils/chatClient.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 6359c461b..b91345989 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -57,7 +57,7 @@ // Sends a signin message to the websocket as soon as the websocket connects this.ws.onopen = () => { - this.sendToWebsocket('signin', '', {}); + this.sendServerMessage('signin'); this.retries = 0; }; @@ -122,6 +122,15 @@ this.ws.send(JSON.stringify(msg)); } + /** + * Sends a message (JSON string) to the server, withou a target user. + * @param {string} type - type of message + * @param {object} data - contents of the message. defaults to empty object; + */ + sendServerMessage(type, data = {}) { + this.sendToWebsocket(type, '', data); + } + /** * Create a new Chat object associated to an id of another user * @param {string} id - firebase id of the other user @@ -343,7 +352,7 @@ * Requests the websocket a list of online users. */ requestUsers() { - this.sendToWebsocket('user-list-request', '', {}); + this.sendServerMessage('user-list-request'); } } From 5cfaef29705b84bd56e4298cda2279d75f691cd5 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Jan 2019 16:52:49 -0300 Subject: [PATCH 165/237] Remove authService.getChatClient() --- webchat/auth/authService.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index 510ea57c6..76eaa06b9 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -182,10 +182,6 @@ return false; }; - service.getChatClient = () => { - return chatClient; - } - /** * Execute each function stored to be thriggered when user logout * is called. From 46edfa8a0aba6480ed0a89887d3cf7f18a27b25e Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Jan 2019 17:11:52 -0300 Subject: [PATCH 166/237] Use a mapper on chatClient websocket handling --- webchat/utils/chatClient.js | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index b91345989..83750e834 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -156,8 +156,8 @@ /** * Handles events sent by the websocket server, - * parsing the string content on {e.data} as a javascript regular object. - * @param {MessageEvent} e - websocket event + * parsing the string content on {event.data} as a javascript regular object. + * @param {MessageEvent} event - websocket event * * @listens websocket#call-request * @listens websocket#call-answer @@ -171,28 +171,17 @@ console.log('ws event: ', msg.type); console.log(msg); - switch (msg.type) { - case 'call-request': - this.handleCallRequest(msg); - break; - case 'call-answer': - this.handleCallAnswer(msg); - break; - case 'rpc-offer': - this.handleRpcOffer(msg); - break; - case 'rpc-answer': - this.handleRpcAnswer(msg); - break; - case 'ice-candidate-received': - this.handleCandidateReceived(msg); - break; - case 'user-list-update': - this.handleUserListUpdate(msg); - break; - default: - this.emit('ws-message', msg); - break; + const handlersMap = { + 'call-request': this.handleCallRequest.bind(this), + 'call-answer': this.handleCallAnswer.bind(this), + 'rpc-offer': this.handleRpcOffer.bind(this), + 'rpc-answer': this.handleRpcAnswer.bind(this), + 'ice-candidate-received': this.handleCandidateReceived.bind(this), + 'user-list-update': this.handleUserListUpdate.bind(this), + } + + if (_.has(handlersMap, msg.type)) { + handlersMap[msg.type](msg); } } From df682e73bf7b4de6fc3d0732648aca2c362ea306 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Jan 2019 17:27:40 -0300 Subject: [PATCH 167/237] Add jsdoc to chatEmptyStream function --- webchat/utils/chatClient.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 83750e834..a22ff9ebe 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -3,9 +3,14 @@ const app = angular.module('webchat'); app.factory('ChatClient', ['Chat', 'WEBSOCKET', (Chat, WEBSOCKET) => { + /** + * Create a new MediaStream with a static picture of the user avatar, + * or a standard gravatar icon if the user has no avatar + * @param {string} avatarUrl - url of the user avatar + */ const createEmptyStream = (avatarUrl) => { return new Promise((resolve, reject) => { - if (avatarUrl.indexOf('avatar.png') >= 0) { + if (_.isEmpty(avatarUrl) || avatarUrl.indexOf('avatar.png') >= 0) { avatarUrl = 'http://www.gravatar.com/avatar' } From 9ac7ffb25fa64c73e216cbd09658550ff56ec40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:28:29 -0300 Subject: [PATCH 168/237] Reorganize custom.css in several files --- webchat/index.html | 16 +++- webchat/styles/animations/simple-fade.css | 17 +++++ webchat/styles/custom.css | 76 ------------------- webchat/styles/custom/scrollbar.css | 18 +++++ webchat/styles/responsive/show-management.css | 11 +++ webchat/styles/utils/constants.css | 7 ++ webchat/styles/utils/scrollbar-management.css | 3 + webchat/styles/utils/text-management.css | 5 ++ 8 files changed, 75 insertions(+), 78 deletions(-) create mode 100644 webchat/styles/animations/simple-fade.css delete mode 100644 webchat/styles/custom.css create mode 100644 webchat/styles/custom/scrollbar.css create mode 100644 webchat/styles/responsive/show-management.css create mode 100644 webchat/styles/utils/constants.css create mode 100644 webchat/styles/utils/scrollbar-management.css create mode 100644 webchat/styles/utils/text-management.css diff --git a/webchat/index.html b/webchat/index.html index 7dc361ea6..d1b80dc3d 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -24,8 +24,20 @@ - - + + + + + + + + + + + + + + diff --git a/webchat/styles/animations/simple-fade.css b/webchat/styles/animations/simple-fade.css new file mode 100644 index 000000000..57f09d2fc --- /dev/null +++ b/webchat/styles/animations/simple-fade.css @@ -0,0 +1,17 @@ +@keyframes simple-fade-in { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +@keyframes simple-fade-out { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} diff --git a/webchat/styles/custom.css b/webchat/styles/custom.css deleted file mode 100644 index 49eab056c..000000000 --- a/webchat/styles/custom.css +++ /dev/null @@ -1,76 +0,0 @@ -html, body { - height: 100%; - max-height: 100%; - overflow: hidden; -} - -#webchat { - overflow: hidden; - display: flex; - animation-name: simple-fade-in; - animation-duration: 2s; - min-height: 100%; - height: 100%; -} - -#content { - flex: 1; - min-height: 100%; - max-height: 100%; - display: flex; - height: 100%; - overflow: hidden; -} - -.hide-scrollbar::-webkit-scrollbar { - display: none; -} -.custom-scrollbar::-webkit-scrollbar { - width: .3em; - height: .3em; -} -.custom-scrollbar::-webkit-scrollbar-button { - background: #009688 -} -.custom-scrollbar::-webkit-scrollbar-track-piece { - background: #ccc -} -.custom-scrollbar::-webkit-scrollbar-thumb { - background: #009688 -} - -@media screen and (min-width: 1280px) { - .hide-on-desktop { - display: none; - } -} - -.no-padding { - padding: 0; -} - -.no-margin { - margin: 0; -} - -.fill-height { - height: 100%; -} - -@keyframes simple-fade-in { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -@keyframes simple-fade-out { - 0% { - opacity: 1; - } - 100% { - opacity: 0; - } -} diff --git a/webchat/styles/custom/scrollbar.css b/webchat/styles/custom/scrollbar.css new file mode 100644 index 000000000..6fba77e80 --- /dev/null +++ b/webchat/styles/custom/scrollbar.css @@ -0,0 +1,18 @@ +.custom-scrollbar::-webkit-scrollbar { + width: .3em; + height: .3em; +} +.custom-scrollbar::-webkit-scrollbar-button { + background: var(--custom-scrollbar-color); +} +.custom-scrollbar::-webkit-scrollbar-track-piece { + background: var(--custom-scrollbar-background); +} +.custom-scrollbar::-webkit-scrollbar-thumb { + background: var(--custom-scrollbar-color); +} + +.custom-scrollbar { + scrollbar-color: #009688 #ccc; + scrollbar-width: thin; +} diff --git a/webchat/styles/responsive/show-management.css b/webchat/styles/responsive/show-management.css new file mode 100644 index 000000000..7fbdf7ffa --- /dev/null +++ b/webchat/styles/responsive/show-management.css @@ -0,0 +1,11 @@ +@media screen and (max-width: 450px) { + .hide-on-mobile { + display: none; + } +} + +@media screen and (min-width: 1280px) { + .hide-on-desktop { + display: none; + } +} \ No newline at end of file diff --git a/webchat/styles/utils/constants.css b/webchat/styles/utils/constants.css new file mode 100644 index 000000000..4bbed4354 --- /dev/null +++ b/webchat/styles/utils/constants.css @@ -0,0 +1,7 @@ +:root { + --custom-scrollbar-background: #ccc; + --custom-scrollbar-color: #009688; + + --responsive-mobile-width: 450px; + --responsive-desktop-width: 1280px; +} \ No newline at end of file diff --git a/webchat/styles/utils/scrollbar-management.css b/webchat/styles/utils/scrollbar-management.css new file mode 100644 index 000000000..9cc2cc2c6 --- /dev/null +++ b/webchat/styles/utils/scrollbar-management.css @@ -0,0 +1,3 @@ +.hide-scrollbar::-webkit-scrollbar { + display: none; +} \ No newline at end of file diff --git a/webchat/styles/utils/text-management.css b/webchat/styles/utils/text-management.css new file mode 100644 index 000000000..72756cb4f --- /dev/null +++ b/webchat/styles/utils/text-management.css @@ -0,0 +1,5 @@ +.wrap-ellipsis { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} From be2325e1c993dc63c214e525d9f7a37d661805d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:31:52 -0300 Subject: [PATCH 169/237] Refactor contacts sidenav reorganizing css classes and moving files --- .../contacts-sidenav.component.js | 2 +- .../components/contacts/contacts-sidenav.css | 19 ++++++++++++++ .../components/contacts/contacts-sidenav.html | 15 +++++++++++ webchat/components/contacts/contacts.css | 26 ------------------- .../contacts/list/contacts-list.css | 11 ++++++++ .../contacts/list/contacts-list.html | 17 +++++++++--- .../contacts/sidenav/contacts-sidenav.html | 9 ------- .../contacts/toolbar/contacts-toolbar.css | 11 ++++++++ .../contacts/toolbar/contacts-toolbar.html | 13 ++++++++-- webchat/index.html | 9 ++++++- 10 files changed, 89 insertions(+), 43 deletions(-) rename webchat/components/contacts/{sidenav => }/contacts-sidenav.component.js (90%) create mode 100644 webchat/components/contacts/contacts-sidenav.css create mode 100644 webchat/components/contacts/contacts-sidenav.html delete mode 100644 webchat/components/contacts/contacts.css create mode 100644 webchat/components/contacts/list/contacts-list.css delete mode 100644 webchat/components/contacts/sidenav/contacts-sidenav.html create mode 100644 webchat/components/contacts/toolbar/contacts-toolbar.css diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.component.js b/webchat/components/contacts/contacts-sidenav.component.js similarity index 90% rename from webchat/components/contacts/sidenav/contacts-sidenav.component.js rename to webchat/components/contacts/contacts-sidenav.component.js index a51ccd8f5..655095397 100644 --- a/webchat/components/contacts/sidenav/contacts-sidenav.component.js +++ b/webchat/components/contacts/contacts-sidenav.component.js @@ -10,7 +10,7 @@ * */ angular.module("webchat").component("contactsSidenav", { - templateUrl: "app/components/contacts/sidenav/contacts-sidenav.html", + templateUrl: "app/components/contacts/contacts-sidenav.html", controller: contactsSidenavController, controllerAs: "contactsSidenavCtrl", bindings: { diff --git a/webchat/components/contacts/contacts-sidenav.css b/webchat/components/contacts/contacts-sidenav.css new file mode 100644 index 000000000..8a96a9a1e --- /dev/null +++ b/webchat/components/contacts/contacts-sidenav.css @@ -0,0 +1,19 @@ +.contacts-sidenav { + height: 100%; + width: 100%; + display: grid; + grid-template-rows: 56px calc(100% - 56px); + grid-template-areas: + 'sidenav__toolbar' + 'sidenav__list'; +} + +.contacts-sidenav__toolbar { + height: 100%; + grid-area: sidenav__toolbar; +} + +.contacts-sidenav__list { + grid-area: sidenav__list; + overflow-y: scroll; +} \ No newline at end of file diff --git a/webchat/components/contacts/contacts-sidenav.html b/webchat/components/contacts/contacts-sidenav.html new file mode 100644 index 000000000..d69e5cb66 --- /dev/null +++ b/webchat/components/contacts/contacts-sidenav.html @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/webchat/components/contacts/contacts.css b/webchat/components/contacts/contacts.css deleted file mode 100644 index b797ea32e..000000000 --- a/webchat/components/contacts/contacts.css +++ /dev/null @@ -1,26 +0,0 @@ -.contacts-list { - overflow: hidden; - flex: 1; -} - -.contacts-list-container { - overflow-y: scroll; -} - -.user-contact { - font-size: 1.5em; - line-height: 1em; -} - -.close-button { - margin-right: auto; -} - -.contacts-search { - margin-left: auto; -} - -.no-contacts-message { - text-align: center; - align-self: center; -} \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.css b/webchat/components/contacts/list/contacts-list.css new file mode 100644 index 000000000..93c937a02 --- /dev/null +++ b/webchat/components/contacts/list/contacts-list.css @@ -0,0 +1,11 @@ +.contacts-list__container { + padding: 0; +} + +.contacts-list__contact { + font-size: 1.2em; +} + +.contacts-list__no-contacts-msg { + text-align: center; +} \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 674f1f1ee..5538537ef 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,7 +1,16 @@ - - - + + + + -

    Não há contatos online no momento.

    +

    Não há contatos online no momento.

    \ No newline at end of file diff --git a/webchat/components/contacts/sidenav/contacts-sidenav.html b/webchat/components/contacts/sidenav/contacts-sidenav.html deleted file mode 100644 index 88d02a1af..000000000 --- a/webchat/components/contacts/sidenav/contacts-sidenav.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.css b/webchat/components/contacts/toolbar/contacts-toolbar.css new file mode 100644 index 000000000..6e37ae77a --- /dev/null +++ b/webchat/components/contacts/toolbar/contacts-toolbar.css @@ -0,0 +1,11 @@ +.toolbar__container { + padding: 10px 0; + width: 100%; + display: flex; + flex-direction: row; + align-items: center; +} + +.toolbar__search-bar { + width: 100%; +} \ No newline at end of file diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.html b/webchat/components/contacts/toolbar/contacts-toolbar.html index d903788c5..e887ec204 100644 --- a/webchat/components/contacts/toolbar/contacts-toolbar.html +++ b/webchat/components/contacts/toolbar/contacts-toolbar.html @@ -1,2 +1,11 @@ - - +
    + + + + +
    diff --git a/webchat/index.html b/webchat/index.html index d1b80dc3d..32bc68d80 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -50,6 +50,12 @@ + + + + + + @@ -111,10 +117,11 @@ + - + From 890a5f589ce594bd2e47c67a018a04b838d121f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:32:50 -0300 Subject: [PATCH 170/237] Remove outside icon click event bug --- webchat/components/icon-button/icon-button.component.js | 1 + webchat/components/icon-button/icon-button.css | 3 --- webchat/components/icon-button/icon-button.html | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 webchat/components/icon-button/icon-button.css diff --git a/webchat/components/icon-button/icon-button.component.js b/webchat/components/icon-button/icon-button.component.js index 96ada0066..fa34060bd 100644 --- a/webchat/components/icon-button/icon-button.component.js +++ b/webchat/components/icon-button/icon-button.component.js @@ -17,6 +17,7 @@ bindings: { icon: "@", iconColor: "@", + action: '<', }, }); diff --git a/webchat/components/icon-button/icon-button.css b/webchat/components/icon-button/icon-button.css deleted file mode 100644 index 0eb250913..000000000 --- a/webchat/components/icon-button/icon-button.css +++ /dev/null @@ -1,3 +0,0 @@ -.icon-button { - margin: 0; -} \ No newline at end of file diff --git a/webchat/components/icon-button/icon-button.html b/webchat/components/icon-button/icon-button.html index f4ebff76c..de63ad5d2 100644 --- a/webchat/components/icon-button/icon-button.html +++ b/webchat/components/icon-button/icon-button.html @@ -1,4 +1,4 @@ - + {{iconButtonCtrl.icon}} From f11ce14ab241b644d4c5b114f93552a1a11d437e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:33:54 -0300 Subject: [PATCH 171/237] Refactor user-description using grid and text-overflow --- .../user-description.component.js | 6 +--- .../user-description/user-description.css | 36 ++++++++++--------- .../user-description/user-description.html | 10 +++--- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/webchat/components/user-description/user-description.component.js b/webchat/components/user-description/user-description.component.js index 91c7a59d5..1cbbfe84d 100644 --- a/webchat/components/user-description/user-description.component.js +++ b/webchat/components/user-description/user-description.component.js @@ -15,7 +15,7 @@ controllerAs: "userDescriptionCtrl", bindings: { name: "@", - description: "@", + text: "@", avatar: "@", }, }); @@ -23,10 +23,6 @@ function userDescriptionController() { const userDescriptionCtrl = this; - userDescriptionCtrl.charLimitName = Utils.isMobileScreen() ? 15 : 25; - userDescriptionCtrl.charLimitDescription = Utils.isMobileScreen() ? 20 : 35; - userDescriptionCtrl.limitString = (string, charLimit) => Utils.limitString(string, charLimit); - } })(); \ No newline at end of file diff --git a/webchat/components/user-description/user-description.css b/webchat/components/user-description/user-description.css index 1464b508d..0b3b4c503 100644 --- a/webchat/components/user-description/user-description.css +++ b/webchat/components/user-description/user-description.css @@ -1,25 +1,29 @@ -.user-description-container { - display: flex; - flex-direction: row; - font-size: 0.8em; +.user-description { + display: grid; + grid-template-columns: max-content auto; + grid-template-rows: max-content max-content; + grid-template-areas: + 'avatar name' + 'avatar text'; + grid-gap: 0 10px; + padding: 10px 0; + align-items: center; } -.avatar { - padding: 10px; - height: 50px; - width: 50px; +.user-description__avatar { + grid-area: avatar; + height: 3em; + width: 3em; border-radius: 50%; } -.user-text { - align-content: center; - align-self: center; - display: flex; - flex-direction: column; - padding: 0; - margin: 0; +.user-description__name { + grid-area: name; + line-height: 16px; } -.user-description { +.user-description__text { + grid-area: text; font-size: 0.8em; + line-height: 16px; } \ No newline at end of file diff --git a/webchat/components/user-description/user-description.html b/webchat/components/user-description/user-description.html index 188f78a35..2691bbf5e 100644 --- a/webchat/components/user-description/user-description.html +++ b/webchat/components/user-description/user-description.html @@ -1,7 +1,5 @@ -
    - -
    - {{userDescriptionCtrl.limitString(userDescriptionCtrl.name, userDescriptionCtrl.charLimitName)}} - {{userDescriptionCtrl.limitString(userDescriptionCtrl.description, userDescriptionCtrl.charLimitDescription)}} -
    +
    + + {{userDescriptionCtrl.name }} + {{userDescriptionCtrl.text }}
    \ No newline at end of file From 8ee43bab40c89da9d72593d8816a050b5b7eeb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:34:52 -0300 Subject: [PATCH 172/237] Refactor expansive search bar using BEM nomenclature --- .../expansive-search-bar.css | 45 ++++++++++++++----- .../expansive-search-bar.html | 13 ++++-- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.css b/webchat/components/expansive-search-bar/expansive-search-bar.css index f8df9d914..43e83e9c4 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.css +++ b/webchat/components/expansive-search-bar/expansive-search-bar.css @@ -1,10 +1,9 @@ -.search-container { +.expansive-search__container { display: flex; flex-direction: row; - display: 100%; } -.expansive-search-input { +.expansive-search__input { width: 100%; border-radius: 50px; padding: 0 20px; @@ -13,12 +12,38 @@ outline: none; } -.expansive-search-input.ng-enter { - animation-name: simple-fade-in; - animation-duration: 0.25s; +.expansive-search__input.ng-enter { + animation-name: width-expansion-in; + animation-duration: 0.75s; } -.expansive-search-input.ng-leave { - animation-name: simple-fade-out; - animation-duration: 0.25s; -} \ No newline at end of file +.expansive-search__input.ng-leave { + animation-name: width-expansion-out; + animation-duration: 0.75s; +} + + +/* Expand element in width direction */ +@keyframes width-expansion-in { + 0% { + width: 0; + padding: 0; + } + + 100% { + width: 100%; + padding: 0 20px; + } +} + +@keyframes width-expansion-out { + 0% { + width: 100%; + padding: 0 20px; + } + + 100% { + width: 0; + padding: 0; + } +} diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html index 3c845cbb1..a92cdaf2f 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.html +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -1,4 +1,11 @@ -
    - - +
    + + +
    From 0c0281c2ddc500ce4d2735e46d30cccfc62c5ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:37:23 -0300 Subject: [PATCH 173/237] Refactor ecis-header using BEM nomenclature --- webchat/components/header/ecis-header.html | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index f155fc5d7..f5d410fb5 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -1,6 +1,21 @@ -
    - - - - +
    + + + + + + +
    \ No newline at end of file From 8fa19474bf2693b82c66cab6ae0981179c4d8cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:38:21 -0300 Subject: [PATCH 174/237] Refactor CSS grid --- webchat/components/header/ecis-header.css | 27 +++++++++++++++++++++++ webchat/ecis.css | 12 +++++++++- webchat/home/home.css | 15 +++++++++++++ webchat/home/home.html | 4 +++- webchat/webchat/webchat.css | 19 ++++++++++++++++ webchat/webchat/webchat.html | 6 +++-- 6 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 webchat/components/header/ecis-header.css create mode 100644 webchat/home/home.css create mode 100644 webchat/webchat/webchat.css diff --git a/webchat/components/header/ecis-header.css b/webchat/components/header/ecis-header.css new file mode 100644 index 000000000..caed6238e --- /dev/null +++ b/webchat/components/header/ecis-header.css @@ -0,0 +1,27 @@ +.ecis-header { + padding: 0; + display: grid; + grid-template-columns: max-content max-content auto max-content; + grid-template-areas: + 'toggle-btn logo user-description logout-btn'; + align-itens: center; +} + +.ecis-header__toggle-sidenav-btn { + grid-area: toggle-btn; +} + +.ecis-header__logo { + grid-area: logo; +} + +.ecis-header__current-user { + grid-area: user-description; + font-size: 1rem; + margin: 0 10px; + justify-self: flex-end; +} + +.ecis-header__logout-btn { + grid-area: logout-btn; +} diff --git a/webchat/ecis.css b/webchat/ecis.css index b76c6be46..b10ce0758 100644 --- a/webchat/ecis.css +++ b/webchat/ecis.css @@ -1,4 +1,14 @@ - ec-content { +html, body { + height: 100%; + max-height: 100%; +} + +#webchat { + height: 100%; + max-height: 100%; +} + +ec-content { display: grid; align-items: center; justify-items: center; diff --git a/webchat/home/home.css b/webchat/home/home.css new file mode 100644 index 000000000..ca4a29dad --- /dev/null +++ b/webchat/home/home.css @@ -0,0 +1,15 @@ +.home-content { + height: 100%; + display: grid; + grid-template-columns: auto max-content; + grid-template-rows: 100%; + grid-template-areas: + 'sidenav chat'; +} + +.home-sidenav { + height: 100%; + max-height: 100%; + width: 100%; + grid-area: sidenav; +} diff --git a/webchat/home/home.html b/webchat/home/home.html index 4700ebff1..ea9bb8d52 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1 +1,3 @@ - +
    + +
    diff --git a/webchat/webchat/webchat.css b/webchat/webchat/webchat.css new file mode 100644 index 000000000..3dde1b912 --- /dev/null +++ b/webchat/webchat/webchat.css @@ -0,0 +1,19 @@ +.webchat__container { + height: 100%; + display: grid; + grid-template-columns: 100%; + grid-template-rows: 64px calc(100% - 64px); + grid-template-areas: + 'header' + 'content'; + animation-name: simple-fade-in; + animation-duration: 0.5s; +} + +.webchat__header { + grid-area: header; +} + +.webchat__content { + grid-area: content; +} \ No newline at end of file diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html index f19d55998..d615c7bb5 100644 --- a/webchat/webchat/webchat.html +++ b/webchat/webchat/webchat.html @@ -1,2 +1,4 @@ - -
    \ No newline at end of file +
    + +
    +
    From 300ace428018e97bb04877b69ffec9ea0f163529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:38:35 -0300 Subject: [PATCH 175/237] Add CSS imports to index.html --- webchat/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webchat/index.html b/webchat/index.html index 32bc68d80..7e935f60c 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -42,13 +42,15 @@ + + - - - - + + + + From 8fa3ef4561a8853dd65b81459bb81fb4cbdb0c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:40:29 -0300 Subject: [PATCH 176/237] Fix contacts list height --- webchat/components/contacts/contacts-sidenav.css | 1 + 1 file changed, 1 insertion(+) diff --git a/webchat/components/contacts/contacts-sidenav.css b/webchat/components/contacts/contacts-sidenav.css index 8a96a9a1e..d79d62df6 100644 --- a/webchat/components/contacts/contacts-sidenav.css +++ b/webchat/components/contacts/contacts-sidenav.css @@ -14,6 +14,7 @@ } .contacts-sidenav__list { + height: 100%; grid-area: sidenav__list; overflow-y: scroll; } \ No newline at end of file From 63c6813afd0eea87c91e0dfa4ed41d4d999b6408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:55:30 -0300 Subject: [PATCH 177/237] Fix home grid to fit chat --- webchat/home/home.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/home/home.css b/webchat/home/home.css index ca4a29dad..cc8d354f1 100644 --- a/webchat/home/home.css +++ b/webchat/home/home.css @@ -1,7 +1,7 @@ .home-content { height: 100%; display: grid; - grid-template-columns: auto max-content; + grid-template-columns: max-content auto; grid-template-rows: 100%; grid-template-areas: 'sidenav chat'; From f5e75c8c0296fcb8f96e77946ddd67b59a405f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 30 Jan 2019 19:56:55 -0300 Subject: [PATCH 178/237] Add BEM nomenclature to home html --- webchat/home/home.css | 8 ++++++-- webchat/home/home.html | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/webchat/home/home.css b/webchat/home/home.css index cc8d354f1..f38673d48 100644 --- a/webchat/home/home.css +++ b/webchat/home/home.css @@ -1,4 +1,4 @@ -.home-content { +.home__content { height: 100%; display: grid; grid-template-columns: max-content auto; @@ -7,9 +7,13 @@ 'sidenav chat'; } -.home-sidenav { +.home__sidenav { height: 100%; max-height: 100%; width: 100%; grid-area: sidenav; } + +.home__chat { + grid-area: chat; +} diff --git a/webchat/home/home.html b/webchat/home/home.html index ea9bb8d52..2f19105a3 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1,3 +1,3 @@ -
    - +
    +
    From c608c9e4cda7a63f29eb93ecb15ee16fda5cb2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 31 Jan 2019 12:00:33 -0300 Subject: [PATCH 179/237] Fix contacts toolbar size --- webchat/components/contacts/contacts-sidenav.css | 4 +++- webchat/components/contacts/contacts-sidenav.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/webchat/components/contacts/contacts-sidenav.css b/webchat/components/contacts/contacts-sidenav.css index d79d62df6..84de962b0 100644 --- a/webchat/components/contacts/contacts-sidenav.css +++ b/webchat/components/contacts/contacts-sidenav.css @@ -2,7 +2,7 @@ height: 100%; width: 100%; display: grid; - grid-template-rows: 56px calc(100% - 56px); + grid-template-rows: 64px calc(100% - 64px); grid-template-areas: 'sidenav__toolbar' 'sidenav__list'; @@ -10,6 +10,8 @@ .contacts-sidenav__toolbar { height: 100%; + max-height: 64px; + padding: 0 10px; grid-area: sidenav__toolbar; } diff --git a/webchat/components/contacts/contacts-sidenav.html b/webchat/components/contacts/contacts-sidenav.html index d69e5cb66..ee2d7c0cd 100644 --- a/webchat/components/contacts/contacts-sidenav.html +++ b/webchat/components/contacts/contacts-sidenav.html @@ -5,7 +5,7 @@ md-disable-backdrop md-whiteframe="4"> Date: Thu, 31 Jan 2019 14:20:03 -0300 Subject: [PATCH 180/237] Remove console.log statements --- webchat/utils/chat.js | 11 ++--------- webchat/utils/chatClient.js | 5 ----- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index ff0a75a3c..ffd48d558 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -68,7 +68,6 @@ * @param {Object} candidate - RTCIceCandidate to be added to this connection */ receiveCandidate(candidate) { - console.log('candidate received', candidate); const rtcCandidate = new RTCIceCandidate(candidate); this.rpc.addIceCandidate(rtcCandidate); } @@ -139,11 +138,7 @@ return this.rpc.createOffer().then(offer => { return this.rpc.setLocalDescription(offer).then(() => { return offer; - }).catch(e => { - console.log('Erro em local description apos offer', e); - }); - }).catch(e => { - console.log('Erro em offer', e); + }) }); } @@ -166,9 +161,7 @@ return this.rpc.setLocalDescription(answer).then(() => { return answer; }) - }).catch(e => { - console.log('Erro em answer', e); - }); + }) }) } diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index a22ff9ebe..4112fcecf 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -82,7 +82,6 @@ retryWebSocket() { if (this.retries < WEBSOCKET.maxRetries) { this.retries += 1; - console.log('Retrying connection, retry: ', this.retries); setTimeout(function () { this.startWebsocket() }.bind(this), 5000) @@ -173,8 +172,6 @@ */ handleWebSocket(event) { const msg = JSON.parse(event.data); - console.log('ws event: ', msg.type); - console.log(msg); const handlersMap = { 'call-request': this.handleCallRequest.bind(this), @@ -246,7 +243,6 @@ */ handleRpcOffer(msg) { const id = msg.id; - console.log('offer received, answering ', id); const chat = this.chats[id]; chat.on('ice-candidate-discovered', e => this.handleDiscoveredIceCandidates(id, e)); chat.accept(msg.data).then(connection => { @@ -317,7 +313,6 @@ */ handleDiscoveredIceCandidates(id, event) { if (event.candidate) { - console.log('candidate discovered', event.candidate); this.sendToWebsocket('ice-candidate', id, event.candidate); } } From d23e6769893f7c743760ef7c53161e546e93db9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 6 Feb 2019 15:26:44 -0300 Subject: [PATCH 181/237] Add css grid to contacts toolbar --- .../contacts/toolbar/contacts-toolbar.css | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/webchat/components/contacts/toolbar/contacts-toolbar.css b/webchat/components/contacts/toolbar/contacts-toolbar.css index 6e37ae77a..931213554 100644 --- a/webchat/components/contacts/toolbar/contacts-toolbar.css +++ b/webchat/components/contacts/toolbar/contacts-toolbar.css @@ -1,11 +1,18 @@ .toolbar__container { padding: 10px 0; width: 100%; - display: flex; - flex-direction: row; - align-items: center; + display: grid; + grid-template-columns: max-content auto; + grid-template-rows: 100%; + grid-template-areas: + 'close-btn search-bar'; +} + +.toolbar__close-btn { + grid-area: close-btn; } .toolbar__search-bar { width: 100%; + grid-area: search-bar; } \ No newline at end of file From 529aaa8707359253b09676fee49a2174c0e79e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 6 Feb 2019 16:22:38 -0300 Subject: [PATCH 182/237] Replace units in px for units in em --- webchat/components/contacts/contacts-sidenav.css | 6 +++--- .../expansive-search-bar/expansive-search-bar.css | 8 ++++---- webchat/components/header/ecis-header.css | 2 +- webchat/components/logo/logo.css | 6 +++--- webchat/components/user-description/user-description.css | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/webchat/components/contacts/contacts-sidenav.css b/webchat/components/contacts/contacts-sidenav.css index 84de962b0..725ff41ce 100644 --- a/webchat/components/contacts/contacts-sidenav.css +++ b/webchat/components/contacts/contacts-sidenav.css @@ -2,7 +2,7 @@ height: 100%; width: 100%; display: grid; - grid-template-rows: 64px calc(100% - 64px); + grid-template-rows: 4em calc(100% - 4em); grid-template-areas: 'sidenav__toolbar' 'sidenav__list'; @@ -10,8 +10,8 @@ .contacts-sidenav__toolbar { height: 100%; - max-height: 64px; - padding: 0 10px; + max-height: 4em; + padding: 0 0.6em; grid-area: sidenav__toolbar; } diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.css b/webchat/components/expansive-search-bar/expansive-search-bar.css index 43e83e9c4..808ff3692 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.css +++ b/webchat/components/expansive-search-bar/expansive-search-bar.css @@ -5,8 +5,8 @@ .expansive-search__input { width: 100%; - border-radius: 50px; - padding: 0 20px; + border-radius: 4em; + padding: 0 1.2em; background-color: #EEEEEE; border: none; outline: none; @@ -32,14 +32,14 @@ 100% { width: 100%; - padding: 0 20px; + padding: 0 1.2em; } } @keyframes width-expansion-out { 0% { width: 100%; - padding: 0 20px; + padding: 0 1.2em; } 100% { diff --git a/webchat/components/header/ecis-header.css b/webchat/components/header/ecis-header.css index caed6238e..431d2a704 100644 --- a/webchat/components/header/ecis-header.css +++ b/webchat/components/header/ecis-header.css @@ -18,7 +18,7 @@ .ecis-header__current-user { grid-area: user-description; font-size: 1rem; - margin: 0 10px; + margin: 0 0.6em; justify-self: flex-end; } diff --git a/webchat/components/logo/logo.css b/webchat/components/logo/logo.css index d705fa922..a1308cbdb 100644 --- a/webchat/components/logo/logo.css +++ b/webchat/components/logo/logo.css @@ -1,7 +1,7 @@ .logo { - height: 40px; + height: 2em; width: auto; - margin: 0 10px; + margin: 0 0.6em; } .logo-responsive { @@ -23,6 +23,6 @@ @media screen and (max-width: 320px) { .logo-responsive { width: auto; - height: 28px; + height: 1em; } } \ No newline at end of file diff --git a/webchat/components/user-description/user-description.css b/webchat/components/user-description/user-description.css index 0b3b4c503..3b8dc1c18 100644 --- a/webchat/components/user-description/user-description.css +++ b/webchat/components/user-description/user-description.css @@ -5,8 +5,8 @@ grid-template-areas: 'avatar name' 'avatar text'; - grid-gap: 0 10px; - padding: 10px 0; + grid-gap: 0 0.6rem; + padding: 0.6rem 0; align-items: center; } @@ -19,11 +19,11 @@ .user-description__name { grid-area: name; - line-height: 16px; + line-height: 1rem; } .user-description__text { grid-area: text; font-size: 0.8em; - line-height: 16px; + line-height: 1rem; } \ No newline at end of file From baf882e84a8e41606e87ed91a4c30cc189e71e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 6 Feb 2019 16:56:17 -0300 Subject: [PATCH 183/237] Removes chat state --- webchat/app.js | 10 ---------- webchat/chat/chat.html | 0 webchat/chat/chatController.js | 11 ----------- webchat/index.html | 1 - 4 files changed, 22 deletions(-) delete mode 100644 webchat/chat/chat.html delete mode 100644 webchat/chat/chatController.js diff --git a/webchat/app.js b/webchat/app.js index 30a8ec0c0..d64051c79 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -12,7 +12,6 @@ app.constant('STATES', { abstract: 'webchat', home: `${rootName}.home`, - chat: `${rootName}.chat`, login: 'login', error: 'error', }); @@ -53,15 +52,6 @@ }, }, }) - .state(STATES.chat, { - url: "/chat", - views: { - content: { - templateUrl: "app/chat/chat.html", - controller: "ChatController as controller", - }, - }, - }) .state(STATES.login, { url: "/login", views: { diff --git a/webchat/chat/chat.html b/webchat/chat/chat.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/webchat/chat/chatController.js b/webchat/chat/chatController.js deleted file mode 100644 index 466f5592f..000000000 --- a/webchat/chat/chatController.js +++ /dev/null @@ -1,11 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('ChatController', function ChatController () { - const chatController = this; - - }); - -})(); \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index f37100b09..72536717a 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -110,7 +110,6 @@ - From 5ccee9d2a6509c3c9c3da32ef11cdf3d007359fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:01:31 -0300 Subject: [PATCH 184/237] Add close ws on logout --- webchat/auth/authService.js | 1 + webchat/utils/chatClient.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/webchat/auth/authService.js b/webchat/auth/authService.js index 76eaa06b9..9f91d5d0b 100644 --- a/webchat/auth/authService.js +++ b/webchat/auth/authService.js @@ -152,6 +152,7 @@ delete $window.localStorage.userInfo; userInfo = undefined; clearInterval(refreshInterval); + chatClient.closeClient(); executeLogoutListeners(); diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 4112fcecf..1770a30f8 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -88,6 +88,11 @@ } } + closeClient() { + this.ws.onclose = () => {}; + this.ws.close(); + } + /** * Mimics node's on/emit event handlers. * Raises an event. From 22131cbc6ddc8ca1738731f36a738104261bd10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:09:45 -0300 Subject: [PATCH 185/237] Extracts general input class from specific class --- .../expansive-search-bar/expansive-search-bar.html | 2 +- webchat/index.html | 1 + webchat/styles/custom/custom.css | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 webchat/styles/custom/custom.css diff --git a/webchat/components/expansive-search-bar/expansive-search-bar.html b/webchat/components/expansive-search-bar/expansive-search-bar.html index a92cdaf2f..53272bbb1 100644 --- a/webchat/components/expansive-search-bar/expansive-search-bar.html +++ b/webchat/components/expansive-search-bar/expansive-search-bar.html @@ -1,6 +1,6 @@
    + diff --git a/webchat/styles/custom/custom.css b/webchat/styles/custom/custom.css new file mode 100644 index 000000000..4da3533e0 --- /dev/null +++ b/webchat/styles/custom/custom.css @@ -0,0 +1,8 @@ +.custom-input { + width: 100%; + border-radius: 50px; + padding: 0 20px; + background-color: #EEEEEE; + border: none; + outline: none; +} \ No newline at end of file From 6c7e2b0cacce8a6078d05ce9e9ac54dabadf5010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:11:06 -0300 Subject: [PATCH 186/237] Add toggle icon button --- .../toggle-button/toggle-button.component.js | 32 +++++++++++++++++++ .../toggle-button/toggle-button.css | 0 .../toggle-button/toggle-button.html | 15 +++++++++ webchat/index.html | 1 + 4 files changed, 48 insertions(+) create mode 100644 webchat/components/toggle-button/toggle-button.component.js create mode 100644 webchat/components/toggle-button/toggle-button.css create mode 100644 webchat/components/toggle-button/toggle-button.html diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js new file mode 100644 index 000000000..afdcfbcd0 --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -0,0 +1,32 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("toggleButton", { + templateUrl: "app/components/toggle-button/toggle-button.html", + controller: toggleButtonController, + controllerAs: "toggleButtonCtrl", + bindings: { + iconOn: '@', + iconOff: '@', + iconColorOn: '@', + iconColorOff: '@', + action: '<', + }, + }); + + function toggleButtonController() { + const toggleButtonCtrl = this; + + toggleButtonCtrl.$onInit = () => { + toggleButtonCtrl.active = true; + toggleButtonCtrl.iconColorOff = toggleButtonCtrl.iconColorOff || '#EEE'; + toggleButtonCtrl.iconColorOn = toggleButtonCtrl.iconColorOn || '#EEE'; + }; + + toggleButtonCtrl.toggle = () => { + toggleButtonCtrl.active = !toggleButtonCtrl.active; + toggleButtonCtrl.action(); + }; + } + +})(); \ No newline at end of file diff --git a/webchat/components/toggle-button/toggle-button.css b/webchat/components/toggle-button/toggle-button.css new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/components/toggle-button/toggle-button.html b/webchat/components/toggle-button/toggle-button.html new file mode 100644 index 000000000..a8fdfe341 --- /dev/null +++ b/webchat/components/toggle-button/toggle-button.html @@ -0,0 +1,15 @@ + + + {{ toggleButtonCtrl.iconOn }} + + + {{ toggleButtonCtrl.iconOff }} + + \ No newline at end of file diff --git a/webchat/index.html b/webchat/index.html index f06a90a0e..1fd34be0a 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -117,6 +117,7 @@ + From 9ba78f27f96bebdd629d6dbca382cf5c59221229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:12:51 -0300 Subject: [PATCH 187/237] Modify contacts list to receive open chat function and show user email --- webchat/components/contacts/contacts-sidenav.component.js | 1 + webchat/components/contacts/contacts-sidenav.html | 1 + webchat/components/contacts/list/contacts-list.component.js | 3 ++- webchat/components/contacts/list/contacts-list.html | 6 +++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webchat/components/contacts/contacts-sidenav.component.js b/webchat/components/contacts/contacts-sidenav.component.js index 655095397..f2346246e 100644 --- a/webchat/components/contacts/contacts-sidenav.component.js +++ b/webchat/components/contacts/contacts-sidenav.component.js @@ -15,6 +15,7 @@ controllerAs: "contactsSidenavCtrl", bindings: { contacts: "<", + openChat: "<", }, }); diff --git a/webchat/components/contacts/contacts-sidenav.html b/webchat/components/contacts/contacts-sidenav.html index ee2d7c0cd..12a3af319 100644 --- a/webchat/components/contacts/contacts-sidenav.html +++ b/webchat/components/contacts/contacts-sidenav.html @@ -11,5 +11,6 @@ \ No newline at end of file diff --git a/webchat/components/contacts/list/contacts-list.component.js b/webchat/components/contacts/list/contacts-list.component.js index 89e7ff213..69e5952f9 100644 --- a/webchat/components/contacts/list/contacts-list.component.js +++ b/webchat/components/contacts/list/contacts-list.component.js @@ -14,7 +14,8 @@ controllerAs: "contactsListCtrl", bindings: { searchQuery: "<", - contacts: "<" + contacts: "<", + openChat: "<", }, }); diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 5538537ef..5355da2eb 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -1,16 +1,16 @@ + text="{{user.email[0]}}"> -

    Não há contatos online no momento.

    +

    Não há contatos online no momento.

    \ No newline at end of file From 2f4099170f874f26c4bff1cc0b4c3ca81ffee0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 7 Feb 2019 09:13:42 -0300 Subject: [PATCH 188/237] Add icon button disabled state --- webchat/components/icon-button/icon-button.component.js | 3 +++ webchat/components/icon-button/icon-button.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webchat/components/icon-button/icon-button.component.js b/webchat/components/icon-button/icon-button.component.js index fa34060bd..243f3cdbc 100644 --- a/webchat/components/icon-button/icon-button.component.js +++ b/webchat/components/icon-button/icon-button.component.js @@ -18,6 +18,7 @@ icon: "@", iconColor: "@", action: '<', + disabled: '<', }, }); @@ -26,7 +27,9 @@ iconButtonCtrl.$onInit = () => { iconButtonCtrl.iconColor = iconButtonCtrl.iconColor || "#EEE"; + iconButtonCtrl.disabled = iconButtonCtrl.disabled || false; }; + } })(); \ No newline at end of file diff --git a/webchat/components/icon-button/icon-button.html b/webchat/components/icon-button/icon-button.html index de63ad5d2..70dd0dbc1 100644 --- a/webchat/components/icon-button/icon-button.html +++ b/webchat/components/icon-button/icon-button.html @@ -1,5 +1,5 @@ - - + + {{iconButtonCtrl.icon}} \ No newline at end of file From 39db1ffedad3a7fb45fb3d978790acff47030a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Feb 2019 12:47:11 -0300 Subject: [PATCH 189/237] Add lodash defaults to toggle button and icon button --- .../components/icon-button/icon-button.component.js | 7 +++++-- .../toggle-button/toggle-button.component.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webchat/components/icon-button/icon-button.component.js b/webchat/components/icon-button/icon-button.component.js index 243f3cdbc..ec2b275a0 100644 --- a/webchat/components/icon-button/icon-button.component.js +++ b/webchat/components/icon-button/icon-button.component.js @@ -26,8 +26,11 @@ const iconButtonCtrl = this; iconButtonCtrl.$onInit = () => { - iconButtonCtrl.iconColor = iconButtonCtrl.iconColor || "#EEE"; - iconButtonCtrl.disabled = iconButtonCtrl.disabled || false; + _.defaults(iconButtonCtrl, { + iconColor: "#EEE", + action: () => {}, + disabled: false, + }); }; } diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index afdcfbcd0..537e8dc5d 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -18,9 +18,14 @@ const toggleButtonCtrl = this; toggleButtonCtrl.$onInit = () => { - toggleButtonCtrl.active = true; - toggleButtonCtrl.iconColorOff = toggleButtonCtrl.iconColorOff || '#EEE'; - toggleButtonCtrl.iconColorOn = toggleButtonCtrl.iconColorOn || '#EEE'; + console.log(toggleButtonCtrl); + _.defaults(toggleButtonCtrl, { + active: true, + iconColorOn: "#EEE", + iconColorOff: "#EEE", + action: () => {} + }); + console.log(toggleButtonCtrl); }; toggleButtonCtrl.toggle = () => { From c52787326a0b82e2df0af066d219e3b912a96dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Feb 2019 13:00:55 -0300 Subject: [PATCH 190/237] Add toggle-button jsdoc --- .../toggle-button/toggle-button.component.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 537e8dc5d..02ce563c5 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -1,6 +1,24 @@ (function () { 'use strict'; + /** + * Button that calls an action and changes its icon on click. + * It receives as a binding an icon to shown when on and an + * icon to show when off. Also it receives an action to be + * called on click and the icons color when on and off. If + * the icon color is not passed, its color will be a default + * one (#EEE). + * @class toggleButton + * @example + * + * + * + */ angular.module("webchat").component("toggleButton", { templateUrl: "app/components/toggle-button/toggle-button.html", controller: toggleButtonController, From 7905a45353241074ce25026522221c7ec969dc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 14 Feb 2019 13:51:02 -0300 Subject: [PATCH 191/237] Refacts toggle-button component --- .../toggle-button/toggle-button.component.js | 12 +++++++++++ .../toggle-button/toggle-button.html | 20 +++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 02ce563c5..c3575f400 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -50,6 +50,18 @@ toggleButtonCtrl.active = !toggleButtonCtrl.active; toggleButtonCtrl.action(); }; + + Object.defineProperty(toggleButtonCtrl, 'activeIcon', { + get: () => { + return toggleButtonCtrl.active ? toggleButtonCtrl.iconOn : toggleButtonCtrl.iconOff; + }, + }); + + Object.defineProperty(toggleButtonCtrl, 'activeIconColor', { + get: () => { + return toggleButtonCtrl.active ? toggleButtonCtrl.iconColorOn : toggleButtonCtrl.iconColorOff; + }, + }); } })(); \ No newline at end of file diff --git a/webchat/components/toggle-button/toggle-button.html b/webchat/components/toggle-button/toggle-button.html index a8fdfe341..b066812bf 100644 --- a/webchat/components/toggle-button/toggle-button.html +++ b/webchat/components/toggle-button/toggle-button.html @@ -1,15 +1,5 @@ - - - {{ toggleButtonCtrl.iconOn }} - - - {{ toggleButtonCtrl.iconOff }} - - \ No newline at end of file + + \ No newline at end of file From b75a113853c9a0e6cc47690b432f3dc7d93ecf2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 12:51:51 -0300 Subject: [PATCH 192/237] Change webchat folder and files to be referenced as main --- webchat/app.js | 10 +++++----- webchat/ecis.css | 7 +------ webchat/index.html | 6 +++--- webchat/{webchat/webchat.css => main/main.css} | 6 +++--- webchat/main/main.html | 4 ++++ webchat/main/mainController.js | 12 ++++++++++++ webchat/webchat/webchat.html | 4 ---- webchat/webchat/webchatController.js | 12 ------------ 8 files changed, 28 insertions(+), 33 deletions(-) rename webchat/{webchat/webchat.css => main/main.css} (83%) create mode 100644 webchat/main/main.html create mode 100644 webchat/main/mainController.js delete mode 100644 webchat/webchat/webchat.html delete mode 100644 webchat/webchat/webchatController.js diff --git a/webchat/app.js b/webchat/app.js index d64051c79..11431b295 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -8,9 +8,9 @@ 'firebase', ]); - const rootName = 'webchat'; + const rootName = 'main'; app.constant('STATES', { - abstract: 'webchat', + abstract: rootName, home: `${rootName}.home`, login: 'login', error: 'error', @@ -36,9 +36,9 @@ abstract: true, views: { main: { - templateUrl: "app/webchat/webchat.html", - controller: "WebchatController", - controllerAs: "webchatCtrl", + templateUrl: "app/main/main.html", + controller: "mainController", + controllerAs: "mainCtrl", }, }, }) diff --git a/webchat/ecis.css b/webchat/ecis.css index b10ce0758..5cb6d8aaf 100644 --- a/webchat/ecis.css +++ b/webchat/ecis.css @@ -1,9 +1,4 @@ -html, body { - height: 100%; - max-height: 100%; -} - -#webchat { +html, body, #main { height: 100%; max-height: 100%; } diff --git a/webchat/index.html b/webchat/index.html index 1fd34be0a..5d91c4f0e 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -44,7 +44,7 @@ - + @@ -62,7 +62,7 @@ -
    +
    - + diff --git a/webchat/webchat/webchat.css b/webchat/main/main.css similarity index 83% rename from webchat/webchat/webchat.css rename to webchat/main/main.css index 3dde1b912..f59069010 100644 --- a/webchat/webchat/webchat.css +++ b/webchat/main/main.css @@ -1,4 +1,4 @@ -.webchat__container { +.main__container { height: 100%; display: grid; grid-template-columns: 100%; @@ -10,10 +10,10 @@ animation-duration: 0.5s; } -.webchat__header { +.main__header { grid-area: header; } -.webchat__content { +.main__content { grid-area: content; } \ No newline at end of file diff --git a/webchat/main/main.html b/webchat/main/main.html new file mode 100644 index 000000000..8f21e5aa6 --- /dev/null +++ b/webchat/main/main.html @@ -0,0 +1,4 @@ +
    + +
    +
    diff --git a/webchat/main/mainController.js b/webchat/main/mainController.js new file mode 100644 index 000000000..70f58a270 --- /dev/null +++ b/webchat/main/mainController.js @@ -0,0 +1,12 @@ +(function () { + 'use strict'; + + const webchat = angular.module('webchat'); + + webchat.controller('mainController', ['AuthService', function mainController (AuthService) { + const mainCtrl = this; + + mainCtrl.user = AuthService.getCurrentUser(); + }]); + +})(); \ No newline at end of file diff --git a/webchat/webchat/webchat.html b/webchat/webchat/webchat.html deleted file mode 100644 index d615c7bb5..000000000 --- a/webchat/webchat/webchat.html +++ /dev/null @@ -1,4 +0,0 @@ -
    - -
    -
    diff --git a/webchat/webchat/webchatController.js b/webchat/webchat/webchatController.js deleted file mode 100644 index 338dcd989..000000000 --- a/webchat/webchat/webchatController.js +++ /dev/null @@ -1,12 +0,0 @@ -(function () { - 'use strict'; - - const webchat = angular.module('webchat'); - - webchat.controller('WebchatController', ['AuthService', function WebchatController (AuthService) { - const webchatCtrl = this; - - webchatCtrl.user = AuthService.getCurrentUser(); - }]); - -})(); \ No newline at end of file From 318578d535da7901c573195eaaae33f1809ebe27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:13:07 -0300 Subject: [PATCH 193/237] Add chat-message component --- .../chat/message/chat-message.component.js | 35 +++++++++++++++++++ .../components/chat/message/chat-message.css | 28 +++++++++++++++ .../components/chat/message/chat-message.html | 4 +++ 3 files changed, 67 insertions(+) create mode 100644 webchat/components/chat/message/chat-message.component.js create mode 100644 webchat/components/chat/message/chat-message.css create mode 100644 webchat/components/chat/message/chat-message.html diff --git a/webchat/components/chat/message/chat-message.component.js b/webchat/components/chat/message/chat-message.component.js new file mode 100644 index 000000000..84cc30538 --- /dev/null +++ b/webchat/components/chat/message/chat-message.component.js @@ -0,0 +1,35 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("chatMessage", { + templateUrl: "app/components/chat/message/chat-message.html", + controller: [ + 'AuthService', + chatMessageController, + ], + controllerAs: "chatMessageCtrl", + bindings: { + messageObj: '<', + }, + }); + + function chatMessageController(AuthService) { + const chatMessageCtrl = this; + + + chatMessageCtrl.formatTimestamp = (timestamp) => { + return timestamp.getHours() + ":" + timestamp.getMinutes(); + }; + + chatMessageCtrl.$onInit = () => { + const timestamp = new Date(chatMessageCtrl.messageObj.timestamp); + chatMessageCtrl.formattedTimestamp = chatMessageCtrl.formatTimestamp(timestamp); + }; + + chatMessageCtrl.messageSent = () => { + const result = chatMessageCtrl.messageObj.sender === AuthService.getCurrentUser().key; + return result; + }; + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/message/chat-message.css b/webchat/components/chat/message/chat-message.css new file mode 100644 index 000000000..0c244fb3e --- /dev/null +++ b/webchat/components/chat/message/chat-message.css @@ -0,0 +1,28 @@ +.chat-message__container { + width: fit-content; + max-width: 60%; + padding: 5px 10px; + background: #FFFFFF; + margin: 2px 5px; + border: 1px solid black; + border-radius: 5px; + display: grid; + grid-template-columns: auto auto; + grid-template-areas: + 'text timestamp'; +} + +.chat-message__text { + grid-area: text; +} + +.chat-message__time { + grid-area: timestamp; + font-size: 0.8em; + align-self: flex-end; + margin: 0 10px; +} + +.chat-message--sent { + margin-left: auto; +} \ No newline at end of file diff --git a/webchat/components/chat/message/chat-message.html b/webchat/components/chat/message/chat-message.html new file mode 100644 index 000000000..9bec975f3 --- /dev/null +++ b/webchat/components/chat/message/chat-message.html @@ -0,0 +1,4 @@ +
    + {{ chatMessageCtrl.messageObj.msg }} + {{ chatMessageCtrl.formattedTimestamp }} +
    \ No newline at end of file From 52cbc129f350aeb46a5e248a2301607c8f24ec35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:15:28 -0300 Subject: [PATCH 194/237] Add chat-buttons component --- .../chat/buttons/chat-buttons.component.js | 18 ++++++++++++++++++ .../components/chat/buttons/chat-buttons.css | 0 .../components/chat/buttons/chat-buttons.html | 1 + 3 files changed, 19 insertions(+) create mode 100644 webchat/components/chat/buttons/chat-buttons.component.js create mode 100644 webchat/components/chat/buttons/chat-buttons.css create mode 100644 webchat/components/chat/buttons/chat-buttons.html diff --git a/webchat/components/chat/buttons/chat-buttons.component.js b/webchat/components/chat/buttons/chat-buttons.component.js new file mode 100644 index 000000000..08bf5d7ea --- /dev/null +++ b/webchat/components/chat/buttons/chat-buttons.component.js @@ -0,0 +1,18 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("chatButtons", { + templateUrl: "app/components/chat/buttons/chat-buttons.html", + controller: chatButtonsController, + controllerAs: "chatButtonsCtrl", + bindings: { + callFunc: "<", + }, + }); + + function chatButtonsController() { + const chatButtonsCtrl = this; + + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/buttons/chat-buttons.css b/webchat/components/chat/buttons/chat-buttons.css new file mode 100644 index 000000000..e69de29bb diff --git a/webchat/components/chat/buttons/chat-buttons.html b/webchat/components/chat/buttons/chat-buttons.html new file mode 100644 index 000000000..7240fd019 --- /dev/null +++ b/webchat/components/chat/buttons/chat-buttons.html @@ -0,0 +1 @@ + \ No newline at end of file From 22689ecc85ddba8973efce18b5a501114dd4202f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:15:58 -0300 Subject: [PATCH 195/237] Add chat-input component --- .../chat/input/chat-input.component.js | 39 +++++++++++++++++++ webchat/components/chat/input/chat-input.css | 22 +++++++++++ webchat/components/chat/input/chat-input.html | 14 +++++++ 3 files changed, 75 insertions(+) create mode 100644 webchat/components/chat/input/chat-input.component.js create mode 100644 webchat/components/chat/input/chat-input.css create mode 100644 webchat/components/chat/input/chat-input.html diff --git a/webchat/components/chat/input/chat-input.component.js b/webchat/components/chat/input/chat-input.component.js new file mode 100644 index 000000000..768511a44 --- /dev/null +++ b/webchat/components/chat/input/chat-input.component.js @@ -0,0 +1,39 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("chatInput", { + templateUrl: "app/components/chat/input/chat-input.html", + controller: chatInputController, + controllerAs: "chatInputCtrl", + bindings: { + sendMessageFunc: "<", + state: "<" + }, + }); + + function chatInputController() { + const chatInputCtrl = this; + + chatInputCtrl.getState = () => chatInputCtrl.state; + + chatInputCtrl.getStateStyle = () => { + const state = chatInputCtrl.getState(); + if (_.includes(['connected', 'complete'], state)) { + return 'lawngreen'; + } else if (_.includes(['failed', 'disconnected', 'closed'], state)) { + return 'red'; + } else if (_.includes(['new', 'checking'], state)) { + return 'goldenrod'; + } + return 'lightgray'; + }; + + chatInputCtrl.sendMessage = () => { + if (chatInputCtrl.msg) { + chatInputCtrl.sendMessageFunc(chatInputCtrl.msg); + chatInputCtrl.msg = ''; + } + }; + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/input/chat-input.css b/webchat/components/chat/input/chat-input.css new file mode 100644 index 000000000..1f9764359 --- /dev/null +++ b/webchat/components/chat/input/chat-input.css @@ -0,0 +1,22 @@ +.chat-input__container { + height: 100%; + width: 100%; + display: flex; + align-content: center; + align-items: center; +} + +.chat-input__connection-state { + margin-left: 10px; +} + +.chat-input__text { + width: 100%; + height: 70%; + margin: 0 0 0 10px; + background: #FFFFFF; +} + +.chat-input__text:disabled { + background: #dddddd; +} \ No newline at end of file diff --git a/webchat/components/chat/input/chat-input.html b/webchat/components/chat/input/chat-input.html new file mode 100644 index 000000000..d62da383d --- /dev/null +++ b/webchat/components/chat/input/chat-input.html @@ -0,0 +1,14 @@ +
    +

    + + + +
    From f3e940cf021b2870465fe7c9f0eb414a675cec94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:16:25 -0300 Subject: [PATCH 196/237] Add chat-body component --- .../components/chat/body/chat-body.component.js | 17 +++++++++++++++++ webchat/components/chat/body/chat-body.css | 8 ++++++++ webchat/components/chat/body/chat-body.html | 7 +++++++ 3 files changed, 32 insertions(+) create mode 100644 webchat/components/chat/body/chat-body.component.js create mode 100644 webchat/components/chat/body/chat-body.css create mode 100644 webchat/components/chat/body/chat-body.html diff --git a/webchat/components/chat/body/chat-body.component.js b/webchat/components/chat/body/chat-body.component.js new file mode 100644 index 000000000..cc3c4f4bc --- /dev/null +++ b/webchat/components/chat/body/chat-body.component.js @@ -0,0 +1,17 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("chatBody", { + templateUrl: "app/components/chat/body/chat-body.html", + controller: chatBodyController, + controllerAs: "chatBodyCtrl", + bindings: { + messages: '<', + }, + }); + + function chatBodyController() { + const chatBodyCtrl = this; + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css new file mode 100644 index 000000000..161d82c13 --- /dev/null +++ b/webchat/components/chat/body/chat-body.css @@ -0,0 +1,8 @@ +.chat-body__container { + height: 100%; + max-height: 100%; + display: flex; + flex-direction: column; + overflow-y: scroll; + justify-content: flex-end; +} diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html new file mode 100644 index 000000000..48bd48557 --- /dev/null +++ b/webchat/components/chat/body/chat-body.html @@ -0,0 +1,7 @@ +
    + + +
    \ No newline at end of file From 33470526108c8f4d4032aafcd98f139bd8c8da77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:16:40 -0300 Subject: [PATCH 197/237] Add chat-header component --- .../chat/header/chat-header.component.js | 19 +++++++++++++++++++ .../components/chat/header/chat-header.css | 17 +++++++++++++++++ .../components/chat/header/chat-header.html | 8 ++++++++ 3 files changed, 44 insertions(+) create mode 100644 webchat/components/chat/header/chat-header.component.js create mode 100644 webchat/components/chat/header/chat-header.css create mode 100644 webchat/components/chat/header/chat-header.html diff --git a/webchat/components/chat/header/chat-header.component.js b/webchat/components/chat/header/chat-header.component.js new file mode 100644 index 000000000..f8949a503 --- /dev/null +++ b/webchat/components/chat/header/chat-header.component.js @@ -0,0 +1,19 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("chatHeader", { + templateUrl: "app/components/chat/header/chat-header.html", + controller: chatHeaderController, + controllerAs: "chatHeaderCtrl", + bindings: { + user: "<", + chat: "<", + callFunc: "<", + }, + }); + + function chatHeaderController() { + const chatHeaderCtrl = this; + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/header/chat-header.css b/webchat/components/chat/header/chat-header.css new file mode 100644 index 000000000..b5f28f0bd --- /dev/null +++ b/webchat/components/chat/header/chat-header.css @@ -0,0 +1,17 @@ +.chat-header__container { + display: grid; + grid-template-columns: auto max-content; + grid-template-areas: + 'current-user video-buttons'; + align-items: center; +} + +.chat-header__current-user { + grid-area: current-user; + margin: 0 10px; + color: #EEEEEE; +} + +.chat-header__buttons { + grid-area: video-buttons; +} \ No newline at end of file diff --git a/webchat/components/chat/header/chat-header.html b/webchat/components/chat/header/chat-header.html new file mode 100644 index 000000000..c357f885f --- /dev/null +++ b/webchat/components/chat/header/chat-header.html @@ -0,0 +1,8 @@ +
    + + +
    From bd755364f3adb0f7aa333c852e676e1c0a893dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:16:55 -0300 Subject: [PATCH 198/237] Add ecis-chat-component --- .../components/chat/ecis-chat.component.js | 28 +++++++++++++++++++ webchat/components/chat/ecis-chat.css | 25 +++++++++++++++++ webchat/components/chat/ecis-chat.html | 16 +++++++++++ 3 files changed, 69 insertions(+) create mode 100644 webchat/components/chat/ecis-chat.component.js create mode 100644 webchat/components/chat/ecis-chat.css create mode 100644 webchat/components/chat/ecis-chat.html diff --git a/webchat/components/chat/ecis-chat.component.js b/webchat/components/chat/ecis-chat.component.js new file mode 100644 index 000000000..a80eb9cab --- /dev/null +++ b/webchat/components/chat/ecis-chat.component.js @@ -0,0 +1,28 @@ +(function () { + 'use strict'; + + angular.module("webchat").component("ecisChat", { + templateUrl: "app/components/chat/ecis-chat.html", + controller: ecisChatController, + controllerAs: "ecisChatCtrl", + bindings: { + chat: '<', + user: '<', + callFunc: '<', + state: '<', + }, + }); + + function ecisChatController() { + const ecisChatCtrl = this; + + ecisChatCtrl.sendMessage = (msg) => { + ecisChatCtrl.chat.sendMessage(msg); + }; + + ecisChatCtrl.call = () => { + ecisChatCtrl.callFunc(ecisChatCtrl.user); + }; + } + +})(); \ No newline at end of file diff --git a/webchat/components/chat/ecis-chat.css b/webchat/components/chat/ecis-chat.css new file mode 100644 index 000000000..ee8a080f5 --- /dev/null +++ b/webchat/components/chat/ecis-chat.css @@ -0,0 +1,25 @@ +.chat__container { + height: 100%; + background: #EEEEEE; + display: grid; + grid-template-rows: 64px calc(100% - 64px - 48px) 48px; + grid-template-areas: + 'header' + 'body' + 'input'; +} + +.chat__header { + grid-area: header; + background: #009688; +} + +.chat__body { + grid-area: body; + background: #E5DDD3; +} + +.chat__input { + grid-area: input; + background: #009688; +} \ No newline at end of file diff --git a/webchat/components/chat/ecis-chat.html b/webchat/components/chat/ecis-chat.html new file mode 100644 index 000000000..b46d04748 --- /dev/null +++ b/webchat/components/chat/ecis-chat.html @@ -0,0 +1,16 @@ +
    + + + + + + +
    From bc43450001a952d8e0167d9965de51d9797bd555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:17:38 -0300 Subject: [PATCH 199/237] Add chat components imports --- webchat/index.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webchat/index.html b/webchat/index.html index 5d91c4f0e..5308c018d 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -58,6 +58,14 @@ + + + + + + + + @@ -125,6 +133,13 @@ + + + + + + + From ffd092c6039d52b5205d0a117bc713c411c6545f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:18:27 -0300 Subject: [PATCH 200/237] Add chat component implementation --- .../toggle-button/toggle-button.component.js | 2 - webchat/home/home.html | 10 ++- webchat/home/homeController.js | 69 ++++++++++++++++++- 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index c3575f400..94c0874d4 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -36,14 +36,12 @@ const toggleButtonCtrl = this; toggleButtonCtrl.$onInit = () => { - console.log(toggleButtonCtrl); _.defaults(toggleButtonCtrl, { active: true, iconColorOn: "#EEE", iconColorOff: "#EEE", action: () => {} }); - console.log(toggleButtonCtrl); }; toggleButtonCtrl.toggle = () => { diff --git a/webchat/home/home.html b/webchat/home/home.html index 2f19105a3..c4e19a178 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -1,3 +1,11 @@
    - + + +
    diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index fa8beabbb..b69a562bf 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,11 +3,74 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', ['WebchatService', function HomeController (WebchatService) { + webchat.controller('HomeController', ['UserService', 'AuthService', 'WebchatService', 'MessageService', '$scope', function HomeController (UserService, AuthService, WebchatService, MessageService, $scope) { const homeCtrl = this; - homeCtrl.contacts = WebchatService.getContacts(); + homeCtrl.$onInit = () => { + homeCtrl.client = AuthService.chatClient; + homeCtrl.cachedUsers = {}; - }]); + homeCtrl.getUserList(homeCtrl.client.users); + homeCtrl.client.on('user-list-updated', homeCtrl.getUserList); + homeCtrl.client.on('call-requested', homeCtrl.promptCall); + homeCtrl.client.on('chat-created', homeCtrl.chatCreated); + }; + + homeCtrl.getUserList = (users) => { + const parsedUsers = []; + + if (users.forEach) { + users.forEach(userKey => { + if (userKey !== homeCtrl.client.id) { + if (!_.has(homeCtrl.cachedUsers, userKey)) { + UserService.getUser(userKey).then(user => { + homeCtrl.cachedUsers[userKey] = user; + parsedUsers.push(homeCtrl.cachedUsers[userKey]); + }); + } else { + parsedUsers.push(homeCtrl.cachedUsers[userKey]); + } + } + }); + } + homeCtrl.contacts = parsedUsers; + }; + + homeCtrl.openChat = (user) => { + homeCtrl.currentUser = user; + console.log(homeCtrl.client.chats[user.key]); + }; + homeCtrl.chatCreated = (e) => { + UserService.getUser(e.id).then(user => { + homeCtrl.currentChat = e.chat; + homeCtrl.currentUser = user; + homeCtrl.currentChat.on('ice-connection-changed', homeCtrl.stateChange); + homeCtrl.currentChat.on('msg-list-updated', list => { + $scope.$apply(); + }); + }); + }; + + homeCtrl.stateChange = (state) => { + homeCtrl.state = state; + console.log(state); + $scope.$apply(); + }; + + homeCtrl.call = (user) => { + homeCtrl.client.requestCall(user.key); + homeCtrl.openChat(user); + }; + + homeCtrl.promptCall = (id) => { + UserService.getUser(id).then(user => { + MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { + if (answer) { + homeCtrl.client.acceptCall(id); + } + }); + }); + }; + }]); })(); From 52b38e8ce7d517df2a2d5b5f9b21d08362df341b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 1 Mar 2019 13:21:20 -0300 Subject: [PATCH 201/237] Fix ecis-header user description to receive email --- webchat/components/header/ecis-header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/header/ecis-header.html b/webchat/components/header/ecis-header.html index f5d410fb5..a1eb40357 100644 --- a/webchat/components/header/ecis-header.html +++ b/webchat/components/header/ecis-header.html @@ -11,7 +11,7 @@ class="ecis-header__current-user" name="{{headerCtrl.user.name}}" avatar="{{headerCtrl.user.photo_url}}" - text="{{headerCtrl.user.current_institution.name}}"> + text="{{headerCtrl.user.email[0]}}"> Date: Thu, 7 Mar 2019 15:09:30 -0300 Subject: [PATCH 202/237] Remove unused WebchatService --- webchat/services/WebchatService.js | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 webchat/services/WebchatService.js diff --git a/webchat/services/WebchatService.js b/webchat/services/WebchatService.js deleted file mode 100644 index 6977c4a15..000000000 --- a/webchat/services/WebchatService.js +++ /dev/null @@ -1,11 +0,0 @@ -(function () { - 'use strict'; - - angular.module("webchat").service('WebchatService', function WebchatService() { - const WebchatService = this; - - WebchatService.getContacts = () => []; - - - }); -})(); \ No newline at end of file From 74d7f951fe871431e08365d805f69acca9c00b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:12:23 -0300 Subject: [PATCH 203/237] Remove WebchatService imports --- webchat/home/homeController.js | 2 +- webchat/index.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index b69a562bf..c659a827f 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,7 +3,7 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', ['UserService', 'AuthService', 'WebchatService', 'MessageService', '$scope', function HomeController (UserService, AuthService, WebchatService, MessageService, $scope) { + webchat.controller('HomeController', ['UserService', 'AuthService', 'MessageService', '$scope', function HomeController (UserService, AuthService, MessageService, $scope) { const homeCtrl = this; homeCtrl.$onInit = () => { diff --git a/webchat/index.html b/webchat/index.html index 5308c018d..4718ee2a2 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -115,7 +115,6 @@ - From c64ab076a2bf46c8283935c7993f17cc5b090677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:29:15 -0300 Subject: [PATCH 204/237] Remove all console.log calls --- webchat/home/homeController.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index c659a827f..c2effcf76 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -38,7 +38,6 @@ homeCtrl.openChat = (user) => { homeCtrl.currentUser = user; - console.log(homeCtrl.client.chats[user.key]); }; homeCtrl.chatCreated = (e) => { @@ -54,7 +53,6 @@ homeCtrl.stateChange = (state) => { homeCtrl.state = state; - console.log(state); $scope.$apply(); }; From 0db69b1363b69868a048cf6741aa9af60e56c86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:29:39 -0300 Subject: [PATCH 205/237] Replace default forEach for lodash forEach --- webchat/home/homeController.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index c2effcf76..4de3f6d31 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -19,20 +19,18 @@ homeCtrl.getUserList = (users) => { const parsedUsers = []; - if (users.forEach) { - users.forEach(userKey => { - if (userKey !== homeCtrl.client.id) { - if (!_.has(homeCtrl.cachedUsers, userKey)) { - UserService.getUser(userKey).then(user => { - homeCtrl.cachedUsers[userKey] = user; - parsedUsers.push(homeCtrl.cachedUsers[userKey]); - }); - } else { + _.forEach(users, userKey => { + if (userKey !== homeCtrl.client.id) { + if (!_.has(homeCtrl.cachedUsers, userKey)) { + UserService.getUser(userKey).then(user => { + homeCtrl.cachedUsers[userKey] = user; parsedUsers.push(homeCtrl.cachedUsers[userKey]); - } + }); + } else { + parsedUsers.push(homeCtrl.cachedUsers[userKey]); } - }); - } + } + }); homeCtrl.contacts = parsedUsers; }; From 29424e27d516a036381a75992b1b20a7f557c2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:34:10 -0300 Subject: [PATCH 206/237] Replace calc call for 1fr in chat__container grid definition --- webchat/components/chat/ecis-chat.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/chat/ecis-chat.css b/webchat/components/chat/ecis-chat.css index ee8a080f5..0cefd60d2 100644 --- a/webchat/components/chat/ecis-chat.css +++ b/webchat/components/chat/ecis-chat.css @@ -2,7 +2,7 @@ height: 100%; background: #EEEEEE; display: grid; - grid-template-rows: 64px calc(100% - 64px - 48px) 48px; + grid-template-rows: max-content 1fr max-content; grid-template-areas: 'header' 'body' From fe4e080530eb76a77a316b9e5cc92b5fbc53fce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:38:18 -0300 Subject: [PATCH 207/237] Add min-height to chat-input__text class --- webchat/components/chat/input/chat-input.css | 1 + 1 file changed, 1 insertion(+) diff --git a/webchat/components/chat/input/chat-input.css b/webchat/components/chat/input/chat-input.css index 1f9764359..040d61af9 100644 --- a/webchat/components/chat/input/chat-input.css +++ b/webchat/components/chat/input/chat-input.css @@ -15,6 +15,7 @@ height: 70%; margin: 0 0 0 10px; background: #FFFFFF; + min-height: 36px; } .chat-input__text:disabled { From ec624d02d9c722890c1acd04ff80d564ae334eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 10:46:07 -0300 Subject: [PATCH 208/237] Add sendMessage on enter pressed --- webchat/components/chat/input/chat-input.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/input/chat-input.html b/webchat/components/chat/input/chat-input.html index d62da383d..e6f7877e7 100644 --- a/webchat/components/chat/input/chat-input.html +++ b/webchat/components/chat/input/chat-input.html @@ -4,7 +4,8 @@ class="chat-input__connection-state">⬤

    + ng-model="chatInputCtrl.msg" + ng-keydown="$event.keyCode === 13 && chatInputCtrl.sendMessage()"/> Date: Fri, 8 Mar 2019 10:57:42 -0300 Subject: [PATCH 209/237] Add autoclose sidenav when a chat is open and is on mobile --- webchat/home/homeController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 4de3f6d31..43a3d92d5 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -3,7 +3,8 @@ const webchat = angular.module('webchat'); - webchat.controller('HomeController', ['UserService', 'AuthService', 'MessageService', '$scope', function HomeController (UserService, AuthService, MessageService, $scope) { + webchat.controller('HomeController', ['UserService', 'AuthService', 'MessageService', '$scope', 'NavbarManagementService', + function HomeController (UserService, AuthService, MessageService, $scope, NavbarManagementService) { const homeCtrl = this; homeCtrl.$onInit = () => { @@ -36,6 +37,9 @@ homeCtrl.openChat = (user) => { homeCtrl.currentUser = user; + if (Utils.isMobileScreen()) { + NavbarManagementService.toggleSidenav('left'); + } }; homeCtrl.chatCreated = (e) => { From 5f288d380bfef9686b64034bb0c7c0a8cfef07e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 8 Mar 2019 12:33:55 -0300 Subject: [PATCH 210/237] Add disabled input when state is not connected --- webchat/components/chat/input/chat-input.component.js | 5 +++++ webchat/components/chat/input/chat-input.html | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/webchat/components/chat/input/chat-input.component.js b/webchat/components/chat/input/chat-input.component.js index 768511a44..c7e90699a 100644 --- a/webchat/components/chat/input/chat-input.component.js +++ b/webchat/components/chat/input/chat-input.component.js @@ -34,6 +34,11 @@ chatInputCtrl.msg = ''; } }; + + chatInputCtrl.inputDisabled = () => { + return !_.includes(['connected', 'complete'], chatInputCtrl.state); + }; + } })(); \ No newline at end of file diff --git a/webchat/components/chat/input/chat-input.html b/webchat/components/chat/input/chat-input.html index e6f7877e7..45660ddb2 100644 --- a/webchat/components/chat/input/chat-input.html +++ b/webchat/components/chat/input/chat-input.html @@ -5,11 +5,13 @@ + ng-keydown="$event.keyCode === 13 && chatInputCtrl.sendMessage()" + ng-disabled="chatInputCtrl.inputDisabled()"/> + action="chatInputCtrl.sendMessage" + disabled="chatInputCtrl.inputDisabled()">
    From 6c9f81344d45793fccf483c2c64eb00f52065f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 12 Mar 2019 20:31:06 -0300 Subject: [PATCH 211/237] Fix typo on state definition --- webchat/components/chat/input/chat-input.component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webchat/components/chat/input/chat-input.component.js b/webchat/components/chat/input/chat-input.component.js index c7e90699a..b365ac7b8 100644 --- a/webchat/components/chat/input/chat-input.component.js +++ b/webchat/components/chat/input/chat-input.component.js @@ -18,7 +18,7 @@ chatInputCtrl.getStateStyle = () => { const state = chatInputCtrl.getState(); - if (_.includes(['connected', 'complete'], state)) { + if (_.includes(['connected', 'completed'], state)) { return 'lawngreen'; } else if (_.includes(['failed', 'disconnected', 'closed'], state)) { return 'red'; @@ -36,7 +36,7 @@ }; chatInputCtrl.inputDisabled = () => { - return !_.includes(['connected', 'complete'], chatInputCtrl.state); + return !_.includes(['connected', 'completed'], chatInputCtrl.state); }; } From a2c75dada081cdf22777cf77eb67b7c48b4ccb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Tue, 12 Mar 2019 20:31:34 -0300 Subject: [PATCH 212/237] Add structure to add video on webchat --- webchat/home/homeController.js | 57 +++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 43a3d92d5..b4b1c08c7 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -43,13 +43,23 @@ }; homeCtrl.chatCreated = (e) => { - UserService.getUser(e.id).then(user => { - homeCtrl.currentChat = e.chat; - homeCtrl.currentUser = user; - homeCtrl.currentChat.on('ice-connection-changed', homeCtrl.stateChange); - homeCtrl.currentChat.on('msg-list-updated', list => { - $scope.$apply(); - }); + homeCtrl.currentUser = homeCtrl.getUser(e.id); + homeCtrl.currentChat = e.chat; + + const selfie = document.getElementById('video-selfie'); + selfie.srcObject = homeCtrl.currentChat.selfStream; + selfie.play().then().catch(e => console.log('cant play video: ', e)); + + homeCtrl.currentChat.on('ice-connection-changed', homeCtrl.stateChange); + homeCtrl.currentChat.on('msg-list-updated', list => { + $scope.$apply(); + }); + + homeCtrl.currentChat.on('track-received', ev => { + const el = document.getElementById('video-remote'); + el.srcObject = ev.streams[0]; + el.play().then().catch(e => console.log('cant play video: ', e)); + $scope.$apply(); }); }; @@ -59,18 +69,35 @@ }; homeCtrl.call = (user) => { - homeCtrl.client.requestCall(user.key); - homeCtrl.openChat(user); + getMedia().then(stream => { + homeCtrl.client.requestCall(user.key, stream); + }); }; homeCtrl.promptCall = (id) => { - UserService.getUser(id).then(user => { - MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { - if (answer) { - homeCtrl.client.acceptCall(id); - } - }); + const user = homeCtrl.getUser(id); + + MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { + if (answer) { + homeCtrl.openChat(user); + getMedia().then(stream => { + homeCtrl.client.acceptCall(id, stream); + }); + } + }); + }; + + function getMedia() { + return new Promise((resolve, reject) => { + let stream; + navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(s => { + stream = s; + }).catch(e => console.log(e)).finally(() => resolve(stream)); }); + } + + homeCtrl.getUser = (id) => { + return homeCtrl.cachedUsers[id]; }; }]); })(); From 08411a5cd52f058207b66da42bb910d422ea3592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Mar 2019 11:24:05 -0300 Subject: [PATCH 213/237] Modify toggle button to have a specific function to call when on and off --- .../toggle-button/toggle-button.component.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 94c0874d4..50ce06ece 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -28,7 +28,8 @@ iconOff: '@', iconColorOn: '@', iconColorOff: '@', - action: '<', + actionOn: '<', + actionOff: '<', }, }); @@ -40,13 +41,14 @@ active: true, iconColorOn: "#EEE", iconColorOff: "#EEE", - action: () => {} + actionOn: () => {}, + actionOff: () => {}, }); }; toggleButtonCtrl.toggle = () => { toggleButtonCtrl.active = !toggleButtonCtrl.active; - toggleButtonCtrl.action(); + toggleButtonCtrl.activeActionFunc(); }; Object.defineProperty(toggleButtonCtrl, 'activeIcon', { @@ -60,6 +62,12 @@ return toggleButtonCtrl.active ? toggleButtonCtrl.iconColorOn : toggleButtonCtrl.iconColorOff; }, }); + + Object.defineProperty(toggleButtonCtrl, 'activeActionFunc', { + get: () => { + return toggleButtonCtrl.active ? toggleButtonCtrl.actionOn : toggleButtonCtrl.actionOff; + }, + }); } })(); \ No newline at end of file From 5d509d170999eadc6cc93c38049bcafc52723bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Mar 2019 11:24:51 -0300 Subject: [PATCH 214/237] Add video and audio toggle buttons on chat --- webchat/components/chat/buttons/chat-buttons.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/buttons/chat-buttons.html b/webchat/components/chat/buttons/chat-buttons.html index 7240fd019..8a5541348 100644 --- a/webchat/components/chat/buttons/chat-buttons.html +++ b/webchat/components/chat/buttons/chat-buttons.html @@ -1 +1,11 @@ - \ No newline at end of file + + + From 88e6ae0fec6a1418f179163c1f711ef0d5770a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Mar 2019 11:26:31 -0300 Subject: [PATCH 215/237] Fix navbar shown when accept call --- webchat/home/homeController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index b4b1c08c7..6cd162341 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -79,7 +79,7 @@ MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { if (answer) { - homeCtrl.openChat(user); + homeCtrl.currentUser = user; getMedia().then(stream => { homeCtrl.client.acceptCall(id, stream); }); From 382be66cacad3d0395c5c73dc088b07539b61f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Wed, 13 Mar 2019 11:28:40 -0300 Subject: [PATCH 216/237] Add video tags on chat body --- webchat/components/chat/body/chat-body.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index 48bd48557..9d87fec32 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -4,4 +4,8 @@ ng-repeat="message in chatBodyCtrl.messages" message-obj="message"> -
    \ No newline at end of file +
    +
    + + +
    From d5231988a77792691172d1b3a6fb2d637030c34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 14 Mar 2019 09:10:55 -0300 Subject: [PATCH 217/237] Add videoStream passed as a binding to chat body --- .../chat/body/chat-body.component.js | 24 +++++++++++++++++++ .../components/chat/ecis-chat.component.js | 2 ++ webchat/components/chat/ecis-chat.html | 4 +++- webchat/home/home.html | 4 +++- webchat/home/homeController.js | 9 ++----- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/webchat/components/chat/body/chat-body.component.js b/webchat/components/chat/body/chat-body.component.js index cc3c4f4bc..de7334f6d 100644 --- a/webchat/components/chat/body/chat-body.component.js +++ b/webchat/components/chat/body/chat-body.component.js @@ -7,11 +7,35 @@ controllerAs: "chatBodyCtrl", bindings: { messages: '<', + videoActive: '<', + selfieStream: '<', + remoteStream: '<', }, }); function chatBodyController() { const chatBodyCtrl = this; + + chatBodyCtrl.$onChanges = (changesObj) => { + updateSelfieVideo(changesObj); + updateRemoteVideo(changesObj); + }; + + const updateSelfieVideo = (changesObj) => { + if (_.has(changesObj, 'selfieStream.currentValue')) { + const selfieVideo = document.getElementById('video-selfie'); + selfieVideo.srcObject = chatBodyCtrl.selfieStream; + selfieVideo.play(); + } + }; + + const updateRemoteVideo = (changesObj) => { + if (_.has(changesObj, 'remoteStream.currentValue')) { + const remoteVideo = document.getElementById('video-remote'); + remoteVideo.srcObject = chatBodyCtrl.remoteStream; + remoteVideo.play(); + } + }; } })(); \ No newline at end of file diff --git a/webchat/components/chat/ecis-chat.component.js b/webchat/components/chat/ecis-chat.component.js index a80eb9cab..a9b7d0958 100644 --- a/webchat/components/chat/ecis-chat.component.js +++ b/webchat/components/chat/ecis-chat.component.js @@ -10,6 +10,8 @@ user: '<', callFunc: '<', state: '<', + selfieStream: '<', + remoteStream: '<', }, }); diff --git a/webchat/components/chat/ecis-chat.html b/webchat/components/chat/ecis-chat.html index b46d04748..1bcff6d70 100644 --- a/webchat/components/chat/ecis-chat.html +++ b/webchat/components/chat/ecis-chat.html @@ -6,7 +6,9 @@ + messages="ecisChatCtrl.chat.currentMessages" + selfie-stream="ecisChatCtrl.selfieStream" + remote-stream="ecisChatCtrl.remoteStream"> + state="homeCtrl.state" + selfie-stream="homeCtrl.selfieStream" + remote-stream="homeCtrl.remoteStream">
    diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 6cd162341..f683db4e8 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -46,9 +46,7 @@ homeCtrl.currentUser = homeCtrl.getUser(e.id); homeCtrl.currentChat = e.chat; - const selfie = document.getElementById('video-selfie'); - selfie.srcObject = homeCtrl.currentChat.selfStream; - selfie.play().then().catch(e => console.log('cant play video: ', e)); + homeCtrl.selfieStream = homeCtrl.currentChat.selfStream; homeCtrl.currentChat.on('ice-connection-changed', homeCtrl.stateChange); homeCtrl.currentChat.on('msg-list-updated', list => { @@ -56,10 +54,7 @@ }); homeCtrl.currentChat.on('track-received', ev => { - const el = document.getElementById('video-remote'); - el.srcObject = ev.streams[0]; - el.play().then().catch(e => console.log('cant play video: ', e)); - $scope.$apply(); + homeCtrl.remoteStream = ev.streams[0]; }); }; From 1a6a75882acf1985cde1d439d07cbd31cecdc056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 14 Mar 2019 13:08:35 -0300 Subject: [PATCH 218/237] Add specific height an width to video --- webchat/components/chat/body/chat-body.css | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index 161d82c13..98db2bf5b 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -1,4 +1,9 @@ -.chat-body__container { +.chat-body { + height: 100%; + width: 100%; +} + +.chat-body__messages-container { height: 100%; max-height: 100%; display: flex; @@ -6,3 +11,24 @@ overflow-y: scroll; justify-content: flex-end; } + +.chat-body__video-container { + background-color: darkgray; + max-width: 100%; + max-height: 100%; + height: 100%; + width: 100%; +} + +#video-remote { + height: 100%; + width: 100%; + max-width: 100%; + max-height: 100%; +} + +#video-selfie { + display: none; + max-width: 100%; + max-height: 100%; +} \ No newline at end of file From 21fccf4f6f2917259a097f06c52c8137656d1afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Thu, 14 Mar 2019 13:09:12 -0300 Subject: [PATCH 219/237] Add video toggle --- webchat/components/chat/body/chat-body.html | 4 ++-- .../chat/buttons/chat-buttons.component.js | 2 ++ webchat/components/chat/buttons/chat-buttons.html | 4 ++-- webchat/components/chat/ecis-chat.component.js | 11 +++++++++++ webchat/components/chat/ecis-chat.html | 5 ++++- .../components/chat/header/chat-header.component.js | 3 +++ webchat/components/chat/header/chat-header.html | 5 ++++- .../toggle-button/toggle-button.component.js | 2 +- webchat/home/homeController.js | 12 ++++++++---- 9 files changed, 37 insertions(+), 11 deletions(-) diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index 9d87fec32..b1a63ce13 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -1,11 +1,11 @@ -
    +
    -
    +
    diff --git a/webchat/components/chat/buttons/chat-buttons.component.js b/webchat/components/chat/buttons/chat-buttons.component.js index 08bf5d7ea..fa9bd908b 100644 --- a/webchat/components/chat/buttons/chat-buttons.component.js +++ b/webchat/components/chat/buttons/chat-buttons.component.js @@ -7,6 +7,8 @@ controllerAs: "chatButtonsCtrl", bindings: { callFunc: "<", + enableVideoFunc: "<", + disableVideoFunc: "<", }, }); diff --git a/webchat/components/chat/buttons/chat-buttons.html b/webchat/components/chat/buttons/chat-buttons.html index 8a5541348..4aef7cd55 100644 --- a/webchat/components/chat/buttons/chat-buttons.html +++ b/webchat/components/chat/buttons/chat-buttons.html @@ -1,8 +1,8 @@ + action-on="chatButtonsCtrl.enableVideoFunc" + action-off="chatButtonsCtrl.disableVideoFunc"> { ecisChatCtrl.callFunc(ecisChatCtrl.user); }; + + ecisChatCtrl.disableVideo = () => { + ecisChatCtrl.videoActive = false; + console.log('disabled'); + }; + + ecisChatCtrl.enableVideo = () => { + ecisChatCtrl.videoActive = true; + console.log('enabled'); + }; + } })(); \ No newline at end of file diff --git a/webchat/components/chat/ecis-chat.html b/webchat/components/chat/ecis-chat.html index 1bcff6d70..153b534ba 100644 --- a/webchat/components/chat/ecis-chat.html +++ b/webchat/components/chat/ecis-chat.html @@ -2,11 +2,14 @@ + call-func="ecisChatCtrl.call" + enable-video-func="ecisChatCtrl.enableVideo" + disable-video-func="ecisChatCtrl.disableVideo"> diff --git a/webchat/components/chat/header/chat-header.component.js b/webchat/components/chat/header/chat-header.component.js index f8949a503..32fe45182 100644 --- a/webchat/components/chat/header/chat-header.component.js +++ b/webchat/components/chat/header/chat-header.component.js @@ -9,11 +9,14 @@ user: "<", chat: "<", callFunc: "<", + enableVideoFunc: '<', + disableVideoFunc: '<', }, }); function chatHeaderController() { const chatHeaderCtrl = this; + } })(); \ No newline at end of file diff --git a/webchat/components/chat/header/chat-header.html b/webchat/components/chat/header/chat-header.html index c357f885f..1e11de890 100644 --- a/webchat/components/chat/header/chat-header.html +++ b/webchat/components/chat/header/chat-header.html @@ -4,5 +4,8 @@ avatar="{{ chatHeaderCtrl.user.photo_url }}" name="{{ chatHeaderCtrl.user.name }}" text="{{ chatHeaderCtrl.user.email[0] }}"> - +
    diff --git a/webchat/components/toggle-button/toggle-button.component.js b/webchat/components/toggle-button/toggle-button.component.js index 50ce06ece..ce965cdc6 100644 --- a/webchat/components/toggle-button/toggle-button.component.js +++ b/webchat/components/toggle-button/toggle-button.component.js @@ -47,8 +47,8 @@ }; toggleButtonCtrl.toggle = () => { - toggleButtonCtrl.active = !toggleButtonCtrl.active; toggleButtonCtrl.activeActionFunc(); + toggleButtonCtrl.active = !toggleButtonCtrl.active; }; Object.defineProperty(toggleButtonCtrl, 'activeIcon', { diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index f683db4e8..f22e830ca 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -74,14 +74,18 @@ MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { if (answer) { - homeCtrl.currentUser = user; - getMedia().then(stream => { - homeCtrl.client.acceptCall(id, stream); - }); + homeCtrl.acceptCall(user, id); } }); }; + homeCtrl.acceptCall = (user, id) => { + homeCtrl.currentUser = user; + getMedia().then(stream => { + homeCtrl.client.acceptCall(id, stream); + }); + }; + function getMedia() { return new Promise((resolve, reject) => { let stream; From 4a41716a12e00949c51d3c45d343990fed1a1f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 13:28:56 -0300 Subject: [PATCH 220/237] Apply responsability to contain remote stream to chat --- .../components/chat/body/chat-body.component.js | 12 ++++++++---- webchat/components/chat/ecis-chat.component.js | 2 -- webchat/home/home.html | 4 ++-- webchat/home/homeController.js | 15 ++++----------- webchat/utils/chat.js | 8 +++++++- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/webchat/components/chat/body/chat-body.component.js b/webchat/components/chat/body/chat-body.component.js index de7334f6d..fda116370 100644 --- a/webchat/components/chat/body/chat-body.component.js +++ b/webchat/components/chat/body/chat-body.component.js @@ -22,17 +22,21 @@ }; const updateSelfieVideo = (changesObj) => { - if (_.has(changesObj, 'selfieStream.currentValue')) { + const canUpdate = _.get(changesObj, 'selfieStream.currentValue.active', false); + + if (canUpdate) { const selfieVideo = document.getElementById('video-selfie'); - selfieVideo.srcObject = chatBodyCtrl.selfieStream; + selfieVideo.srcObject = changesObj.selfieStream.currentValue; selfieVideo.play(); } }; const updateRemoteVideo = (changesObj) => { - if (_.has(changesObj, 'remoteStream.currentValue')) { + const canUpdate = _.get(changesObj, 'remoteStream.currentValue.active', false); + + if (canUpdate) { const remoteVideo = document.getElementById('video-remote'); - remoteVideo.srcObject = chatBodyCtrl.remoteStream; + remoteVideo.srcObject = changesObj.remoteStream.currentValue; remoteVideo.play(); } }; diff --git a/webchat/components/chat/ecis-chat.component.js b/webchat/components/chat/ecis-chat.component.js index 6dfcb06da..19c137352 100644 --- a/webchat/components/chat/ecis-chat.component.js +++ b/webchat/components/chat/ecis-chat.component.js @@ -28,12 +28,10 @@ ecisChatCtrl.disableVideo = () => { ecisChatCtrl.videoActive = false; - console.log('disabled'); }; ecisChatCtrl.enableVideo = () => { ecisChatCtrl.videoActive = true; - console.log('enabled'); }; } diff --git a/webchat/home/home.html b/webchat/home/home.html index b1a40114f..8a81faeb5 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -7,7 +7,7 @@ user="homeCtrl.currentUser" call-func="homeCtrl.call" state="homeCtrl.state" - selfie-stream="homeCtrl.selfieStream" - remote-stream="homeCtrl.remoteStream"> + selfie-stream="homeCtrl.currentChat.selfieStream" + remote-stream="homeCtrl.currentChat.remoteStream">
    diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index f22e830ca..ff23092fe 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -37,25 +37,18 @@ homeCtrl.openChat = (user) => { homeCtrl.currentUser = user; - if (Utils.isMobileScreen()) { - NavbarManagementService.toggleSidenav('left'); - } + homeCtrl.currentChat = homeCtrl.client.chats[user.key] || {}; + }; homeCtrl.chatCreated = (e) => { - homeCtrl.currentUser = homeCtrl.getUser(e.id); - homeCtrl.currentChat = e.chat; - - homeCtrl.selfieStream = homeCtrl.currentChat.selfStream; + homeCtrl.openChat(homeCtrl.getUser(e.id)); homeCtrl.currentChat.on('ice-connection-changed', homeCtrl.stateChange); homeCtrl.currentChat.on('msg-list-updated', list => { $scope.$apply(); }); - homeCtrl.currentChat.on('track-received', ev => { - homeCtrl.remoteStream = ev.streams[0]; - }); }; homeCtrl.stateChange = (state) => { @@ -80,7 +73,7 @@ }; homeCtrl.acceptCall = (user, id) => { - homeCtrl.currentUser = user; + homeCtrl.openChat(user); getMedia().then(stream => { homeCtrl.client.acceptCall(id, stream); }); diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index ffd48d558..cc210f8d0 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -25,10 +25,15 @@ this.rpc.onicecandidate = e => this.emit('ice-candidate-discovered', e); this.sendChannel = this.rpc.createDataChannel('sendChannel'); this.rpc.ondatachannel = this.handleDataChannel.bind(this); - this.rpc.ontrack = e => this.emit('track-received', e); + this.rpc.ontrack = this.handleTrack.bind(this); this.rpc.oniceconnectionstatechange = this.handleIceConnectionState.bind(this); this.rpc.onsignalingstatechange = this.handleState.bind(this); this._currentMessages = []; + this._remoteStream = {}; + } + + get remoteStream() { + return this._remoteStream; } get selfStream() { @@ -171,6 +176,7 @@ * @param {Event} e - event which contains the stream object and its tracks. */ handleTrack(e) { + this._remoteStream = e.streams[0]; this.emit('track-received', e); } From 6fa2345fc5c7af5c963291254e276e4ca449f74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 15:06:56 -0300 Subject: [PATCH 221/237] Fix dialog confirm action not triggering --- webchat/home/homeController.js | 8 +++--- webchat/index.html | 2 +- webchat/styles/custom/custom.css | 5 ++++ webchat/utils/confirm_dialog.css | 29 ++++++++++++++++++++++ webchat/utils/confirm_dialog.html | 15 +++++++++++ webchat/utils/messageService.js | 41 +++++++++++++++++++++++-------- 6 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 webchat/utils/confirm_dialog.css create mode 100644 webchat/utils/confirm_dialog.html diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index ff23092fe..7bcff2c8c 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -65,10 +65,10 @@ homeCtrl.promptCall = (id) => { const user = homeCtrl.getUser(id); - MessageService.showConfirmationDialog({}, "Ligação recebida", `Ligação de ${user.name}. Aceitar?`).then(answer => { - if (answer) { - homeCtrl.acceptCall(user, id); - } + MessageService.showConfirmationDialog({}, { + title: user.name, + subtitle: "Está te ligando você deseja atender essa ligação?", + confirmAction: () => homeCtrl.acceptCall(user, id), }); }; diff --git a/webchat/index.html b/webchat/index.html index 4718ee2a2..26d4db6f5 100644 --- a/webchat/index.html +++ b/webchat/index.html @@ -66,7 +66,7 @@ - + diff --git a/webchat/styles/custom/custom.css b/webchat/styles/custom/custom.css index 4da3533e0..3978a6af5 100644 --- a/webchat/styles/custom/custom.css +++ b/webchat/styles/custom/custom.css @@ -5,4 +5,9 @@ background-color: #EEEEEE; border: none; outline: none; +} + +.custom-title { + font-size: 20px; + font-weight: 500; } \ No newline at end of file diff --git a/webchat/utils/confirm_dialog.css b/webchat/utils/confirm_dialog.css new file mode 100644 index 000000000..0ced2c801 --- /dev/null +++ b/webchat/utils/confirm_dialog.css @@ -0,0 +1,29 @@ +.dialog__container { + display: grid; + grid-template-areas: + "title" + "subtitle" + "buttons"; + padding: 1.5em 2em 0; +} + +.dialog__title { + grid-area: title; + margin: 0; +} + +.dialog__subtitle { + grid-area: subtitle; + padding: 0.5em 0; +} + +.dialog__buttons { + grid-area: buttons; + display: flex; + flex-direction: row; + justify-content: flex-end; +} + +.dialog__button { + margin: 1em 0; +} \ No newline at end of file diff --git a/webchat/utils/confirm_dialog.html b/webchat/utils/confirm_dialog.html new file mode 100644 index 000000000..840422bff --- /dev/null +++ b/webchat/utils/confirm_dialog.html @@ -0,0 +1,15 @@ + + + {{ dialogCtrl.title }} + {{ dialogCtrl.subtitle }} + +
    + + {{ dialogCtrl.cancelText }} + + + {{ dialogCtrl.confirmText }} + +
    +
    +
    diff --git a/webchat/utils/messageService.js b/webchat/utils/messageService.js index 001b710e2..ab0df3f6a 100644 --- a/webchat/utils/messageService.js +++ b/webchat/utils/messageService.js @@ -28,19 +28,40 @@ return (message && msg[message.code]) || msg[message] || message; } - service.showConfirmationDialog = function showConfirmationDialog(event, title, textContent) { - const confirm = $mdDialog.confirm() - .clickOutsideToClose(true) - .title(title) - .textContent(textContent) - .ariaLabel(title) - .targetEvent(event) - .ok('Ok') - .cancel('Cancelar'); + service.showConfirmationDialog = function showConfirmationDialog(event, params) { + const dialog = { + templateUrl: "app/utils/confirm_dialog.html", + controller: dialogController, + controllerAs: 'dialogCtrl', + parent: angular.element(document.body), + targetEvent: event, + clickOutsideToClose:true, + locals: params, + }; - return $mdDialog.show(confirm); + return $mdDialog.show(dialog); }; + function dialogController (locals) { + const dialogCtrl = this; + + dialogCtrl.$onInit = () => { + _.assign(dialogCtrl, locals); + _.defaults(dialogCtrl, { + confirmAction: () => {}, + cancelText: "Cancelar", + confirmText: "Confirmar", + }); + }; + + dialogCtrl.cancelDialog = $mdDialog.cancel; + + dialogCtrl.confirmDialog = () => { + dialogCtrl.confirmAction(); + $mdDialog.hide(); + }; + } + service.showMessageDialog = function (event, message) { function MessageController ($mdDialog) { From 2a730505cb5be35b59774ff56e948ad641543ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 16:35:34 -0300 Subject: [PATCH 222/237] Fix message shown when there is no contacts online --- webchat/components/contacts/list/contacts-list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/contacts/list/contacts-list.html b/webchat/components/contacts/list/contacts-list.html index 5355da2eb..07426aba9 100644 --- a/webchat/components/contacts/list/contacts-list.html +++ b/webchat/components/contacts/list/contacts-list.html @@ -12,5 +12,5 @@ -

    Não há contatos online no momento.

    +

    Não há contatos online no momento.

    \ No newline at end of file From 59f6457e5956aefce92952b7099bc7c748ffb5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 16:46:33 -0300 Subject: [PATCH 223/237] Add is-empty-card component and message when no chat is selected --- webchat/home/home.html | 1 + webchat/images/desenho-cis.png | Bin 0 -> 63421 bytes webchat/index.html | 6 +++- .../is-empty-card/is-empty-card.component.js | 24 ++++++++++++++++ webchat/utils/is-empty-card/is-empty-card.css | 26 ++++++++++++++++++ .../utils/is-empty-card/is-empty-card.html | 4 +++ 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 webchat/images/desenho-cis.png create mode 100644 webchat/utils/is-empty-card/is-empty-card.component.js create mode 100644 webchat/utils/is-empty-card/is-empty-card.css create mode 100644 webchat/utils/is-empty-card/is-empty-card.html diff --git a/webchat/home/home.html b/webchat/home/home.html index 8a81faeb5..3e4a418f3 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -10,4 +10,5 @@ selfie-stream="homeCtrl.currentChat.selfieStream" remote-stream="homeCtrl.currentChat.remoteStream"> +
    diff --git a/webchat/images/desenho-cis.png b/webchat/images/desenho-cis.png new file mode 100644 index 0000000000000000000000000000000000000000..958e63f9af8086e54aa65a10f12bd9f7096ec219 GIT binary patch literal 63421 zcmeEu)ADiEa}C06_XwNnRZQ@X7%I=NTbB_{0Fq z<_i3W-d#c0UBe0P?rG*~1;|=DnOm_ubuhEGQnxa*^mh4XB>?~@CQs#MHNB>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#$Ya~c`b5-5uQDCrjJ$v*1!1enJmAX$ z>s#*tP6#ad6)otqoG|0_SS{%PD-w_*7v9P)l{&+MPu8G+hFre`9C0q-MV&M-#mQ(% zNZOxiP?#JAOI=*JG>{yAl`a$KF%=+_^h@!#rfU1iGWAMK^pEGDXVs`4Vd9WpCM5%- zzGNvGGRR@69Y}|^Fd`mWJd4?Qb{eSXc7V&d-+?nJE=AYUWeC>=!z4tyvEiYtxbELt zX9q}b*Q*qvkq}quUj?T}R2utKdX4-!d*;kdu-`C|M20jkumsA`hwlOvGbC%ucn9RF zB;-{@JtxVR|A!XST_B~cFrst&X-1Xt*qzgv^L~JpFK-~pb3kior3t;i{O;q+C;A6^ zBrfbGg@~4ly92&Vc@UEhI3UeRRz?JV+0U%@t@ACGL6c_*)^K|2sdP`SGh`mk! z^A33Yg4*RSXfqM@r(vAoUHOaQxOMgnDsR#mLX`wsQB z#?ph^c<#|kN`yqi?&e4bIKbgi#MM^g&$e&M!ihWP^tp)A=aO>y>yi{D4iH~o^_jq- zroqq{(D+YwsIB$+f$?m%)&H_YAUwL$ByzT@FXVki4r#KvTt8D-!|M?QmJE3fqAkfb zb&?yw9j1kmZcj{5w0CqlJcJCh1T=e-z+zv(4jEi{`IqMqi>(mcOvG?;!UGuWUoW|cesM=c4J0%jYbq)mDKp#j&A#xUXvvv6O zF+vCKnkCt-(2YX>Z9~Z15D%5w8x$^=l(*N+Z>IA??<}K#?p&wsP2dKg>0yWuXMaDX za6}U53HbAIDBvJ)mJ(aSb`LgRgZRn&_(9dge1-fOmZDJLjvS-`WF(#gqx*cSRg@s? t)))SIo;hDTs2_a$|L=b-+xv%3!-RRiA6DpRKM9TXrsiFZ5;dEb{{v - + + + @@ -150,6 +152,8 @@ + + diff --git a/webchat/utils/is-empty-card/is-empty-card.component.js b/webchat/utils/is-empty-card/is-empty-card.component.js new file mode 100644 index 000000000..2bbed5714 --- /dev/null +++ b/webchat/utils/is-empty-card/is-empty-card.component.js @@ -0,0 +1,24 @@ +(function () { + 'use strict'; + + /** + * Component that is shown when something is empty and in the error page. + * It's shows a default image and a text that it receives as a binding. + * @class isEmptyCard + * @example + * + */ + angular.module("webchat").component("isEmptyCard", { + templateUrl: "app/utils/is-empty-card/is-empty-card.html", + controller: isEmptyCardController, + controllerAs: "isEmptyCardCtrl", + bindings: { + text: "@" + }, + }); + + function isEmptyCardController() { + + } + +})(); \ No newline at end of file diff --git a/webchat/utils/is-empty-card/is-empty-card.css b/webchat/utils/is-empty-card/is-empty-card.css new file mode 100644 index 000000000..e211f97f9 --- /dev/null +++ b/webchat/utils/is-empty-card/is-empty-card.css @@ -0,0 +1,26 @@ +.is-empty-card__container { + display: grid; + grid-template-rows: auto auto; + grid-template-areas: + 'image' + 'text'; + width: 100%; + height: 100%; +} + +.is-empty-card__image { + grid-area: image; + width: 100%; +} + +.is-empty-card__text { + grid-area: text; + display: flex; + font-size: 1.5em; + margin: 1em 0; + padding: 0 0.5em; + font-weight: bold; + color: #009688; + text-align: center; + justify-content: center; +} \ No newline at end of file diff --git a/webchat/utils/is-empty-card/is-empty-card.html b/webchat/utils/is-empty-card/is-empty-card.html new file mode 100644 index 000000000..65a66249b --- /dev/null +++ b/webchat/utils/is-empty-card/is-empty-card.html @@ -0,0 +1,4 @@ +

    + + {{ isEmptyCardCtrl.text }} +
    \ No newline at end of file From 8bbbbadd5a74763dbd029b31722090eee98e9abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 17:07:05 -0300 Subject: [PATCH 224/237] Add secure chat info message --- webchat/components/chat/body/chat-body.css | 9 +++++++++ webchat/components/chat/body/chat-body.html | 1 + 2 files changed, 10 insertions(+) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index 98db2bf5b..f7b5c4ca9 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -20,6 +20,15 @@ width: 100%; } +.chat-body__info-message { + background-color: lightgoldenrodyellow; + width: fit-content; + padding: 10px 20px; + border-radius: 10px; + align-self: center; + margin: 10px 0 auto 0; +} + #video-remote { height: 100%; width: 100%; diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index b1a63ce13..1a0d50a47 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -1,4 +1,5 @@
    + Esta é uma conversa segura e não esta sendo gravada Date: Fri, 15 Mar 2019 17:18:16 -0300 Subject: [PATCH 225/237] Fix is-empty-card component size --- webchat/utils/is-empty-card/is-empty-card.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webchat/utils/is-empty-card/is-empty-card.css b/webchat/utils/is-empty-card/is-empty-card.css index e211f97f9..194314844 100644 --- a/webchat/utils/is-empty-card/is-empty-card.css +++ b/webchat/utils/is-empty-card/is-empty-card.css @@ -1,16 +1,19 @@ .is-empty-card__container { display: grid; - grid-template-rows: auto auto; + grid-template-rows: 1fr 1fr; grid-template-areas: 'image' 'text'; width: 100%; height: 100%; + justify-content: center; } .is-empty-card__image { grid-area: image; - width: 100%; + max-height: 100%; + max-width: 100%; + align-self: flex-end; } .is-empty-card__text { From bf5ba8e35b393b4dddf2b4156a6a421ce1be2f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 17:20:48 -0300 Subject: [PATCH 226/237] Fix info message size --- webchat/components/chat/body/chat-body.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index f7b5c4ca9..7528d3c00 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -21,12 +21,13 @@ } .chat-body__info-message { + text-align: center; background-color: lightgoldenrodyellow; width: fit-content; padding: 10px 20px; border-radius: 10px; align-self: center; - margin: 10px 0 auto 0; + margin: 10px 10px auto; } #video-remote { From 85227823d395ac21745dce6ca3a5e1ed9d993bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 17:32:03 -0300 Subject: [PATCH 227/237] Fix video responsive size --- webchat/components/chat/ecis-chat.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/chat/ecis-chat.css b/webchat/components/chat/ecis-chat.css index 0cefd60d2..05d185115 100644 --- a/webchat/components/chat/ecis-chat.css +++ b/webchat/components/chat/ecis-chat.css @@ -2,7 +2,7 @@ height: 100%; background: #EEEEEE; display: grid; - grid-template-rows: max-content 1fr max-content; + grid-template-rows: 64px calc(100% - 64px - 50px) 50px; grid-template-areas: 'header' 'body' From 98925143440b8a13889b129155cb8767a25e2232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 17:33:08 -0300 Subject: [PATCH 228/237] Fix is-empty-card allign --- webchat/utils/is-empty-card/is-empty-card.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/utils/is-empty-card/is-empty-card.css b/webchat/utils/is-empty-card/is-empty-card.css index 194314844..d7371b428 100644 --- a/webchat/utils/is-empty-card/is-empty-card.css +++ b/webchat/utils/is-empty-card/is-empty-card.css @@ -6,7 +6,7 @@ 'text'; width: 100%; height: 100%; - justify-content: center; + justify-items: center; } .is-empty-card__image { From aa9049fdc4b788f295b2e12ae99f6c5d258c3b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Fri, 15 Mar 2019 17:53:03 -0300 Subject: [PATCH 229/237] Add audio management functions --- webchat/components/chat/body/chat-body.component.js | 11 +++++++++++ webchat/components/chat/body/chat-body.html | 2 +- .../components/chat/buttons/chat-buttons.component.js | 2 ++ webchat/components/chat/buttons/chat-buttons.html | 4 ++-- webchat/components/chat/ecis-chat.component.js | 8 ++++++++ webchat/components/chat/ecis-chat.html | 5 ++++- .../components/chat/header/chat-header.component.js | 2 ++ webchat/components/chat/header/chat-header.html | 4 +++- 8 files changed, 33 insertions(+), 5 deletions(-) diff --git a/webchat/components/chat/body/chat-body.component.js b/webchat/components/chat/body/chat-body.component.js index fda116370..f80dd9dee 100644 --- a/webchat/components/chat/body/chat-body.component.js +++ b/webchat/components/chat/body/chat-body.component.js @@ -8,6 +8,7 @@ bindings: { messages: '<', videoActive: '<', + audioActive: '<', selfieStream: '<', remoteStream: '<', }, @@ -19,6 +20,7 @@ chatBodyCtrl.$onChanges = (changesObj) => { updateSelfieVideo(changesObj); updateRemoteVideo(changesObj); + updateRemoteAudio(changesObj); }; const updateSelfieVideo = (changesObj) => { @@ -40,6 +42,15 @@ remoteVideo.play(); } }; + + const updateRemoteAudio = (changesObj) => { + const canUpdate = _.has(changesObj, 'audioActive'); + + if (canUpdate) { + const remoteVideo = document.getElementById('video-remote'); + remoteVideo.muted = changesObj.audioActive.currentValue; + } + }; } })(); \ No newline at end of file diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index 1a0d50a47..8c61a3da1 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -8,5 +8,5 @@
    - +
    diff --git a/webchat/components/chat/buttons/chat-buttons.component.js b/webchat/components/chat/buttons/chat-buttons.component.js index fa9bd908b..2c5f0a4f9 100644 --- a/webchat/components/chat/buttons/chat-buttons.component.js +++ b/webchat/components/chat/buttons/chat-buttons.component.js @@ -9,6 +9,8 @@ callFunc: "<", enableVideoFunc: "<", disableVideoFunc: "<", + enableAudioFunc: "<", + disableAudioFunc: "<", }, }); diff --git a/webchat/components/chat/buttons/chat-buttons.html b/webchat/components/chat/buttons/chat-buttons.html index 4aef7cd55..181219584 100644 --- a/webchat/components/chat/buttons/chat-buttons.html +++ b/webchat/components/chat/buttons/chat-buttons.html @@ -6,6 +6,6 @@ + action-on="chatButtonsCtrl.enableAudioFunc" + action-off="chatButtonsCtrl.disableAudioFunc"> diff --git a/webchat/components/chat/ecis-chat.component.js b/webchat/components/chat/ecis-chat.component.js index 19c137352..243ed7707 100644 --- a/webchat/components/chat/ecis-chat.component.js +++ b/webchat/components/chat/ecis-chat.component.js @@ -34,6 +34,14 @@ ecisChatCtrl.videoActive = true; }; + ecisChatCtrl.disableAudio = () => { + ecisChatCtrl.audioActive = false; + }; + + ecisChatCtrl.enableAudio = () => { + ecisChatCtrl.audioActive = true; + }; + } })(); \ No newline at end of file diff --git a/webchat/components/chat/ecis-chat.html b/webchat/components/chat/ecis-chat.html index 153b534ba..94080c253 100644 --- a/webchat/components/chat/ecis-chat.html +++ b/webchat/components/chat/ecis-chat.html @@ -4,12 +4,15 @@ user="ecisChatCtrl.user" call-func="ecisChatCtrl.call" enable-video-func="ecisChatCtrl.enableVideo" - disable-video-func="ecisChatCtrl.disableVideo"> + disable-video-func="ecisChatCtrl.disableVideo" + enable-audio-func="ecisChatCtrl.enableAudio" + disable-audio-func="ecisChatCtrl.disableAudio"> diff --git a/webchat/components/chat/header/chat-header.component.js b/webchat/components/chat/header/chat-header.component.js index 32fe45182..56c68d904 100644 --- a/webchat/components/chat/header/chat-header.component.js +++ b/webchat/components/chat/header/chat-header.component.js @@ -11,6 +11,8 @@ callFunc: "<", enableVideoFunc: '<', disableVideoFunc: '<', + enableAudioFunc: '<', + disableAudioFunc: '<', }, }); diff --git a/webchat/components/chat/header/chat-header.html b/webchat/components/chat/header/chat-header.html index 1e11de890..af0c36bb6 100644 --- a/webchat/components/chat/header/chat-header.html +++ b/webchat/components/chat/header/chat-header.html @@ -7,5 +7,7 @@ + disable-video-func="chatHeaderCtrl.disableVideoFunc" + enable-audio-func="chatHeaderCtrl.enableAudioFunc" + disable-audio-func="chatHeaderCtrl.disableAudioFunc"> From 270999d5acef6dc7fe779e41cc55223732903fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 14:50:44 -0300 Subject: [PATCH 230/237] Change info message color to match cis palette --- webchat/components/chat/body/chat-body.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index 7528d3c00..bbc6aa3ab 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -22,7 +22,8 @@ .chat-body__info-message { text-align: center; - background-color: lightgoldenrodyellow; + background-color: #009688; + color: white; width: fit-content; padding: 10px 20px; border-radius: 10px; From 5ab56a4c9d7b535c1fb8f6ee43462739179cc9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 15:44:24 -0300 Subject: [PATCH 231/237] Move state responsability to chat object --- webchat/home/home.html | 2 +- webchat/home/homeController.js | 1 - webchat/utils/chat.js | 8 +++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/webchat/home/home.html b/webchat/home/home.html index 3e4a418f3..f66c74149 100644 --- a/webchat/home/home.html +++ b/webchat/home/home.html @@ -6,7 +6,7 @@ chat="homeCtrl.currentChat" user="homeCtrl.currentUser" call-func="homeCtrl.call" - state="homeCtrl.state" + state="homeCtrl.currentChat.connectionState" selfie-stream="homeCtrl.currentChat.selfieStream" remote-stream="homeCtrl.currentChat.remoteStream"> diff --git a/webchat/home/homeController.js b/webchat/home/homeController.js index 7bcff2c8c..cef4fd162 100644 --- a/webchat/home/homeController.js +++ b/webchat/home/homeController.js @@ -52,7 +52,6 @@ }; homeCtrl.stateChange = (state) => { - homeCtrl.state = state; $scope.$apply(); }; diff --git a/webchat/utils/chat.js b/webchat/utils/chat.js index cc210f8d0..fcb00ea57 100644 --- a/webchat/utils/chat.js +++ b/webchat/utils/chat.js @@ -30,6 +30,7 @@ this.rpc.onsignalingstatechange = this.handleState.bind(this); this._currentMessages = []; this._remoteStream = {}; + this._connectionState = ""; } get remoteStream() { @@ -40,6 +41,10 @@ return this._selfStream; } + get connectionState() { + return this._connectionState; + } + /** * Mimics node's on/emit event handlers. * Raises an event. @@ -119,7 +124,8 @@ * @fires Chat#ice-connection-changed */ handleIceConnectionState(ev) { - this.emit('ice-connection-changed', ev.target.iceConnectionState) + this._connectionState = ev.target.iceConnectionState; + this.emit('ice-connection-changed', ev.target.iceConnectionState); } /** From ab2cf962a5bf92ddd75222b4b9166a9b6947a18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 16:17:04 -0300 Subject: [PATCH 232/237] Add no-video-message --- webchat/components/chat/body/chat-body.css | 14 ++++++++++++++ webchat/components/chat/body/chat-body.html | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index bbc6aa3ab..982f2197d 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -13,6 +13,7 @@ } .chat-body__video-container { + display: grid; background-color: darkgray; max-width: 100%; max-height: 100%; @@ -31,6 +32,19 @@ margin: 10px 10px auto; } +.chat-body__no-video-message { + background-color: #009688; + color: white; + border-radius: 10px; + padding: 10px 20px; + height: fit-content; + width: fit-content; + margin: 10px; + text-align: center; + align-self: center; + justify-self: center; +} + #video-remote { height: 100%; width: 100%; diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index 8c61a3da1..f9c0eac60 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -7,6 +7,9 @@
    - - +
    + + +
    + Nenhum vídeo está sendo recebido
    From 679211012b2c9bc90d06456a60146f3c134d2ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 16:30:48 -0300 Subject: [PATCH 233/237] Fix chat body scroll --- webchat/components/chat/body/chat-body.css | 7 ++++++- webchat/components/chat/body/chat-body.html | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index 982f2197d..fbde78d32 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -3,12 +3,17 @@ width: 100%; } +.chat-body__messages-wrapper { + overflow-y: auto; + max-height: 100%; + max-width: 100%; +} + .chat-body__messages-container { height: 100%; max-height: 100%; display: flex; flex-direction: column; - overflow-y: scroll; justify-content: flex-end; } diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index f9c0eac60..f864d89a5 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -1,11 +1,13 @@ -
    - Esta é uma conversa segura e não esta sendo gravada - - -
    +
    +
    + Esta é uma conversa segura e não esta sendo gravada + + +
    +
    From 47c9203268d94badc8200fd7641858cf0e54fd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 16:31:05 -0300 Subject: [PATCH 234/237] Fix layout break when word is too big --- webchat/components/chat/message/chat-message.css | 1 + 1 file changed, 1 insertion(+) diff --git a/webchat/components/chat/message/chat-message.css b/webchat/components/chat/message/chat-message.css index 0c244fb3e..498676fc7 100644 --- a/webchat/components/chat/message/chat-message.css +++ b/webchat/components/chat/message/chat-message.css @@ -14,6 +14,7 @@ .chat-message__text { grid-area: text; + word-break: break-word; } .chat-message__time { From 40fe2c5df3e9a25a16ca706baf6ca06e7299bf84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 16:32:12 -0300 Subject: [PATCH 235/237] Fix info-message margin --- webchat/components/chat/body/chat-body.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.css b/webchat/components/chat/body/chat-body.css index fbde78d32..7bfd72bec 100644 --- a/webchat/components/chat/body/chat-body.css +++ b/webchat/components/chat/body/chat-body.css @@ -34,7 +34,7 @@ padding: 10px 20px; border-radius: 10px; align-self: center; - margin: 10px 10px auto; + margin: 10px 10px; } .chat-body__no-video-message { From 5db1a6b66f1d2b1506e5798e8c7051214d856885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Sun, 17 Mar 2019 16:35:19 -0300 Subject: [PATCH 236/237] Fix div definition on chat body --- webchat/components/chat/body/chat-body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webchat/components/chat/body/chat-body.html b/webchat/components/chat/body/chat-body.html index f864d89a5..47831ae3b 100644 --- a/webchat/components/chat/body/chat-body.html +++ b/webchat/components/chat/body/chat-body.html @@ -7,7 +7,7 @@ message-obj="message">
    - +
    From 14597913c29c75e882de8542fdc78e74d694efe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Esp=C3=ADndula?= Date: Mon, 18 Mar 2019 12:54:21 -0300 Subject: [PATCH 237/237] Change websocket url to production --- webchat/app.js | 3 +-- webchat/utils/chatClient.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/webchat/app.js b/webchat/app.js index 11431b295..1dcd7984f 100644 --- a/webchat/app.js +++ b/webchat/app.js @@ -17,8 +17,7 @@ }); app.constant('WEBSOCKET', { - hostname: window.location.hostname, - port: 8090, + url: "ws://webchat-server-dot-development-cis.appspot.com/", maxRetries: 5, }); diff --git a/webchat/utils/chatClient.js b/webchat/utils/chatClient.js index 1770a30f8..65fbc2051 100644 --- a/webchat/utils/chatClient.js +++ b/webchat/utils/chatClient.js @@ -57,7 +57,7 @@ * Starts a new connection with the websocket server. */ startWebsocket() { - const websocket = `ws://${WEBSOCKET.hostname}:${WEBSOCKET.port}`; + const websocket = WEBSOCKET.url; this.ws = new WebSocket(websocket); // Sends a signin message to the websocket as soon as the websocket connects