Comparing version 1.0.20 to 1.0.31
{ | ||
"name": "c8ocaf", | ||
"version": "1.0.20", | ||
"version": "1.0.31", | ||
"description": "Convertigo Angular Framework", | ||
@@ -10,3 +10,4 @@ "main": "bundle/index.umd.js", | ||
"src/", | ||
"LICENCE" | ||
"LICENCE", | ||
"tsconfig.json" | ||
], | ||
@@ -16,3 +17,4 @@ "scripts": { | ||
"prepublish": "npm run clean && ngc && npm run build", | ||
"build": "webpack && cp bundles/index.umd.js bundles/index.js" | ||
"build": "webpack && cp bundles/index.umd.js bundles/index.js", | ||
"build-dev" : "tsc -p ." | ||
}, | ||
@@ -19,0 +21,0 @@ "repository": { |
@@ -19,2 +19,3 @@ import { C8oRouter } from './convertigo.router'; | ||
listenNavParams(requestable: string): any; | ||
callForm(requestable: string, id: string): void; | ||
call(requestable: any, data?: any, navParams?: any, timeout?: number): void; | ||
@@ -21,0 +22,0 @@ ionViewDidLoad(): void; |
@@ -22,2 +22,5 @@ "use strict"; | ||
}; | ||
C8oPage.prototype.callForm = function (requestable, id) { | ||
this.call(requestable, this.form[id]); | ||
}; | ||
C8oPage.prototype.call = function (requestable, data, navParams, timeout) { | ||
@@ -24,0 +27,0 @@ var _this = this; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"C8oPage":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./convertigo.router","name":"C8oRouter"},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams"},{"__symbolic":"reference","module":"ionic-angular","name":"LoadingController"},{"__symbolic":"reference","module":"@angular/platform-browser","name":"DomSanitizer"}]}],"listen":[{"__symbolic":"method"}],"listenNavParams":[{"__symbolic":"method"}],"call":[{"__symbolic":"method"}],"ionViewDidLoad":[{"__symbolic":"method"}],"ionViewWillEnter":[{"__symbolic":"method"}],"ionViewDidEnter":[{"__symbolic":"method"}],"ionViewWillLeave":[{"__symbolic":"method"}],"ionViewDidLeave":[{"__symbolic":"method"}],"ionViewWillUnload":[{"__symbolic":"method"}],"getAttachmentUrl":[{"__symbolic":"method"}],"getNextLetter":[{"__symbolic":"method"}],"wordPlusOne":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"C8oPage":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./convertigo.router","name":"C8oRouter"},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams"},{"__symbolic":"reference","module":"ionic-angular","name":"LoadingController"},{"__symbolic":"reference","module":"@angular/platform-browser","name":"DomSanitizer"}]}],"listen":[{"__symbolic":"method"}],"listenNavParams":[{"__symbolic":"method"}],"call":[{"__symbolic":"method"}],"ionViewDidLoad":[{"__symbolic":"method"}],"ionViewWillEnter":[{"__symbolic":"method"}],"ionViewDidEnter":[{"__symbolic":"method"}],"ionViewWillLeave":[{"__symbolic":"method"}],"ionViewDidLeave":[{"__symbolic":"method"}],"ionViewWillUnload":[{"__symbolic":"method"}],"getAttachmentUrl":[{"__symbolic":"method"}],"getNextLetter":[{"__symbolic":"method"}],"wordPlusOne":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"C8oPage":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./convertigo.router","name":"C8oRouter"},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams"},{"__symbolic":"reference","module":"ionic-angular","name":"LoadingController"},{"__symbolic":"reference","module":"@angular/platform-browser","name":"DomSanitizer"}]}],"listen":[{"__symbolic":"method"}],"listenNavParams":[{"__symbolic":"method"}],"callForm":[{"__symbolic":"method"}],"call":[{"__symbolic":"method"}],"ionViewDidLoad":[{"__symbolic":"method"}],"ionViewWillEnter":[{"__symbolic":"method"}],"ionViewDidEnter":[{"__symbolic":"method"}],"ionViewWillLeave":[{"__symbolic":"method"}],"ionViewDidLeave":[{"__symbolic":"method"}],"ionViewWillUnload":[{"__symbolic":"method"}],"getAttachmentUrl":[{"__symbolic":"method"}],"getNextLetter":[{"__symbolic":"method"}],"wordPlusOne":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"C8oPage":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./convertigo.router","name":"C8oRouter"},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams"},{"__symbolic":"reference","module":"ionic-angular","name":"LoadingController"},{"__symbolic":"reference","module":"@angular/platform-browser","name":"DomSanitizer"}]}],"listen":[{"__symbolic":"method"}],"listenNavParams":[{"__symbolic":"method"}],"callForm":[{"__symbolic":"method"}],"call":[{"__symbolic":"method"}],"ionViewDidLoad":[{"__symbolic":"method"}],"ionViewWillEnter":[{"__symbolic":"method"}],"ionViewDidEnter":[{"__symbolic":"method"}],"ionViewWillLeave":[{"__symbolic":"method"}],"ionViewDidLeave":[{"__symbolic":"method"}],"ionViewWillUnload":[{"__symbolic":"method"}],"getAttachmentUrl":[{"__symbolic":"method"}],"getNextLetter":[{"__symbolic":"method"}],"wordPlusOne":[{"__symbolic":"method"}]}}}}] |
@@ -50,3 +50,5 @@ import { C8oRouter } from './convertigo.router' | ||
} | ||
callForm(requestable:string, id: string){ | ||
this.call(requestable, this.form[id]); | ||
} | ||
/** | ||
@@ -53,0 +55,0 @@ * Calls a Convertigo requestable with parameters as Object |
@@ -29,2 +29,4 @@ import { App } from 'ionic-angular'; | ||
setRoot(view: any, data: any, options: Object): Promise<any>; | ||
doOAuthLogin(url: String): void; | ||
openOAuthLogin(url: String): Promise<any>; | ||
} |
@@ -65,3 +65,3 @@ "use strict"; | ||
var requestable = (parameters["__project"] == undefined ? "" : parameters["__project"]) + "." + parameters["__sequence"]; | ||
var activeView = this.app.getActiveNav().getViews().slice(-1)[0] != undefined ? this.app.getActiveNav().getViews().slice(-1)[0].constructor.name : null; | ||
var activeView = this.app.getActiveNav().getViews().slice(-1)[0] != undefined ? this.app.getActiveNav().getViews().slice(-1)[0].component.name : null; | ||
var navParams = (parameters["_navParams"] == {}) ? "" : parameters["_navParams"]; | ||
@@ -82,3 +82,3 @@ for (var _i = 0, _a = this.routing_table; _i < _a.length; _i++) { | ||
} | ||
if (this.findView(activeView, route.target.page, requestable) && !route.target.alwaysNewPage) { | ||
if (this.findView(activeView, route.target.page.name, requestable) && !route.target.alwaysNewPage) { | ||
this.log("Route for Requestable '" + item.requestable + "', the view is already displayed, using curent view"); | ||
@@ -192,6 +192,6 @@ this.storeResponseForView(activeView, requestable, response, navParams, route.didEnter, route.didLeave); | ||
if (targetView != undefined) { | ||
if (view instanceof (targetView)) { | ||
return (true); | ||
if (view == targetView) { | ||
return true; | ||
} | ||
return (false); | ||
return false; | ||
} | ||
@@ -208,2 +208,45 @@ else { | ||
}; | ||
C8oRouter.prototype.doOAuthLogin = function (url) { | ||
var _this = this; | ||
this.openOAuthLogin(url).then(function (parsedResponse) { | ||
_this.c8o.log.debug("Parsed response is : " + JSON.stringify(parsedResponse)); | ||
_this.c8o.callJsonObject(".loginToken", parsedResponse); | ||
}); | ||
}; | ||
C8oRouter.prototype.openOAuthLogin = function (url) { | ||
var myC8o = this.c8o; | ||
return new Promise(function (resolve, reject) { | ||
if (window["cordova"] != undefined) { | ||
var browserRef_1 = window["cordova"].InAppBrowser.open(url, "_blank", "location=no, clearsessioncache=yes, clearcache=yes"); | ||
var responseParams_1; | ||
var parsedResponse_1 = {}; | ||
browserRef_1.addEventListener("loadstart", function (evt) { | ||
myC8o.log.debug("Auth Page loaded"); | ||
if ((evt.url).indexOf("https://login.live.com/oauth20_desktop.srf") === 0) { | ||
browserRef_1.removeEventListener("exit", function (evt) { }); | ||
myC8o.log.debug("Exit Listener removed"); | ||
browserRef_1.close(); | ||
responseParams_1 = ((evt.url).split("#")[1]).split("&"); | ||
for (var i = 0; i < responseParams_1.length; i++) { | ||
parsedResponse_1[responseParams_1[i].split("=")[0]] = responseParams_1[i].split("=")[1]; | ||
} | ||
if (parsedResponse_1["access_token"] !== undefined && | ||
parsedResponse_1["access_token"] !== null) { | ||
resolve(parsedResponse_1); | ||
} | ||
else { | ||
myC8o.log.error("oAuthClient : oAuth authentication error"); | ||
reject("oAuth authentication error"); | ||
} | ||
} | ||
}); | ||
browserRef_1.addEventListener("exit", function (evt) { | ||
myC8o.log.debug("Auth Page closed"); | ||
}); | ||
} | ||
else { | ||
myC8o.log.error("oAuthClient : Cordova is missing, This can only work in a Built application running on a device"); | ||
} | ||
}); | ||
}; | ||
return C8oRouter; | ||
@@ -210,0 +253,0 @@ }()); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"C8oRouter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"c8osdkangular2","name":"C8o"},{"__symbolic":"reference","module":"ionic-angular","name":"App"},{"__symbolic":"reference","module":"ionic-angular","name":"ToastController"}]}],"log":[{"__symbolic":"method"}],"addRouteListener":[{"__symbolic":"method"}],"execute_route":[{"__symbolic":"method"}],"c8oCall":[{"__symbolic":"method"}],"storeResponseForView":[{"__symbolic":"method"}],"getResponseForView":[{"__symbolic":"method"}],"getParamForView":[{"__symbolic":"method"}],"findView":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"setRoot":[{"__symbolic":"method"}]},"statics":{"C8OCAF_SESSION_STORAGE_DATA":"_c8ocafsession_storage_data","C8OCAF_SESSION_STORAGE_MODE":"_c8ocafsession_storage_mode","C8OCAF_SESSION_STORAGE_CLEAR":"_c8ocafsession_storage_clear"}}}},{"__symbolic":"module","version":1,"metadata":{"C8oRouter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"c8osdkangular2","name":"C8o"},{"__symbolic":"reference","module":"ionic-angular","name":"App"},{"__symbolic":"reference","module":"ionic-angular","name":"ToastController"}]}],"log":[{"__symbolic":"method"}],"addRouteListener":[{"__symbolic":"method"}],"execute_route":[{"__symbolic":"method"}],"c8oCall":[{"__symbolic":"method"}],"storeResponseForView":[{"__symbolic":"method"}],"getResponseForView":[{"__symbolic":"method"}],"getParamForView":[{"__symbolic":"method"}],"findView":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"setRoot":[{"__symbolic":"method"}]},"statics":{"C8OCAF_SESSION_STORAGE_DATA":"_c8ocafsession_storage_data","C8OCAF_SESSION_STORAGE_MODE":"_c8ocafsession_storage_mode","C8OCAF_SESSION_STORAGE_CLEAR":"_c8ocafsession_storage_clear"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"C8oRouter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"c8osdkangular2","name":"C8o"},{"__symbolic":"reference","module":"ionic-angular","name":"App"},{"__symbolic":"reference","module":"ionic-angular","name":"ToastController"}]}],"log":[{"__symbolic":"method"}],"addRouteListener":[{"__symbolic":"method"}],"execute_route":[{"__symbolic":"method"}],"c8oCall":[{"__symbolic":"method"}],"storeResponseForView":[{"__symbolic":"method"}],"getResponseForView":[{"__symbolic":"method"}],"getParamForView":[{"__symbolic":"method"}],"findView":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"setRoot":[{"__symbolic":"method"}],"doOAuthLogin":[{"__symbolic":"method"}],"openOAuthLogin":[{"__symbolic":"method"}]},"statics":{"C8OCAF_SESSION_STORAGE_DATA":"_c8ocafsession_storage_data","C8OCAF_SESSION_STORAGE_MODE":"_c8ocafsession_storage_mode","C8OCAF_SESSION_STORAGE_CLEAR":"_c8ocafsession_storage_clear"}}}},{"__symbolic":"module","version":1,"metadata":{"C8oRouter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"c8osdkangular2","name":"C8o"},{"__symbolic":"reference","module":"ionic-angular","name":"App"},{"__symbolic":"reference","module":"ionic-angular","name":"ToastController"}]}],"log":[{"__symbolic":"method"}],"addRouteListener":[{"__symbolic":"method"}],"execute_route":[{"__symbolic":"method"}],"c8oCall":[{"__symbolic":"method"}],"storeResponseForView":[{"__symbolic":"method"}],"getResponseForView":[{"__symbolic":"method"}],"getParamForView":[{"__symbolic":"method"}],"findView":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"setRoot":[{"__symbolic":"method"}],"doOAuthLogin":[{"__symbolic":"method"}],"openOAuthLogin":[{"__symbolic":"method"}]},"statics":{"C8OCAF_SESSION_STORAGE_DATA":"_c8ocafsession_storage_data","C8OCAF_SESSION_STORAGE_MODE":"_c8ocafsession_storage_mode","C8OCAF_SESSION_STORAGE_CLEAR":"_c8ocafsession_storage_clear"}}}}] |
@@ -107,3 +107,3 @@ import {App } from 'ionic-angular'; | ||
let requestable : string = (parameters["__project"] == undefined ?"": parameters["__project"]) + "." + parameters["__sequence"]; | ||
let activeView : any = this.app.getActiveNav().getViews().slice(-1)[0] != undefined ? this.app.getActiveNav().getViews().slice(-1)[0].constructor.name:null; | ||
let activeView : any = this.app.getActiveNav().getViews().slice(-1)[0] != undefined ? this.app.getActiveNav().getViews().slice(-1)[0].component.name:null; | ||
let navParams : any = (parameters["_navParams"] == {}) ? "" : parameters["_navParams"] | ||
@@ -125,3 +125,3 @@ for(var item of this.routing_table){ | ||
// test to see if we are already on the target page | ||
if (this.findView(activeView, route.target.page, requestable) && !route.target.alwaysNewPage) { | ||
if (this.findView(activeView, route.target.page.name, requestable) && !route.target.alwaysNewPage) { | ||
this.log("Route for Requestable '" + item.requestable + "', the view is already displayed, using curent view"); | ||
@@ -277,6 +277,6 @@ this.storeResponseForView(activeView, requestable, response, navParams, route.didEnter, route.didLeave); | ||
if (item["view"] == view && item["requestable"] == requestable) | ||
return (item["navParams"]) | ||
return (item["navParams"]); | ||
} | ||
return(new Object()) | ||
return(new Object()); | ||
} | ||
@@ -296,11 +296,10 @@ | ||
if(targetView != undefined){ | ||
if(view instanceof (targetView)){ | ||
return (true) | ||
if(view == targetView){ | ||
return true; | ||
} | ||
return(false) | ||
return false; | ||
} | ||
else{ | ||
return false | ||
return false; | ||
} | ||
} | ||
@@ -316,3 +315,3 @@ | ||
public push(view : any, data: any, options: Object): Promise<any>{ | ||
return this.app.getActiveNav().push(view, data , options ) | ||
return this.app.getActiveNav().push(view, data , options); | ||
} | ||
@@ -330,2 +329,59 @@ | ||
public doOAuthLogin(url : String) { | ||
this.openOAuthLogin(url).then((parsedResponse)=> { | ||
this.c8o.log.debug("Parsed response is : " + JSON.stringify(parsedResponse)) | ||
this.c8o.callJsonObject(".loginToken", parsedResponse) | ||
}) | ||
} | ||
public openOAuthLogin(url : String) : Promise<any> { | ||
var myC8o = this.c8o; | ||
return new Promise(function(resolve, reject) { | ||
/* | ||
const clientId = "693828295623-he7m18picm1rl5e5q52lu55jh4e1clb5.apps.googleusercontent.com"; | ||
const url = "https://accounts.google.com/o/oauth2/auth?client_id=${clientId}" + | ||
"&redirect_uri=http://localhost/callback" + | ||
"&scope=https://www.googleapis.com/auth/youtube" + | ||
"&response_type=token"; | ||
*/ | ||
if (window["cordova"] != undefined) { | ||
const browserRef = window["cordova"].InAppBrowser.open( | ||
url, | ||
"_blank", | ||
"location=no, clearsessioncache=yes, clearcache=yes" | ||
); | ||
let responseParams : string; | ||
let parsedResponse : Object = {}; | ||
browserRef.addEventListener("loadstart", (evt) => { | ||
myC8o.log.debug("Auth Page loaded") | ||
if ((evt.url).indexOf("https://login.live.com/oauth20_desktop.srf") === 0) { | ||
browserRef.removeEventListener("exit", (evt) => {}); | ||
myC8o.log.debug("Exit Listener removed") | ||
browserRef.close(); | ||
responseParams = ((evt.url).split("#")[1]).split("&"); | ||
for (var i = 0; i < responseParams.length; i++) { | ||
parsedResponse[responseParams[i].split("=")[0]] = responseParams[i].split("=")[1]; | ||
} | ||
if (parsedResponse["access_token"] !== undefined && | ||
parsedResponse["access_token"] !== null) { | ||
resolve(parsedResponse); | ||
} else { | ||
myC8o.log.error("oAuthClient : oAuth authentication error") | ||
reject("oAuth authentication error"); | ||
} | ||
} | ||
}); | ||
browserRef.addEventListener("exit", function(evt) { | ||
myC8o.log.debug("Auth Page closed") | ||
// reject("An error has occured when connecting to oAuth service"); | ||
}); | ||
} | ||
else { | ||
myC8o.log.error("oAuthClient : Cordova is missing, This can only work in a Built application running on a device") | ||
} | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144761
28
2341