web-manager 3.2.24 → 3.2.26
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +7 -1
- package/lib/account.js +15 -8
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1015,7 +1015,13 @@ function Manager() {
|
|
1015
1015
|
HELPERS
|
1016
1016
|
*/
|
1017
1017
|
function subscriptionManager(self, options_user) {
|
1018
|
-
if (
|
1018
|
+
if (
|
1019
|
+
!('serviceWorker' in navigator)
|
1020
|
+
|| (typeof firebase === 'undefined')
|
1021
|
+
|| (typeof firebase.messaging === 'undefined')
|
1022
|
+
) {
|
1023
|
+
return
|
1024
|
+
}
|
1019
1025
|
|
1020
1026
|
// service worker guide: https://developers.google.com/web/updates/2018/06/fresher-sw
|
1021
1027
|
navigator.serviceWorker.register(
|
package/lib/account.js
CHANGED
@@ -147,17 +147,22 @@ Account.prototype.handleAccount = function (account) {
|
|
147
147
|
}
|
148
148
|
|
149
149
|
function handlePlanVisibility(planId) {
|
150
|
-
var elements = document.querySelectorAll('[data-plan-id]');
|
150
|
+
var elements = document.querySelectorAll('[data-plan-id][data-plan-visibility]');
|
151
|
+
|
152
|
+
// Log
|
153
|
+
console.log('handlePlanVisibility(): planId', planId);
|
154
|
+
console.log('handlePlanVisibility(): elements', elements);
|
151
155
|
|
152
156
|
// Initially hide all elements
|
153
|
-
elements.forEach(function(
|
154
|
-
|
157
|
+
elements.forEach(function($el) {
|
158
|
+
$el.setAttribute('hidden', true);
|
159
|
+
console.log('handlePlanVisibility(): hiding', $el);
|
155
160
|
});
|
156
161
|
|
157
162
|
// Toggle visibility based on plan
|
158
|
-
elements.forEach(function(
|
159
|
-
var requiredPlans =
|
160
|
-
var visibility =
|
163
|
+
elements.forEach(function($el) {
|
164
|
+
var requiredPlans = $el.getAttribute('data-plan-id').split(',');
|
165
|
+
var visibility = $el.getAttribute('data-plan-visibility') || 'visible';
|
161
166
|
|
162
167
|
var shouldBeVisible = false;
|
163
168
|
|
@@ -172,10 +177,12 @@ function handlePlanVisibility(planId) {
|
|
172
177
|
? visibility === 'hidden'
|
173
178
|
: visibility === 'visible';
|
174
179
|
|
180
|
+
console.log('handlePlanVisibility(): setting', shouldHide, $el);
|
181
|
+
|
175
182
|
if (shouldHide) {
|
176
|
-
|
183
|
+
$el.setAttribute('hidden', true);
|
177
184
|
} else {
|
178
|
-
|
185
|
+
$el.removeAttribute('hidden');
|
179
186
|
}
|
180
187
|
});
|
181
188
|
}
|
package/package.json
CHANGED