web-manager 2.1.28 → 2.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +24 -20
  2. package/lib/account.js +12 -7
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1220,6 +1220,7 @@ function Manager() {
1220
1220
  if (setting.enabled === true) {
1221
1221
  function _post() {
1222
1222
  // This.log('Loaded Firebase.');
1223
+ // console.log('_post.');
1223
1224
  window.app = firebase.initializeApp(setting.config);
1224
1225
 
1225
1226
  Promise.all([
@@ -1231,8 +1232,9 @@ function Manager() {
1231
1232
  .catch(reject);
1232
1233
  }
1233
1234
  if (setting.load) {
1234
- setting.load()
1235
- _post()
1235
+ setting.load(This)
1236
+ .then(_post)
1237
+ .catch(reject);
1236
1238
  } else {
1237
1239
  import('firebase/app')
1238
1240
  .then(function(mod) {
@@ -1241,9 +1243,8 @@ function Manager() {
1241
1243
  })
1242
1244
  .catch(reject);
1243
1245
  }
1244
- return resolve()
1245
1246
  } else {
1246
- return resolve();
1247
+ resolve();
1247
1248
  }
1248
1249
  });
1249
1250
  }
@@ -1257,15 +1258,16 @@ function Manager() {
1257
1258
  var setting = options.libraries.firebase_auth;
1258
1259
  if (setting.enabled === true) {
1259
1260
  if (setting.load) {
1260
- setting.load()
1261
- resolve()
1261
+ setting.load(This)
1262
+ .then(resolve)
1263
+ .catch(reject);
1262
1264
  } else {
1263
1265
  import('firebase/auth')
1264
1266
  .then(resolve)
1265
1267
  .catch(reject);
1266
1268
  }
1267
1269
  } else {
1268
- return resolve();
1270
+ resolve();
1269
1271
  }
1270
1272
 
1271
1273
  });
@@ -1280,15 +1282,16 @@ function Manager() {
1280
1282
  var setting = options.libraries.firebase_firestore;
1281
1283
  if (setting.enabled === true) {
1282
1284
  if (setting.load) {
1283
- setting.load()
1284
- resolve()
1285
+ setting.load(This)
1286
+ .then(resolve)
1287
+ .catch(reject);
1285
1288
  } else {
1286
1289
  import('firebase/firestore')
1287
1290
  .then(resolve)
1288
1291
  .catch(reject);
1289
1292
  }
1290
1293
  } else {
1291
- return resolve();
1294
+ resolve();
1292
1295
  }
1293
1296
  });
1294
1297
  }
@@ -1301,15 +1304,16 @@ function Manager() {
1301
1304
  var setting = options.libraries.firebase_messaging;
1302
1305
  if (setting.enabled === true) {
1303
1306
  if (setting.load) {
1304
- setting.load()
1305
- resolve()
1307
+ setting.load(This)
1308
+ .then(resolve)
1309
+ .catch(reject);
1306
1310
  } else {
1307
1311
  import('firebase/messaging')
1308
1312
  .then(resolve)
1309
1313
  .catch(reject);
1310
1314
  }
1311
1315
  } else {
1312
- return resolve();
1316
+ resolve();
1313
1317
  }
1314
1318
  });
1315
1319
  }
@@ -1336,7 +1340,7 @@ function Manager() {
1336
1340
  })
1337
1341
  .catch(reject);
1338
1342
  } else {
1339
- return resolve();
1343
+ resolve();
1340
1344
  }
1341
1345
  });
1342
1346
  }
@@ -1351,11 +1355,11 @@ function Manager() {
1351
1355
  .then(function(mod) {
1352
1356
  window.cookieconsent.initialise(options.libraries.cookieconsent.config);
1353
1357
  // This.log('Loaded Cookieconsent.');
1354
- return resolve();
1358
+ resolve();
1355
1359
  })
1356
1360
  .catch(reject);
1357
1361
  } else {
1358
- return resolve();
1362
+ resolve();
1359
1363
  }
1360
1364
 
1361
1365
  });
@@ -1379,11 +1383,11 @@ function Manager() {
1379
1383
  return reject(e);
1380
1384
  }
1381
1385
  // This.log('Loaded tawk.');
1382
- return resolve();
1386
+ resolve();
1383
1387
  })
1384
1388
 
1385
1389
  } else {
1386
- return resolve();
1390
+ resolve();
1387
1391
  }
1388
1392
  });
1389
1393
  }
@@ -1402,11 +1406,11 @@ function Manager() {
1402
1406
  config.environment = This.properties.meta.environment;
1403
1407
  Sentry.init(config);
1404
1408
  // This.log('Loaded Sentry.');
1405
- return resolve();
1409
+ resolve();
1406
1410
  })
1407
1411
  .catch(reject);
1408
1412
  } else {
1409
- return resolve();
1413
+ resolve();
1410
1414
  }
1411
1415
  });
1412
1416
  }
package/lib/account.js CHANGED
@@ -3,17 +3,21 @@
3
3
  var dom;
4
4
  var utilities;
5
5
 
6
- function Account() {
6
+ function Account(init) {
7
7
  var self = this;
8
+ init = init || {};
8
9
  self.properties = {};
9
-
10
- dom = self.Manager.dom();
11
- utilities = self.Manager.utilities();
12
-
13
10
  self.accountPageInitialized = false;
14
11
 
15
- if (new URL(window.location.href).pathname.includes('account')) {
16
- self.initializeAccountPage();
12
+ try {
13
+ dom = init.dom || self.Manager.dom();
14
+ utilities = init.utilities || self.Manager.utilities();
15
+
16
+ if (new URL(window.location.href).pathname.includes('account')) {
17
+ self.initializeAccountPage();
18
+ }
19
+ } catch (e) {
20
+ console.error('Failed to initialize libraries');
17
21
  }
18
22
 
19
23
  // var pastDate = new Date(0);
@@ -192,6 +196,7 @@ function getMonth(date) {
192
196
 
193
197
  Account.prototype._resolveAccount = function (currentUser, account, options) {
194
198
  var self = this;
199
+ currentUser = currentUser || {};
195
200
  account = account || {};
196
201
  options = options || {};
197
202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "2.1.28",
3
+ "version": "2.1.32",
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": {