web-manager 2.1.21 → 2.1.27
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +64 -21
- package/lib/dom.js +21 -16
- package/package.json +4 -4
package/index.js
CHANGED
@@ -240,6 +240,17 @@ function Manager() {
|
|
240
240
|
user.getIdToken(false)
|
241
241
|
.then(function(token) {
|
242
242
|
var done;
|
243
|
+
// fetch('https://us-central1-' + This.properties.options.libraries.firebase_app.config.projectId + '.cloudfunctions.net/bm_api', {
|
244
|
+
// method: 'POST',
|
245
|
+
// body: JSON.stringify({
|
246
|
+
// authenticationToken: token,
|
247
|
+
// command: 'signup-handler',
|
248
|
+
// payload: {
|
249
|
+
// newsletterSignUp: domLib.select('.auth-newsletter-input').getValue(),
|
250
|
+
// affiliateCode: This.storage().get('auth.affiliateCode', '')
|
251
|
+
// }
|
252
|
+
// }),
|
253
|
+
// })
|
243
254
|
fetch('https://us-central1-' + This.properties.options.libraries.firebase_app.config.projectId + '.cloudfunctions.net/bm_signUpHandler', {
|
244
255
|
method: 'POST',
|
245
256
|
body: JSON.stringify({
|
@@ -525,6 +536,7 @@ function Manager() {
|
|
525
536
|
libraries: {
|
526
537
|
firebase_app: {
|
527
538
|
enabled: true,
|
539
|
+
load: false,
|
528
540
|
config: {
|
529
541
|
apiKey: '',
|
530
542
|
authDomain: '',
|
@@ -536,13 +548,16 @@ function Manager() {
|
|
536
548
|
}
|
537
549
|
},
|
538
550
|
firebase_firestore: {
|
539
|
-
enabled: true
|
551
|
+
enabled: true,
|
552
|
+
load: false,
|
540
553
|
},
|
541
554
|
firebase_messaging: {
|
542
|
-
enabled: true
|
555
|
+
enabled: true,
|
556
|
+
load: false,
|
543
557
|
},
|
544
558
|
firebase_auth: {
|
545
559
|
enabled: true,
|
560
|
+
load: false,
|
546
561
|
},
|
547
562
|
lazysizes: {
|
548
563
|
enabled: true
|
@@ -1201,12 +1216,11 @@ function Manager() {
|
|
1201
1216
|
// if (typeof window.firebase !== 'undefined') {
|
1202
1217
|
// return resolve();
|
1203
1218
|
// }
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1219
|
+
var setting = options.libraries.firebase_app
|
1220
|
+
if (setting.enabled === true) {
|
1221
|
+
function _post() {
|
1207
1222
|
// This.log('Loaded Firebase.');
|
1208
|
-
window.
|
1209
|
-
window.app = firebase.initializeApp(options.libraries.firebase_app.config);
|
1223
|
+
window.app = firebase.initializeApp(setting.config);
|
1210
1224
|
|
1211
1225
|
Promise.all([
|
1212
1226
|
load_firebase_auth(This, options),
|
@@ -1215,8 +1229,19 @@ function Manager() {
|
|
1215
1229
|
])
|
1216
1230
|
.then(resolve)
|
1217
1231
|
.catch(reject);
|
1218
|
-
|
1219
|
-
|
1232
|
+
}
|
1233
|
+
if (setting.load) {
|
1234
|
+
setting.load()
|
1235
|
+
_post()
|
1236
|
+
} else {
|
1237
|
+
import('firebase/app')
|
1238
|
+
.then(function(mod) {
|
1239
|
+
window.firebase = mod.default;
|
1240
|
+
_post()
|
1241
|
+
})
|
1242
|
+
.catch(reject);
|
1243
|
+
}
|
1244
|
+
return resolve()
|
1220
1245
|
} else {
|
1221
1246
|
return resolve();
|
1222
1247
|
}
|
@@ -1229,10 +1254,16 @@ function Manager() {
|
|
1229
1254
|
// if (typeof utilities.get(window, 'firebase.auth', undefined) !== 'undefined') {
|
1230
1255
|
// return resolve();
|
1231
1256
|
// }
|
1232
|
-
|
1233
|
-
|
1234
|
-
.
|
1235
|
-
|
1257
|
+
var setting = options.libraries.firebase_auth;
|
1258
|
+
if (setting.enabled === true) {
|
1259
|
+
if (setting.load) {
|
1260
|
+
setting.load()
|
1261
|
+
resolve()
|
1262
|
+
} else {
|
1263
|
+
import('firebase/auth')
|
1264
|
+
.then(resolve)
|
1265
|
+
.catch(reject);
|
1266
|
+
}
|
1236
1267
|
} else {
|
1237
1268
|
return resolve();
|
1238
1269
|
}
|
@@ -1246,10 +1277,16 @@ function Manager() {
|
|
1246
1277
|
// if (typeof utilities.get(window, 'firebase.firestore', undefined) !== 'undefined') {
|
1247
1278
|
// return resolve();
|
1248
1279
|
// }
|
1249
|
-
|
1250
|
-
|
1251
|
-
.
|
1252
|
-
|
1280
|
+
var setting = options.libraries.firebase_firestore;
|
1281
|
+
if (setting.enabled === true) {
|
1282
|
+
if (setting.load) {
|
1283
|
+
setting.load()
|
1284
|
+
resolve()
|
1285
|
+
} else {
|
1286
|
+
import('firebase/firestore')
|
1287
|
+
.then(resolve)
|
1288
|
+
.catch(reject);
|
1289
|
+
}
|
1253
1290
|
} else {
|
1254
1291
|
return resolve();
|
1255
1292
|
}
|
@@ -1261,10 +1298,16 @@ function Manager() {
|
|
1261
1298
|
// if (typeof utilities.get(window, 'firebase.messaging', undefined) !== 'undefined') {
|
1262
1299
|
// return resolve();
|
1263
1300
|
// }
|
1264
|
-
|
1265
|
-
|
1266
|
-
.
|
1267
|
-
|
1301
|
+
var setting = options.libraries.firebase_messaging;
|
1302
|
+
if (setting.enabled === true) {
|
1303
|
+
if (setting.load) {
|
1304
|
+
setting.load()
|
1305
|
+
resolve()
|
1306
|
+
} else {
|
1307
|
+
import('firebase/messaging')
|
1308
|
+
.then(resolve)
|
1309
|
+
.catch(reject);
|
1310
|
+
}
|
1268
1311
|
} else {
|
1269
1312
|
return resolve();
|
1270
1313
|
}
|
package/lib/dom.js
CHANGED
@@ -250,22 +250,27 @@ Dom.prototype.exists = function() {
|
|
250
250
|
}
|
251
251
|
|
252
252
|
Dom.loadScript = function(options, callback) {
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
253
|
+
return new Promise(function(resolve, reject) {
|
254
|
+
options = options || {};
|
255
|
+
options.async = (typeof options.async === 'undefined') ? false : options.async;
|
256
|
+
options.crossorigin = (typeof options.crossorigin === 'undefined') ? false : options.crossorigin;
|
257
|
+
var s = document.createElement('script');
|
258
|
+
s.src = options.src;
|
259
|
+
s.async = options.async;
|
260
|
+
if (options.crossorigin) {
|
261
|
+
s.setAttribute('crossorigin','*');
|
262
|
+
}
|
263
|
+
s.onload = function() {
|
264
|
+
if (callback) { callback(); }
|
265
|
+
return resolve();
|
266
|
+
};
|
267
|
+
s.onerror = function() {
|
268
|
+
var error = new Error('Failed to load script ' + options.src);
|
269
|
+
if (callback) { callback(error); }
|
270
|
+
return reject(error);
|
271
|
+
};
|
272
|
+
document.head.appendChild(s);
|
273
|
+
});
|
269
274
|
}
|
270
275
|
|
271
276
|
Dom.select = function(selector, options) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.27",
|
4
4
|
"description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -23,9 +23,9 @@
|
|
23
23
|
},
|
24
24
|
"homepage": "https://itwcreativeworks.com",
|
25
25
|
"dependencies": {
|
26
|
-
"@sentry/browser": "^6.
|
26
|
+
"@sentry/browser": "^6.15.0",
|
27
27
|
"cookieconsent": "^3.1.1",
|
28
|
-
"firebase": "^8.
|
28
|
+
"firebase": "^8.10.0",
|
29
29
|
"lazysizes": "^5.3.2"
|
30
30
|
}
|
31
|
-
}
|
31
|
+
}
|