web-manager 3.0.3 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +30 -11
- package/package.json +1 -1
package/index.js
CHANGED
@@ -287,10 +287,12 @@ function Manager() {
|
|
287
287
|
}
|
288
288
|
}
|
289
289
|
|
290
|
+
|
291
|
+
|
290
292
|
function _authHandle_in_normal(This, user) {
|
291
293
|
var domLib = This.dom();
|
292
294
|
var returnUrl = This.properties.page.queryString.get('auth_redirect');
|
293
|
-
if (returnUrl) {
|
295
|
+
if (returnUrl && This.isValidRedirectUrl(returnUrl)) {
|
294
296
|
window.location.href = decodeURIComponent(returnUrl);
|
295
297
|
return;
|
296
298
|
}
|
@@ -615,17 +617,22 @@ function Manager() {
|
|
615
617
|
This.properties.global.brand.name = configuration.global.brand.name;
|
616
618
|
This.properties.meta.environment = utilities.get(configuration, 'global.settings.debug.environment', This.properties.meta.environment);
|
617
619
|
|
620
|
+
// This.properties.global.cacheBreaker = This.properties.meta.environment === 'development'
|
621
|
+
// ? new Date().getTime()
|
622
|
+
// : This.properties.global.cacheBreaker;
|
618
623
|
// This.log('Config: ', options_user);
|
619
624
|
|
620
625
|
// parse query stringify
|
621
626
|
This.properties.page.queryString = new URLSearchParams(window.location.search);
|
622
627
|
var pageQueryString = This.properties.page.queryString
|
623
628
|
var pagePathname = window.location.pathname;
|
624
|
-
|
625
|
-
|
629
|
+
var qsAff = pageQueryString.get('aff');
|
630
|
+
if (qsAff) {
|
631
|
+
This.storage().set('auth.affiliateCode', qsAff);
|
626
632
|
}
|
627
|
-
|
628
|
-
|
633
|
+
var qsRedirect = pageQueryString.get('redirect');
|
634
|
+
if (qsRedirect && This.isValidRedirectUrl(qsRedirect)) {
|
635
|
+
window.location.href = decodeURIComponent(qsRedirect);
|
629
636
|
return;
|
630
637
|
}
|
631
638
|
var authRegex = /\/(signin|signup|forgot)\//;
|
@@ -987,14 +994,19 @@ function Manager() {
|
|
987
994
|
signOut: function() {
|
988
995
|
// This.log('signOut()');
|
989
996
|
// var This = this;
|
990
|
-
firebase.auth().signOut()
|
991
|
-
.then(function() {
|
992
|
-
// This.log('signOut success.');
|
993
|
-
})
|
997
|
+
return firebase.auth().signOut()
|
994
998
|
.catch(function(e) {
|
995
999
|
console.error(e);
|
996
1000
|
// This.log('signOut failed: ', error);
|
997
1001
|
});
|
1002
|
+
// return firebase.auth().signOut()
|
1003
|
+
// .then(function() {
|
1004
|
+
// // This.log('signOut success.');
|
1005
|
+
// })
|
1006
|
+
// .catch(function(e) {
|
1007
|
+
// // console.error(e);
|
1008
|
+
// // This.log('signOut failed: ', error);
|
1009
|
+
// });
|
998
1010
|
},
|
999
1011
|
forgot: function(email) {
|
1000
1012
|
// This.log('forgot()');
|
@@ -1162,7 +1174,7 @@ function Manager() {
|
|
1162
1174
|
if (!('serviceWorker' in navigator) || !(typeof firebase.messaging !== 'undefined')) {return}
|
1163
1175
|
|
1164
1176
|
// service worker guide: https://developers.google.com/web/updates/2018/06/fresher-sw
|
1165
|
-
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, app: This.properties.global.app, env: This.properties.meta.environment, v: This.properties.global.version, firebase: options_user.libraries.firebase_app.config})) )
|
1177
|
+
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, app: This.properties.global.app, env: This.properties.meta.environment, v: This.properties.global.version, cb: This.properties.global.cacheBreaker, firebase: options_user.libraries.firebase_app.config})) )
|
1166
1178
|
.then(function (registration) {
|
1167
1179
|
// firebase.messaging().useServiceWorker(registration);
|
1168
1180
|
// console.log('----TEST registration', registration);
|
@@ -1606,7 +1618,7 @@ function Manager() {
|
|
1606
1618
|
// }
|
1607
1619
|
// }
|
1608
1620
|
// }
|
1609
|
-
Manager.prototype.performance = function() {
|
1621
|
+
Manager.prototype.performance = function () {
|
1610
1622
|
return {
|
1611
1623
|
mark: function(mark) {
|
1612
1624
|
try {
|
@@ -1617,6 +1629,13 @@ function Manager() {
|
|
1617
1629
|
}
|
1618
1630
|
}
|
1619
1631
|
|
1632
|
+
Manager.prototype.isValidRedirectUrl = function (url) {
|
1633
|
+
var returnUrlObject = new URL(decodeURIComponent(url));
|
1634
|
+
var currentUrlObject = new URL(window.location.href);
|
1635
|
+
return returnUrlObject.host === currentUrlObject.host
|
1636
|
+
|| returnUrlObject.protocol === This.properties.global.app + ':'
|
1637
|
+
}
|
1638
|
+
|
1620
1639
|
// Manager.prototype.performance = function() {
|
1621
1640
|
// var This = this;
|
1622
1641
|
//
|
package/package.json
CHANGED