@livelike/embet 0.0.14 → 0.0.15

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/embet.umd.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /* emBET SDK Version 0.0.14 */
1
+ /* emBET SDK Version 0.0.15 */
2
2
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).embet={})}(this,(function(e){"use strict";!function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const e=HTMLElement,t=function(){return Reflect.construct(e,[],this.constructor)};window.HTMLElement=t,HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}();
3
3
  /**
4
4
  * @license
@@ -386,20 +386,20 @@ const Ho=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Objec
386
386
  * subject to an additional IP rights grant found at
387
387
  * http://polymer.github.io/PATENTS.txt
388
388
  */
389
- const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=>t=>{const n=es.get(t);if(void 0===e&&t instanceof ko){if(void 0!==n||!es.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==n&&t.setValue(e);es.set(t,e)})),ns=D`<style>.embet-widget livelike-widget-header{border-radius:0;height:22.5%}.embet-widget livelike-widget-header .center{width:100%;text-align:center;padding-top:1rem}.embet-widget .widget-tagline{font-size:18px;font-weight:700;padding-bottom:10px;text-transform:uppercase}.embet-widget livelike-title{text-transform:uppercase;font-weight:700;padding:0;display:block;width:100%}.embet-widget livelike-widget-body{border-radius:0;height:47.5%}.embet-widget livelike-widget-footer{border-radius:0;height:30%}.embet-widget .option-container{padding:1rem;height:100%;align-items:stretch;display:flex;flex-direction:column}.embet-widget livelike-option{height:50%;border-width:2px;border-style:solid;border-radius:0;padding:0;box-shadow:5px 5px 10px 1px rgba(0,0,0,.2);align-items:unset;box-sizing:border-box}.embet-widget .option-container[interacted] livelike-option{background:rgba(50,50,50,.7);border:2px solid rgba(190,190,190,.7)}.embet-widget .option-container[interacted] livelike-option[selected]{border:2px solid rgba(0,250,0,.7)}.embet-widget livelike-option:not(:last-of-type){margin-bottom:1rem}.embet-widget livelike-option .option-image-wrap{display:flex;width:100%;position:relative;box-sizing:border-box}.embet-widget livelike-option .percentage-container{position:absolute;display:flex;transform:translate(-50%,-50%);top:50%;left:50%;white-space:nowrap}.embet-widget livelike-description{word-break:unset;align-self:center;padding:0 .5rem}.embet-widget .bet-details{padding:0 .5rem;align-self:center}.embet-widget livelike-image img{padding-left:6px}.embet-widget livelike-percentage{padding:0 5px 0 0}.embet-widget livelike-progress{height:calc(100% + 1px);background:rgba(160,160,160,.7);border-radius:0;box-sizing:border-box}.embet-widget livelike-progress[selected]{background:rgba(0,225,0,.7)}.embet-widget .image-grid[interacted] .bet-details,.embet-widget .image-grid[interacted] img,.embet-widget .image-grid[interacted] livelike-description,.embet-widget .option-container[interacted] .bet-details,.embet-widget .option-container[interacted] livelike-description,[variation=bar] .embet-widget .option-container[interacted] livelike-image,[variation=square] .embet-widget .option-container[interacted] livelike-image{opacity:.2}.embet-widget livelike-timer{height:3px}[variation=inline] .embet-widget .option-container{flex-direction:row}[variation=inline] .embet-widget livelike-image img{padding-left:0}[variation=inline] .embet-widget .bet-details,[variation=inline] .embet-widget livelike-descrption{padding:8px}[variation=inline] .live-total-text-options{display:flex;flex-direction:column;width:100%;padding:0 10px}[variation=square] .embet-widget livelike-option:not(:last-of-type){margin-bottom:0}[variation=square] .image-grid{padding:16px;display:grid;grid-column-gap:8px;grid-row-gap:8px}[variation=square] .embet-widget .square-option-0,[variation=square] .embet-widget .square-option-1,[variation=square] .embet-widget .square-option-2,[variation=square] .embet-widget .square-option-3{height:100%;border:none;box-shadow:0 0 0 1px #c1c2ca;border-radius:6px;flex-grow:1;transition:all .2s ease}[variation=square] .embet-widget .square-option-0:after,[variation=square] .embet-widget .square-option-1:after,[variation=square] .embet-widget .square-option-2:after,[variation=square] .embet-widget .square-option-3:after{content:'';width:100%;height:100%;z-index:4;position:absolute;border-radius:6px;transition:all .2s ease}[variation=square] .live-spread-option-text{display:flex;flex-direction:column;font-size:16px!important;width:100%;justify-content:center}[variation=square] .percentage-container{z-index:5}[variation=square] livelike-description{font-size:16px;text-align:center;flex-grow:0;padding:5px 0 0 0;z-index:1}</style>`;function is(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=(e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase())(n);"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}function rs(e){return D`<style>.dismiss-button{background:0 0;border:none;position:absolute;top:12px;right:16px}.dismiss-button:hover{cursor:pointer}</style><button class="dismiss-button" @click="${()=>((e,t,n)=>{const i=new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return e.dispatchEvent(i),i})(e,"dismiss-clicked")}"><svg height="18px" width="18px" viewBox="0 0 28 28"><polygon points="28,22.398 19.594,14 28,5.602 22.398,0 14,8.402 5.598,0 0,5.602 8.398,14 0,22.398 5.598,28 14,19.598 22.398,28" style="fill:#979797"/></svg></button>`}const os={".widget-tagline":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-title":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-description":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".bet-details":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-text":["fontSize","lineHeight","height","marginLeft","marginRight","marginTop","marginBottom"],".bet-button":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],".dismiss-button":["lineHeight","top","right","height"],".dismiss-button svg":["height","width"],".option-container livelike-image img":["height","paddingLeft"],"livelike-widget-body .option-container":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-footer":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-container":["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom"],".footer-sponsor":["lineHeight","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],".footer-sponsor img":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-header div.center":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".live-total-text-options":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-option:not(:last-child)":["marginLeft","marginRight","marginTop","marginBottom"],"livelike-option":["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],"livelike-progress":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".percentage-container":["fontSize","lineHeight","paddingRight"],".percentage-text":["fontSize","lineHeight"],"livelike-timer":["height"]};class ss extends Ri{constructor(){super(...arguments),this.defaultVoteHide=!1,this.hideVoteInResults=!1,this.voteCallback=e=>{e.detail&&e.detail.item&&e.detail.item.id&&!this.voted&&(this.voted=!0)},this.updateThemeStyles=e=>{this.themeStyles=Object.assign(Object.assign({},this.themeStyles),e)},this.themeUpdated=e=>{this.requestUpdate()},this.parseCustomData=e=>{this.sponsors=e.sponsors||this.widgetPayload.sponsors||[],this.place_bet_url=this.customData.place_bet_url||"";const t={"LIVE MONEYLINE":"bar","LIVE SPREAD":"square","LIVE TOTAL":"inline"}[this.customData.type];if(this.widgetVariation=this.customData.widgetVariation||t,this.setAttribute("variation",this.widgetVariation),e.theme&&e.theme.widgets){Wr.applyTheme(e.theme);const t=this.kind||this.widgetPayload.kind;!this.widgetPayload.kind&&(this.widgetPayload.kind=t),this.themeStyles=e.theme.widgets[t.split("-")[1]]}if(e.customCss){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e.customCss),this.appendChild(t)}if(e.customStyles&&(this.customStyles=e.customStyles),!e.disableResizing){const t=e.widgetWidthPercentage,n=e.parentContainer;this.resizeObserver=new ResizeObserver(((e,t)=>n=>n.forEach((n=>{const i=n.target;if(i){const r=Math.round(n.contentRect.width),o=t&&document.querySelector(t),s=(o?o.offsetWidth:document.body.offsetWidth)*(Number(e)||.3),a="hasBeenResized",c=i.classList.contains(a),l=Number(i.dataset.lastWidgetWidth);let u=!1;if(l+1===r||l-1===r)return;Object.keys(os).forEach((e=>{os[e].forEach((t=>{i.querySelectorAll(e).forEach((e=>{const n=getComputedStyle(e)[t];if(n){const o=n.split(/^(-?[0-9]*.?[0-9]+)(.+)$/).filter((e=>0!==e.length)),a=o[0],l=o[1];if(a&&!isNaN(Number(a))&&0!==Number(a)){const n=((c?Number(a)*s/Number(i.dataset.lastWidgetWidth):Number(a))*r/s).toString()+l;e.style[t]=n,u=!0}}}))}))})),u&&(i.dataset.lastWidgetWidth=String(r)),!c&&u&&i.classList.add(a)}})))(t,n)),this.resizeObserver.observe(this)}}}static get properties(){return{voted:{type:Boolean},customData:{type:Object},sponsors:{type:Array},place_bet_url:{type:String},themeStyles:{type:Object},customStyles:{type:String},options:{type:Array},optionsRenderer:{type:Function},widgetVariation:{type:String}}}connectedCallback(){super.connectedCallback(),this.addEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}disconnectedCallbck(){super.disconnectedCallbck(),this.removeEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}firstUpdated(){super.firstUpdated(),this.customData&&this.parseCustomData(this.customData),this.widgetPayload.options&&(this.options=this.widgetPayload.options),this.updateComplete.then((()=>{const e=this.querySelector("livelike-widget-root");e.updateComplete.then((()=>{const t=e.shadowRoot.querySelector("livelike-widget-bylines");t&&t.remove();const n=e.shadowRoot.querySelector("livelike-widget-reactions");n&&n.remove()}))}))}render(){const e=this.customData&&this.customData.type?D`<div class="widget-tagline">${this.customData.type}</div>`:null;return D`<template>${ns}<style>${this.customStyles}live-moneyline,live-spread,live-total{display:block}.embet-widget{height:${this.customData&&this.customData.widgetHeight?this.customData.widgetHeight:"100%"}}</style><livelike-widget-root class="embet-widget"><livelike-widget-header class="widget-header" slot="header"><div class="center">${e}<livelike-title></livelike-title></div>${rs(this)}</livelike-widget-header><livelike-widget-body>${this.widgetVariation&&this.optionsRenderer(this.options,this.customData,this.voted,this.widgetVariation)}</livelike-widget-body>${function(e,t,n,i){let r,o;return t&&(r=is(t.footer),o=is(t.betButton)),D`<style>.embet-widget livelike-widget-footer{display:flex;border-radius:0;padding:10px 16px;${r}}.embet-widget .footer-container{width:50%;display:flex;flex-direction:column;justify-content:center;margin:5px;padding:5px}.embet-widget .footer-text{height:12px;text-align:center;font-size:12px;color:#999;white-space:nowrap;margin-bottom:10px}.embet-widget .footer-sponsor{border:2px solid rgba(255,255,255,.2);max-height:40px;box-sizing:border-box}.embet-widget .footer-sponsor img{object-fit:contain;box-sizing:border-box;width:100%;height:100%;padding:4px 10px}.embet-widget .bet-button{border-radius:3rem;padding:10px;white-space:nowrap;border-width:2px;border-style:solid;${o}}.embet-widget .bet-button:hover{cursor:pointer}.embet-widget .bet-button a{text-decoration:none;font-weight:700;color:inherit}${i}</style><livelike-widget-footer><div class="footer-container"><div class="footer-text">SPONSORED BY</div><div class="footer-sponsor">${n&&n[0]&&n[0].logo_url?D`<img src="${n[0].logo_url}" alt="${n[0].name}">`:null}</div></div><div class="footer-container"><div class="footer-text"></div><button class="bet-button"><a target="_blank" href="${e||""}">PLACE BET</a></button></div></livelike-widget-footer>`}(this.place_bet_url,this.themeStyles,this.sponsors,this.customStyles)}<livelike-timer class="custom-timer"></livelike-timer></livelike-widget-root></template>`}}const as=(e,t)=>{const n=e.reduce(((e,t)=>e+t.vote_count),0);return n>0?Math.round(t.vote_count/n*100):0},cs=(e,t)=>{if(e&&e.betDetails){const n=e.betDetails.find((e=>e.description===t.description));if(n)return D` <div class="bet-details">${n.bet}</div> `}},ls=(e,t,n)=>D`
389
+ const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=>t=>{const n=es.get(t);if(void 0===e&&t instanceof ko){if(void 0!==n||!es.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==n&&t.setValue(e);es.set(t,e)})),ns=D`<style>.embet-widget livelike-widget-header{border-radius:0;height:22.5%}.embet-widget livelike-widget-header .center{width:100%;text-align:center;padding-top:1rem}.embet-widget .widget-tagline{font-size:18px;font-weight:700;padding-bottom:10px;text-transform:uppercase}.embet-widget livelike-title{text-transform:uppercase;font-weight:700;padding:0;display:block;width:100%}.embet-widget livelike-widget-body{border-radius:0;height:47.5%}.embet-widget livelike-widget-footer{border-radius:0;height:30%}.embet-widget .option-container{padding:1rem;height:100%;align-items:stretch;display:flex;flex-direction:column}.embet-widget livelike-option{height:50%;border-width:2px;border-style:solid;border-radius:0;padding:0;box-shadow:5px 5px 10px 1px rgba(0,0,0,.2);align-items:unset;box-sizing:border-box}.embet-widget .option-container[interacted] livelike-option{background:rgba(50,50,50,.7);border:2px solid rgba(190,190,190,.7)}.embet-widget .option-container[interacted] livelike-option[selected]{border:2px solid rgba(0,250,0,.7)}.embet-widget livelike-option:not(:last-of-type){margin-bottom:1rem}.embet-widget livelike-option .option-image-wrap{display:flex;width:100%;position:relative;box-sizing:border-box}.embet-widget livelike-option .percentage-container{position:absolute;display:flex;transform:translate(-50%,-50%);top:50%;left:50%;white-space:nowrap}.embet-widget livelike-description{word-break:unset;align-self:center;padding:0 .5rem}.embet-widget .bet-details{padding:0 .5rem;align-self:center}.embet-widget livelike-image img{padding-left:6px}.embet-widget livelike-percentage{padding:0 5px 0 0}.embet-widget livelike-progress{height:calc(100% + 1px);background:rgba(160,160,160,.7);border-radius:0;box-sizing:border-box}.embet-widget livelike-progress[selected]{background:rgba(0,225,0,.7)}.embet-widget .image-grid[interacted] .bet-details,.embet-widget .image-grid[interacted] img,.embet-widget .image-grid[interacted] livelike-description,.embet-widget .option-container[interacted] .bet-details,.embet-widget .option-container[interacted] livelike-description,[variation=bar] .embet-widget .option-container[interacted] livelike-image,[variation=square] .embet-widget .option-container[interacted] livelike-image{opacity:.2}.embet-widget livelike-timer{height:3px}[variation=inline] .embet-widget .option-container{flex-direction:row}[variation=inline] .embet-widget livelike-image img{padding-left:0}[variation=inline] .embet-widget .bet-details,[variation=inline] .embet-widget livelike-descrption{padding:8px}[variation=inline] .live-total-text-options{display:flex;flex-direction:column;width:100%;padding:0 10px}[variation=square] .embet-widget livelike-option:not(:last-of-type){margin-bottom:0}[variation=square] .image-grid{padding:16px;display:grid;grid-column-gap:8px;grid-row-gap:8px}[variation=square] .embet-widget .square-option-0,[variation=square] .embet-widget .square-option-1,[variation=square] .embet-widget .square-option-2,[variation=square] .embet-widget .square-option-3{height:100%;border:none;box-shadow:0 0 0 1px #c1c2ca;border-radius:6px;flex-grow:1;transition:all .2s ease}[variation=square] .embet-widget .square-option-0:after,[variation=square] .embet-widget .square-option-1:after,[variation=square] .embet-widget .square-option-2:after,[variation=square] .embet-widget .square-option-3:after{content:'';width:100%;height:100%;z-index:4;position:absolute;border-radius:6px;transition:all .2s ease}[variation=square] .live-spread-option-text{display:flex;flex-direction:column;font-size:16px!important;width:100%;justify-content:center}[variation=square] .percentage-container{z-index:5}[variation=square] livelike-description{font-size:16px;text-align:center;flex-grow:0;padding:5px 0 0 0;z-index:1}</style>`;function is(e){if(e){let t="";return Object.keys(e).forEach((n=>{let i=(e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase())(n);"fontColor"===n&&(i="color"),t+=`${i}: ${e[n]};\n`})),t}return""}const rs={".widget-tagline":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-title":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-description":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".bet-details":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-text":["fontSize","lineHeight","height","marginLeft","marginRight","marginTop","marginBottom"],".bet-button":["fontSize","lineHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],".dismiss-button":["lineHeight","top","right","height"],".dismiss-button svg":["height","width"],".option-container livelike-image img":["height","paddingLeft"],"livelike-widget-body .option-container":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-footer":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".footer-container":["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom"],".footer-sponsor":["lineHeight","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],".footer-sponsor img":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-widget-header div.center":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".live-total-text-options":["paddingLeft","paddingRight","paddingTop","paddingBottom"],"livelike-option:not(:last-child)":["marginLeft","marginRight","marginTop","marginBottom"],"livelike-option":["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],"livelike-progress":["paddingLeft","paddingRight","paddingTop","paddingBottom"],".percentage-container":["fontSize","lineHeight","paddingRight"],".percentage-text":["fontSize","lineHeight"],"livelike-timer":["height"]};class os extends Ri{constructor(){super(...arguments),this.defaultVoteHide=!1,this.hideVoteInResults=!1,this.voteCallback=e=>{e.detail&&e.detail.item&&e.detail.item.id&&!this.voted&&(this.voted=!0)},this.updateThemeStyles=e=>{this.themeStyles=Object.assign(Object.assign({},this.themeStyles),e)},this.themeUpdated=e=>{this.requestUpdate()},this.parseCustomData=e=>{this.sponsors=e.sponsors||this.widgetPayload.sponsors||[],this.place_bet_url=this.customData.place_bet_url||"";const t={"LIVE MONEYLINE":"bar","LIVE SPREAD":"square","LIVE TOTAL":"inline"}[this.customData.type];if(this.widgetVariation=this.customData.widgetVariation||t,this.setAttribute("variation",this.widgetVariation),e.theme&&e.theme.widgets){Wr.applyTheme(e.theme);const t=this.kind||this.widgetPayload.kind;!this.widgetPayload.kind&&(this.widgetPayload.kind=t),this.themeStyles=e.theme.widgets[t.split("-")[1]]}if(e.customCss){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e.customCss),this.appendChild(t)}if(e.customStyles&&(this.customStyles=e.customStyles),!e.disableResizing){const t=e.widgetWidthPercentage,n=e.parentContainer;this.resizeObserver=new ResizeObserver(((e,t)=>n=>n.forEach((n=>{const i=n.target;if(i){const r=Math.round(n.contentRect.width),o=t&&document.querySelector(t),s=(o?o.offsetWidth:document.body.offsetWidth)*(Number(e)||.3),a="hasBeenResized",c=i.classList.contains(a),l=Number(i.dataset.lastWidgetWidth);let u=!1;if(l+1===r||l-1===r)return;Object.keys(rs).forEach((e=>{rs[e].forEach((t=>{i.querySelectorAll(e).forEach((e=>{const n=getComputedStyle(e)[t];if(n){const o=n.split(/^(-?[0-9]*.?[0-9]+)(.+)$/).filter((e=>0!==e.length)),a=o[0],l=o[1];if(a&&!isNaN(Number(a))&&0!==Number(a)){const n=((c?Number(a)*s/Number(i.dataset.lastWidgetWidth):Number(a))*r/s).toString()+l;e.style[t]=n,u=!0}}}))}))})),u&&(i.dataset.lastWidgetWidth=String(r)),!c&&u&&i.classList.add(a)}})))(t,n)),this.resizeObserver.observe(this)}}}static get properties(){return{voted:{type:Boolean},customData:{type:Object},sponsors:{type:Array},place_bet_url:{type:String},themeStyles:{type:Object},customStyles:{type:String},options:{type:Array},optionsRenderer:{type:Function},widgetVariation:{type:String}}}connectedCallback(){super.connectedCallback(),this.addEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}disconnectedCallbck(){super.disconnectedCallbck(),this.removeEventListener("interacted",this.voteCallback),document.addEventListener("livelike-theme-updated",this.themeUpdated)}firstUpdated(){super.firstUpdated(),this.customData&&this.parseCustomData(this.customData),this.widgetPayload.options&&(this.options=this.widgetPayload.options),this.updateComplete.then((()=>{const e=this.querySelector("livelike-widget-root");e.updateComplete.then((()=>{const t=e.shadowRoot.querySelector("livelike-widget-bylines");t&&t.remove();const n=e.shadowRoot.querySelector("livelike-widget-reactions");n&&n.remove()}))}))}render(){const e=this.customData&&this.customData.type?D`<div class="widget-tagline">${this.customData.type}</div>`:null;return D`<template>${ns}<style>${this.customStyles}live-moneyline,live-spread,live-total{display:block}.embet-widget{height:${this.customData&&this.customData.widgetHeight?this.customData.widgetHeight:"100%"}}</style><livelike-widget-root class="embet-widget"><livelike-widget-header class="widget-header" slot="header"><div class="center">${e}<livelike-title></livelike-title></div>${t=this,D`<style>.dismiss-button{background:0 0;border:none;position:absolute;top:12px;right:16px}.dismiss-button:hover{cursor:pointer}</style><button class="dismiss-button" @click="${t.widgetDismissClick}"><svg height="18px" width="18px" viewBox="0 0 28 28"><polygon points="28,22.398 19.594,14 28,5.602 22.398,0 14,8.402 5.598,0 0,5.602 8.398,14 0,22.398 5.598,28 14,19.598 22.398,28" style="fill:#979797"/></svg></button>`}</livelike-widget-header><livelike-widget-body>${this.widgetVariation&&this.optionsRenderer(this.options,this.customData,this.voted,this.widgetVariation)}</livelike-widget-body>${function(e,t,n,i){let r,o;return t&&(r=is(t.footer),o=is(t.betButton)),D`<style>.embet-widget livelike-widget-footer{display:flex;border-radius:0;padding:10px 16px;${r}}.embet-widget .footer-container{width:50%;display:flex;flex-direction:column;justify-content:center;margin:5px;padding:5px}.embet-widget .footer-text{height:12px;text-align:center;font-size:12px;color:#999;white-space:nowrap;margin-bottom:10px}.embet-widget .footer-sponsor{border:2px solid rgba(255,255,255,.2);max-height:40px;box-sizing:border-box}.embet-widget .footer-sponsor img{object-fit:contain;box-sizing:border-box;width:100%;height:100%;padding:4px 10px}.embet-widget .bet-button{border-radius:3rem;padding:10px;white-space:nowrap;border-width:2px;border-style:solid;${o}}.embet-widget .bet-button:hover{cursor:pointer}.embet-widget .bet-button a{text-decoration:none;font-weight:700;color:inherit}${i}</style><livelike-widget-footer><div class="footer-container"><div class="footer-text">SPONSORED BY</div><div class="footer-sponsor">${n&&n[0]&&n[0].logo_url?D`<img src="${n[0].logo_url}" alt="${n[0].name}">`:null}</div></div><div class="footer-container"><div class="footer-text"></div><button class="bet-button"><a target="_blank" href="${e||""}">PLACE BET</a></button></div></livelike-widget-footer>`}(this.place_bet_url,this.themeStyles,this.sponsors,this.customStyles)}<livelike-timer class="custom-timer"></livelike-timer></livelike-widget-root></template>`;var t}}const ss=(e,t)=>{const n=e.reduce(((e,t)=>e+t.vote_count),0);return n>0?Math.round(t.vote_count/n*100):0},as=(e,t)=>{if(e&&e.betDetails){const n=e.betDetails.find((e=>e.description===t.description));if(n)return D` <div class="bet-details">${n.bet}</div> `}},cs=(e,t,n)=>D`
390
390
  <div class="option-container" ?interacted=${n}>
391
391
  ${e&&e.map(((i,r)=>D`
392
392
  <livelike-option index=${r} .option=${i}>
393
393
  <div class="option-image-wrap">
394
394
  <livelike-image src=${i.image_url} height="40px"></livelike-image>
395
395
  <livelike-description .description=${i.description}></livelike-description>
396
- ${cs(t,i)}
396
+ ${as(t,i)}
397
397
  <livelike-progress
398
- .value=${as(e,i)}
398
+ .value=${ss(e,i)}
399
399
  ></livelike-progress>
400
400
  <div class="percentage-container">
401
401
  <livelike-percentage
402
- .value=${as(e,i)}
402
+ .value=${ss(e,i)}
403
403
  ></livelike-percentage>
404
404
  ${n?D` <span class="percentage-text">of votes</span> `:null}
405
405
  </div>
@@ -407,14 +407,14 @@ const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=
407
407
  </livelike-option>
408
408
  `))}
409
409
  </div>
410
- `,us=(e,t,n)=>D`
410
+ `,ls=(e,t,n)=>D`
411
411
  <style>
412
412
  [variation='square'] .image-grid {
413
413
  grid-template-columns: repeat(${e.length}, 1fr);
414
414
  }
415
415
  </style>
416
416
  <div class="image-grid" ?interacted=${n}>
417
- ${e&&e.map(((i,r)=>{const o=as(e,i);return D`
417
+ ${e&&e.map(((i,r)=>{const o=ss(e,i);return D`
418
418
  <style>
419
419
  [variation='square'] .image-grid[interacted] .square-option-${r}:after {
420
420
  background: linear-gradient(
@@ -437,7 +437,7 @@ const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=
437
437
  <livelike-image src=${i.image_url} height="60px"></livelike-image>
438
438
  <div class="live-spread-option-text">
439
439
  <livelike-description .description=${i.description}></livelike-description>
440
- ${cs(t,i)}
440
+ ${as(t,i)}
441
441
  <div class="percentage-container">
442
442
  <livelike-percentage .value=${o}></livelike-percentage>
443
443
  ${n?D` <span class="percentage-text">of votes</span> `:null}
@@ -446,20 +446,20 @@ const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=
446
446
  </livelike-option>
447
447
  `}))}
448
448
  </div>
449
- `,ds=(e,t,n)=>D`
449
+ `,us=(e,t,n)=>D`
450
450
  <div class="option-container" ?interacted=${n}>
451
451
  <livelike-image src=${e[0].image_url} height="60px"></livelike-image>
452
452
  <div class="live-total-text-options">${e&&e.map(((i,r)=>D`
453
453
  <livelike-option index=${r} .option=${i}>
454
454
  <div class="option-image-wrap">
455
455
  <livelike-description .description=${i.description}></livelike-description>
456
- ${cs(t,i)}
456
+ ${as(t,i)}
457
457
  <livelike-progress
458
- .value=${as(e,i)}
458
+ .value=${ss(e,i)}
459
459
  ></livelike-progress>
460
460
  <div class="percentage-container">
461
461
  <livelike-percentage
462
- .value=${as(e,i)}
462
+ .value=${ss(e,i)}
463
463
  ></livelike-percentage>
464
464
  ${n?D` <span class="percentage-text">of votes</span> `:null}
465
465
  </div>
@@ -468,4 +468,4 @@ const es=new WeakMap,ts=(e=>(...t)=>{const n=e(...t);return lo.set(n,!0),n})((e=
468
468
  `))}</div>
469
469
  <livelike-image src=${e[1].image_url} height="60px"></livelike-image>
470
470
  </div>
471
- `,hs=(e,t,n,i)=>(0,{bar:ls,square:us,inline:ds}[i])(e,t,n);customElements.define("live-total",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});customElements.define("live-spread",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});customElements.define("live-moneyline",class extends ss{constructor(){super(...arguments),this.optionsRenderer=hs}});var ps,fs,gs=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class ms extends Qo{constructor(){super(...arguments),this.getProgramFromCustomId=e=>{const t=window.LiveLike._$$;if(t&&t.ready){const n=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),i=t.clientId,r=t.appResource[i].program_custom_id_url_template,o=n(e,r);return fetch(o).then((e=>e.json())).then((e=>{this.programid=e.id,this.widgetContainer.programid=e.id}))}return setTimeout((()=>this.getProgramFromCustomId(e)),100)}}createRenderRoot(){return this}firstUpdated(){this.widgetContainer.customWidgetRenderer=({widgetPayload:e})=>{const t=function(e){try{return JSON.parse(e)}catch(e){return null}}(e.custom_data);if(t){const e=t.type.toLowerCase().split(" ").join("-"),n=document.createElement(e);return n.customData=t,n}}}updated(e){e.forEach(((e,t)=>{"customid"===t&&this.customid&&this.getProgramFromCustomId(this.customid),"programid"===t&&this.programid&&!this.customid&&(this.widgetContainer.programid=this.programid)}))}render(){return jo`<style>embet-widgets{display:block}</style><livelike-widgets .mode="${ts(this.mode)}"></livelike-widgets>`}}gs([(ps="livelike-widgets",(e,t)=>{const n={get(){return this.renderRoot.querySelector(ps)},enumerable:!0,configurable:!0};if(fs){const i=void 0!==t?t:e.key,r="symbol"==typeof i?Symbol():`__${i}`;n.get=function(){return void 0===this[r]&&(this[r]=this.renderRoot.querySelector(ps)),this[r]}}return void 0!==t?Go(n,e,t):Wo(n,e)})],ms.prototype,"widgetContainer",void 0),gs([Vo({type:String})],ms.prototype,"customid",void 0),gs([Vo({type:String})],ms.prototype,"programid",void 0),gs([Vo({type:String})],ms.prototype,"mode",void 0),customElements.define("embet-widgets",ms);const vs=Wr.applyTheme;function ys(e){return Wr.init(Object.assign({clientId:e.clientId},e))}Wr.applyTheme=e=>(document.dispatchEvent(new CustomEvent("livelike-theme-updated",{detail:{theme:e}})),vs(e));const bs={init:ys};window.embet=bs,e.default=bs,e.init=ys,Object.defineProperty(e,"__esModule",{value:!0})}));
471
+ `,ds=(e,t,n,i)=>(0,{bar:cs,square:ls,inline:us}[i])(e,t,n);customElements.define("live-total",class extends os{constructor(){super(...arguments),this.optionsRenderer=ds}});customElements.define("live-spread",class extends os{constructor(){super(...arguments),this.optionsRenderer=ds}});customElements.define("live-moneyline",class extends os{constructor(){super(...arguments),this.optionsRenderer=ds}});var hs,ps,fs=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};class gs extends Qo{constructor(){super(...arguments),this.getProgramFromCustomId=e=>{const t=window.LiveLike._$$;if(t&&t.ready){const n=(e,t)=>t&&encodeURI(t.replace(/{(.*?)}/g,e)),i=t.clientId,r=t.appResource[i].program_custom_id_url_template,o=n(e,r);return fetch(o).then((e=>e.json())).then((e=>{this.programid=e.id,this.widgetContainer.programid=e.id}))}return setTimeout((()=>this.getProgramFromCustomId(e)),100)}}createRenderRoot(){return this}firstUpdated(){this.widgetContainer.customWidgetRenderer=({widgetPayload:e})=>{const t=function(e){try{return JSON.parse(e)}catch(e){return null}}(e.custom_data);if(t){const e=t.type.toLowerCase().split(" ").join("-"),n=document.createElement(e);return n.customData=t,n}}}updated(e){e.forEach(((e,t)=>{"customid"===t&&this.customid&&this.getProgramFromCustomId(this.customid),"programid"===t&&this.programid&&!this.customid&&(this.widgetContainer.programid=this.programid)}))}render(){return jo`<style>embet-widgets{display:block}</style><livelike-widgets .mode="${ts(this.mode)}"></livelike-widgets>`}}fs([(hs="livelike-widgets",(e,t)=>{const n={get(){return this.renderRoot.querySelector(hs)},enumerable:!0,configurable:!0};if(ps){const i=void 0!==t?t:e.key,r="symbol"==typeof i?Symbol():`__${i}`;n.get=function(){return void 0===this[r]&&(this[r]=this.renderRoot.querySelector(hs)),this[r]}}return void 0!==t?Go(n,e,t):Wo(n,e)})],gs.prototype,"widgetContainer",void 0),fs([Vo({type:String})],gs.prototype,"customid",void 0),fs([Vo({type:String})],gs.prototype,"programid",void 0),fs([Vo({type:String})],gs.prototype,"mode",void 0),customElements.define("embet-widgets",gs);const ms=Wr.applyTheme;function vs(e){return Wr.init(Object.assign({clientId:e.clientId},e))}Wr.applyTheme=e=>(document.dispatchEvent(new CustomEvent("livelike-theme-updated",{detail:{theme:e}})),ms(e));const ys={init:vs};window.embet=ys,e.default=ys,e.init=vs,Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livelike/embet",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "embet sdk",
5
5
  "main": "embet.esm.min.js",
6
6
  "browserslist": [