@everymatrix/casino-engagement-suite-luckywheel 0.10.2 → 0.11.3
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/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-af14a77c.js +1 -0
- package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.entry.js +1 -1
- package/dist/casino-engagement-suite-luckywheel/index.esm.js +1 -1
- package/dist/cjs/{casino-engagement-suite-luckywheel-7f447bbb.js → casino-engagement-suite-luckywheel-990cb87a.js} +47 -57
- package/dist/cjs/casino-engagement-suite-luckywheel.cjs.entry.js +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/collection/components/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.js +47 -31
- package/dist/esm/{casino-engagement-suite-luckywheel-dd02aeae.js → casino-engagement-suite-luckywheel-af14a77c.js} +47 -57
- package/dist/esm/casino-engagement-suite-luckywheel.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/types/components/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.d.ts +3 -1
- package/dist/types/models/luckywheel.d.ts +12 -0
- package/package.json +1 -1
- package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-dd02aeae.js +0 -15
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/libs/common/src/storybook/storybook-utils.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.dev.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/main.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/preview.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/index.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-af14a77c.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,g as e}from"./index-48c42d04.js";var s,r,n,a,o,h;!function(t){t.Arrow="Arrow",t.Partition="Partition"}(s||(s={})),function(t){t.DownFromTop="DownFromTop",t.UpFromCenter="UpFromCenter",t.DownFromCenter="DownFromCenter",t.UpFromBottom="UpFromBottom"}(r||(r={})),function(t){t.en="en",t.fr="fr",t.de="de",t.tr="tr"}(n||(n={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(a||(a={})),function(t){t.launch="launch",t.loop="loop",t.halt="halt"}(o||(o={})),function(t){t.quad="quad",t.cubic="cubic",t.quart="quart",t.quint="quint",t.expo="expo",t.sine="sine",t.circ="circ"}(h||(h={}));const c=(t,i)=>{Object.keys(i).map((e=>{t.setAttribute(e.split(/(?=[A-Z])/).map((t=>t.toLocaleLowerCase())).join("-"),i[e])}))},d=t=>new Promise((i=>{let e=document.createElementNS("http://www.w3.org/2000/svg","image");e.onload=()=>i(e),e.onerror=()=>i(e),e.href.baseVal=t})),l=t=>({x:t,y:t}),u=(t,i)=>({x:t.x+i.x,y:t.y+i.y}),g={Image:"",Name:"Thank you",PrizeText:"",PrizeImage:""},b=async(t,i)=>{let e=((t,i)=>{const e=t.map((t=>{const e={};return Object.keys(t).map((s=>{"object"==typeof t[s]&&t[s]&&(e["Image1"===s?"Image":s]=t[s][i]||t[s]["*"])})),e}));return(t=>{let i=0;return t.map((t=>{i+=Number(t.probability)})),i})(t)<1&&e.push(g),e})(t.Program.WheelOfFortune.Partitions,i);return e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?e.map((t=>{if(t.Image){const i=document.createElementNS("http://www.w3.org/2000/svg","image");return i.href.baseVal=t.Image,Object.assign(Object.assign({},t),{Image:i})}return t})):await Promise.all(e.map((async t=>Object.assign(Object.assign({},t),await(async t=>t?{Image:await d(t)}:{})(t.Image))))),e},p={in:{quad:t=>Math.pow(t,2),cubic:t=>Math.pow(t,3),quart:t=>Math.pow(t,4),quint:t=>Math.pow(t,5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-Math.pow(t,2))},out:{quad:t=>1-Math.pow(1-t,2),cubic:t=>1-Math.pow(1-t,3),quart:t=>1-Math.pow(1-t,4),quint:t=>1-Math.pow(1-t,5),sine:t=>Math.sin(t*Math.PI/2),expo:t=>1===t?1:1-Math.pow(2,-10*t),circ:t=>Math.sqrt(1-Math.pow(t-1,2))}},f={quad:2,cubic:3,quart:4,quint:5,sine:Math.PI/2,expo:Math.LN2,circ:1/0},m={in:{quad:t=>2*t,cubic:t=>3*t**2,quart:t=>4*t**3,quint:t=>5*t**4,sine:t=>Math.PI/2*Math.sin(Math.PI/2*t),expo:t=>10*Math.LN2*2**(10*t-10),circ:t=>-.5*(1-t**2)**-.5},out:{cubic:t=>3*t**2-6*t+3}},y=[{launchTurns:5,launchSpeed:.2,loopSpeed:15,haltTurns:2,haltSpeed:.16},{launchTurns:2,launchSpeed:.5,loopSpeed:20,haltTurns:2,haltSpeed:.22},{launchTurns:6,launchSpeed:1.38,loopSpeed:45,haltTurns:6,haltSpeed:.5}],v=t=>Object.keys(t).map((i=>t[i]));var x;!function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise"}(x||(x={}));class w{constructor({size:t,radius:i,options:e,themeIndex:s,contentdirection:n}){this.arrowmode=r.DownFromTop,this.convertDegToArc=t=>t*Math.PI/180,this.convertArcToDeg=t=>180*t/Math.PI%360,this.getArcDelta=t=>2*Math.PI/t,this.findDeg=(t,i)=>t*this.convertArcToDeg(this.getArcDelta(i)),this.angleTransform=t=>{switch(t){case r.DownFromTop:case r.UpFromCenter:return-Math.PI/2;case r.DownFromCenter:case r.UpFromBottom:return Math.PI/2}},this.contentdirection=n,this.center=t/2,this.ratio=t/375,this.options=e,this.length=e.length,this.themeIndex=s,this.radius=i}get sizeImage(){const t=t=>48*this.ratio*5/t;if(this.length<=3)return t(4);switch(this.length){case 8:case 7:return 24*this.ratio;case 6:return 36*this.ratio;case 5:return 48*this.ratio;case 4:return 56*this.ratio;default:return t(this.length)}}getSizeImageByPartition(t){return this.options[t].Name?this.sizeImage/2:this.sizeImage}getSvgImageProps(t,i=1.25){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Name?this.radius-e/2-3*this.ratio:(this.radius-e/2)/Number(i)-3*this.ratio,Object.assign(Object.assign({},this.getPropsForPartitionInfo(t,this.getOffsetImage(e),s,a.outward)),{width:e,height:e})}getSvgTextProps(t,i){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Image?this.radius-e-6*this.ratio:this.radius-6*this.ratio,Object.assign({},this.getPropsForPartitionInfo(t,this.offsetText,s,void 0,i))}getSvgTextPropsAdjustedByImage(t){const i=this.getSvgTextProps(t,this.options[t].Image?80:100);return Object.assign({},i)}get offsetText(){return{center:0,position:{x:0,y:0},transform:{x:0,y:0}}}getOffsetImage(t){return{center:0,position:{x:-1*t/2,y:-1*t/2},transform:{x:0,y:0}}}get direction(){return x.clockwise}getAngleSelf(t,i){return 360*t/this.length*this.direction+90*(void 0!==i?i:a[this.contentdirection])}getPartitionPositions(t,i,e){const s=this.angleTransform(this.arrowmode)+this.direction*t*2*Math.PI/this.length,r=((t,i,e)=>{const s=l(e);return{x:s.x+t*Math.cos(i),y:s.y+t*Math.sin(i)}})(i||this.radius-9*this.ratio,s,this.center+e.center);return{transformOrigin:u(r,e.transform),point:u(r,e.position)}}getPropsForPartitionInfo(t,i,e,s,r){const{point:n,transformOrigin:a}=this.getPartitionPositions(t,e,i);return Object.assign(Object.assign({},n),{style:{"font-size":13*this.ratio+"px",transform:`rotate(${this.getAngleSelf(t,s)}deg) translate(${"clockwise"===this.contentdirection?n.x:n.x-100}px, ${n.y-50}px)`,"transform-origin":`${o=a,Object.keys(o).map((t=>`${o[t]}px`)).join(" ")}`,height:`${r}px`,width:`${r}px`}});var o}getPartitionDraw(t){const i=l(this.center),e=l(this.radius),{point:s,pointNext:r}=((t,i,e,s)=>{const r=t=>((t,i,e,s)=>{const r=Math.PI/180*(360/i*(t-.5)-90),n=l(s),a=l(e);return{x:n.x+a.x*Math.cos(r),y:n.y+a.y*Math.sin(r)}})(t,i,e,s);return{point:r(t),pointNext:r(t+1)}})(t,this.length,this.radius,this.center);return{d:["M",...v(i),"L",...v(s),"A",...v(e),"0 0 1",...v(r),"Z"].join(" ")}}getDeg(t){return this.findDeg(this.length-(t||this.length-1),this.length)}getSpinnerProps(){const t=l(this.center);return{"transform-origin":`${t.x} ${t.y}`}}}class k{constructor(t){this.deg=0,this.degTarget=void 0,this.step=void 0,this.easingType=h.cubic,this.param=y[2],this.halt=(t,i=(()=>{}))=>{this.shouldHalt=()=>{this.step=o.halt,this.cb=()=>{i(),this.setDeg(t,0)},this.degTarget=t+360*this.param.haltTurns,this.continueRepeat()}},this.continueRepeat=()=>setTimeout((()=>this.ticker()),30),this.ticker=()=>{const t=this.param.loopSpeed,i=t=>33*f[this.easingType]*t/this.param.loopSpeed,e=()=>{const t=360*this.param.launchTurns-this.deg,e=i(t);this.animateF(e,this.deg,t,p.in[this.easingType],m.in[this.easingType])},s=()=>{const t=i(this.degTarget);this.animateF(t,0,this.degTarget,p.out[this.easingType],m.out[this.easingType])},r=()=>{this.setDeg((this.deg+t)%360,f[this.easingType]),this.continueRepeat()};({[o.launch]:()=>{this.cb=()=>{this.step=o.loop,this.setDeg(t,f[this.easingType]),this.continueRepeat()},e()},[o.loop]:()=>{this.shouldHalt&&0===this.deg?this.shouldHalt():r()},[o.halt]:()=>{this.deg===360-t?s():r()}})[this.step]()},this.setDeg=(t,i)=>{this.deg=t,this.tick(t,i)},this.animateF=(t,i,e,s,r)=>{let n=null;const a=()=>{let o=(new Date).getTime();n||(n=o);const h=o-n,c=e*s(h/t)+i,d=Math.abs(r(h/t));this.setDeg(c,d),h<t?setTimeout((()=>a()),30):this.cb()};a()},this.animate=(t,i,e,s,r)=>{let n=null;window.cancelAnimationFrame(n);let a=null;const o=h=>{a||(a=h);const c=h-a,d=e*s(c/t)+i,l=Math.abs(r(c/t));this.setDeg(d,l),c<t?n=window.requestAnimationFrame(o):this.cb()};n=window.requestAnimationFrame(o)},this.tick=t.tick}launch(){this.shouldHalt=void 0,this.step=o.launch,this.ticker()}}const P=class{constructor(i){t(this,i),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.host.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.host.prepend(i)}),1)})).catch((t=>{console.log("Error ",t)}))},this.renderImage=(t,i)=>{const e=this.options[i].Image;c(e,this.settings.getSvgImageProps(i)),t.innerHTML=null,t.appendChild(e)},this.updateSpinable=()=>{if(this.luckywheel.Current){if(Number(this.luckywheel.Current.RemainingTimes)>0)return void(this.spinable=!0);window.postMessage({type:"ShowNoSpinLeftModal"})}this.spinable=!1},this.eventSpin=()=>{this.updateSpinable(),this.spinable&&!this.isSpinning&&(this.isSpinning=!0,this.spinContainer=this.svg.querySelector("g.PartitionsContainer"),this.spinner.launch(),window.postMessage({type:"SpinLuckyWheel",data:{lotteryProgramID:this.luckywheel.Program.Id}}))},this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.luckywheel=void 0,this.size="440",this.contentdirection="anticlockwise",this.limitStylingAppends=!1,this.isPartitionsCustomableReady=!1,this.isSpinning=!1,this.options=void 0,this.radius=.85*Number(this.size)/2,this.speed=0,this.settings=void 0,this.svg=void 0,this.spinContainer=void 0,this.spinable=void 0,this.spinner=void 0}handleEvent(t){const{type:i,success:e,data:s}=null==t?void 0:t.data;"SpinLuckyWheelRes"===i&&this.isSpinning&&(e?this.handleSpinResult(s):this.handleSpinError())}handleSpinError(){this.spinner.halt(0,(()=>{this.isSpinning=!1,this.updateSpinable(),window.postMessage({type:"ShowLuckywheelRewardModal",data:{HasError:!0}})}))}handleSpinResult(t){if(this.luckywheel.Program.Id===t.LotteryProgramID){const i=+t.Result.WheelOfFortunePartitionIndex;this.spinner.halt(this.settings.getDeg(i),(()=>{var t;this.isSpinning=!1,this.updateSpinable();const e=null===(t=this.luckywheel.Program.WheelOfFortune.Partitions[i])||void 0===t?void 0:t.PrizeText;window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeMessage:e[this.language]||e["*"],HasError:!1}})}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}async componentWillLoad(){this.options=await b(this.luckywheel,n.en),this.settings=new w({size:this.size,radius:this.radius,options:this.options,themeIndex:1,contentdirection:this.contentdirection}),this.spinner=new k({tick:(t,i)=>{c(this.spinContainer,{style:[`transform: rotate(${t}deg)`,`height: ${this.size}px`,`width: ${this.size}px`].join(";")}),this.speed=.5*i}})}defineGeneralVariables(){return{"--length":`${this.options.length}`,"--radius":`${this.radius}`,"--ratio":""+Number(this.size)/480,"--size":`${this.size}`}}setSvgSize(t){if(!t||!this.size)return;const i=this.size.toString();t.getAttribute("width")!==i&&t.setAttribute("width",i),t.getAttribute("height")!==i&&t.setAttribute("height",i)}render(){const t={height:`${this.size}px`,width:`${this.size}px`};return i("div",{key:"5a2bd14583c0203c1f0c1bf08b1e0bfb03f6b67c",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"a126763387e8e0b2cf17114611683a96f88c19d0",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",{key:"6e1d4403bfd457531dd7796985a53a21a06e5170",ref:this.setSvgSize.bind(this),class:"Bottom Customable"},i("div",{key:"76ddd407e5fb8ca8b45d941e484517fce1e9ac81",style:t})),i("g",Object.assign({key:"54db6c2dff0f2b04eebcea9c172c5b31b03cced1",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"0e6b85cb47c5a5d93ea6ea83fb79940c2a3b8a36",class:"PartitionsBackgrounds"},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),"clip-path":`url(#clip${s})`,class:"PartitionBackground Customable",style:Object.assign({"--index":s.toString()},t)},i("div",{style:t}))))),i("g",{key:"4a80e2032c9ae8c098959fd4d840990852c274ad",class:"PartitionsBackgroundStrokes"},this.options.map(((t,e)=>i("path",Object.assign({class:"PartitionBackgroundStroke"},this.settings.getPartitionDraw(e),{width:this.size,height:this.size}))))),i("g",{key:"1627351fb8ca3c8bf14a0a094b23a66ff229ed41",class:"Partitions",style:{filter:this.speed>.3?`blur(${this.speed}px)`:""}},this.options.map(((t,e)=>[t.Image&&i("g",{class:`PartitionImage PartitionImage${e}`,ref:t=>this.renderImage(t,e)}),t.Name&&i("foreignObject",Object.assign({class:"PartitionText",ref:t=>{if(t){const i=this.options[e].Image?"80":"100";t.setAttribute("width",i),t.setAttribute("height",i)}}},this.settings.getSvgTextPropsAdjustedByImage(e)),i("div",{class:"PartitionTextEntityContainer"},i("p",{class:"PartitionTextEntity"+("clockwise"===this.settings.contentdirection?"":" Anticlockwise"),innerHTML:t.Name})))])))),i("g",{key:"9613e4e8d20d71b7f4235d8525fc37c81ce31888",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable1:!0}},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),class:"Partition1 Customable",style:{"--index":s.toString()}},i("div",{style:t}))))),i("g",{key:"ce76408c4d29c88e52f5ad63e6a82656764d382d",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable2:!0}},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),class:"Partition2 Customable",style:{"--index":s.toString()}},i("div",{style:t}))))),i("foreignObject",{key:"0b04e8ec26b833c76f1cce80434de36a8fbdd1f3",ref:this.setSvgSize.bind(this),class:"Middle Customable",style:t},i("div",{key:"4f73cd8bf70df4aca04be1a39fa6d86ad3b310bf",style:t})),i("foreignObject",{key:"4424537d5b9e6580f1992bb6b0e20b888a108466",ref:this.setSvgSize.bind(this),class:"Top Customable",style:t},i("div",{key:"97ea30e77c51acc82057029d329dc439b3f0f40b",style:t})),i("g",{key:"c380d42505a1db3bb3e579de26815617451f3f17",class:{spinning:this.isSpinning,Center:!0}},i("foreignObject",{key:"b0b8b2d4dd157290942fc02392db8846ba7175b8",ref:t=>{t&&(t.setAttribute("width","100"),t.setAttribute("height","100"))},style:{transform:`translate(${Number(this.size)/2-50}px, ${Number(this.size)/2-50}px)`}},i("div",{key:"5989d7a1345891594a4c0e4d1b1355e7b4944779",style:{width:"100px",height:"100px",cursor:"pointer"},onClick:this.eventSpin}))),i("g",{key:"5d43bb8ecefc96b9a382e5a8801b98c71a1ffe2c"},this.options.map(((t,e)=>i("clipPath",{id:`clip${e}`},i("path",Object.assign({},this.settings.getPartitionDraw(e)))))))))}get host(){return e(this)}};P.style=':host{font-family:system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"}*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.LotteryProgramWof{background:var(--emw--color-contrast, #07072A);display:flex;align-items:center;flex-direction:column;padding:20px 0}main{max-width:600px;width:100%;display:flex;justify-content:space-around;min-height:200px}svg{transition:opacity 0.3s}.WheelContainer{text-align:center}.FortuneContainer{width:100%;display:flex;align-items:center;flex-direction:column}.Center{cursor:pointer;transition:filter;transition-duration:1s}.Center.disabled{filter:grayscale(80%)}.Center .CenterCircle{fill:#3CE4BB;stroke:rgb(150, 54, 88);stroke-width:2px;cursor:pointer;transition:fill;transition-duration:1s}.Center .CenterText{fill:#FFFFFF}.PointerPartition{opacity:0.3;fill:lightgoldenrodyellow;stroke:red;stroke-width:6px;stroke-dasharray:12}.Current{color:#FFFFFF}.PartitionText{color:#FFFFFF;font-style:normal;font-weight:700;text-anchor:end;text-shadow:0px 3px #000;dominant-baseline:central}.PartitionsShadow{background-blend-mode:multiply;mix-blend-mode:multiply}.PartitionTextEntityContainer{height:100%;display:flex;align-items:center}.PartitionTextEntity{width:100%}.PartitionTextEntity.Anticlockwise{text-align:end}foreignObject.Bottom div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-bg.svg");background-size:calc(var(--radius) * 2px + var(--ratio) * 20px);background-position:center}foreignObject.Middle div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-spin.svg"), url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-pointer.svg");background-position:center, center 5px}foreignObject.Top{mix-blend-mode:multiply}foreignObject.Top div{background-image:var(--img-theme-shadow);background-position:center;background-size:calc(var(--radius) * 2px)}foreignObject.Partition1 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc(var(--index) * 360deg / var(--length)))}foreignObject.Partition2 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc((var(--index) + 0.5) * 360deg / var(--length)))}foreignObject.PointerArea{mix-blend-mode:screen}foreignObject.PointerArea div{background-image:var(--img-theme-pointer-area);background-position:center -3px;background-size:51%}foreignObject.Partition1 div,foreignObject.Partition2 div{transform-origin:center}.PartitionsCustomable1 div,.PartitionsCustomable2 div{visibility:hidden}.PartitionsCustomable1 div.active,.PartitionsCustomable2 div.active{visibility:visible}foreignObject.Customable{overflow:visible}foreignObject.Customable div{background-repeat:no-repeat}.PartitionBackground div{background-size:calc(var(--radius) * 2 / var(--size) * 100%) calc(var(--radius) * 2 / var(--size) * 100%);background-position:center}.PartitionBackground:nth-child(2n) div{background:var(--emw--color-primary, #3F2E75)}.PartitionBackground:nth-child(2n+1) div{background:var(--emw--color-secondary, #9482CE)}.PartitionBackground div{transform-origin:center}.PartitionBackgroundStroke{fill:transparent;stroke:var(--emw--color-background-secondary, #251D3E);stroke-width:3px;stroke-dasharray:none}.PointerPartitionFrame{stroke:#FFDD64;fill:transparent;stroke-dasharray:var(--radius) calc(6.2831853072 / var(--length) * var(--radius));stroke-width:0px}.PointerPartitionFrame.active{stroke-width:3px}.WheelContainer.Mobile foreignObject.Middle div{background-size:95px, 38px}.PartitionText .PartitionTextEntityContainer .PartitionTextEntity{text-align:center;text-transform:uppercase;text-shadow:none;font-size:var(--emw--font-size-small, 14px);font-weight:900}';export{P as C}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{C as casino_engagement_suite_luckywheel}from"./casino-engagement-suite-luckywheel-
|
|
1
|
+
export{C as casino_engagement_suite_luckywheel}from"./casino-engagement-suite-luckywheel-af14a77c.js";import"./index-48c42d04.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{C as CasinoEngagementSuiteLuckywheel}from"./casino-engagement-suite-luckywheel-
|
|
1
|
+
export{C as CasinoEngagementSuiteLuckywheel}from"./casino-engagement-suite-luckywheel-af14a77c.js";import"./index-48c42d04.js";
|
|
@@ -2,33 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-6096cc4b.js');
|
|
4
4
|
|
|
5
|
-
/*! *****************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
|
|
20
|
-
function __rest(s, e) {
|
|
21
|
-
var t = {};
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
-
t[p] = s[p];
|
|
24
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
-
t[p[i]] = s[p[i]];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
5
|
var PointerMode;
|
|
33
6
|
(function (PointerMode) {
|
|
34
7
|
PointerMode["Arrow"] = "Arrow";
|
|
@@ -632,34 +605,51 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
632
605
|
this.spinner = undefined;
|
|
633
606
|
}
|
|
634
607
|
handleEvent(e) {
|
|
635
|
-
const
|
|
608
|
+
const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
|
|
636
609
|
switch (type) {
|
|
637
610
|
case 'SpinLuckyWheelRes':
|
|
638
|
-
if (this.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
this.
|
|
644
|
-
|
|
645
|
-
let prizeText = '';
|
|
646
|
-
if (!hasError) {
|
|
647
|
-
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
648
|
-
prizeText = partition[this.language] || partition['*'];
|
|
649
|
-
this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
|
|
650
|
-
}
|
|
651
|
-
window.postMessage({
|
|
652
|
-
type: 'ShowLuckywheelRewardModal',
|
|
653
|
-
data: {
|
|
654
|
-
PrizeMessage: prizeText,
|
|
655
|
-
HasError: hasError
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
});
|
|
611
|
+
if (this.isSpinning) {
|
|
612
|
+
if (!success) {
|
|
613
|
+
this.handleSpinError();
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
this.handleSpinResult(data);
|
|
617
|
+
}
|
|
659
618
|
}
|
|
660
619
|
break;
|
|
661
620
|
}
|
|
662
621
|
}
|
|
622
|
+
handleSpinError() {
|
|
623
|
+
this.spinner.halt(0, () => {
|
|
624
|
+
this.isSpinning = false;
|
|
625
|
+
this.updateSpinable();
|
|
626
|
+
window.postMessage({
|
|
627
|
+
type: 'ShowLuckywheelRewardModal',
|
|
628
|
+
data: {
|
|
629
|
+
HasError: true
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
handleSpinResult(data) {
|
|
635
|
+
if (this.luckywheel.Program.Id === data.LotteryProgramID) {
|
|
636
|
+
const index = +data.Result.WheelOfFortunePartitionIndex;
|
|
637
|
+
this.spinner.halt(this.settings.getDeg(index), () => {
|
|
638
|
+
var _a;
|
|
639
|
+
this.isSpinning = false;
|
|
640
|
+
this.updateSpinable();
|
|
641
|
+
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
642
|
+
const prizeText = partition[this.language] || partition['*'];
|
|
643
|
+
window.postMessage({
|
|
644
|
+
type: 'ShowLuckywheelRewardModal',
|
|
645
|
+
data: {
|
|
646
|
+
PrizeMessage: prizeText,
|
|
647
|
+
HasError: false
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
663
653
|
componentDidRender() {
|
|
664
654
|
if (!this.limitStylingAppends && this.host) {
|
|
665
655
|
if (this.clientStyling)
|
|
@@ -708,13 +698,13 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
708
698
|
}
|
|
709
699
|
render() {
|
|
710
700
|
const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
|
|
711
|
-
return (index.h("div", { key: '
|
|
701
|
+
return (index.h("div", { key: '5a2bd14583c0203c1f0c1bf08b1e0bfb03f6b67c', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, index.h("svg", { key: 'a126763387e8e0b2cf17114611683a96f88c19d0', width: this.size, height: this.size, ref: (el) => {
|
|
712
702
|
this.svg = el;
|
|
713
|
-
} }, index.h("foreignObject", { key: '
|
|
703
|
+
} }, index.h("foreignObject", { key: '6e1d4403bfd457531dd7796985a53a21a06e5170', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, index.h("div", { key: '76ddd407e5fb8ca8b45d941e484517fce1e9ac81', style: foreignObjectAgentProps })), index.h("g", Object.assign({ key: '54db6c2dff0f2b04eebcea9c172c5b31b03cced1', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), index.h("g", { key: '0e6b85cb47c5a5d93ea6ea83fb79940c2a3b8a36', class: "PartitionsBackgrounds" }, this.options.map((_el, index$1) => {
|
|
714
704
|
return (index.h("foreignObject", { ref: this.setSvgSize.bind(this), "clip-path": `url(#clip${index$1})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index$1.toString() }, foreignObjectAgentProps) }, index.h("div", { style: foreignObjectAgentProps })));
|
|
715
|
-
})), index.h("g", { key: '
|
|
705
|
+
})), index.h("g", { key: '4a80e2032c9ae8c098959fd4d840990852c274ad', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index$1) => {
|
|
716
706
|
return (index.h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index$1), { width: this.size, height: this.size })));
|
|
717
|
-
})), index.h("g", { key: '
|
|
707
|
+
})), index.h("g", { key: '1627351fb8ca3c8bf14a0a094b23a66ff229ed41', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index$1) => {
|
|
718
708
|
return [
|
|
719
709
|
el.Image && (index.h("g", { class: `PartitionImage PartitionImage${index$1}`, ref: (el) => this.renderImage(el, index$1) })),
|
|
720
710
|
el.Name && (index.h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
|
|
@@ -725,18 +715,18 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
725
715
|
}
|
|
726
716
|
} }, this.settings.getSvgTextPropsAdjustedByImage(index$1)), index.h("div", { class: "PartitionTextEntityContainer" }, index.h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
|
|
727
717
|
];
|
|
728
|
-
}))), index.h("g", { key: '
|
|
718
|
+
}))), index.h("g", { key: '9613e4e8d20d71b7f4235d8525fc37c81ce31888', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index$1) => {
|
|
729
719
|
return (index.h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index$1.toString() } }, index.h("div", { style: foreignObjectAgentProps })));
|
|
730
|
-
})), index.h("g", { key: '
|
|
720
|
+
})), index.h("g", { key: 'ce76408c4d29c88e52f5ad63e6a82656764d382d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index$1) => {
|
|
731
721
|
return (index.h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index$1.toString() } }, index.h("div", { style: foreignObjectAgentProps })));
|
|
732
|
-
})), index.h("foreignObject", { key: '
|
|
722
|
+
})), index.h("foreignObject", { key: '0b04e8ec26b833c76f1cce80434de36a8fbdd1f3', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, index.h("div", { key: '4f73cd8bf70df4aca04be1a39fa6d86ad3b310bf', style: foreignObjectAgentProps })), index.h("foreignObject", { key: '4424537d5b9e6580f1992bb6b0e20b888a108466', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, index.h("div", { key: '97ea30e77c51acc82057029d329dc439b3f0f40b', style: foreignObjectAgentProps })), index.h("g", { key: 'c380d42505a1db3bb3e579de26815617451f3f17', class: { spinning: this.isSpinning, Center: true } }, index.h("foreignObject", { key: 'b0b8b2d4dd157290942fc02392db8846ba7175b8', ref: (el) => {
|
|
733
723
|
if (el) {
|
|
734
724
|
el.setAttribute('width', '100');
|
|
735
725
|
el.setAttribute('height', '100');
|
|
736
726
|
}
|
|
737
727
|
}, style: {
|
|
738
728
|
transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
|
|
739
|
-
} }, index.h("div", { key: '
|
|
729
|
+
} }, index.h("div", { key: '5989d7a1345891594a4c0e4d1b1355e7b4944779', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), index.h("g", { key: '5d43bb8ecefc96b9a382e5a8801b98c71a1ffe2c' }, this.options.map((_el, index$1) => {
|
|
740
730
|
return (index.h("clipPath", { id: `clip${index$1}` }, index.h("path", Object.assign({}, this.settings.getPartitionDraw(index$1)))));
|
|
741
731
|
})))));
|
|
742
732
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-
|
|
5
|
+
const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-990cb87a.js');
|
|
6
6
|
require('./index-6096cc4b.js');
|
|
7
7
|
|
|
8
8
|
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-
|
|
5
|
+
const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-990cb87a.js');
|
|
6
6
|
require('./index-6096cc4b.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
1
|
import { h } from "@stencil/core";
|
|
3
2
|
import { SvgCalc } from "../../utils/class.svgcalc";
|
|
4
3
|
import { Lang } from "../../utils/types";
|
|
@@ -79,34 +78,51 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
79
78
|
this.spinner = undefined;
|
|
80
79
|
}
|
|
81
80
|
handleEvent(e) {
|
|
82
|
-
const
|
|
81
|
+
const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
|
|
83
82
|
switch (type) {
|
|
84
83
|
case 'SpinLuckyWheelRes':
|
|
85
|
-
if (this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
let prizeText = '';
|
|
93
|
-
if (!hasError) {
|
|
94
|
-
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
95
|
-
prizeText = partition[this.language] || partition['*'];
|
|
96
|
-
this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
|
|
97
|
-
}
|
|
98
|
-
window.postMessage({
|
|
99
|
-
type: 'ShowLuckywheelRewardModal',
|
|
100
|
-
data: {
|
|
101
|
-
PrizeMessage: prizeText,
|
|
102
|
-
HasError: hasError
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
84
|
+
if (this.isSpinning) {
|
|
85
|
+
if (!success) {
|
|
86
|
+
this.handleSpinError();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.handleSpinResult(data);
|
|
90
|
+
}
|
|
106
91
|
}
|
|
107
92
|
break;
|
|
108
93
|
}
|
|
109
94
|
}
|
|
95
|
+
handleSpinError() {
|
|
96
|
+
this.spinner.halt(0, () => {
|
|
97
|
+
this.isSpinning = false;
|
|
98
|
+
this.updateSpinable();
|
|
99
|
+
window.postMessage({
|
|
100
|
+
type: 'ShowLuckywheelRewardModal',
|
|
101
|
+
data: {
|
|
102
|
+
HasError: true
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
handleSpinResult(data) {
|
|
108
|
+
if (this.luckywheel.Program.Id === data.LotteryProgramID) {
|
|
109
|
+
const index = +data.Result.WheelOfFortunePartitionIndex;
|
|
110
|
+
this.spinner.halt(this.settings.getDeg(index), () => {
|
|
111
|
+
var _a;
|
|
112
|
+
this.isSpinning = false;
|
|
113
|
+
this.updateSpinable();
|
|
114
|
+
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
115
|
+
const prizeText = partition[this.language] || partition['*'];
|
|
116
|
+
window.postMessage({
|
|
117
|
+
type: 'ShowLuckywheelRewardModal',
|
|
118
|
+
data: {
|
|
119
|
+
PrizeMessage: prizeText,
|
|
120
|
+
HasError: false
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
110
126
|
componentDidRender() {
|
|
111
127
|
if (!this.limitStylingAppends && this.host) {
|
|
112
128
|
if (this.clientStyling)
|
|
@@ -155,13 +171,13 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
155
171
|
}
|
|
156
172
|
render() {
|
|
157
173
|
const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
|
|
158
|
-
return (h("div", { key: '
|
|
174
|
+
return (h("div", { key: '5a2bd14583c0203c1f0c1bf08b1e0bfb03f6b67c', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: 'a126763387e8e0b2cf17114611683a96f88c19d0', width: this.size, height: this.size, ref: (el) => {
|
|
159
175
|
this.svg = el;
|
|
160
|
-
} }, h("foreignObject", { key: '
|
|
176
|
+
} }, h("foreignObject", { key: '6e1d4403bfd457531dd7796985a53a21a06e5170', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '76ddd407e5fb8ca8b45d941e484517fce1e9ac81', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '54db6c2dff0f2b04eebcea9c172c5b31b03cced1', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '0e6b85cb47c5a5d93ea6ea83fb79940c2a3b8a36', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
|
|
161
177
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index.toString() }, foreignObjectAgentProps) }, h("div", { style: foreignObjectAgentProps })));
|
|
162
|
-
})), h("g", { key: '
|
|
178
|
+
})), h("g", { key: '4a80e2032c9ae8c098959fd4d840990852c274ad', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
|
|
163
179
|
return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
|
|
164
|
-
})), h("g", { key: '
|
|
180
|
+
})), h("g", { key: '1627351fb8ca3c8bf14a0a094b23a66ff229ed41', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
|
|
165
181
|
return [
|
|
166
182
|
el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
|
|
167
183
|
el.Name && (h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
|
|
@@ -172,18 +188,18 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
172
188
|
}
|
|
173
189
|
} }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
|
|
174
190
|
];
|
|
175
|
-
}))), h("g", { key: '
|
|
191
|
+
}))), h("g", { key: '9613e4e8d20d71b7f4235d8525fc37c81ce31888', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
|
|
176
192
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
|
|
177
|
-
})), h("g", { key: '
|
|
193
|
+
})), h("g", { key: 'ce76408c4d29c88e52f5ad63e6a82656764d382d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
|
|
178
194
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
|
|
179
|
-
})), h("foreignObject", { key: '
|
|
195
|
+
})), h("foreignObject", { key: '0b04e8ec26b833c76f1cce80434de36a8fbdd1f3', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: '4f73cd8bf70df4aca04be1a39fa6d86ad3b310bf', style: foreignObjectAgentProps })), h("foreignObject", { key: '4424537d5b9e6580f1992bb6b0e20b888a108466', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '97ea30e77c51acc82057029d329dc439b3f0f40b', style: foreignObjectAgentProps })), h("g", { key: 'c380d42505a1db3bb3e579de26815617451f3f17', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: 'b0b8b2d4dd157290942fc02392db8846ba7175b8', ref: (el) => {
|
|
180
196
|
if (el) {
|
|
181
197
|
el.setAttribute('width', '100');
|
|
182
198
|
el.setAttribute('height', '100');
|
|
183
199
|
}
|
|
184
200
|
}, style: {
|
|
185
201
|
transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
|
|
186
|
-
} }, h("div", { key: '
|
|
202
|
+
} }, h("div", { key: '5989d7a1345891594a4c0e4d1b1355e7b4944779', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: '5d43bb8ecefc96b9a382e5a8801b98c71a1ffe2c' }, this.options.map((_el, index) => {
|
|
187
203
|
return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
|
|
188
204
|
})))));
|
|
189
205
|
}
|
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement } from './index-48c42d04.js';
|
|
2
2
|
|
|
3
|
-
/*! *****************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
|
|
18
|
-
function __rest(s, e) {
|
|
19
|
-
var t = {};
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
23
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
24
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
25
|
-
t[p[i]] = s[p[i]];
|
|
26
|
-
}
|
|
27
|
-
return t;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
3
|
var PointerMode;
|
|
31
4
|
(function (PointerMode) {
|
|
32
5
|
PointerMode["Arrow"] = "Arrow";
|
|
@@ -630,34 +603,51 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
630
603
|
this.spinner = undefined;
|
|
631
604
|
}
|
|
632
605
|
handleEvent(e) {
|
|
633
|
-
const
|
|
606
|
+
const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
|
|
634
607
|
switch (type) {
|
|
635
608
|
case 'SpinLuckyWheelRes':
|
|
636
|
-
if (this.
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
this.
|
|
642
|
-
|
|
643
|
-
let prizeText = '';
|
|
644
|
-
if (!hasError) {
|
|
645
|
-
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
646
|
-
prizeText = partition[this.language] || partition['*'];
|
|
647
|
-
this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
|
|
648
|
-
}
|
|
649
|
-
window.postMessage({
|
|
650
|
-
type: 'ShowLuckywheelRewardModal',
|
|
651
|
-
data: {
|
|
652
|
-
PrizeMessage: prizeText,
|
|
653
|
-
HasError: hasError
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
});
|
|
609
|
+
if (this.isSpinning) {
|
|
610
|
+
if (!success) {
|
|
611
|
+
this.handleSpinError();
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
this.handleSpinResult(data);
|
|
615
|
+
}
|
|
657
616
|
}
|
|
658
617
|
break;
|
|
659
618
|
}
|
|
660
619
|
}
|
|
620
|
+
handleSpinError() {
|
|
621
|
+
this.spinner.halt(0, () => {
|
|
622
|
+
this.isSpinning = false;
|
|
623
|
+
this.updateSpinable();
|
|
624
|
+
window.postMessage({
|
|
625
|
+
type: 'ShowLuckywheelRewardModal',
|
|
626
|
+
data: {
|
|
627
|
+
HasError: true
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
handleSpinResult(data) {
|
|
633
|
+
if (this.luckywheel.Program.Id === data.LotteryProgramID) {
|
|
634
|
+
const index = +data.Result.WheelOfFortunePartitionIndex;
|
|
635
|
+
this.spinner.halt(this.settings.getDeg(index), () => {
|
|
636
|
+
var _a;
|
|
637
|
+
this.isSpinning = false;
|
|
638
|
+
this.updateSpinable();
|
|
639
|
+
const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
|
|
640
|
+
const prizeText = partition[this.language] || partition['*'];
|
|
641
|
+
window.postMessage({
|
|
642
|
+
type: 'ShowLuckywheelRewardModal',
|
|
643
|
+
data: {
|
|
644
|
+
PrizeMessage: prizeText,
|
|
645
|
+
HasError: false
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
}
|
|
661
651
|
componentDidRender() {
|
|
662
652
|
if (!this.limitStylingAppends && this.host) {
|
|
663
653
|
if (this.clientStyling)
|
|
@@ -706,13 +696,13 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
706
696
|
}
|
|
707
697
|
render() {
|
|
708
698
|
const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
|
|
709
|
-
return (h("div", { key: '
|
|
699
|
+
return (h("div", { key: '5a2bd14583c0203c1f0c1bf08b1e0bfb03f6b67c', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: 'a126763387e8e0b2cf17114611683a96f88c19d0', width: this.size, height: this.size, ref: (el) => {
|
|
710
700
|
this.svg = el;
|
|
711
|
-
} }, h("foreignObject", { key: '
|
|
701
|
+
} }, h("foreignObject", { key: '6e1d4403bfd457531dd7796985a53a21a06e5170', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '76ddd407e5fb8ca8b45d941e484517fce1e9ac81', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '54db6c2dff0f2b04eebcea9c172c5b31b03cced1', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '0e6b85cb47c5a5d93ea6ea83fb79940c2a3b8a36', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
|
|
712
702
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index.toString() }, foreignObjectAgentProps) }, h("div", { style: foreignObjectAgentProps })));
|
|
713
|
-
})), h("g", { key: '
|
|
703
|
+
})), h("g", { key: '4a80e2032c9ae8c098959fd4d840990852c274ad', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
|
|
714
704
|
return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
|
|
715
|
-
})), h("g", { key: '
|
|
705
|
+
})), h("g", { key: '1627351fb8ca3c8bf14a0a094b23a66ff229ed41', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
|
|
716
706
|
return [
|
|
717
707
|
el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
|
|
718
708
|
el.Name && (h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
|
|
@@ -723,18 +713,18 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
723
713
|
}
|
|
724
714
|
} }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
|
|
725
715
|
];
|
|
726
|
-
}))), h("g", { key: '
|
|
716
|
+
}))), h("g", { key: '9613e4e8d20d71b7f4235d8525fc37c81ce31888', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
|
|
727
717
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
|
|
728
|
-
})), h("g", { key: '
|
|
718
|
+
})), h("g", { key: 'ce76408c4d29c88e52f5ad63e6a82656764d382d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
|
|
729
719
|
return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
|
|
730
|
-
})), h("foreignObject", { key: '
|
|
720
|
+
})), h("foreignObject", { key: '0b04e8ec26b833c76f1cce80434de36a8fbdd1f3', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: '4f73cd8bf70df4aca04be1a39fa6d86ad3b310bf', style: foreignObjectAgentProps })), h("foreignObject", { key: '4424537d5b9e6580f1992bb6b0e20b888a108466', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '97ea30e77c51acc82057029d329dc439b3f0f40b', style: foreignObjectAgentProps })), h("g", { key: 'c380d42505a1db3bb3e579de26815617451f3f17', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: 'b0b8b2d4dd157290942fc02392db8846ba7175b8', ref: (el) => {
|
|
731
721
|
if (el) {
|
|
732
722
|
el.setAttribute('width', '100');
|
|
733
723
|
el.setAttribute('height', '100');
|
|
734
724
|
}
|
|
735
725
|
}, style: {
|
|
736
726
|
transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
|
|
737
|
-
} }, h("div", { key: '
|
|
727
|
+
} }, h("div", { key: '5989d7a1345891594a4c0e4d1b1355e7b4944779', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: '5d43bb8ecefc96b9a382e5a8801b98c71a1ffe2c' }, this.options.map((_el, index) => {
|
|
738
728
|
return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
|
|
739
729
|
})))));
|
|
740
730
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-
|
|
1
|
+
export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-af14a77c.js';
|
|
2
2
|
import './index-48c42d04.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as CasinoEngagementSuiteLuckywheel } from './casino-engagement-suite-luckywheel-
|
|
1
|
+
export { C as CasinoEngagementSuiteLuckywheel } from './casino-engagement-suite-luckywheel-af14a77c.js';
|
|
2
2
|
import './index-48c42d04.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentDirection, LuckyWheel } from '../../models/luckywheel';
|
|
1
|
+
import { ContentDirection, ISpinLuckyWheelEventResult, LuckyWheel } from '../../models/luckywheel';
|
|
2
2
|
export declare class CasinoEngagementSuiteLuckywheel {
|
|
3
3
|
/**
|
|
4
4
|
* Client custom styling via string
|
|
@@ -41,6 +41,8 @@ export declare class CasinoEngagementSuiteLuckywheel {
|
|
|
41
41
|
spinable: boolean;
|
|
42
42
|
private spinner;
|
|
43
43
|
handleEvent(e: any): void;
|
|
44
|
+
handleSpinError(): void;
|
|
45
|
+
handleSpinResult(data: ISpinLuckyWheelEventResult): void;
|
|
44
46
|
componentDidRender(): void;
|
|
45
47
|
componentWillLoad(): Promise<void>;
|
|
46
48
|
setClientStyling: () => void;
|
|
@@ -55,3 +55,15 @@ export declare enum ContentDirection {
|
|
|
55
55
|
anticlockwise = -1,
|
|
56
56
|
outward = 0
|
|
57
57
|
}
|
|
58
|
+
export interface ISpinLuckyWheelEventResult {
|
|
59
|
+
Id: string;
|
|
60
|
+
LotteryProgramID: string;
|
|
61
|
+
LotteryProgramVersion: string;
|
|
62
|
+
LotteryProgramTicketID: string;
|
|
63
|
+
IdempotencyKey: string;
|
|
64
|
+
UserID: string;
|
|
65
|
+
State: string;
|
|
66
|
+
Result: {
|
|
67
|
+
WheelOfFortunePartitionIndex: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
package/package.json
CHANGED
package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-dd02aeae.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,g as e}from"./index-48c42d04.js";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var s,r,n,a,o,h;!function(t){t.Arrow="Arrow",t.Partition="Partition"}(s||(s={})),function(t){t.DownFromTop="DownFromTop",t.UpFromCenter="UpFromCenter",t.DownFromCenter="DownFromCenter",t.UpFromBottom="UpFromBottom"}(r||(r={})),function(t){t.en="en",t.fr="fr",t.de="de",t.tr="tr"}(n||(n={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(a||(a={})),function(t){t.launch="launch",t.loop="loop",t.halt="halt"}(o||(o={})),function(t){t.quad="quad",t.cubic="cubic",t.quart="quart",t.quint="quint",t.expo="expo",t.sine="sine",t.circ="circ"}(h||(h={}));const c=(t,i)=>{Object.keys(i).map((e=>{t.setAttribute(e.split(/(?=[A-Z])/).map((t=>t.toLocaleLowerCase())).join("-"),i[e])}))},d=t=>new Promise((i=>{let e=document.createElementNS("http://www.w3.org/2000/svg","image");e.onload=()=>i(e),e.onerror=()=>i(e),e.href.baseVal=t})),l=t=>({x:t,y:t}),u=(t,i)=>({x:t.x+i.x,y:t.y+i.y}),g={Image:"",Name:"Thank you",PrizeText:"",PrizeImage:""},b=async(t,i)=>{let e=((t,i)=>{const e=t.map((t=>{const e={};return Object.keys(t).map((s=>{"object"==typeof t[s]&&t[s]&&(e["Image1"===s?"Image":s]=t[s][i]||t[s]["*"])})),e}));return(t=>{let i=0;return t.map((t=>{i+=Number(t.probability)})),i})(t)<1&&e.push(g),e})(t.Program.WheelOfFortune.Partitions,i);return e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?e.map((t=>{if(t.Image){const i=document.createElementNS("http://www.w3.org/2000/svg","image");return i.href.baseVal=t.Image,Object.assign(Object.assign({},t),{Image:i})}return t})):await Promise.all(e.map((async t=>Object.assign(Object.assign({},t),await(async t=>t?{Image:await d(t)}:{})(t.Image))))),e},f={in:{quad:t=>Math.pow(t,2),cubic:t=>Math.pow(t,3),quart:t=>Math.pow(t,4),quint:t=>Math.pow(t,5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-Math.pow(t,2))},out:{quad:t=>1-Math.pow(1-t,2),cubic:t=>1-Math.pow(1-t,3),quart:t=>1-Math.pow(1-t,4),quint:t=>1-Math.pow(1-t,5),sine:t=>Math.sin(t*Math.PI/2),expo:t=>1===t?1:1-Math.pow(2,-10*t),circ:t=>Math.sqrt(1-Math.pow(t-1,2))}},p={quad:2,cubic:3,quart:4,quint:5,sine:Math.PI/2,expo:Math.LN2,circ:1/0},m={in:{quad:t=>2*t,cubic:t=>3*t**2,quart:t=>4*t**3,quint:t=>5*t**4,sine:t=>Math.PI/2*Math.sin(Math.PI/2*t),expo:t=>10*Math.LN2*2**(10*t-10),circ:t=>-.5*(1-t**2)**-.5},out:{cubic:t=>3*t**2-6*t+3}},v=[{launchTurns:5,launchSpeed:.2,loopSpeed:15,haltTurns:2,haltSpeed:.16},{launchTurns:2,launchSpeed:.5,loopSpeed:20,haltTurns:2,haltSpeed:.22},{launchTurns:6,launchSpeed:1.38,loopSpeed:45,haltTurns:6,haltSpeed:.5}],y=t=>Object.keys(t).map((i=>t[i]));var x;!function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise"}(x||(x={}));class w{constructor({size:t,radius:i,options:e,themeIndex:s,contentdirection:n}){this.arrowmode=r.DownFromTop,this.convertDegToArc=t=>t*Math.PI/180,this.convertArcToDeg=t=>180*t/Math.PI%360,this.getArcDelta=t=>2*Math.PI/t,this.findDeg=(t,i)=>t*this.convertArcToDeg(this.getArcDelta(i)),this.angleTransform=t=>{switch(t){case r.DownFromTop:case r.UpFromCenter:return-Math.PI/2;case r.DownFromCenter:case r.UpFromBottom:return Math.PI/2}},this.contentdirection=n,this.center=t/2,this.ratio=t/375,this.options=e,this.length=e.length,this.themeIndex=s,this.radius=i}get sizeImage(){const t=t=>48*this.ratio*5/t;if(this.length<=3)return t(4);switch(this.length){case 8:case 7:return 24*this.ratio;case 6:return 36*this.ratio;case 5:return 48*this.ratio;case 4:return 56*this.ratio;default:return t(this.length)}}getSizeImageByPartition(t){return this.options[t].Name?this.sizeImage/2:this.sizeImage}getSvgImageProps(t,i=1.25){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Name?this.radius-e/2-3*this.ratio:(this.radius-e/2)/Number(i)-3*this.ratio,Object.assign(Object.assign({},this.getPropsForPartitionInfo(t,this.getOffsetImage(e),s,a.outward)),{width:e,height:e})}getSvgTextProps(t,i){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Image?this.radius-e-6*this.ratio:this.radius-6*this.ratio,Object.assign({},this.getPropsForPartitionInfo(t,this.offsetText,s,void 0,i))}getSvgTextPropsAdjustedByImage(t){const i=this.getSvgTextProps(t,this.options[t].Image?80:100);return Object.assign({},i)}get offsetText(){return{center:0,position:{x:0,y:0},transform:{x:0,y:0}}}getOffsetImage(t){return{center:0,position:{x:-1*t/2,y:-1*t/2},transform:{x:0,y:0}}}get direction(){return x.clockwise}getAngleSelf(t,i){return 360*t/this.length*this.direction+90*(void 0!==i?i:a[this.contentdirection])}getPartitionPositions(t,i,e){const s=this.angleTransform(this.arrowmode)+this.direction*t*2*Math.PI/this.length,r=((t,i,e)=>{const s=l(e);return{x:s.x+t*Math.cos(i),y:s.y+t*Math.sin(i)}})(i||this.radius-9*this.ratio,s,this.center+e.center);return{transformOrigin:u(r,e.transform),point:u(r,e.position)}}getPropsForPartitionInfo(t,i,e,s,r){const{point:n,transformOrigin:a}=this.getPartitionPositions(t,e,i);return Object.assign(Object.assign({},n),{style:{"font-size":13*this.ratio+"px",transform:`rotate(${this.getAngleSelf(t,s)}deg) translate(${"clockwise"===this.contentdirection?n.x:n.x-100}px, ${n.y-50}px)`,"transform-origin":`${o=a,Object.keys(o).map((t=>`${o[t]}px`)).join(" ")}`,height:`${r}px`,width:`${r}px`}});var o}getPartitionDraw(t){const i=l(this.center),e=l(this.radius),{point:s,pointNext:r}=((t,i,e,s)=>{const r=t=>((t,i,e,s)=>{const r=Math.PI/180*(360/i*(t-.5)-90),n=l(s),a=l(e);return{x:n.x+a.x*Math.cos(r),y:n.y+a.y*Math.sin(r)}})(t,i,e,s);return{point:r(t),pointNext:r(t+1)}})(t,this.length,this.radius,this.center);return{d:["M",...y(i),"L",...y(s),"A",...y(e),"0 0 1",...y(r),"Z"].join(" ")}}getDeg(t){return this.findDeg(this.length-(t||this.length-1),this.length)}getSpinnerProps(){const t=l(this.center);return{"transform-origin":`${t.x} ${t.y}`}}}class k{constructor(t){this.deg=0,this.degTarget=void 0,this.step=void 0,this.easingType=h.cubic,this.param=v[2],this.halt=(t,i=(()=>{}))=>{this.shouldHalt=()=>{this.step=o.halt,this.cb=()=>{i(),this.setDeg(t,0)},this.degTarget=t+360*this.param.haltTurns,this.continueRepeat()}},this.continueRepeat=()=>setTimeout((()=>this.ticker()),30),this.ticker=()=>{const t=this.param.loopSpeed,i=t=>33*p[this.easingType]*t/this.param.loopSpeed,e=()=>{const t=360*this.param.launchTurns-this.deg,e=i(t);this.animateF(e,this.deg,t,f.in[this.easingType],m.in[this.easingType])},s=()=>{const t=i(this.degTarget);this.animateF(t,0,this.degTarget,f.out[this.easingType],m.out[this.easingType])},r=()=>{this.setDeg((this.deg+t)%360,p[this.easingType]),this.continueRepeat()};({[o.launch]:()=>{this.cb=()=>{this.step=o.loop,this.setDeg(t,p[this.easingType]),this.continueRepeat()},e()},[o.loop]:()=>{this.shouldHalt&&0===this.deg?this.shouldHalt():r()},[o.halt]:()=>{this.deg===360-t?s():r()}})[this.step]()},this.setDeg=(t,i)=>{this.deg=t,this.tick(t,i)},this.animateF=(t,i,e,s,r)=>{let n=null;const a=()=>{let o=(new Date).getTime();n||(n=o);const h=o-n,c=e*s(h/t)+i,d=Math.abs(r(h/t));this.setDeg(c,d),h<t?setTimeout((()=>a()),30):this.cb()};a()},this.animate=(t,i,e,s,r)=>{let n=null;window.cancelAnimationFrame(n);let a=null;const o=h=>{a||(a=h);const c=h-a,d=e*s(c/t)+i,l=Math.abs(r(c/t));this.setDeg(d,l),c<t?n=window.requestAnimationFrame(o):this.cb()};n=window.requestAnimationFrame(o)},this.tick=t.tick}launch(){this.shouldHalt=void 0,this.step=o.launch,this.ticker()}}const P=class{constructor(i){t(this,i),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.host.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.host.prepend(i)}),1)})).catch((t=>{console.log("Error ",t)}))},this.renderImage=(t,i)=>{const e=this.options[i].Image;c(e,this.settings.getSvgImageProps(i)),t.innerHTML=null,t.appendChild(e)},this.updateSpinable=()=>{if(this.luckywheel.Current){if(Number(this.luckywheel.Current.RemainingTimes)>0)return void(this.spinable=!0);window.postMessage({type:"ShowNoSpinLeftModal"})}this.spinable=!1},this.eventSpin=()=>{this.updateSpinable(),this.spinable&&!this.isSpinning&&(this.isSpinning=!0,this.spinContainer=this.svg.querySelector("g.PartitionsContainer"),this.spinner.launch(),window.postMessage({type:"SpinLuckyWheel",data:{lotteryProgramID:this.luckywheel.Program.Id}}))},this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.luckywheel=void 0,this.size="440",this.contentdirection="anticlockwise",this.limitStylingAppends=!1,this.isPartitionsCustomableReady=!1,this.isSpinning=!1,this.options=void 0,this.radius=.85*Number(this.size)/2,this.speed=0,this.settings=void 0,this.svg=void 0,this.spinContainer=void 0,this.spinable=void 0,this.spinner=void 0}handleEvent(t){const i=null==t?void 0:t.data,{type:e}=i,s=function(t,i){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)i.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(e[s[r]]=t[s[r]])}return e}(i,["type"]);if("SpinLuckyWheelRes"===e&&this.luckywheel.Program.Id===s.data.LotteryProgramID){const t=!1===s.success,i=+s.data.Result.WheelOfFortunePartitionIndex;this.spinner.halt(this.settings.getDeg(i),(()=>{var e;this.isSpinning=!1,this.updateSpinable();let s="";if(!t){const t=null===(e=this.luckywheel.Program.WheelOfFortune.Partitions[i])||void 0===e?void 0:e.PrizeText;s=t[this.language]||t["*"],this.luckywheel.Current.RemainingTimes=+this.luckywheel.Current.RemainingTimes-1}window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeMessage:s,HasError:t}})}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}async componentWillLoad(){this.options=await b(this.luckywheel,n.en),this.settings=new w({size:this.size,radius:this.radius,options:this.options,themeIndex:1,contentdirection:this.contentdirection}),this.spinner=new k({tick:(t,i)=>{c(this.spinContainer,{style:[`transform: rotate(${t}deg)`,`height: ${this.size}px`,`width: ${this.size}px`].join(";")}),this.speed=.5*i}})}defineGeneralVariables(){return{"--length":`${this.options.length}`,"--radius":`${this.radius}`,"--ratio":""+Number(this.size)/480,"--size":`${this.size}`}}setSvgSize(t){if(!t||!this.size)return;const i=this.size.toString();t.getAttribute("width")!==i&&t.setAttribute("width",i),t.getAttribute("height")!==i&&t.setAttribute("height",i)}render(){const t={height:`${this.size}px`,width:`${this.size}px`};return i("div",{key:"78d086b46bc1bcacbe302865dc15c792c773804d",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"6901ab597372b7ae55054e29b5682c7d9b485009",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",{key:"b4c74fb0ca34aa758cf8c465f81a81c01f43105d",ref:this.setSvgSize.bind(this),class:"Bottom Customable"},i("div",{key:"8e28dd13395a973d85a9918c07823a50b4f321b3",style:t})),i("g",Object.assign({key:"60e57cf4d3a9d67d9518bf2ec6bf4ea424ea9fb0",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"df9c0a5a3dce9af3c52d0078aba94dd7fb282e93",class:"PartitionsBackgrounds"},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),"clip-path":`url(#clip${s})`,class:"PartitionBackground Customable",style:Object.assign({"--index":s.toString()},t)},i("div",{style:t}))))),i("g",{key:"68459c2a782308b0fe0bf3cd5f2af7fba9b3cb21",class:"PartitionsBackgroundStrokes"},this.options.map(((t,e)=>i("path",Object.assign({class:"PartitionBackgroundStroke"},this.settings.getPartitionDraw(e),{width:this.size,height:this.size}))))),i("g",{key:"861cb52c03df6c1382444f39faddb655e3cfc666",class:"Partitions",style:{filter:this.speed>.3?`blur(${this.speed}px)`:""}},this.options.map(((t,e)=>[t.Image&&i("g",{class:`PartitionImage PartitionImage${e}`,ref:t=>this.renderImage(t,e)}),t.Name&&i("foreignObject",Object.assign({class:"PartitionText",ref:t=>{if(t){const i=this.options[e].Image?"80":"100";t.setAttribute("width",i),t.setAttribute("height",i)}}},this.settings.getSvgTextPropsAdjustedByImage(e)),i("div",{class:"PartitionTextEntityContainer"},i("p",{class:"PartitionTextEntity"+("clockwise"===this.settings.contentdirection?"":" Anticlockwise"),innerHTML:t.Name})))])))),i("g",{key:"643f0e15b17dc284f24b7041db6db50103c00e95",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable1:!0}},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),class:"Partition1 Customable",style:{"--index":s.toString()}},i("div",{style:t}))))),i("g",{key:"c67e6b5ced27ad8f7a754761a5cc0b208d0ba5e8",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable2:!0}},this.options.map(((e,s)=>i("foreignObject",{ref:this.setSvgSize.bind(this),class:"Partition2 Customable",style:{"--index":s.toString()}},i("div",{style:t}))))),i("foreignObject",{key:"9f7da36604a540d5e5a28e7a70be3214a9d3573e",ref:this.setSvgSize.bind(this),class:"Middle Customable",style:t},i("div",{key:"68bfe0e45df06d3467c38e17a52c28b31743e854",style:t})),i("foreignObject",{key:"c83067b46e165f43604562f4b7c2cb7c392538ee",ref:this.setSvgSize.bind(this),class:"Top Customable",style:t},i("div",{key:"a13e39bc3b343067722b0ba7559bb04e42d697c9",style:t})),i("g",{key:"2acf2669dac5c601cc6bc9e153a978979fead125",class:{spinning:this.isSpinning,Center:!0}},i("foreignObject",{key:"c20231aaa327354e573dc9ba9ace7c773341040d",ref:t=>{t&&(t.setAttribute("width","100"),t.setAttribute("height","100"))},style:{transform:`translate(${Number(this.size)/2-50}px, ${Number(this.size)/2-50}px)`}},i("div",{key:"c5f53cadfe9efbde4e31a253f3567df4cc78f273",style:{width:"100px",height:"100px",cursor:"pointer"},onClick:this.eventSpin}))),i("g",{key:"c22942d06adeb36b68fcfe8b72c936588058e6ac"},this.options.map(((t,e)=>i("clipPath",{id:`clip${e}`},i("path",Object.assign({},this.settings.getPartitionDraw(e)))))))))}get host(){return e(this)}};P.style=':host{font-family:system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"}*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.LotteryProgramWof{background:var(--emw--color-contrast, #07072A);display:flex;align-items:center;flex-direction:column;padding:20px 0}main{max-width:600px;width:100%;display:flex;justify-content:space-around;min-height:200px}svg{transition:opacity 0.3s}.WheelContainer{text-align:center}.FortuneContainer{width:100%;display:flex;align-items:center;flex-direction:column}.Center{cursor:pointer;transition:filter;transition-duration:1s}.Center.disabled{filter:grayscale(80%)}.Center .CenterCircle{fill:#3CE4BB;stroke:rgb(150, 54, 88);stroke-width:2px;cursor:pointer;transition:fill;transition-duration:1s}.Center .CenterText{fill:#FFFFFF}.PointerPartition{opacity:0.3;fill:lightgoldenrodyellow;stroke:red;stroke-width:6px;stroke-dasharray:12}.Current{color:#FFFFFF}.PartitionText{color:#FFFFFF;font-style:normal;font-weight:700;text-anchor:end;text-shadow:0px 3px #000;dominant-baseline:central}.PartitionsShadow{background-blend-mode:multiply;mix-blend-mode:multiply}.PartitionTextEntityContainer{height:100%;display:flex;align-items:center}.PartitionTextEntity{width:100%}.PartitionTextEntity.Anticlockwise{text-align:end}foreignObject.Bottom div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-bg.svg");background-size:calc(var(--radius) * 2px + var(--ratio) * 20px);background-position:center}foreignObject.Middle div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-spin.svg"), url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-pointer.svg");background-position:center, center 5px}foreignObject.Top{mix-blend-mode:multiply}foreignObject.Top div{background-image:var(--img-theme-shadow);background-position:center;background-size:calc(var(--radius) * 2px)}foreignObject.Partition1 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc(var(--index) * 360deg / var(--length)))}foreignObject.Partition2 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc((var(--index) + 0.5) * 360deg / var(--length)))}foreignObject.PointerArea{mix-blend-mode:screen}foreignObject.PointerArea div{background-image:var(--img-theme-pointer-area);background-position:center -3px;background-size:51%}foreignObject.Partition1 div,foreignObject.Partition2 div{transform-origin:center}.PartitionsCustomable1 div,.PartitionsCustomable2 div{visibility:hidden}.PartitionsCustomable1 div.active,.PartitionsCustomable2 div.active{visibility:visible}foreignObject.Customable{overflow:visible}foreignObject.Customable div{background-repeat:no-repeat}.PartitionBackground div{background-size:calc(var(--radius) * 2 / var(--size) * 100%) calc(var(--radius) * 2 / var(--size) * 100%);background-position:center}.PartitionBackground:nth-child(2n) div{background:var(--emw--color-primary, #3F2E75)}.PartitionBackground:nth-child(2n+1) div{background:var(--emw--color-secondary, #9482CE)}.PartitionBackground div{transform-origin:center}.PartitionBackgroundStroke{fill:transparent;stroke:var(--emw--color-background-secondary, #251D3E);stroke-width:3px;stroke-dasharray:none}.PointerPartitionFrame{stroke:#FFDD64;fill:transparent;stroke-dasharray:var(--radius) calc(6.2831853072 / var(--length) * var(--radius));stroke-width:0px}.PointerPartitionFrame.active{stroke-width:3px}.WheelContainer.Mobile foreignObject.Middle div{background-size:95px, 38px}.PartitionText .PartitionTextEntityContainer .PartitionTextEntity{text-align:center;text-transform:uppercase;text-shadow:none;font-size:var(--emw--font-size-small, 14px);font-weight:900}';export{P as C}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|