web-manager 3.2.27 → 3.2.29
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +54 -57
- package/lib/account.js +0 -9
- package/package.json +2 -2
package/index.js
CHANGED
@@ -190,73 +190,70 @@ function Manager() {
|
|
190
190
|
});
|
191
191
|
setInterval(function () {
|
192
192
|
refreshNewVersion(self);
|
193
|
-
}, 1000 * 60 * 60
|
193
|
+
}, 1000 * 60 * 60); // Fetch new version every 1 hour
|
194
194
|
|
195
195
|
}
|
196
196
|
|
197
197
|
function _authStateHandler(self, user) {
|
198
198
|
// self.log('----authStateHandler', user);
|
199
|
-
if (user) {
|
200
|
-
|
201
|
-
_authHandle_in(self, user);
|
202
|
-
|
203
|
-
self.notifications().subscribe().catch(function (e) {
|
204
|
-
console.error(e);
|
205
|
-
});
|
206
|
-
} else {
|
207
|
-
_authHandle_out(self);
|
208
|
-
}
|
209
|
-
} else {
|
210
|
-
_authHandle_out(self);
|
199
|
+
if (!user || user.isAnonymous) {
|
200
|
+
return _authHandle_out(self);
|
211
201
|
}
|
212
|
-
}
|
213
202
|
|
214
|
-
|
215
|
-
// self.log('_authHandle_in', user);
|
216
|
-
// if (self.properties.page.status.didSignUp) {
|
217
|
-
var done;
|
218
|
-
var hoursSinceCreation = Math.abs(new Date() - new Date(+user.metadata.createdAt)) / 36e5;
|
219
|
-
|
220
|
-
function _done() {
|
221
|
-
if (!done) {
|
222
|
-
done = true;
|
223
|
-
store.set('didSignUp', true)
|
224
|
-
_authHandle_in_normal(self, user);
|
225
|
-
}
|
226
|
-
}
|
203
|
+
_authHandle_in_normal(self, user);
|
227
204
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
fetch('https://us-central1-' + self.properties.options.libraries.firebase_app.config.projectId + '.cloudfunctions.net/bm_api', {
|
233
|
-
method: 'POST',
|
234
|
-
body: JSON.stringify({
|
235
|
-
authenticationToken: token,
|
236
|
-
command: 'user:sign-up',
|
237
|
-
payload: {
|
238
|
-
newsletterSignUp: select('.auth-newsletter-input').getValue(),
|
239
|
-
// affiliateCode: store.get('auth.affiliateCode', ''),
|
240
|
-
affiliateCode: store.get('affiliateCode', ''),
|
241
|
-
},
|
242
|
-
}),
|
243
|
-
})
|
244
|
-
.catch(function () {})
|
245
|
-
.finally(_done);
|
205
|
+
self.notifications().subscribe().catch(function (e) {
|
206
|
+
console.error(e);
|
207
|
+
});
|
208
|
+
}
|
246
209
|
|
247
|
-
|
248
|
-
|
249
|
-
|
210
|
+
// MOVED TO UJ - 12/15/23
|
211
|
+
// function _authHandle_in(self, user) {
|
212
|
+
// // self.log('_authHandle_in', user);
|
213
|
+
// // if (self.properties.page.status.didSignUp) {
|
214
|
+
// var done;
|
215
|
+
// var hoursSinceCreation = Math.abs(new Date() - new Date(+user.metadata.createdAt)) / 36e5;
|
216
|
+
|
217
|
+
// function _done() {
|
218
|
+
// if (!done) {
|
219
|
+
// done = true;
|
220
|
+
// store.set('didSignUp', true)
|
221
|
+
// _authHandle_in_normal(self, user);
|
222
|
+
// }
|
223
|
+
// }
|
250
224
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
225
|
+
// if (!store.get('didSignUp') && hoursSinceCreation < 0.5) {
|
226
|
+
// user.getIdToken(false)
|
227
|
+
// .then(function(token) {
|
228
|
+
|
229
|
+
// fetch('https://us-central1-' + self.properties.options.libraries.firebase_app.config.projectId + '.cloudfunctions.net/bm_api', {
|
230
|
+
// method: 'POST',
|
231
|
+
// body: JSON.stringify({
|
232
|
+
// authenticationToken: token,
|
233
|
+
// command: 'user:sign-up',
|
234
|
+
// payload: {
|
235
|
+
// newsletterSignUp: select('.auth-newsletter-input').getValue(),
|
236
|
+
// // affiliateCode: store.get('auth.affiliateCode', ''),
|
237
|
+
// affiliateCode: store.get('affiliateCode', ''),
|
238
|
+
// },
|
239
|
+
// }),
|
240
|
+
// })
|
241
|
+
// .catch(function () {})
|
242
|
+
// .finally(_done);
|
243
|
+
|
244
|
+
// setTimeout(function () {
|
245
|
+
// _done()
|
246
|
+
// }, 5000);
|
247
|
+
|
248
|
+
// })
|
249
|
+
// .catch(function(error) {
|
250
|
+
// console.error(error);
|
251
|
+
// _done();
|
252
|
+
// });
|
253
|
+
// } else {
|
254
|
+
// _done();
|
255
|
+
// }
|
256
|
+
// }
|
260
257
|
|
261
258
|
|
262
259
|
|
package/lib/account.js
CHANGED
@@ -106,8 +106,6 @@ Account.prototype.resolve = function (account, options) {
|
|
106
106
|
options = options || {};
|
107
107
|
options.fetchNewAccount = typeof options.fetchNewAccount === 'undefined' ? true : options.fetchNewAccount;
|
108
108
|
|
109
|
-
console.log('account.resolve():', currentUser, options);
|
110
|
-
|
111
109
|
// If there is no user logged in or we choose not to fetch the account, resolve a default account
|
112
110
|
if (!currentUser || !currentUser.uid || !options.fetchNewAccount) {
|
113
111
|
return resolve(
|
@@ -151,14 +149,9 @@ Account.prototype.handleAccount = function (account) {
|
|
151
149
|
function handlePlanVisibility(planId) {
|
152
150
|
var elements = document.querySelectorAll('[data-plan-id][data-plan-visibility]');
|
153
151
|
|
154
|
-
// Log
|
155
|
-
console.log('account.handlePlanVisibility(): planId', planId);
|
156
|
-
console.log('account.handlePlanVisibility(): elements', elements);
|
157
|
-
|
158
152
|
// Initially hide all elements
|
159
153
|
elements.forEach(function($el) {
|
160
154
|
$el.setAttribute('hidden', true);
|
161
|
-
console.log('account.handlePlanVisibility(): hiding', $el);
|
162
155
|
});
|
163
156
|
|
164
157
|
// Toggle visibility based on plan
|
@@ -179,8 +172,6 @@ function handlePlanVisibility(planId) {
|
|
179
172
|
? visibility === 'hidden'
|
180
173
|
: visibility === 'visible';
|
181
174
|
|
182
|
-
console.log('account.handlePlanVisibility(): setting', shouldHide, $el);
|
183
|
-
|
184
175
|
if (shouldHide) {
|
185
176
|
$el.setAttribute('hidden', true);
|
186
177
|
} else {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-manager",
|
3
|
-
"version": "3.2.
|
3
|
+
"version": "3.2.29",
|
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": {
|
@@ -36,4 +36,4 @@
|
|
36
36
|
"firebase": "^9.23.0",
|
37
37
|
"lazysizes": "^5.3.2"
|
38
38
|
}
|
39
|
-
}
|
39
|
+
}
|