@betarena/ad-engine 0.0.3 → 0.0.5

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.
@@ -1 +1 @@
1
- var te=Object.defineProperty;var ne=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var S=(e,t,n)=>(ne(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const f of o.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function N(){}function K(e){return e()}function B(){return Object.create(null)}function W(e){e.forEach(K)}function R(e){return typeof e=="function"}function V(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function ie(e){return Object.keys(e).length===0}const re=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function C(e,t){e.appendChild(t)}function m(e,t,n){e.insertBefore(t,n||null)}function p(e){e.parentNode&&e.parentNode.removeChild(e)}function x(e){return document.createElement(e)}function j(e){return document.createTextNode(e)}function z(){return j(" ")}function oe(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function F(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function se(e){return Array.from(e.childNodes)}function G(e,t){t=""+t,e.data!==t&&(e.data=t)}let A;function T(e){A=e}function ue(){if(!A)throw new Error("Function called outside component initialization");return A}function ce(e){ue().$$.on_mount.push(e)}const E=[],k=[];let L=[];const D=[],de=Promise.resolve();let P=!1;function fe(){P||(P=!0,de.then(J))}function U(e){L.push(e)}const I=new Set;let v=0;function J(){if(v!==0)return;const e=A;do{try{for(;v<E.length;){const t=E[v];v++,T(t),le(t.$$)}}catch(t){throw E.length=0,v=0,t}for(T(null),E.length=0,v=0;k.length;)k.pop()();for(let t=0;t<L.length;t+=1){const n=L[t];I.has(n)||(I.add(n),n())}L.length=0}while(E.length);for(;D.length;)D.pop()();P=!1,I.clear(),T(e)}function le(e){if(e.fragment!==null){e.update(),W(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(U)}}function ae(e){const t=[],n=[];L.forEach(i=>e.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),L=t}const M=new Set;let pe;function Q(e,t){e&&e.i&&(M.delete(e),e.i(t))}function he(e,t,n,i){if(e&&e.o){if(M.has(e))return;M.add(e),pe.c.push(()=>{M.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function me(e){e&&e.c()}function X(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),U(()=>{const o=e.$$.on_mount.map(K).filter(R);e.$$.on_destroy?e.$$.on_destroy.push(...o):W(o),e.$$.on_mount=[]}),r.forEach(U)}function Y(e,t){const n=e.$$;n.fragment!==null&&(ae(n.after_update),W(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function ge(e,t){e.$$.dirty[0]===-1&&(E.push(e),fe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Z(e,t,n,i,r,o,f=null,g=[-1]){const a=A;T(e);const s=e.$$={fragment:null,ctx:[],props:o,update:N,not_equal:r,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(a?a.$$.context:[])),callbacks:B(),dirty:g,skip_bound:!1,root:t.target||a.$$.root};f&&f(s.root);let _=!1;if(s.ctx=n?n(e,t.props||{},(l,y,...u)=>{const h=u.length?u[0]:y;return s.ctx&&r(s.ctx[l],s.ctx[l]=h)&&(!s.skip_bound&&s.bound[l]&&s.bound[l](h),_&&ge(e,l)),y}):[],s.update(),_=!0,W(s.before_update),s.fragment=i?i(s.ctx):!1,t.target){if(t.hydrate){const l=se(t.target);s.fragment&&s.fragment.l(l),l.forEach(p)}else s.fragment&&s.fragment.c();t.intro&&Q(e.$$.fragment),X(e,t.target,t.anchor),J()}T(a)}class ee{constructor(){S(this,"$$");S(this,"$$set")}$destroy(){Y(this,1),this.$destroy=N}$on(t,n){if(!R(n))return N;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!ie(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const _e="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_e);const{window:ye}=re;function we(e){var w;let t,n,i,r,o,f=((w=e[1])==null?void 0:w.country_code)+"",g,a,s,_,l,y,u,h,b;return{c(){t=x("div"),n=j("Device Type: "),i=j(e[0]),r=z(),o=x("div"),g=j(f),a=z(),s=x("div"),s.innerHTML="",_=z(),l=x("hr"),y=z(),u=x("div"),u.innerHTML="",F(s,"data-betarena-zone-id","1"),F(u,"data-betarena-zone-id","2")},m(c,d){m(c,t,d),C(t,n),C(t,i),m(c,r,d),m(c,o,d),C(o,g),m(c,a,d),m(c,s,d),m(c,_,d),m(c,l,d),m(c,y,d),m(c,u,d),h||(b=oe(ye,"resize",e[4]),h=!0)},p(c,[d]){var O;d&1&&G(i,c[0]),d&2&&f!==(f=((O=c[1])==null?void 0:O.country_code)+"")&&G(g,f)},i:N,o:N,d(c){c&&(p(t),p(r),p(o),p(a),p(s),p(_),p(l),p(y),p(u)),h=!1,b()}}}function $e(e,t,n){let{deviceWidthList:i=[768,1024]}=t,r="desktop",o=null,f,g;function a(){window.innerWidth<i[0]?n(0,r="mobile"):window.innerWidth>=i[0]&&window.innerWidth<i[1]?n(0,r="tablet"):n(0,r="desktop")}async function s(){const u=await fetch("https://get.geojs.io/v1/ip/geo.json",{method:"GET"});n(1,o=await u.json())}async function _(u){var w,c,d,O;if(!u||u.length==0)return;f=await(await fetch(`https://betarena-test-e2748dab12f5.herokuapp.com/ads?zoneIds=${u}`,{method:"GET"})).json()??[];const b=new Map(f.ads);for(const H of g){const q=(w=H.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:w.value;if(!q||!o)continue;const $=b.get(parseInt(q));!((c=$==null?void 0:$.targeting)!=null&&c.device.includes(r))||$.targeting.country.exclude.length>0&&$.targeting.country.exclude.includes(((d=o.country_code)==null?void 0:d.toUpperCase())??"EN")||$.targeting.country.include.length>0&&!$.targeting.country.include.includes(((O=o.country_code)==null?void 0:O.toUpperCase())??"EN")||(H.innerHTML=$.name)}}async function l(){var h;a(),await s(),g=document.querySelectorAll("[data-betarena-zone-id]");const u=[];for(const b of g){const w=(h=b.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:h.value;w&&u.push(w)}_(u)}ce(async()=>{await l()});const y=()=>{a()};return e.$$set=u=>{"deviceWidthList"in u&&n(3,i=u.deviceWidthList)},[r,o,a,i,y]}class be extends ee{constructor(t){super(),Z(this,t,$e,we,V,{deviceWidthList:3})}}function ve(e){let t,n,i;return n=new be({}),{c(){t=x("main"),me(n.$$.fragment)},m(r,o){m(r,t,o),X(n,t,null),i=!0},p:N,i(r){i||(Q(n.$$.fragment,r),i=!0)},o(r){he(n.$$.fragment,r),i=!1},d(r){r&&p(t),Y(n)}}}class xe extends ee{constructor(t){super(),Z(this,t,null,ve,V,{})}}typeof document>"u"||new xe({target:document.body});
1
+ var Z=Object.defineProperty;var ee=(e,t,n)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j=(e,t,n)=>(ee(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const d of i.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function w(){}function D(e){return e()}function B(){return Object.create(null)}function O(e){e.forEach(D)}function H(e){return typeof e=="function"}function K(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function te(e){return Object.keys(e).length===0}const ne=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function W(e,t){e.appendChild(t)}function E(e,t,n){e.insertBefore(t,n||null)}function b(e){e.parentNode&&e.parentNode.removeChild(e)}function A(e){return document.createElement(e)}function L(e){return document.createTextNode(e)}function re(){return L(" ")}function oe(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function ie(e){return Array.from(e.childNodes)}function F(e,t){t=""+t,e.data!==t&&(e.data=t)}let x;function v(e){x=e}function se(){if(!x)throw new Error("Function called outside component initialization");return x}function ue(e){se().$$.on_mount.push(e)}const _=[],G=[];let y=[];const k=[],ce=Promise.resolve();let S=!1;function de(){S||(S=!0,ce.then(R))}function C(e){y.push(e)}const z=new Set;let m=0;function R(){if(m!==0)return;const e=x;do{try{for(;m<_.length;){const t=_[m];m++,v(t),fe(t.$$)}}catch(t){throw _.length=0,m=0,t}for(v(null),_.length=0,m=0;G.length;)G.pop()();for(let t=0;t<y.length;t+=1){const n=y[t];z.has(n)||(z.add(n),n())}y.length=0}while(_.length);for(;k.length;)k.pop()();S=!1,z.clear(),v(e)}function fe(e){if(e.fragment!==null){e.update(),O(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(C)}}function ae(e){const t=[],n=[];y.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),y=t}const N=new Set;let le;function V(e,t){e&&e.i&&(N.delete(e),e.i(t))}function he(e,t,n,r){if(e&&e.o){if(N.has(e))return;N.add(e),le.c.push(()=>{N.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function pe(e){e&&e.c()}function J(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),C(()=>{const i=e.$$.on_mount.map(D).filter(H);e.$$.on_destroy?e.$$.on_destroy.push(...i):O(i),e.$$.on_mount=[]}),o.forEach(C)}function Q(e,t){const n=e.$$;n.fragment!==null&&(ae(n.after_update),O(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function ge(e,t){e.$$.dirty[0]===-1&&(_.push(e),de(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function X(e,t,n,r,o,i,d=null,l=[-1]){const f=x;v(e);const s=e.$$={fragment:null,ctx:[],props:i,update:w,not_equal:o,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:B(),dirty:l,skip_bound:!1,root:t.target||f.$$.root};d&&d(s.root);let p=!1;if(s.ctx=n?n(e,t.props||{},(u,a,...c)=>{const g=c.length?c[0]:a;return s.ctx&&o(s.ctx[u],s.ctx[u]=g)&&(!s.skip_bound&&s.bound[u]&&s.bound[u](g),p&&ge(e,u)),a}):[],s.update(),p=!0,O(s.before_update),s.fragment=r?r(s.ctx):!1,t.target){if(t.hydrate){const u=ie(t.target);s.fragment&&s.fragment.l(u),u.forEach(b)}else s.fragment&&s.fragment.c();t.intro&&V(e.$$.fragment),J(e,t.target,t.anchor),R()}v(f)}class Y{constructor(){j(this,"$$");j(this,"$$set")}$destroy(){Q(this,1),this.$destroy=w}$on(t,n){if(!H(n))return w;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!te(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const me="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(me);const{window:_e}=ne;function ye(e){var p;let t,n,r,o,i,d=((p=e[1])==null?void 0:p.country_code)+"",l,f,s;return{c(){t=A("div"),n=L("Device Type: "),r=L(e[0]),o=re(),i=A("div"),l=L(d)},m(u,a){E(u,t,a),W(t,n),W(t,r),E(u,o,a),E(u,i,a),W(i,l),f||(s=oe(_e,"resize",e[4]),f=!0)},p(u,[a]){var c;a&1&&F(r,u[0]),a&2&&d!==(d=((c=u[1])==null?void 0:c.country_code)+"")&&F(l,d)},i:w,o:w,d(u){u&&(b(t),b(o),b(i)),f=!1,s()}}}function we(e,t,n){let{deviceWidthList:r=[768,1024]}=t,o="desktop",i=null,d,l;function f(){window.innerWidth<r[0]?n(0,o="mobile"):window.innerWidth>=r[0]&&window.innerWidth<r[1]?n(0,o="tablet"):n(0,o="desktop")}async function s(){const c=await fetch("https://get.geojs.io/v1/ip/geo.json",{method:"GET"});n(1,i=await c.json())}async function p(c){var $,I,M,P;if(!c||c.length==0)return;d=await(await fetch(`https://betarena-test-e2748dab12f5.herokuapp.com/ads?zoneIds=${c}`,{method:"GET"})).json()??[];const T=new Map(d.ads);for(const U of l){const q=($=U.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:$.value;if(!q||!i)continue;const h=T.get(parseInt(q));!((I=h==null?void 0:h.targeting)!=null&&I.device.includes(o))||h.targeting.country.exclude.length>0&&h.targeting.country.exclude.includes(((M=i.country_code)==null?void 0:M.toUpperCase())??"EN")||h.targeting.country.include.length>0&&!h.targeting.country.include.includes(((P=i.country_code)==null?void 0:P.toUpperCase())??"EN")||(U.innerHTML=h.name)}}async function u(){var g;f(),await s(),l=document.querySelectorAll("[data-betarena-zone-id]");const c=[];for(const T of l){const $=(g=T.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:g.value;$&&c.push($)}p(c)}ue(async()=>{await u()});const a=()=>{f()};return e.$$set=c=>{"deviceWidthList"in c&&n(3,r=c.deviceWidthList)},[o,i,f,r,a]}class $e extends Y{constructor(t){super(),X(this,t,we,ye,K,{deviceWidthList:3})}}function be(e){let t,n,r;return n=new $e({}),{c(){t=A("main"),pe(n.$$.fragment)},m(o,i){E(o,t,i),J(n,t,null),r=!0},p:w,i(o){r||(V(n.$$.fragment,o),r=!0)},o(o){he(n.$$.fragment,o),r=!1},d(o){o&&b(t),Q(n)}}}class ve extends Y{constructor(t){super(),X(this,t,null,be,K,{})}}typeof document>"u"||new ve({target:document.body});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betarena/ad-engine",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "description": "Betarena Ad-Engine Component Logic",
6
6
  "type": "module",