ultimate-jekyll-manager 0.0.242 → 0.0.244

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.
@@ -117,9 +117,34 @@ const setupMessageHandler = () => {
117
117
  // Update iframe dimensions dynamically
118
118
  const $iframe = document.getElementById(payload.id);
119
119
  if ($iframe) {
120
+ // If promo-server reports 0 dimensions, it means the iframe hasn't been laid out yet
121
+ // (e.g., ad blocker cosmetic filters or element not in layout flow on initial load).
122
+ // Skip setting height to 0 and request a re-measurement after a delay.
123
+ if (!payload.height || !payload.width) {
124
+ // Track re-measure attempts per iframe
125
+ const reMeasureCount = ($iframe.__reMeasureCount || 0) + 1;
126
+ $iframe.__reMeasureCount = reMeasureCount;
127
+
128
+ // Give up after 5 attempts (total ~8s of retrying including promo-server's own retries)
129
+ if (reMeasureCount > 5) {
130
+ console.warn('[Vert] Giving up on re-measure after', reMeasureCount, 'attempts');
131
+ return;
132
+ }
133
+
134
+ console.warn('[Vert] Received 0 dimensions, requesting re-measure (attempt', reMeasureCount + '):', payload);
135
+ setTimeout(() => {
136
+ // Measure vert-unit width from parent and send it to iframe so it can
137
+ // use it as a fallback if its own self-measurement returns 0.
138
+ const $vertUnit = $iframe.closest('vert-unit');
139
+ const currentParentWidth = $vertUnit ? $vertUnit.offsetWidth : 0;
140
+ $iframe.contentWindow?.postMessage({
141
+ command: 'uj-vert-unit:re-measure',
142
+ payload: { parentWidth: currentParentWidth },
143
+ }, '*');
144
+ }, 500 * reMeasureCount);
145
+ return;
146
+ }
120
147
  $iframe.style.height = payload.height + 'px';
121
- // DISABLED: See revealVertUnit note above
122
- // revealVertUnit($iframe.closest('vert-unit'));
123
148
  }
124
149
  } else if (command === 'uj-vert-unit:click') {
125
150
  // Navigate to the URL when ad is clicked
@@ -191,10 +216,18 @@ const createCustomAd = ($vertUnit, config) => {
191
216
  ? `${window.location.protocol}//${window.location.host}/verts/main`
192
217
  : 'https://promo-server.itwcreativeworks.com/verts/main';
193
218
 
219
+ // Measure the vert-unit's width from the parent page so the iframe knows its
220
+ // available width even if Rocket Loader or other deferrals prevent the iframe
221
+ // from self-measuring on initial load.
222
+ const parentWidth = $vertUnit.offsetWidth;
223
+
194
224
  // Build full URL with parameters
195
225
  const adURL = new URL(baseURL);
196
226
  adURL.searchParams.set('parentURL', window.location.href);
197
227
  adURL.searchParams.set('frameId', iframeId);
228
+ if (parentWidth) {
229
+ adURL.searchParams.set('parentWidth', parentWidth);
230
+ }
198
231
  if (config.size) {
199
232
  adURL.searchParams.set('size', config.size);
200
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.242",
3
+ "version": "0.0.244",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -1,16 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Read(//Users/ian/Library/Application Support/Code/User/**)",
5
- "Read(//Users/ian/Developer/Repositories/ITW-Creative-works/ultimate-jekyll-manager/src/gulp/tasks/**)",
6
- "Read(//Users/ian/Developer/Repositories/ITW-Creative-works/ultimate-jekyll-manager/src/**)",
7
- "Read(//Users/ian/Developer/Repositories/Trusteroo/trusteroo-website/**)",
8
- "Bash(cat:*)",
9
- "Read(//Users/ian/Developer/Repositories/ITW-Creative-Works/ultimate-jekyll-legacy/special/master/pages/admin/notifications/**)",
10
- "mcp__mcp-router__chrome-devtools__navigate_page",
11
- "mcp__mcp-router__chrome-devtools__resize_page"
12
- ],
13
- "deny": [],
14
- "ask": []
15
- }
16
- }