web-manager 3.2.25 → 3.2.27
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/account.js +17 -8
- package/package.json +1 -1
package/lib/account.js
CHANGED
@@ -106,6 +106,8 @@ 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
|
+
|
109
111
|
// If there is no user logged in or we choose not to fetch the account, resolve a default account
|
110
112
|
if (!currentUser || !currentUser.uid || !options.fetchNewAccount) {
|
111
113
|
return resolve(
|
@@ -147,17 +149,22 @@ Account.prototype.handleAccount = function (account) {
|
|
147
149
|
}
|
148
150
|
|
149
151
|
function handlePlanVisibility(planId) {
|
150
|
-
var elements = document.querySelectorAll('[data-plan-id]');
|
152
|
+
var elements = document.querySelectorAll('[data-plan-id][data-plan-visibility]');
|
153
|
+
|
154
|
+
// Log
|
155
|
+
console.log('account.handlePlanVisibility(): planId', planId);
|
156
|
+
console.log('account.handlePlanVisibility(): elements', elements);
|
151
157
|
|
152
158
|
// Initially hide all elements
|
153
|
-
elements.forEach(function(
|
154
|
-
|
159
|
+
elements.forEach(function($el) {
|
160
|
+
$el.setAttribute('hidden', true);
|
161
|
+
console.log('account.handlePlanVisibility(): hiding', $el);
|
155
162
|
});
|
156
163
|
|
157
164
|
// Toggle visibility based on plan
|
158
|
-
elements.forEach(function(
|
159
|
-
var requiredPlans =
|
160
|
-
var visibility =
|
165
|
+
elements.forEach(function($el) {
|
166
|
+
var requiredPlans = $el.getAttribute('data-plan-id').split(',');
|
167
|
+
var visibility = $el.getAttribute('data-plan-visibility') || 'visible';
|
161
168
|
|
162
169
|
var shouldBeVisible = false;
|
163
170
|
|
@@ -172,10 +179,12 @@ function handlePlanVisibility(planId) {
|
|
172
179
|
? visibility === 'hidden'
|
173
180
|
: visibility === 'visible';
|
174
181
|
|
182
|
+
console.log('account.handlePlanVisibility(): setting', shouldHide, $el);
|
183
|
+
|
175
184
|
if (shouldHide) {
|
176
|
-
|
185
|
+
$el.setAttribute('hidden', true);
|
177
186
|
} else {
|
178
|
-
|
187
|
+
$el.removeAttribute('hidden');
|
179
188
|
}
|
180
189
|
});
|
181
190
|
}
|
package/package.json
CHANGED