@adland/embed 0.1.1 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @adland/embed
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - b322df0: Point unsold-slot links at the 0xSlots app's new home.
8
+
9
+ The app moved off `app.0xslots.org` onto a path on the apex domain, so the
10
+ default base link is now `https://0xslots.org/app` and an empty slot opens
11
+ `https://0xslots.org/app/slots/<address>?chain=<id>`.
12
+
13
+ This only changes the default. Anything already passing `baseLinkUrl` (the prop,
14
+ the provider, or the `base-link-url` attribute on `<adland-slot>`) is untouched —
15
+ but a publisher who pinned it to the old subdomain should update, since those
16
+ links break when that host stops resolving.
17
+
18
+ `@adland/react` also exports `DEFAULT_BASE_LINK_URL`, so the value can be
19
+ referenced rather than copied.
20
+
21
+ - Updated dependencies [b322df0]
22
+ - @adland/react@0.18.2
23
+
3
24
  ## 0.1.1
4
25
 
5
26
  ### Patch Changes
@@ -135,7 +135,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
135
135
  color: var(--adland-label, #9ca3af);
136
136
  }
137
137
  .adland-empty { justify-content: center; color: var(--adland-muted, #6b7280); }
138
- `;function sO(e){let t=X$(e),r=J2(e),o=Q$(e),n=eO(e),i=n?PZ[n]??n:"";return `<div part="card" class="adland-card">${t?`<img part="media" class="adland-media" src="${eE(t)}" alt="" loading="lazy" />`:""}<div part="body" class="adland-body">${r?`<p part="title" class="adland-title">${Q2(r)}</p>`:""}${o?`<p part="description" class="adland-description">${Q2(o)}</p>`:""}</div>${i?`<span part="badge" class="adland-badge">${Q2(i)}</span>`:""}<span part="label" class="adland-label">Ad</span></div>`}function aO(){return '<div part="card" class="adland-card adland-empty"><span part="description" class="adland-description">Your ad here</span><span part="label" class="adland-label">Ad</span></div>'}function cO(e){if(e.type==="link"||e.type==="miniapp"){let t=e.data.url;return typeof t=="string"?t:null}return null}var BZ=["--adland-bg","--adland-fg","--adland-muted","--adland-label","--adland-border","--adland-border-hover","--adland-border-width","--adland-radius","--adland-padding","--adland-gap","--adland-font","--adland-shadow-hover","--adland-media-size","--adland-media-radius","--adland-media-bg","--adland-title-size","--adland-title-weight","--adland-description-size","--adland-badge-radius","--adland-accent-bg","--adland-accent-fg"];function uO(e){let t=getComputedStyle(e),r="";for(let o of BZ){let n=t.getPropertyValue(o).trim();n&&(r+=`${o}:${n};`);}return r}var fO=8453,CZ="https://app.0xslots.org",zZ="68px";function lO(e){return class extends HTMLElement{static observedAttributes=["slot","chain","placement","render-mode","gateway","endpoint","rpc-url","consent","verified","base-link-url","data-ad"];shadowInited=false;cleanupImpression;messageHandler;renderToken=0;connectedCallback(){this.render();}disconnectedCallback(){this.teardown();}attributeChangedCallback(){this.isConnected&&this.render();}attr(r){return this.getAttribute(r)??void 0}chainId(){return Number(this.attr("chain")??fO)||fO}teardown(){this.cleanupImpression?.(),this.cleanupImpression=void 0,this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=void 0);}async loadAd(){let r=this.attr("data-ad");if(r)try{return {data:JSON.parse(r),cid:null}}catch{return {data:null,cid:null}}let o=this.attr("slot");if(!o)return {data:null,cid:null};let n=K$(this.chainId(),this.attr("rpc-url")),i=await Y$(n,o);return i?J$(i,this.attr("gateway")):{data:null,cid:null}}async render(){let r=++this.renderToken;this.teardown(),this.style.minHeight||(this.style.minHeight=zZ);let o;try{o=await this.loadAd();}catch{o={data:null,cid:null};}if(r!==this.renderToken||!this.isConnected)return;let n=o.data?sO(o.data):aO();(this.attr("render-mode")==="inline"?"inline":"isolated")==="inline"?this.renderInline(n,o.data):this.renderIsolated(n,o.data);let s=this.attr("slot");if(s){let a=this.attr("verified")!=null?iO:oO;this.cleanupImpression=a(this,{slot:s,chainId:this.chainId(),placement:this.attr("placement"),cid:o.cid,empty:!o.data,endpoint:this.attr("endpoint"),consent:this.attr("consent")});}}renderInline(r,o){let n=this.shadowRoot??(this.shadowInited?null:this.attachShadow({mode:"open"}));if(!n)return;this.shadowInited=true,n.innerHTML=`<style>${tE}</style>${r}`,n.querySelector(".adland-card")?.addEventListener("click",()=>this.handleClick(o,false));}renderIsolated(r,o){this.replaceChildren();let n=o?cO(o):this.emptyUrl(),i=n?`<a href="${eE(n)}" target="_blank" rel="noopener noreferrer" style="display:block;text-decoration:none;color:inherit">${r}</a>`:r,s=uO(this),a=document.createElement("iframe");a.setAttribute("sandbox","allow-popups allow-popups-to-escape-sandbox allow-scripts"),a.setAttribute("title","Advertisement"),a.setAttribute("scrolling","no"),a.style.cssText="width:100%;border:0;display:block;height:100%",a.srcdoc=`<!doctype html><html><head><meta charset="utf-8"><style>:root{${s}}html,body{margin:0;padding:0}${tE}</style></head><body>${i}<script>(function(){function send(t,x){parent.postMessage(Object.assign({__adland:t},x||{}),'*')}addEventListener('click',function(){send('click')});function size(){send('size',{height:document.documentElement.scrollHeight})}new ResizeObserver(size).observe(document.documentElement);size()})()<\/script></body></html>`;let c=u=>{if(u.source!==a.contentWindow)return;let l=u.data;l?.__adland==="size"&&typeof l.height=="number"?(a.style.height=`${l.height}px`,this.style.minHeight=""):l?.__adland==="click"&&this.handleClick(o,true);};this.messageHandler=c,window.addEventListener("message",c),this.appendChild(a);}baseLink(){return this.attr("base-link-url")??CZ}emptyUrl(){let r=this.attr("slot");return r?`${this.baseLink()}/slots/${r}?chain=${this.chainId()}`:null}handleClick(r,o){let n=this.attr("slot"),i={chainId:this.chainId(),placement:this.attr("placement"),endpoint:this.attr("endpoint"),consent:this.attr("consent")};r?(n&&X2("click",{slot:n,cid:null,...i}),o||e.performAdAction(r)):n&&(X2("click-empty",{slot:n,...i}),o||e.performEmptyAdAction(n,this.chainId(),this.baseLink()));}}}function dO(e,t="adland-slot"){typeof customElements>"u"||customElements.get(t)||customElements.define(t,lO(e));}dO(P4);
138
+ `;function sO(e){let t=X$(e),r=J2(e),o=Q$(e),n=eO(e),i=n?PZ[n]??n:"";return `<div part="card" class="adland-card">${t?`<img part="media" class="adland-media" src="${eE(t)}" alt="" loading="lazy" />`:""}<div part="body" class="adland-body">${r?`<p part="title" class="adland-title">${Q2(r)}</p>`:""}${o?`<p part="description" class="adland-description">${Q2(o)}</p>`:""}</div>${i?`<span part="badge" class="adland-badge">${Q2(i)}</span>`:""}<span part="label" class="adland-label">Ad</span></div>`}function aO(){return '<div part="card" class="adland-card adland-empty"><span part="description" class="adland-description">Your ad here</span><span part="label" class="adland-label">Ad</span></div>'}function cO(e){if(e.type==="link"||e.type==="miniapp"){let t=e.data.url;return typeof t=="string"?t:null}return null}var BZ=["--adland-bg","--adland-fg","--adland-muted","--adland-label","--adland-border","--adland-border-hover","--adland-border-width","--adland-radius","--adland-padding","--adland-gap","--adland-font","--adland-shadow-hover","--adland-media-size","--adland-media-radius","--adland-media-bg","--adland-title-size","--adland-title-weight","--adland-description-size","--adland-badge-radius","--adland-accent-bg","--adland-accent-fg"];function uO(e){let t=getComputedStyle(e),r="";for(let o of BZ){let n=t.getPropertyValue(o).trim();n&&(r+=`${o}:${n};`);}return r}var fO=8453,CZ="https://0xslots.org/app",zZ="68px";function lO(e){return class extends HTMLElement{static observedAttributes=["slot","chain","placement","render-mode","gateway","endpoint","rpc-url","consent","verified","base-link-url","data-ad"];shadowInited=false;cleanupImpression;messageHandler;renderToken=0;connectedCallback(){this.render();}disconnectedCallback(){this.teardown();}attributeChangedCallback(){this.isConnected&&this.render();}attr(r){return this.getAttribute(r)??void 0}chainId(){return Number(this.attr("chain")??fO)||fO}teardown(){this.cleanupImpression?.(),this.cleanupImpression=void 0,this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=void 0);}async loadAd(){let r=this.attr("data-ad");if(r)try{return {data:JSON.parse(r),cid:null}}catch{return {data:null,cid:null}}let o=this.attr("slot");if(!o)return {data:null,cid:null};let n=K$(this.chainId(),this.attr("rpc-url")),i=await Y$(n,o);return i?J$(i,this.attr("gateway")):{data:null,cid:null}}async render(){let r=++this.renderToken;this.teardown(),this.style.minHeight||(this.style.minHeight=zZ);let o;try{o=await this.loadAd();}catch{o={data:null,cid:null};}if(r!==this.renderToken||!this.isConnected)return;let n=o.data?sO(o.data):aO();(this.attr("render-mode")==="inline"?"inline":"isolated")==="inline"?this.renderInline(n,o.data):this.renderIsolated(n,o.data);let s=this.attr("slot");if(s){let a=this.attr("verified")!=null?iO:oO;this.cleanupImpression=a(this,{slot:s,chainId:this.chainId(),placement:this.attr("placement"),cid:o.cid,empty:!o.data,endpoint:this.attr("endpoint"),consent:this.attr("consent")});}}renderInline(r,o){let n=this.shadowRoot??(this.shadowInited?null:this.attachShadow({mode:"open"}));if(!n)return;this.shadowInited=true,n.innerHTML=`<style>${tE}</style>${r}`,n.querySelector(".adland-card")?.addEventListener("click",()=>this.handleClick(o,false));}renderIsolated(r,o){this.replaceChildren();let n=o?cO(o):this.emptyUrl(),i=n?`<a href="${eE(n)}" target="_blank" rel="noopener noreferrer" style="display:block;text-decoration:none;color:inherit">${r}</a>`:r,s=uO(this),a=document.createElement("iframe");a.setAttribute("sandbox","allow-popups allow-popups-to-escape-sandbox allow-scripts"),a.setAttribute("title","Advertisement"),a.setAttribute("scrolling","no"),a.style.cssText="width:100%;border:0;display:block;height:100%",a.srcdoc=`<!doctype html><html><head><meta charset="utf-8"><style>:root{${s}}html,body{margin:0;padding:0}${tE}</style></head><body>${i}<script>(function(){function send(t,x){parent.postMessage(Object.assign({__adland:t},x||{}),'*')}addEventListener('click',function(){send('click')});function size(){send('size',{height:document.documentElement.scrollHeight})}new ResizeObserver(size).observe(document.documentElement);size()})()<\/script></body></html>`;let c=u=>{if(u.source!==a.contentWindow)return;let l=u.data;l?.__adland==="size"&&typeof l.height=="number"?(a.style.height=`${l.height}px`,this.style.minHeight=""):l?.__adland==="click"&&this.handleClick(o,true);};this.messageHandler=c,window.addEventListener("message",c),this.appendChild(a);}baseLink(){return this.attr("base-link-url")??CZ}emptyUrl(){let r=this.attr("slot");return r?`${this.baseLink()}/slots/${r}?chain=${this.chainId()}`:null}handleClick(r,o){let n=this.attr("slot"),i={chainId:this.chainId(),placement:this.attr("placement"),endpoint:this.attr("endpoint"),consent:this.attr("consent")};r?(n&&X2("click",{slot:n,cid:null,...i}),o||e.performAdAction(r)):n&&(X2("click-empty",{slot:n,...i}),o||e.performEmptyAdAction(n,this.chainId(),this.baseLink()));}}}function dO(e,t="adland-slot"){typeof customElements>"u"||customElements.get(t)||customElements.define(t,lO(e));}dO(P4);
139
139
  /*! Bundled license information:
140
140
 
141
141
  ieee754/index.js: