nodebb-plugin-ezoic-infinite 1.8.81 → 1.8.83

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/library.js CHANGED
@@ -155,10 +155,14 @@ const HEAD_PRECONNECTS = [
155
155
  // async on sa.min.js caused "Timed out waiting for loadingStatus LOADING"
156
156
  // because it could execute before CMP was ready.
157
157
  // analytics.js provides Ezoic analytics integration.
158
+ // __tcfapiLocator must exist before the CMP scripts initialize so that
159
+ // Ezoic's TCF cross-frame channel is ready when sa.min.js calls defineScript.
160
+ // Without it the CMP fails to register consent and defineScript throws.
158
161
  const EZOIC_SCRIPTS = [
162
+ '<script data-cfasync="false">(function(){if(document.getElementById("__tcfapiLocator"))return;var f=document.createElement("iframe");f.style.display="none";f.id=f.name="__tcfapiLocator";(document.head||document.documentElement).appendChild(f);}())</script>',
159
163
  '<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
160
164
  '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
161
- '<script src="//www.ezojs.com/ezoic/sa.min.js"></script>',
165
+ '<script data-cfasync="false" src="//www.ezojs.com/ezoic/sa.min.js"></script>',
162
166
  '<script src="//ezoicanalytics.com/analytics.js"></script>',
163
167
  ].join('\n');
164
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.81",
3
+ "version": "1.8.83",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -813,6 +813,8 @@
813
813
  'Error in custom getTCData',
814
814
  'no interstitial API',
815
815
  'JS-Enable should only',
816
+ 'defineScript failed',
817
+ 'failed defineScript',
816
818
  ].map(esc).join('|'));
817
819
  })();
818
820
 
@@ -915,14 +917,16 @@
915
917
  _retries++;
916
918
  patchShowAds();
917
919
 
918
- // Detect Ezoic failed state and reload sa.min.js once to recover
920
+ // Reload sa.min.js only if Ezoic never initialized at all (no loadingStatus).
921
+ // Do NOT reload when loadingStatus === 'complete' (post-defineScript-failure):
922
+ // that would trigger a second defineScript failed error.
919
923
  if (!_scriptReloaded && _retries <= 3) {
920
924
  const ez = window.ezstandalone;
921
- const status = ez?.loadingStatus;
922
- if (status && status !== 'LOADED' && status !== 'LOADING') {
925
+ if (!ez?.loadingStatus) {
923
926
  _scriptReloaded = true;
924
927
  try {
925
928
  const s = document.createElement('script');
929
+ s.setAttribute('data-cfasync', 'false');
926
930
  s.src = '//www.ezojs.com/ezoic/sa.min.js';
927
931
  document.head.appendChild(s);
928
932
  } catch (_) {}