@astronox/core 0.5.2 → 0.5.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astronox/core",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Reusable Astro components, patterns, styles, and infrastructure for AstroNox sites.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -54,18 +54,17 @@ const adBlockingStorageKey = adBlockingRecovery?.storageKey ?? '';
54
54
  storageAvailable = false;
55
55
  }
56
56
 
57
- let cooldownActive =
57
+ const cooldownActive =
58
58
  storedTimestamp !== undefined &&
59
59
  now - storedTimestamp < adBlockingRedisplayIntervalMs;
60
+ let cooldownPersisted = false;
60
61
 
61
- const startCooldown = () => {
62
- if (cooldownActive) return;
63
-
64
- cooldownActive = true;
65
- if (!storageAvailable) return;
62
+ const persistCooldown = () => {
63
+ if (cooldownActive || cooldownPersisted || !storageAvailable) return;
66
64
 
67
65
  try {
68
66
  window.localStorage.setItem(adBlockingStorageKey, String(Date.now()));
67
+ cooldownPersisted = true;
69
68
  } catch {
70
69
  storageAvailable = false;
71
70
  }
@@ -76,7 +75,11 @@ const adBlockingStorageKey = adBlockingRecovery?.storageKey ?? '';
76
75
 
77
76
  if (cooldownActive) {
78
77
  const adBlockingType = googlefc.MessageTypeEnum?.AD_BLOCKING;
79
- if (typeof adBlockingType === 'number') {
78
+ if (
79
+ (typeof adBlockingType === 'string' && adBlockingType.length > 0) ||
80
+ (typeof adBlockingType === 'number' &&
81
+ Number.isFinite(adBlockingType))
82
+ ) {
80
83
  message.proceed(false, [adBlockingType]);
81
84
  return;
82
85
  }
@@ -85,7 +88,7 @@ const adBlockingStorageKey = adBlockingRecovery?.storageKey ?? '';
85
88
  return;
86
89
  }
87
90
 
88
- startCooldown();
91
+ persistCooldown();
89
92
  message.proceed(true);
90
93
  };
91
94
  }