Skip to content

radominchev/poool-paywall-block

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@yourorg/poool-paywall-block

External (publishable) Arc XP block integrating the Poool Access SDK (access.min.js). Mirrors internal feature behavior with extended fields and analytics hooks.

Installation

npm install @yourorg/poool-paywall-block

Add to blocks.json:

{
  "blocks": [
    "@yourorg/poool-paywall-block"
  ]
}

Features

  • Deferred script loading (DOMContentLoaded | load | idle)
  • Config precedence: Custom Field > siteProperties.poool > environment/poool.json
  • Cookies toggle (cookiesEnabled)
  • Advanced JSON override (extraConfigJSON merged into paywall)
  • Feature flag gating (featureFlagKey via siteProperties.flags)
  • DOM CustomEvent + dataLayer emission
  • Consent gating (consentRequired + global __pooolConsentGranted)
  • Debug helpers on window.__pooolDebug

Custom Fields

Field Description
scriptOrigin Poool CDN base URL
appId Poool Access application ID
enabled Master enable/disable
cookiesEnabled Maps to cookies_enabled Access config
deferUntil Defer strategy: DOMContentLoaded
paywallTarget Paywall widget target selector
contentSelector Gated content selector
mode excerpt
percent Visible percent (excerpt mode)
pageType premium
extraConfigJSON JSON merged into paywall object
featureFlagKey Optional flag key gating enablement
emitDomEvents Dispatch poool:paywall-created
emitDataLayer Push analytics payload
dataLayerName Name of data layer array (default dataLayer)
consentRequired Require consent before load
debug Expose debug helpers

Events

If enabled:

window.addEventListener('poool:paywall-created', (e) => console.log(e.detail));
// dataLayer push example
window.dataLayer.find(v => v.event === 'poool_paywall_created');

Consent

Set window.__pooolConsentGranted = false before render to block load when consentRequired true. Flip to true and call debug helper if needed:

window.__pooolConsentGranted = true;
window.__pooolDebug.ensurePooolScript(window.__pooolDebug.config);

Debug

window.__pooolDebug.config
window.__pooolDebug.ensurePooolScript(...)
window.__pooolDebug.initializeAccess(...)

Publishing Checklist

  • Bump version in package.json
  • npm publish --access public
  • Update consuming theme blocks.json
  • Verify fields appear in PageBuilder

License

UNLICENSED (internal). Adjust if distributing publicly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors