ultimate-jekyll-manager 0.0.228 → 0.0.230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,6 +75,9 @@ export default function (Manager, options) {
75
75
  if (policy === 'authenticated') {
76
76
  redirect(unauthenticated, window.location.href);
77
77
  }
78
+
79
+ // Append authReturnUrl to all signup/signin links so users return here after auth
80
+ updateAuthLinks();
78
81
  }
79
82
  });
80
83
  } catch (e) {
@@ -108,6 +111,23 @@ function redirect(url, returnUrl) {
108
111
  window.location.href = newURL;
109
112
  }
110
113
 
114
+ // Add authReturnUrl to all signup/signin links so users return to the current page after auth
115
+ function updateAuthLinks() {
116
+ const currentUrl = window.location.href;
117
+ const authPaths = ['/signin', '/signup'];
118
+
119
+ document.querySelectorAll('a[href]').forEach(($link) => {
120
+ try {
121
+ const href = new URL($link.href, window.location.origin);
122
+
123
+ if (!authPaths.includes(href.pathname)) { return; }
124
+
125
+ href.searchParams.set('authReturnUrl', currentUrl);
126
+ $link.href = href.toString();
127
+ } catch (e) {}
128
+ });
129
+ }
130
+
111
131
  function setAnalyticsUserId(user, webManager) {
112
132
  const userId = user?.uid;
113
133
  const email = user?.email;
@@ -11,6 +11,33 @@ const searchParams = new URLSearchParams(window.location.search);
11
11
  const qsDebug = searchParams.get('debug') === 'true';
12
12
  const qsLoud = searchParams.get('loud') === 'true';
13
13
 
14
+ // Reveal a vert-unit by removing the initial hide styles
15
+ const revealVertUnit = ($vertUnit) => {
16
+ if ($vertUnit) {
17
+ $vertUnit.style.removeProperty('overflow');
18
+ $vertUnit.style.removeProperty('max-height');
19
+ }
20
+ };
21
+
22
+ // Protect height-constrained ancestors from AdSense's height: auto !important override.
23
+ // Walks up from the ad's script element and observes any ancestor with a fixed-height class.
24
+ const HEIGHT_CLASSES = ['vh-100', 'h-100', 'min-vh-100'];
25
+ const protectAncestorHeights = ($el) => {
26
+ let $current = $el?.parentElement;
27
+ while ($current && $current !== document.body) {
28
+ if (HEIGHT_CLASSES.some((cls) => $current.classList.contains(cls))) {
29
+ const $protected = $current;
30
+ console.log('[Vert] Protecting ancestor height:', $protected.className);
31
+ new MutationObserver(() => {
32
+ if ($protected.style.height) {
33
+ $protected.style.removeProperty('height');
34
+ }
35
+ }).observe($protected, { attributes: true, attributeFilter: ['style'] });
36
+ }
37
+ $current = $current.parentElement;
38
+ }
39
+ };
40
+
14
41
  // Main initialization
15
42
  webManager.dom().ready().then(() => {
16
43
  // Get the current script element to extract configuration
@@ -87,6 +114,7 @@ const setupMessageHandler = () => {
87
114
  const $iframe = document.getElementById(payload.id);
88
115
  if ($iframe) {
89
116
  $iframe.style.height = payload.height + 'px';
117
+ revealVertUnit($iframe.closest('vert-unit'));
90
118
  }
91
119
  } else if (command === 'uj-vert-unit:click') {
92
120
  // Navigate to the URL when ad is clicked
@@ -121,6 +149,7 @@ const monitorAdFillStatus = ($vertUnit, config) => {
121
149
  // Handle filled status
122
150
  if (status === 'filled') {
123
151
  console.log('[Vert] Adsense is filled, no fallback needed');
152
+ revealVertUnit($vertUnit);
124
153
  return;
125
154
  }
126
155
 
@@ -173,7 +202,7 @@ const createCustomAd = ($vertUnit, config) => {
173
202
  $iframe.style.cssText = config.style;
174
203
  $iframe.setAttribute('sandbox', 'allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation');
175
204
  $iframe.width = '100%';
176
- $iframe.height = '100%';
205
+ $iframe.height = '0';
177
206
  $iframe.setAttribute('frameborder', '0');
178
207
  $iframe.setAttribute('marginwidth', '0');
179
208
  $iframe.setAttribute('marginheight', '0');
@@ -187,6 +216,9 @@ const createCustomAd = ($vertUnit, config) => {
187
216
  $vertUnit.innerHTML = '';
188
217
  $vertUnit.appendChild($iframe);
189
218
 
219
+ // Reveal the vert unit now that custom ad is loaded
220
+ revealVertUnit($vertUnit);
221
+
190
222
  // Retrigger bindings to apply plan visibility
191
223
  webManager.auth().listen({ once: true }, async () => {
192
224
  webManager.bindings().update();
@@ -198,6 +230,9 @@ const createCustomAd = ($vertUnit, config) => {
198
230
 
199
231
  // Function to create and insert the ad unit
200
232
  const createAdUnit = (config, $currentScript) => {
233
+ // Protect height-constrained ancestors before ads modify them
234
+ protectAncestorHeights($currentScript);
235
+
201
236
  // Create ad unit elements
202
237
  const $vertUnit = document.createElement('vert-unit');
203
238
 
@@ -205,6 +240,9 @@ const createAdUnit = (config, $currentScript) => {
205
240
  $vertUnit.className = 'uj-vert-unit';
206
241
  $vertUnit.setAttribute('data-wm-bind', '@hide auth.account.subscription.product !== basic');
207
242
 
243
+ // Hide until ad is ready to prevent layout flash
244
+ $vertUnit.style.cssText = 'overflow:hidden; max-height:0;';
245
+
208
246
  // Create the ins element for AdSense
209
247
  const $ins = document.createElement('ins');
210
248
  $ins.className = 'adsbygoogle';
@@ -100,6 +100,7 @@
100
100
  {% for item in page.resolved.web_manager %}
101
101
  {{ item[0] | jsonify }}: {{ item[1] | jsonify }},
102
102
  {% endfor %}
103
+ env: {{ page.resolved.web_manager.env | jsonify }},
103
104
  };
104
105
  </script>
105
106
 
@@ -69,7 +69,13 @@ module.exports = async function serve(complete) {
69
69
  externalUrl = instance.options.get('urls').get('external');
70
70
 
71
71
  // Write the config file
72
- jetpack.write('.temp/_config_browsersync.yml', `url: ${externalUrl}`);
72
+ jetpack.write('.temp/_config_browsersync.yml', [
73
+ `url: ${externalUrl}`,
74
+ '',
75
+ 'web_manager:',
76
+ ' env:',
77
+ ` FIREBASE_EMULATOR_CONNECT: ${process.env.FIREBASE_EMULATOR_CONNECT === 'true'}`,
78
+ ].join('\n'));
73
79
  // jetpack.write('.temp/_config_browsersync.yml', `
74
80
  // url: ${externalUrl}
75
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.228",
3
+ "version": "0.0.230",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -99,7 +99,7 @@
99
99
  "sass": "^1.97.3",
100
100
  "spellchecker": "^3.7.1",
101
101
  "through2": "^4.0.2",
102
- "web-manager": "^4.1.6",
102
+ "web-manager": "^4.1.7",
103
103
  "webpack": "^5.104.1",
104
104
  "wonderful-fetch": "^1.3.4",
105
105
  "wonderful-version": "^1.3.2",