@everymatrix/bonus-elevate-levels 1.32.4 → 1.33.0
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/dist/bonus-elevate-levels/bonus-elevate-levels.esm.js +1 -0
- package/dist/bonus-elevate-levels/index.esm.js +0 -0
- package/dist/bonus-elevate-levels/p-b4dbf9a0.entry.js +1 -0
- package/dist/bonus-elevate-levels/p-b93c42e2.js +1 -0
- package/dist/cjs/bonus-elevate-levels.cjs.js +19 -0
- package/dist/cjs/bonus-elevate-levels_5.cjs.entry.js +418 -0
- package/dist/cjs/index-3c66cec7.js +1682 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/bonus-elevate-levels/bonus-elevate-levels.css +18 -0
- package/dist/collection/components/bonus-elevate-levels/bonus-elevate-levels.js +240 -0
- package/dist/collection/components/elevate-level-list/elevate-level-list.css +70 -0
- package/dist/collection/components/elevate-level-list/elevate-level-list.js +223 -0
- package/dist/collection/components/elevate-level-presentation/elevate-level-presentation.css +21 -0
- package/dist/collection/components/elevate-level-presentation/elevate-level-presentation.js +39 -0
- package/dist/collection/components/elevate-levels-data/elevate-levels-data.css +3 -0
- package/dist/collection/components/elevate-levels-data/elevate-levels-data.js +79 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/elevate-levels.js +1 -0
- package/dist/collection/utils/locale.utils.js +27 -0
- package/dist/collection/utils/prototype-collector.js +5 -0
- package/dist/collection/utils/utils.js +44 -0
- package/dist/components/bonus-elevate-levels.d.ts +11 -0
- package/dist/components/bonus-elevate-levels.js +136 -0
- package/dist/components/elevate-level-list.d.ts +11 -0
- package/dist/components/elevate-level-list.js +6 -0
- package/dist/components/elevate-level-list2.js +177 -0
- package/dist/components/elevate-level-presentation.d.ts +11 -0
- package/dist/components/elevate-level-presentation.js +6 -0
- package/dist/components/elevate-level-presentation2.js +31 -0
- package/dist/components/elevate-levels-data.d.ts +11 -0
- package/dist/components/elevate-levels-data.js +6 -0
- package/dist/components/elevate-levels-data2.js +102 -0
- package/dist/components/general-styling-wrapper.js +6 -0
- package/dist/components/general-styling-wrapper2.js +103 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/bonus-elevate-levels.js +17 -0
- package/dist/esm/bonus-elevate-levels_5.entry.js +410 -0
- package/dist/esm/index-2cb5433a.js +1654 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +24 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/bonus-elevate-levels/.stencil/packages/bonus-elevate-levels/stencil.config.d.ts +2 -0
- package/dist/types/components/bonus-elevate-levels/bonus-elevate-levels.d.ts +48 -0
- package/dist/types/components/elevate-level-list/elevate-level-list.d.ts +45 -0
- package/dist/types/components/elevate-level-presentation/elevate-level-presentation.d.ts +8 -0
- package/dist/types/components/elevate-levels-data/elevate-levels-data.d.ts +10 -0
- package/dist/types/components.d.ts +175 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/elevate-levels.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +10 -0
- package/dist/types/utils/prototype-collector.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +21 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,b as l}from"./p-b93c42e2.js";(()=>{const l=import.meta.url,t={};return""!==l&&(t.resourcesUrl=new URL(".",l).href),e(t)})().then((e=>l([["p-b4dbf9a0",[[1,"bonus-elevate-levels",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],endpoint:[513],language:[513],translationUrl:[513,"translation-url"],selectedLevelId:[1537,"selected-level-id"],showDefault:[4,"show-default"],elevateLevelParamProxy:[32],elevateLevels:[32],currentLevel:[32],errorMessage:[32]},[[0,"selectedLevelChanged","selectedLevelChangedHandler"],[2,"elevateLevelsDataChange","elevateLevelsDataChangeHandler"]]],[0,"elevate-level-list",{levels:[16],language:[1],selectedLevelId:[1537,"selected-level-id"],isShowSliderButton:[32],touchPosStart:[32],touchPosEnd:[32],offset:[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[9,"resize","handleResize"]]],[0,"elevate-level-presentation",{elevateLevel:[16]}],[0,"elevate-levels-data",{scopeParams:[1544,"scope-params"]}],[4,"general-styling-wrapper",{clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],translationUrl:[1,"translation-url"],targetTranslations:[16]}]]]],e)));
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as t,c as i,H as s,g as l}from"./p-b93c42e2.js";const n=["ro","en","fr","ar","hu","hr"],o={en:{seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set"},fr:{seeAll:"See All",termsAndConditions:"Terms & Conditions",loadElevateLevelErrorMessage:"Error when load elevate levels",noLevelsSet:"There is no level set"},hr:{level:"Razina",seeAll:"Vidi sve",privilegesFor:"Privilegije za",termsAndConditions:"Uvjeti i odredbe",noLevelsSet:"There is no level set"}},r=(e,t)=>{const i=t;return o[void 0!==i&&n.includes(i)?i:"en"][e]},h=class{constructor(t){e(this,t),this.clientStyling="",this.clientStylingUrl="",this.language="en",this.translationUrl="",this.elevateLevels=[]}selectedLevelChangedHandler(e){e.detail&&(this.currentLevel=Object.assign({},e.detail.level))}selectedLevelIdChangedHandler(){if(this.selectedLevelId&&this.elevateLevels){const e=this.elevateLevels.filter((e=>e.id==this.selectedLevelId))[0];this.currentLevel=Object.assign({},e)}}elevateLevelsDataChangeHandler(e){e.detail&&(e.detail.currentLevel&&(this.currentLevel=Object.assign({},e.detail.currentLevel)),e.detail.elevateLevels&&(this.elevateLevels=[...e.detail.elevateLevels]),e.detail.clearError&&(this.errorMessage=null),e.detail.errorMessage&&e.detail.errorMessage.errorWhenLoadElevateLevels&&(this.errorMessage=r("loadElevateLevelErrorMessage",this.language)))}onTCClick(){window.postMessage({type:"termAndConditionClicked"},window.location.href)}componentWillLoad(){this.elevateLevelParamProxy={endpoint:this.endpoint,language:this.language,selectedLevelId:this.selectedLevelId,showDefault:this.showDefault}}render(){return t("div",{class:"ElevateLevelContent"},t("elevate-levels-data",{scopeParams:this.elevateLevelParamProxy}),t("div",{class:"LevelContent"},this.elevateLevels?t("elevate-level-list",{language:this.language,selectedLevelId:this.selectedLevelId,levels:this.elevateLevels}):r("noLevelsSet",this.language),this.currentLevel&&t("elevate-level-presentation",{elevateLevel:this.currentLevel}),t("div",{class:"tc",onClick:this.onTCClick},r("termsAndConditions",this.language)," ")),this.errorMessage&&t("div",null,this.errorMessage),t("general-styling-wrapper",{clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,targetTranslations:o,translationUrl:this.translationUrl}))}static get watchers(){return{selectedLevelId:["selectedLevelIdChangedHandler"],elevateLevels:["selectedLevelIdChangedHandler"]}}};var a;h.style=":host{display:block}.ElevateLevelContent{padding:20px;position:relative}.ElevateLevelContent .Privileges{padding-bottom:30px}.ElevateLevelContent .tc{position:absolute;right:10px;bottom:10px;text-align:right;display:none}",function(e){e[e.slideToRight=1]="slideToRight",e[e.slideToLeft=-1]="slideToLeft"}(a||(a={}));const d=class{constructor(t){var s;e(this,t),this.selectedLevelChanged=i(this,"selectedLevelChanged",7),this.isShowSliderButton=!1,this.offset=0,this.minOffset=0,this.isMobile=!!((s=window.navigator.userAgent).toLowerCase().match(/android/i)||s.toLowerCase().match(/blackberry|bb/i)||s.toLowerCase().match(/iphone|ipad|ipod/i)||s.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i))}onLevelClicked(e){this.selectedLevelChanged.emit({level:e}),this.selectedLevelId=e.id}levelsChangedHandler(){this.initOffsetOfLevelItems()}initOffsetOfLevelItems(){if(!this.levels||0==this.levels.length||!this.selectedLevelId)return;const e=this.levels.findIndex((e=>this.selectedLevelId==e.id));if(this.onLevelClicked(this.levels[-1==e?0:e]),this.levels.length<=this.moveCountForOneTouch)return;let t=Math.floor((-1==e?1:e+1)/this.moveCountForOneTouch)*this.moveCountForOneTouch*this.childElementWidth*-1;this.offset=t<=this.minOffset?this.minOffset:t>=0?0:t}onTouchStart(e){this.touchPosStart={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}onTouchMove(e){this.touchPosEnd={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};const t=this.touchPosEnd.clientX-this.touchPosStart.clientX,i=this.touchPosEnd.clientY-this.touchPosStart.clientY;Math.abs(t)>Math.abs(i)&&this.slideTo(t>0?a.slideToRight:a.slideToLeft)}slideTo(e){let t=this.levelsElement.offsetLeft+this.childElementWidth*this.moveCountForOneTouch*e;if(t%this.childElementWidth!=0){const i=Math.floor(t/this.childElementWidth)*this.childElementWidth,s=Math.ceil(t/this.childElementWidth)*this.childElementWidth;t=e==a.slideToRight?i:s}this.offset=t<this.minOffset?this.minOffset:t>=0?0:t}initLevelSlider(){var e;if(!(null===(e=this.levelsElement)||void 0===e?void 0:e.firstElementChild))return void console.log("Widget[elevate-level-list] DOM is not ready.");this.isShowSliderButton=!this.isMobile&&this.levelsElement.clientWidth>this.levelsElement.parentElement.clientWidth,this.minOffset=this.levelsElement.parentElement.clientWidth-this.levelsElement.clientWidth,this.childElementWidth=this.levelsElement.firstElementChild.clientWidth,this.moveCountForOneTouch=Math.ceil(this.levelsElement.parentElement.clientWidth/this.childElementWidth)-1;const t=this.levelsElement.childElementCount;this.childElementWidth+=(this.levelsElement.clientWidth-this.childElementWidth*t)/(t-1)}debounce(e,t){{let i;return()=>{clearTimeout(i),i=setTimeout((()=>{e()}),t)}}}handleResize(){this.debounce(this.initLevelSlider.bind(this),200)()}componentDidRender(){this.host.componentOnReady().then((()=>{this.initLevelSlider()}))}render(){return t(s,null,this.levels&&[t("div",{class:`SliderButton LeftButton ${0==this.offset?"Disabled":""} ${this.isShowSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(a.slideToRight)},t("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"}))),t("div",{class:"LevelItemsWrapper"},t("div",{style:{left:`${this.offset}px`},class:"LevelItems "+(this.isMobile?"Mobile":""),id:"levelItems",ref:e=>{this.levelsElement=e}},this.levels.map(((e,i)=>t("div",{class:"Item "+(this.selectedLevelId==e.id?"Active":""),onClick:this.onLevelClicked.bind(this,e)},t("img",{alt:`Presentation Icon for ${e.presentation.displayName}`,class:"LevelImg",src:e.presentation.asset}),t("span",{class:"LevelName",title:e.presentation.displayName},e.presentation.displayName),t("span",{class:"LevelPoints"},0==i?"":">",e.firstEntryPoints," ",r("points",this.language))))))),t("div",{class:`SliderButton RightButton ${this.offset<=this.minOffset?"Disabled":""} ${this.isShowSliderButton?"":"Hidden"}`,onClick:()=>this.slideTo(a.slideToLeft)},t("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})))])}get host(){return l(this)}static get watchers(){return{selectedLevelId:["levelsChangedHandler"]}}};d.style="elevate-level-list{display:flex;flex-direction:row}.LevelItemsWrapper{display:flex;flex:1;margin-top:10px;min-height:30px;transition-property:all;position:relative;height:138px;overflow-x:hidden}.Mobile.LevelItems{overflow-x:hidden}.LevelItems{overflow-x:auto;display:flex;flex-direction:row;gap:10px;left:0;position:absolute;transition:left 0.5s ease-in-out}.LevelItems .Item:hover,.LevelItems .Item.Active{background-color:var(--emfe-w-color-gray-50, #f4f4f4);box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.25)}.LevelItems .Item{width:86px;height:125px;border-radius:15px;text-align:center;display:flex;flex-direction:column;cursor:pointer}.LevelItems .Item .LevelName{font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.LevelItems .Item .LevelPoints{color:var(--emfe-w-color-gray-100, #767171);font-size:10px}.LevelItems .Item .LevelImg{width:65px;height:68px;margin:11px auto}.SliderButton{display:flex;width:29px;align-items:center;cursor:pointer}.SliderButton.Disabled svg{stroke:var(--emfe-w-color-gray-50, #cbc5c5)}.SliderButton.Hidden{display:none}";const v=class{constructor(t){e(this,t)}render(){return t(s,null,t("div",{class:"Row Desc"},t("h3",null,this.elevateLevel.presentation.displayName),t("p",null,t("span",{class:"TxtDesc",innerHTML:this.elevateLevel.presentation.description}))))}};v.style=":host{display:block}.PriviliegeList{padding-inline-start:5px}.PriviliegeList li{display:flex}.PriviliegeList li .Img{width:80px}.PriviliegeList li .Img img{width:60px;margin:10px}.PriviliegeList li .Content h4{text-transform:capitalize;margin-block-start:10px}";var c,p=(function(e,t){var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();e.exports=t=i.fetch,i.fetch&&(t.default=i.fetch.bind(i)),t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response}(c={path:undefined,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},c.exports),c.exports);const u=class{constructor(t){e(this,t),this.elevateLevelsDataChange=i(this,"elevateLevelsDataChange",7)}async componentWillLoad(){if(!this.scopeParams.endpoint)return;let e=new URL(`${this.scopeParams.endpoint}/v1/elevate/levels?language=${this.scopeParams.language}`);await p(e.href).then((e=>e.json())).then((e=>{const t=e.data.sort(((e,t)=>e.firstEntryPoints<t.firstEntryPoints?-1:1));let i=this.scopeParams.selectedLevelId;if(!i&&this.scopeParams.showDefault&&t.length>0&&(i=t[0].id),i){const e=t.filter((e=>e.id==i))[0];this.elevateLevelsDataChange.emit({currentLevel:e})}this.elevateLevelsDataChange.emit({clearError:!0}),this.elevateLevelsDataChange.emit({elevateLevels:t})})).catch((e=>{this.elevateLevelsDataChange.emit({errorMessage:{type:"errorWhenLoadElevateLevels",err:e}}),console.error(e)}))}};u.style=":host{display:block}";const g=class{constructor(t){e(this,t),this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.stylingAppends=!1,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.el.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.el.prepend(t)}),1)})).catch((e=>{console.log("error ",e)}))}}componentDidRender(){this.stylingAppends||(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const s=(t=this.translationUrl,i=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{i[e]=i[e]?i[e]:{};for(let s in t[e])i[e][s]=t[e][s]})),e(!0)}))})));e.push(s)}var t,i;return await Promise.all(e)}render(){return t("div",{class:"StyleShell"},t("slot",{name:"mainContent"}))}get el(){return l(this)}};g.style=":host{display:block}";export{h as bonus_elevate_levels,d as elevate_level_list,v as elevate_level_presentation,u as elevate_levels_data,g as general_styling_wrapper}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t,l,n=!1,o=!1,s=!1,r=!1,i=!1;const c="undefined"!=typeof window?window:{},f=c.document||{head:{}},u={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},a=e=>Promise.resolve(e),$=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),d=(e,t,l)=>{l&&l.map((([l,n,o])=>{const s=b(e,l),r=h(t,o),i=m(l);u.ael(s,n,r,i),(t.o=t.o||[]).push((()=>u.rel(s,n,r,i)))}))},h=(e,t)=>l=>{try{256&e.t?e.i[t](l):(e.u=e.u||[]).push([t,l])}catch(e){ie(e)}},b=(e,t)=>8&t?c:e,m=e=>0!=(2&e),y=new WeakMap,p=e=>"sc-"+e.$,w={},g=e=>"object"==(e=typeof e)||"function"===e,v=(e,t,...l)=>{let n=null,o=null,s=!1,r=!1,i=[];const c=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?c(n):null!=n&&"boolean"!=typeof n&&((s="function"!=typeof e&&!g(n))&&(n+=""),s&&r?i[i.length-1].h+=n:i.push(s?S(null,n):n),r=s)};if(c(l),t){t.name&&(o=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const f=S(e,null);return f.m=t,i.length>0&&(f.p=i),f.g=o,f},S=(e,t)=>({t:0,v:e,h:t,S:null,p:null,m:null,g:null}),j={},k=(e,t,l,n,o,s)=>{if(l!==n){let r=re(e,t),i=t.toLowerCase();if("class"===t){const t=e.classList,o=M(l),s=M(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("ref"===t)n&&n(e);else if(r||"o"!==t[0]||"n"!==t[1]){const i=g(n);if((r||i&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?r=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}null==n||!1===n?!1===n&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&s||o)&&!i&&e.setAttribute(t,n=!0===n?"":n)}else t="-"===t[2]?t.slice(3):re(c,i)?i.slice(2):i[2]+t.slice(3),l&&u.rel(e,t,l,!1),n&&u.ael(e,t,n,!1)}},O=/\s/,M=e=>e?e.split(O):[],C=(e,t,l,n)=>{const o=11===t.S.nodeType&&t.S.host?t.S.host:t.S,s=e&&e.m||w,r=t.m||w;for(n in s)n in r||k(o,n,s[n],void 0,l,t.t);for(n in r)k(o,n,s[n],r[n],l,t.t)},R=(o,i,c,u)=>{let a,$,d,h=i.p[c],b=0;if(n||(s=!0,"slot"===h.v&&(e&&u.classList.add(e+"-s"),h.t|=h.p?2:1)),null!==h.h)a=h.S=f.createTextNode(h.h);else if(1&h.t)a=h.S=f.createTextNode("");else{if(r||(r="svg"===h.v),a=h.S=f.createElementNS(r?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&h.t?"slot-fb":h.v),r&&"foreignObject"===h.v&&(r=!1),C(null,h,r),null!=e&&a["s-si"]!==e&&a.classList.add(a["s-si"]=e),h.p)for(b=0;b<h.p.length;++b)$=R(o,h,b,a),$&&a.appendChild($);"svg"===h.v?r=!1:"foreignObject"===a.tagName&&(r=!0)}return a["s-hn"]=l,3&h.t&&(a["s-sr"]=!0,a["s-cr"]=t,a["s-sn"]=h.g||"",d=o&&o.p&&o.p[c],d&&d.v===h.v&&o.S&&T(o.S,!1)),a},T=(e,t)=>{u.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const o=n[e];o["s-hn"]!==l&&o["s-ol"]&&(L(o).insertBefore(o,E(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&T(o,t)}u.t&=-2},x=(e,t,n,o,s,r)=>{let i,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(c.shadowRoot&&c.tagName===l&&(c=c.shadowRoot);s<=r;++s)o[s]&&(i=R(null,n,s,e),i&&(o[s].S=i,c.insertBefore(i,E(t))))},N=(e,t,l,n,s)=>{for(;t<=l;++t)(n=e[t])&&(s=n.S,D(n),o=!0,s["s-ol"]?s["s-ol"].remove():T(s,!0),s.remove())},P=(e,t)=>e.v===t.v&&("slot"!==e.v||e.g===t.g),E=e=>e&&e["s-ol"]||e,L=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,W=(e,t)=>{const l=t.S=e.S,n=e.p,o=t.p,s=t.v,i=t.h;let c;null===i?(r="svg"===s||"foreignObject"!==s&&r,"slot"===s||C(e,t,r),null!==n&&null!==o?((e,t,l,n)=>{let o,s=0,r=0,i=t.length-1,c=t[0],f=t[i],u=n.length-1,a=n[0],$=n[u];for(;s<=i&&r<=u;)null==c?c=t[++s]:null==f?f=t[--i]:null==a?a=n[++r]:null==$?$=n[--u]:P(c,a)?(W(c,a),c=t[++s],a=n[++r]):P(f,$)?(W(f,$),f=t[--i],$=n[--u]):P(c,$)?("slot"!==c.v&&"slot"!==$.v||T(c.S.parentNode,!1),W(c,$),e.insertBefore(c.S,f.S.nextSibling),c=t[++s],$=n[--u]):P(f,a)?("slot"!==c.v&&"slot"!==$.v||T(f.S.parentNode,!1),W(f,a),e.insertBefore(f.S,c.S),f=t[--i],a=n[++r]):(o=R(t&&t[r],l,r,e),a=n[++r],o&&L(c.S).insertBefore(o,E(c.S)));s>i?x(e,null==n[u+1]?null:n[u+1].S,l,n,r,u):r>u&&N(t,s,i)})(l,n,t,o):null!==o?(null!==e.h&&(l.textContent=""),x(l,null,t,o,0,o.length-1)):null!==n&&N(n,0,n.length-1),r&&"svg"===s&&(r=!1)):(c=l["s-cr"])?c.parentNode.textContent=i:e.h!==i&&(l.data=i)},A=e=>{let t,l,n,o,s,r,i=e.childNodes;for(l=0,n=i.length;l<n;l++)if(t=i[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(r=i[o].nodeType,i[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===r&&s===i[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===r||3===r&&""!==i[o].textContent.trim()){t.hidden=!0;break}A(t)}},H=[],U=e=>{let t,l,n,s,r,i,c=0,f=e.childNodes,u=f.length;for(;c<u;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(n=l.parentNode.childNodes,s=t["s-sn"],i=n.length-1;i>=0;i--)l=n[i],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(q(l,s)?(r=H.find((e=>e.j===l)),o=!0,l["s-sn"]=l["s-sn"]||s,r?r.k=t:H.push({k:t,j:l}),l["s-sr"]&&H.map((e=>{q(e.j,l["s-sn"])&&(r=H.find((e=>e.j===l)),r&&!e.k&&(e.k=r.k))}))):H.some((e=>e.j===l))||H.push({j:l}));1===t.nodeType&&U(t)}},q=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,D=e=>{e.m&&e.m.ref&&e.m.ref(null),e.p&&e.p.map(D)},F=e=>ne(e).O,V=(e,t,l)=>{const n=F(e);return{emit:e=>_(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},_=(e,t,l)=>{const n=u.ce(t,l);return e.dispatchEvent(n),n},z=(e,t)=>{t&&!e.M&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.M=t)))},B=(e,t)=>{if(e.t|=16,!(4&e.t))return z(e,e.C),ye((()=>G(e,t)));e.t|=512},G=(e,t)=>{const l=e.i;let n;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>X(l,e,t))),e.u=null),n=X(l,"componentWillLoad")),Y(n,(()=>I(e,l,t)))},I=async(e,t,l)=>{const n=e.O,o=n["s-rc"];l&&(e=>{const t=e.R,l=e.O,n=t.t,o=((e,t)=>{let l=p(t),n=ue.get(l);if(e=11===e.nodeType?e:f,n)if("string"==typeof n){let t,o=y.get(e=e.head||e);o||y.set(e,o=new Set),o.has(l)||(t=f.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return l})(l.shadowRoot?l.shadowRoot:l.getRootNode(),t);10&n&&(l["s-sc"]=o,l.classList.add(o+"-h"))})(e);J(e,t),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>K(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},J=(r,i)=>{try{i=i.render&&i.render(),r.t&=-17,r.t|=2,((r,i)=>{const c=r.O,a=r.R,$=r.T||S(null,null),d=(e=>e&&e.v===j)(i)?i:v(null,null,i);if(l=c.tagName,a.N&&(d.m=d.m||{},a.N.map((([e,t])=>d.m[t]=c[e]))),d.v=null,d.t|=4,r.T=d,d.S=$.S=c.shadowRoot||c,e=c["s-sc"],t=c["s-cr"],n=0!=(1&a.t),o=!1,W($,d),u.t|=1,s){let e,t,l,n,o,s;U(d.S);let r=0;for(;r<H.length;r++)e=H[r],t=e.j,t["s-ol"]||(l=f.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(r=0;r<H.length;r++)if(e=H[r],t=e.j,e.k){for(n=e.k.parentNode,o=e.k.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&A(d.S),u.t&=-2,H.length=0})(r,i)}catch(e){ie(e,r.O)}return null},K=e=>{const t=e.O,l=e.C;X(e.i,"componentDidRender"),64&e.t||(e.t|=64,Z(t),e.P(t),l||Q()),e.M&&(e.M(),e.M=void 0),512&e.t&&me((()=>B(e,!1))),e.t&=-517},Q=()=>{Z(f.documentElement),me((()=>_(c,"appload",{detail:{namespace:"bonus-elevate-levels"}})))},X=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){ie(e)}},Y=(e,t)=>e&&e.then?e.then(t):t(),Z=e=>e.classList.add("hydrated"),ee=(e,t,l)=>{if(t.L){e.watchers&&(t.W=e.watchers);const n=Object.entries(t.L),o=e.prototype;if(n.map((([e,[n]])=>{(31&n||2&l&&32&n)&&Object.defineProperty(o,e,{get(){return((e,t)=>ne(this).A.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=ne(e),s=o.O,r=o.A.get(t),i=o.t,c=o.i;if(l=((e,t)=>null==e||g(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(l,n.L[t][0]),(!(8&i)||void 0===r)&&l!==r&&(!Number.isNaN(r)||!Number.isNaN(l))&&(o.A.set(t,l),c)){if(n.W&&128&i){const e=n.W[t];e&&e.map((e=>{try{c[e](l,r,t)}catch(e){ie(e,s)}}))}2==(18&i)&&B(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;o.attributeChangedCallback=function(e,t,n){u.jmp((()=>{const t=l.get(e);if(this.hasOwnProperty(t))n=this[t],delete this[t];else if(o.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==n)return;this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const o=n[1]||e;return l.set(o,e),512&n[0]&&t.N.push([e,o]),o}))}}return e},te=(e,t={})=>{const l=[],n=t.exclude||[],o=c.customElements,s=f.head,r=s.querySelector("meta[charset]"),i=f.createElement("style"),a=[];let h,b=!0;Object.assign(u,t),u.l=new URL(t.resourcesUrl||"./",f.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],$:t[1],L:t[2],H:t[3]};s.L=t[2],s.H=t[3],s.N=[],s.W={};const r=s.$,i=class extends HTMLElement{constructor(e){super(e),se(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),b?a.push(this):u.jmp((()=>(e=>{if(0==(1&u.t)){const t=ne(e),l=t.R,n=()=>{};if(1&t.t)d(e,t,l.H);else{t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=f.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){z(t,t.C=l);break}}l.L&&Object.entries(l.L).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=fe(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.W=o.watchers,ee(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){ie(e)}t.t&=-9,t.t|=128,e()}if(o.style){let e=o.style;const t=p(l);if(!ue.has(t)){const n=()=>{};((e,t,l)=>{let n=ue.get(e);$&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,ue.set(e,n)})(t,e,!!(1&l.t)),n()}}}const s=t.C,r=()=>B(t,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(0,t,l)}n()}})(this)))}disconnectedCallback(){u.jmp((()=>(()=>{if(0==(1&u.t)){const e=ne(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return ne(this).U}};s.q=e[0],n.includes(r)||o.get(r)||(l.push(r),o.define(r,ee(i,s,1)))}))})),i.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",i.setAttribute("data-styles",""),s.insertBefore(i,r?r.nextSibling:s.firstChild),b=!1,a.length?a.map((e=>e.connectedCallback())):u.jmp((()=>h=setTimeout(Q,30)))},le=new WeakMap,ne=e=>le.get(e),oe=(e,t)=>le.set(t.i=e,t),se=(e,t)=>{const l={t:0,O:e,R:t,A:new Map};return l.U=new Promise((e=>l.P=e)),e["s-p"]=[],e["s-rc"]=[],d(e,l,t.H),le.set(e,l)},re=(e,t)=>t in e,ie=(e,t)=>(0,console.error)(e,t),ce=new Map,fe=e=>{const t=e.$.replace(/-/g,"_"),l=e.q,n=ce.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(ce.set(l,e),e[t])),ie)},ue=new Map,ae=[],$e=[],de=(e,t)=>l=>{e.push(l),i||(i=!0,t&&4&u.t?me(be):u.raf(be))},he=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ie(e)}e.length=0},be=()=>{he(ae),he($e),(i=ae.length>0)&&u.raf(be)},me=e=>a().then(e),ye=de($e,!0);export{j as H,te as b,V as c,F as g,v as h,a as p,oe as r}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-3c66cec7.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('bonus-elevate-levels.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["bonus-elevate-levels_5.cjs",[[1,"bonus-elevate-levels",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[513],"translationUrl":[513,"translation-url"],"selectedLevelId":[1537,"selected-level-id"],"showDefault":[4,"show-default"],"elevateLevelParamProxy":[32],"elevateLevels":[32],"currentLevel":[32],"errorMessage":[32]},[[0,"selectedLevelChanged","selectedLevelChangedHandler"],[2,"elevateLevelsDataChange","elevateLevelsDataChangeHandler"]]],[0,"elevate-level-list",{"levels":[16],"language":[1],"selectedLevelId":[1537,"selected-level-id"],"isShowSliderButton":[32],"touchPosStart":[32],"touchPosEnd":[32],"offset":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[9,"resize","handleResize"]]],[0,"elevate-level-presentation",{"elevateLevel":[16]}],[0,"elevate-levels-data",{"scopeParams":[1544,"scope-params"]}],[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]}]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3c66cec7.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
|
|
9
|
+
const TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
seeAll: 'See All',
|
|
12
|
+
termsAndConditions: 'Terms & Conditions',
|
|
13
|
+
loadElevateLevelErrorMessage: 'Error when load elevate levels',
|
|
14
|
+
noLevelsSet: 'There is no level set',
|
|
15
|
+
},
|
|
16
|
+
fr: {
|
|
17
|
+
seeAll: 'See All',
|
|
18
|
+
termsAndConditions: 'Terms & Conditions',
|
|
19
|
+
loadElevateLevelErrorMessage: 'Error when load elevate levels',
|
|
20
|
+
noLevelsSet: 'There is no level set',
|
|
21
|
+
},
|
|
22
|
+
hr: {
|
|
23
|
+
level: 'Razina',
|
|
24
|
+
seeAll: 'Vidi sve',
|
|
25
|
+
privilegesFor: 'Privilegije za',
|
|
26
|
+
termsAndConditions: 'Uvjeti i odredbe',
|
|
27
|
+
noLevelsSet: 'There is no level set',
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const translate = (key, customLang) => {
|
|
31
|
+
const lang = customLang;
|
|
32
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const bonusElevateLevelsCss = ":host{display:block}.ElevateLevelContent{padding:20px;position:relative}.ElevateLevelContent .Privileges{padding-bottom:30px}.ElevateLevelContent .tc{position:absolute;right:10px;bottom:10px;text-align:right;display:none}";
|
|
36
|
+
|
|
37
|
+
const BonusElevateLevels = class {
|
|
38
|
+
constructor(hostRef) {
|
|
39
|
+
index.registerInstance(this, hostRef);
|
|
40
|
+
/**
|
|
41
|
+
* Client custom styling via string
|
|
42
|
+
*/
|
|
43
|
+
this.clientStyling = '';
|
|
44
|
+
/**
|
|
45
|
+
* Client custom styling via url
|
|
46
|
+
*/
|
|
47
|
+
this.clientStylingUrl = '';
|
|
48
|
+
/**
|
|
49
|
+
* Language of the widget
|
|
50
|
+
*/
|
|
51
|
+
this.language = 'en';
|
|
52
|
+
/**
|
|
53
|
+
* The translationUrl
|
|
54
|
+
*/
|
|
55
|
+
this.translationUrl = '';
|
|
56
|
+
/**
|
|
57
|
+
* Used in elevate level list
|
|
58
|
+
*/
|
|
59
|
+
this.elevateLevels = [];
|
|
60
|
+
}
|
|
61
|
+
selectedLevelChangedHandler(event) {
|
|
62
|
+
if (event.detail) {
|
|
63
|
+
this.currentLevel = Object.assign({}, event.detail.level);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
selectedLevelIdChangedHandler() {
|
|
67
|
+
if (this.selectedLevelId && this.elevateLevels) {
|
|
68
|
+
const currentLevel = this.elevateLevels.filter((item) => {
|
|
69
|
+
return item.id == this.selectedLevelId;
|
|
70
|
+
})[0];
|
|
71
|
+
this.currentLevel = Object.assign({}, currentLevel);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
elevateLevelsDataChangeHandler(event) {
|
|
75
|
+
if (!event.detail) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (event.detail.currentLevel) {
|
|
79
|
+
this.currentLevel = Object.assign({}, event.detail.currentLevel);
|
|
80
|
+
}
|
|
81
|
+
if (event.detail.elevateLevels) {
|
|
82
|
+
this.elevateLevels = [...event.detail.elevateLevels];
|
|
83
|
+
}
|
|
84
|
+
if (event.detail.clearError) {
|
|
85
|
+
this.errorMessage = null;
|
|
86
|
+
}
|
|
87
|
+
if (event.detail.errorMessage) {
|
|
88
|
+
if (event.detail.errorMessage['errorWhenLoadElevateLevels']) {
|
|
89
|
+
this.errorMessage = translate('loadElevateLevelErrorMessage', this.language);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
onTCClick() {
|
|
94
|
+
window.postMessage({ type: 'termAndConditionClicked' }, window.location.href);
|
|
95
|
+
}
|
|
96
|
+
componentWillLoad() {
|
|
97
|
+
this.elevateLevelParamProxy = {
|
|
98
|
+
endpoint: this.endpoint, language: this.language, selectedLevelId: this.selectedLevelId,
|
|
99
|
+
showDefault: this.showDefault
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
return (index.h("div", { class: "ElevateLevelContent" }, index.h("elevate-levels-data", { scopeParams: this.elevateLevelParamProxy }), index.h("div", { class: "LevelContent" }, this.elevateLevels ?
|
|
104
|
+
index.h("elevate-level-list", { language: this.language, selectedLevelId: this.selectedLevelId, levels: this.elevateLevels }) : translate('noLevelsSet', this.language), this.currentLevel &&
|
|
105
|
+
index.h("elevate-level-presentation", { elevateLevel: this.currentLevel }), index.h("div", { class: "tc", onClick: this.onTCClick }, translate('termsAndConditions', this.language), ' ')), this.errorMessage && index.h("div", null, this.errorMessage), index.h("general-styling-wrapper", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl })));
|
|
106
|
+
}
|
|
107
|
+
static get watchers() { return {
|
|
108
|
+
"selectedLevelId": ["selectedLevelIdChangedHandler"],
|
|
109
|
+
"elevateLevels": ["selectedLevelIdChangedHandler"]
|
|
110
|
+
}; }
|
|
111
|
+
};
|
|
112
|
+
BonusElevateLevels.style = bonusElevateLevelsCss;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @name isMobile
|
|
116
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
117
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
118
|
+
* @returns {Boolean} true or false
|
|
119
|
+
*/
|
|
120
|
+
const isMobile = (userAgent) => {
|
|
121
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
122
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
123
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
124
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
125
|
+
};
|
|
126
|
+
var MOVE_TO;
|
|
127
|
+
(function (MOVE_TO) {
|
|
128
|
+
MOVE_TO[MOVE_TO["slideToRight"] = 1] = "slideToRight";
|
|
129
|
+
MOVE_TO[MOVE_TO["slideToLeft"] = -1] = "slideToLeft";
|
|
130
|
+
})(MOVE_TO || (MOVE_TO = {}));
|
|
131
|
+
|
|
132
|
+
const elevateLevelListCss = "elevate-level-list{display:flex;flex-direction:row}.LevelItemsWrapper{display:flex;flex:1;margin-top:10px;min-height:30px;transition-property:all;position:relative;height:138px;overflow-x:hidden}.Mobile.LevelItems{overflow-x:hidden}.LevelItems{overflow-x:auto;display:flex;flex-direction:row;gap:10px;left:0;position:absolute;transition:left 0.5s ease-in-out}.LevelItems .Item:hover,.LevelItems .Item.Active{background-color:var(--emfe-w-color-gray-50, #f4f4f4);box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.25)}.LevelItems .Item{width:86px;height:125px;border-radius:15px;text-align:center;display:flex;flex-direction:column;cursor:pointer}.LevelItems .Item .LevelName{font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.LevelItems .Item .LevelPoints{color:var(--emfe-w-color-gray-100, #767171);font-size:10px}.LevelItems .Item .LevelImg{width:65px;height:68px;margin:11px auto}.SliderButton{display:flex;width:29px;align-items:center;cursor:pointer}.SliderButton.Disabled svg{stroke:var(--emfe-w-color-gray-50, #cbc5c5)}.SliderButton.Hidden{display:none}";
|
|
133
|
+
|
|
134
|
+
const ElevateLevelList = class {
|
|
135
|
+
constructor(hostRef) {
|
|
136
|
+
index.registerInstance(this, hostRef);
|
|
137
|
+
this.selectedLevelChanged = index.createEvent(this, "selectedLevelChanged", 7);
|
|
138
|
+
this.isShowSliderButton = false;
|
|
139
|
+
this.offset = 0;
|
|
140
|
+
this.minOffset = 0;
|
|
141
|
+
this.isMobile = isMobile(window.navigator.userAgent);
|
|
142
|
+
}
|
|
143
|
+
onLevelClicked(elevateLevel) {
|
|
144
|
+
this.selectedLevelChanged.emit({ level: elevateLevel });
|
|
145
|
+
this.selectedLevelId = elevateLevel.id;
|
|
146
|
+
}
|
|
147
|
+
levelsChangedHandler() {
|
|
148
|
+
this.initOffsetOfLevelItems();
|
|
149
|
+
}
|
|
150
|
+
initOffsetOfLevelItems() {
|
|
151
|
+
if (!this.levels || this.levels.length == 0 || !this.selectedLevelId) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const currentLevelIndex = this.levels.findIndex((item) => {
|
|
155
|
+
return this.selectedLevelId == item.id;
|
|
156
|
+
});
|
|
157
|
+
this.onLevelClicked(this.levels[currentLevelIndex == -1 ? 0 : currentLevelIndex]);
|
|
158
|
+
//do not need change the slider offset when level items less than moveCountForOneTouch
|
|
159
|
+
if (this.levels.length <= this.moveCountForOneTouch) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
//to avoid the slider do not move when currentLevelIndex = moveCountForOneTouch - 1
|
|
163
|
+
let newOffset = Math.floor((currentLevelIndex == -1 ? 1 : currentLevelIndex + 1) / this.moveCountForOneTouch)
|
|
164
|
+
* this.moveCountForOneTouch * this.childElementWidth * (-1);
|
|
165
|
+
this.offset = newOffset <= this.minOffset ? this.minOffset : (newOffset >= 0 ? 0 : newOffset);
|
|
166
|
+
}
|
|
167
|
+
onTouchStart(e) {
|
|
168
|
+
this.touchPosStart = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
|
|
169
|
+
}
|
|
170
|
+
onTouchMove(e) {
|
|
171
|
+
this.touchPosEnd = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
|
|
172
|
+
const diffX = this.touchPosEnd.clientX - this.touchPosStart.clientX;
|
|
173
|
+
const diffY = this.touchPosEnd.clientY - this.touchPosStart.clientY;
|
|
174
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
|
175
|
+
this.slideTo(diffX > 0 ? MOVE_TO.slideToRight : MOVE_TO.slideToLeft);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
slideTo(direction) {
|
|
179
|
+
let newOffset = this.levelsElement.offsetLeft +
|
|
180
|
+
(this.childElementWidth) * this.moveCountForOneTouch * direction;
|
|
181
|
+
if (newOffset % this.childElementWidth != 0) {
|
|
182
|
+
const leftOfPreNode = (Math.floor(newOffset / this.childElementWidth)) * this.childElementWidth;
|
|
183
|
+
const leftOfNextNode = (Math.ceil(newOffset / this.childElementWidth)) * this.childElementWidth;
|
|
184
|
+
//touchmove to right, get left of pre-node; touchmove to left, get left of next-node
|
|
185
|
+
newOffset = direction == MOVE_TO.slideToRight ? leftOfPreNode : leftOfNextNode;
|
|
186
|
+
}
|
|
187
|
+
this.offset = newOffset < this.minOffset ? this.minOffset : (newOffset >= 0 ? 0 : newOffset);
|
|
188
|
+
}
|
|
189
|
+
initLevelSlider() {
|
|
190
|
+
var _a;
|
|
191
|
+
if (!((_a = this.levelsElement) === null || _a === void 0 ? void 0 : _a.firstElementChild)) {
|
|
192
|
+
console.log('Widget[elevate-level-list] DOM is not ready.');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.isShowSliderButton = !this.isMobile && (this.levelsElement.clientWidth > this.levelsElement.parentElement.clientWidth);
|
|
196
|
+
this.minOffset = this.levelsElement.parentElement.clientWidth - this.levelsElement.clientWidth;
|
|
197
|
+
this.childElementWidth = this.levelsElement.firstElementChild.clientWidth;
|
|
198
|
+
this.moveCountForOneTouch = Math.ceil(this.levelsElement.parentElement.clientWidth / this.childElementWidth) - 1;
|
|
199
|
+
const childElementCount = this.levelsElement.childElementCount;
|
|
200
|
+
this.childElementWidth += (this.levelsElement.clientWidth - this.childElementWidth * childElementCount) / (childElementCount - 1);
|
|
201
|
+
}
|
|
202
|
+
debounce(callback, delay) {
|
|
203
|
+
{
|
|
204
|
+
let timer;
|
|
205
|
+
return () => {
|
|
206
|
+
clearTimeout(timer);
|
|
207
|
+
timer = setTimeout(() => {
|
|
208
|
+
callback();
|
|
209
|
+
}, delay);
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
;
|
|
214
|
+
handleResize() {
|
|
215
|
+
this.debounce(this.initLevelSlider.bind(this), 200)();
|
|
216
|
+
}
|
|
217
|
+
componentDidRender() {
|
|
218
|
+
this.host.componentOnReady().then(() => {
|
|
219
|
+
this.initLevelSlider();
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
return (index.h(index.Host, null, this.levels && [
|
|
224
|
+
index.h("div", { class: `SliderButton LeftButton ${this.offset == 0 ? 'Disabled' : ''} ${this.isShowSliderButton ? '' : 'Hidden'}`, onClick: () => this.slideTo(MOVE_TO.slideToRight) }, index.h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))),
|
|
225
|
+
index.h("div", { class: 'LevelItemsWrapper' }, index.h("div", { style: { 'left': `${this.offset}px` }, class: `LevelItems ${this.isMobile ? 'Mobile' : ''}`, id: 'levelItems', ref: (el) => { this.levelsElement = el; } }, this.levels.map((level, idx) => {
|
|
226
|
+
return (index.h("div", { class: `Item ${this.selectedLevelId == level.id ? 'Active' : ''}`, onClick: this.onLevelClicked.bind(this, level) }, index.h("img", { alt: `Presentation Icon for ${level.presentation.displayName}`, class: "LevelImg", src: level.presentation.asset }), index.h("span", { class: "LevelName", title: level.presentation.displayName }, level.presentation.displayName), index.h("span", { class: "LevelPoints" }, idx == 0 ? '' : '>', level.firstEntryPoints, ' ', translate('points', this.language))));
|
|
227
|
+
}))),
|
|
228
|
+
index.h("div", { class: `SliderButton RightButton ${this.offset <= this.minOffset ? 'Disabled' : ''} ${this.isShowSliderButton ? '' : 'Hidden'}`, onClick: () => this.slideTo(MOVE_TO.slideToLeft) }, index.h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })))
|
|
229
|
+
]));
|
|
230
|
+
}
|
|
231
|
+
get host() { return index.getElement(this); }
|
|
232
|
+
static get watchers() { return {
|
|
233
|
+
"selectedLevelId": ["levelsChangedHandler"]
|
|
234
|
+
}; }
|
|
235
|
+
};
|
|
236
|
+
ElevateLevelList.style = elevateLevelListCss;
|
|
237
|
+
|
|
238
|
+
const elevateLevelPresentationCss = ":host{display:block}.PriviliegeList{padding-inline-start:5px}.PriviliegeList li{display:flex}.PriviliegeList li .Img{width:80px}.PriviliegeList li .Img img{width:60px;margin:10px}.PriviliegeList li .Content h4{text-transform:capitalize;margin-block-start:10px}";
|
|
239
|
+
|
|
240
|
+
const ElevateLevelPresentation = class {
|
|
241
|
+
constructor(hostRef) {
|
|
242
|
+
index.registerInstance(this, hostRef);
|
|
243
|
+
}
|
|
244
|
+
render() {
|
|
245
|
+
return index.h(index.Host, null, index.h("div", { class: "Row Desc" }, index.h("h3", null, this.elevateLevel.presentation.displayName), index.h("p", null, index.h("span", { class: "TxtDesc", innerHTML: this.elevateLevel.presentation.description }))));
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
ElevateLevelPresentation.style = elevateLevelPresentationCss;
|
|
249
|
+
|
|
250
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
251
|
+
return module = {
|
|
252
|
+
path: basedir,
|
|
253
|
+
exports: {},
|
|
254
|
+
require: function (path, base) {
|
|
255
|
+
return commonjsRequire();
|
|
256
|
+
}
|
|
257
|
+
}, fn(module, module.exports), module.exports;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function commonjsRequire () {
|
|
261
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
var browser = createCommonjsModule(function (module, exports) {
|
|
265
|
+
|
|
266
|
+
// ref: https://github.com/tc39/proposal-global
|
|
267
|
+
var getGlobal = function () {
|
|
268
|
+
// the only reliable means to get the global object is
|
|
269
|
+
// `Function('return this')()`
|
|
270
|
+
// However, this causes CSP violations in Chrome apps.
|
|
271
|
+
if (typeof self !== 'undefined') { return self; }
|
|
272
|
+
if (typeof window !== 'undefined') { return window; }
|
|
273
|
+
if (typeof global !== 'undefined') { return global; }
|
|
274
|
+
throw new Error('unable to locate global object');
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
var global = getGlobal();
|
|
278
|
+
|
|
279
|
+
module.exports = exports = global.fetch;
|
|
280
|
+
|
|
281
|
+
// Needed for TypeScript and Webpack.
|
|
282
|
+
if (global.fetch) {
|
|
283
|
+
exports.default = global.fetch.bind(global);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
exports.Headers = global.Headers;
|
|
287
|
+
exports.Request = global.Request;
|
|
288
|
+
exports.Response = global.Response;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
const elevateLevelsDataCss = ":host{display:block}";
|
|
292
|
+
|
|
293
|
+
const ElevateLevelsData = class {
|
|
294
|
+
constructor(hostRef) {
|
|
295
|
+
index.registerInstance(this, hostRef);
|
|
296
|
+
this.elevateLevelsDataChange = index.createEvent(this, "elevateLevelsDataChange", 7);
|
|
297
|
+
}
|
|
298
|
+
async componentWillLoad() {
|
|
299
|
+
//load data
|
|
300
|
+
if (!this.scopeParams.endpoint) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const endpoint = this.scopeParams.endpoint;
|
|
304
|
+
let url = new URL(`${endpoint}/v1/elevate/levels?language=${this.scopeParams.language}`);
|
|
305
|
+
await browser(url.href)
|
|
306
|
+
.then((res) => res.json())
|
|
307
|
+
.then((res) => {
|
|
308
|
+
const elevateLevels = res.data.sort((a, b) => {
|
|
309
|
+
return a.firstEntryPoints < b.firstEntryPoints ? -1 : 1;
|
|
310
|
+
});
|
|
311
|
+
let selectedLevelId = this.scopeParams.selectedLevelId;
|
|
312
|
+
// if selected level is not set, set first(basic) as default
|
|
313
|
+
if (!selectedLevelId && this.scopeParams.showDefault && elevateLevels.length > 0) {
|
|
314
|
+
selectedLevelId = elevateLevels[0].id;
|
|
315
|
+
}
|
|
316
|
+
if (selectedLevelId) {
|
|
317
|
+
// get current level by name
|
|
318
|
+
const currentLevel = elevateLevels.filter((item) => {
|
|
319
|
+
return item.id == selectedLevelId;
|
|
320
|
+
})[0];
|
|
321
|
+
this.elevateLevelsDataChange.emit({ currentLevel: currentLevel });
|
|
322
|
+
}
|
|
323
|
+
this.elevateLevelsDataChange.emit({ 'clearError': true });
|
|
324
|
+
this.elevateLevelsDataChange.emit({ 'elevateLevels': elevateLevels });
|
|
325
|
+
}).catch((err) => {
|
|
326
|
+
this.elevateLevelsDataChange.emit({ errorMessage: { type: 'errorWhenLoadElevateLevels', err } });
|
|
327
|
+
console.error(err);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
ElevateLevelsData.style = elevateLevelsDataCss;
|
|
332
|
+
|
|
333
|
+
const mergeTranslations = (url, target) => {
|
|
334
|
+
return new Promise((resolve) => {
|
|
335
|
+
fetch(url)
|
|
336
|
+
.then((res) => res.json())
|
|
337
|
+
.then((data) => {
|
|
338
|
+
Object.keys(data).forEach((item) => {
|
|
339
|
+
target[item] = target[item] ? target[item] : {};
|
|
340
|
+
for (let key in data[item]) {
|
|
341
|
+
target[item][key] = data[item][key];
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
resolve(true);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const generalStylingWrapperCss = ":host{display:block}";
|
|
350
|
+
|
|
351
|
+
const GeneralStylingWrapper = class {
|
|
352
|
+
constructor(hostRef) {
|
|
353
|
+
index.registerInstance(this, hostRef);
|
|
354
|
+
/**
|
|
355
|
+
* Client custom styling via inline styles
|
|
356
|
+
*/
|
|
357
|
+
this.clientStyling = '';
|
|
358
|
+
/**
|
|
359
|
+
* Client custom styling via url
|
|
360
|
+
*/
|
|
361
|
+
this.clientStylingUrl = '';
|
|
362
|
+
/**
|
|
363
|
+
* Translation via url
|
|
364
|
+
*/
|
|
365
|
+
this.translationUrl = '';
|
|
366
|
+
this.stylingAppends = false;
|
|
367
|
+
this.setClientStyling = () => {
|
|
368
|
+
let sheet = document.createElement('style');
|
|
369
|
+
sheet.innerHTML = this.clientStyling;
|
|
370
|
+
this.el.prepend(sheet);
|
|
371
|
+
};
|
|
372
|
+
this.setClientStylingURL = () => {
|
|
373
|
+
let url = new URL(this.clientStylingUrl);
|
|
374
|
+
let cssFile = document.createElement('style');
|
|
375
|
+
fetch(url.href)
|
|
376
|
+
.then((res) => res.text())
|
|
377
|
+
.then((data) => {
|
|
378
|
+
cssFile.innerHTML = data;
|
|
379
|
+
setTimeout(() => {
|
|
380
|
+
this.el.prepend(cssFile);
|
|
381
|
+
}, 1);
|
|
382
|
+
})
|
|
383
|
+
.catch((err) => {
|
|
384
|
+
console.log('error ', err);
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
componentDidRender() {
|
|
389
|
+
// start custom styling area
|
|
390
|
+
if (!this.stylingAppends) {
|
|
391
|
+
if (this.clientStyling)
|
|
392
|
+
this.setClientStyling();
|
|
393
|
+
if (this.clientStylingUrl)
|
|
394
|
+
this.setClientStylingURL();
|
|
395
|
+
this.stylingAppends = true;
|
|
396
|
+
}
|
|
397
|
+
// end custom styling area
|
|
398
|
+
}
|
|
399
|
+
async componentWillLoad() {
|
|
400
|
+
const promises = [];
|
|
401
|
+
if (this.translationUrl) {
|
|
402
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
403
|
+
promises.push(translationPromise);
|
|
404
|
+
}
|
|
405
|
+
return await Promise.all(promises);
|
|
406
|
+
}
|
|
407
|
+
render() {
|
|
408
|
+
return (index.h("div", { class: "StyleShell" }, index.h("slot", { name: "mainContent" })));
|
|
409
|
+
}
|
|
410
|
+
get el() { return index.getElement(this); }
|
|
411
|
+
};
|
|
412
|
+
GeneralStylingWrapper.style = generalStylingWrapperCss;
|
|
413
|
+
|
|
414
|
+
exports.bonus_elevate_levels = BonusElevateLevels;
|
|
415
|
+
exports.elevate_level_list = ElevateLevelList;
|
|
416
|
+
exports.elevate_level_presentation = ElevateLevelPresentation;
|
|
417
|
+
exports.elevate_levels_data = ElevateLevelsData;
|
|
418
|
+
exports.general_styling_wrapper = GeneralStylingWrapper;
|