@betarena/ad-engine 0.0.6 → 0.0.7
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/.eslintrc.yaml +164 -0
- package/package.json +34 -14
- package/src/App.svelte +8 -0
- package/src/lib/Widget-AdEngine.svelte +492 -0
- package/src/lib/Widget-AdGeneral.svelte +284 -0
- package/src/lib/Widget-AdvertSlide.svelte +384 -0
- package/src/lib/assets/icon-close.svg +9 -0
- package/src/lib/assets/icon-external-link.svg +4 -0
- package/src/lib/constants/instance.ts +10 -0
- package/src/lib/store.ts +284 -0
- package/src/lib/types/ad-engine.d.ts +21 -0
- package/src/lib/types/geojs.d.ts +83 -0
- package/src/lib/types/global.d.ts +4 -0
- package/src/lib/types/vite-env.d.ts +2 -0
- package/src/lib/utils/device.ts +37 -0
- package/src/lib/utils/fetch.ts +107 -0
- package/src/lib/utils/geo.ts +34 -0
- package/src/main.ts +17 -0
- package/vite.config.ts +29 -3
- package/dist/assets/index-Cm9IxoHj.js +0 -24
- package/dist/index.html +0 -13
- package/dist/vite.svg +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M=(e,t,n)=>(re(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 d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).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 $(){}function R(e){return e()}function F(){return Object.create(null)}function A(e){e.forEach(R)}function V(e){return typeof e=="function"}function J(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}function j(e,t){e.appendChild(t)}function N(e,t,n){e.insertBefore(t,n||null)}function v(e){e.parentNode&&e.parentNode.removeChild(e)}function C(e){return document.createElement(e)}function O(e){return document.createTextNode(e)}function oe(){return O(" ")}function se(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function ue(e){return Array.from(e.childNodes)}function G(e,t){t=""+t,e.data!==t&&(e.data=t)}let E;function x(e){E=e}function ce(){if(!E)throw new Error("Function called outside component initialization");return E}function ae(e){ce().$$.on_mount.push(e)}const _=[],D=[];let y=[];const K=[],de=Promise.resolve();let S=!1;function fe(){S||(S=!0,de.then(Q))}function I(e){y.push(e)}const z=new Set;let g=0;function Q(){if(g!==0)return;const e=E;do{try{for(;g<_.length;){const t=_[g];g++,x(t),le(t.$$)}}catch(t){throw _.length=0,g=0,t}for(x(null),_.length=0,g=0;D.length;)D.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(),x(e)}function le(e){if(e.fragment!==null){e.update(),A(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(I)}}function pe(e){const t=[],n=[];y.forEach(i=>e.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),y=t}const T=new Set;let he;function X(e,t){e&&e.i&&(T.delete(e),e.i(t))}function me(e,t,n,i){if(e&&e.o){if(T.has(e))return;T.add(e),he.c.push(()=>{T.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function ge(e){e&&e.c()}function Y(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),I(()=>{const o=e.$$.on_mount.map(R).filter(V);e.$$.on_destroy?e.$$.on_destroy.push(...o):A(o),e.$$.on_mount=[]}),r.forEach(I)}function Z(e,t){const n=e.$$;n.fragment!==null&&(pe(n.after_update),A(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function _e(e,t){e.$$.dirty[0]===-1&&(_.push(e),fe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function ee(e,t,n,i,r,o,d=null,p=[-1]){const f=E;x(e);const s=e.$$={fragment:null,ctx:[],props:o,update:$,not_equal:r,bound:F(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:F(),dirty:p,skip_bound:!1,root:t.target||f.$$.root};d&&d(s.root);let m=!1;if(s.ctx=n?n(e,t.props||{},(c,l,...u)=>{const h=u.length?u[0]:l;return s.ctx&&r(s.ctx[c],s.ctx[c]=h)&&(!s.skip_bound&&s.bound[c]&&s.bound[c](h),m&&_e(e,c)),l}):[],s.update(),m=!0,A(s.before_update),s.fragment=i?i(s.ctx):!1,t.target){if(t.hydrate){const c=ue(t.target);s.fragment&&s.fragment.l(c),c.forEach(v)}else s.fragment&&s.fragment.c();t.intro&&X(e.$$.fragment),Y(e,t.target,t.anchor),Q()}x(f)}class te{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){Z(this,1),this.$destroy=$}$on(t,n){if(!V(n))return $;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 ye="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ye);function $e(e){var m;let t,n,i,r,o,d=((m=e[1])==null?void 0:m.country_code)+"",p,f,s;return{c(){t=C("div"),n=O("Device Type: "),i=O(e[0]),r=oe(),o=C("div"),p=O(d)},m(c,l){N(c,t,l),j(t,n),j(t,i),N(c,r,l),N(c,o,l),j(o,p),f||(s=se(window,"resize",e[4]),f=!0)},p(c,[l]){var u;l&1&&G(i,c[0]),l&2&&d!==(d=((u=c[1])==null?void 0:u.country_code)+"")&&G(p,d)},i:$,o:$,d(c){c&&(v(t),v(r),v(o)),f=!1,s()}}}function we(e,t,n){let{deviceWidthList:i=[768,1024]}=t,r="desktop",o=null,d,p;function f(){const u=navigator.userAgent.toLowerCase(),h=u.includes("mobile"),w=/tablet|ipad/.test(u);h?n(0,r="mobile"):w?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 m(u){var b,P,W,U,k,H,q;if(!u||u.length==0)return;d=await(await fetch(`https://betarena-test-e2748dab12f5.herokuapp.com/ads?zoneIds=${u}`,{method:"GET"})).json()??[];const w=new Map(d.ads);for(const L of p){const B=(b=L.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:b.value;if(!B||!o)continue;const a=w.get(parseInt(B));!((P=a==null?void 0:a.targeting)!=null&&P.device.includes(r))||a.targeting.country.exclude.length>0&&a.targeting.country.exclude.includes(((W=o.country_code)==null?void 0:W.toUpperCase())??"EN")||a.targeting.country.include.length>0&&!a.targeting.country.include.includes(((U=o.country_code)==null?void 0:U.toUpperCase())??"EN")||(L.innerHTML=`
|
|
2
|
-
<div>
|
|
3
|
-
name: ${a.name}
|
|
4
|
-
<br />
|
|
5
|
-
clicks: ${a.clicks}
|
|
6
|
-
<br />
|
|
7
|
-
status: ${a.status}
|
|
8
|
-
<br />
|
|
9
|
-
type: ${a.type}
|
|
10
|
-
<br />
|
|
11
|
-
user: ${a.user}
|
|
12
|
-
</div>
|
|
13
|
-
`,(a.type==1||a.type==4)&&((k=a.data)!=null&&k.media)&&(L.innerHTML+=`
|
|
14
|
-
<iframe
|
|
15
|
-
width=250
|
|
16
|
-
height=250
|
|
17
|
-
src="${(H=a.data)==null?void 0:H.media}"
|
|
18
|
-
/>
|
|
19
|
-
`),a.type==2&&(L.innerHTML+=`
|
|
20
|
-
<img
|
|
21
|
-
src=${(q=a.data)==null?void 0:q.media}
|
|
22
|
-
width=100
|
|
23
|
-
/>
|
|
24
|
-
`))}}async function c(){var h;f(),await s(),p=document.querySelectorAll("[data-betarena-zone-id]");const u=[];for(const w of p){const b=(h=w.attributes.getNamedItem("data-betarena-zone-id"))==null?void 0:h.value;b&&u.push(b)}m(u)}ae(async()=>{await c()});const l=()=>{f()};return e.$$set=u=>{"deviceWidthList"in u&&n(3,i=u.deviceWidthList)},[r,o,f,i,l]}class be extends te{constructor(t){super(),ee(this,t,we,$e,J,{deviceWidthList:3})}}function ve(e){let t,n,i;return n=new be({}),{c(){t=C("main"),ge(n.$$.fragment)},m(r,o){N(r,t,o),Y(n,t,null),i=!0},p:$,i(r){i||(X(n.$$.fragment,r),i=!0)},o(r){me(n.$$.fragment,r),i=!1},d(r){r&&v(t),Z(n)}}}class xe extends te{constructor(t){super(),ee(this,t,null,ve,J,{})}}typeof document>"u"||new xe({target:document.body});
|
package/dist/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + Svelte + TS</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-Cm9IxoHj.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<div id="app"></div>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/dist/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|