@everymatrix/casino-engagement-suite-luckywheel 0.14.1 → 0.15.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.
Files changed (23) hide show
  1. package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-9ebd9cfc.js +1 -0
  2. package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.entry.js +1 -1
  3. package/dist/casino-engagement-suite-luckywheel/index.esm.js +1 -1
  4. package/dist/cjs/{casino-engagement-suite-luckywheel-1190dd66.js → casino-engagement-suite-luckywheel-4bf8c89e.js} +28 -9
  5. package/dist/cjs/casino-engagement-suite-luckywheel.cjs.entry.js +1 -1
  6. package/dist/cjs/index.cjs.js +1 -1
  7. package/dist/collection/components/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.js +11 -9
  8. package/dist/collection/models/luckywheel.js +5 -0
  9. package/dist/esm/{casino-engagement-suite-luckywheel-f5786bfe.js → casino-engagement-suite-luckywheel-9ebd9cfc.js} +28 -9
  10. package/dist/esm/casino-engagement-suite-luckywheel.entry.js +1 -1
  11. package/dist/esm/index.js +1 -1
  12. package/dist/types/models/luckywheel.d.ts +5 -1
  13. package/package.json +1 -1
  14. package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel-f5786bfe.js +0 -1
  15. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/libs/common/src/storybook/storybook-utils.d.ts +0 -0
  16. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.d.ts +0 -0
  17. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.dev.d.ts +0 -0
  18. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/main.d.ts +0 -0
  19. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/preview.d.ts +0 -0
  20. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/index.d.ts +0 -0
  21. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  22. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  23. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop/Widgets & Template}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -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,c,d,l;!function(t){t.ActiveTickets="ActiveTickets",t.ImplicitTickets="ImplicitTickets",t.RemainingTimes="RemainingTimes"}(s||(s={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(r||(r={})),function(t){t.fulfilled="fulfilled",t.drawn="drawn"}(n||(n={})),function(t){t.Arrow="Arrow",t.Partition="Partition"}(a||(a={})),function(t){t.DownFromTop="DownFromTop",t.UpFromCenter="UpFromCenter",t.DownFromCenter="DownFromCenter",t.UpFromBottom="UpFromBottom"}(o||(o={})),function(t){t.en="en",t.fr="fr",t.de="de",t.tr="tr"}(h||(h={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(c||(c={})),function(t){t.launch="launch",t.loop="loop",t.halt="halt"}(d||(d={})),function(t){t.quad="quad",t.cubic="cubic",t.quart="quart",t.quint="quint",t.expo="expo",t.sine="sine",t.circ="circ"}(l||(l={}));const u=(t,i)=>{Object.keys(i).map((e=>{t.setAttribute(e.split(/(?=[A-Z])/).map((t=>t.toLocaleLowerCase())).join("-"),i[e])}))},g=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})),f=t=>({x:t,y:t}),b=(t,i)=>({x:t.x+i.x,y:t.y+i.y}),p={Image:"",Name:"Thank you",PrizeText:"",PrizeImage:""},m=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(p),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 g(t)}:{})(t.Image))))),e},v={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))}},y={quad:2,cubic:3,quart:4,quint:5,sine:Math.PI/2,expo:Math.LN2,circ:1/0},x={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}},w=[{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}],k=t=>Object.keys(t).map((i=>t[i]));var P;!function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise"}(P||(P={}));class M{constructor({size:t,radius:i,options:e,themeIndex:s,contentdirection:r}){this.arrowmode=o.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 o.DownFromTop:case o.UpFromCenter:return-Math.PI/2;case o.DownFromCenter:case o.UpFromBottom:return Math.PI/2}},this.contentdirection=r,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,c.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 P.clockwise}getAngleSelf(t,i){return 360*t/this.length*this.direction+90*(void 0!==i?i:c[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=f(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:b(r,e.transform),point:b(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=f(this.center),e=f(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=f(s),a=f(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",...k(i),"L",...k(s),"A",...k(e),"0 0 1",...k(r),"Z"].join(" ")}}getDeg(t){return this.findDeg(this.length-t,this.length)}getSpinnerProps(){const t=f(this.center);return{"transform-origin":`${t.x} ${t.y}`}}}class j{constructor(t){this.deg=0,this.degTarget=void 0,this.step=void 0,this.easingType=l.cubic,this.param=w[2],this.halt=(t,i=(()=>{}))=>{this.shouldHalt=()=>{this.step=d.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*y[this.easingType]*t/this.param.loopSpeed,e=()=>{const t=360*this.param.launchTurns-this.deg,e=i(t);this.animateF(e,this.deg,t,v.in[this.easingType],x.in[this.easingType])},s=()=>{const t=i(this.degTarget);this.animateF(t,0,this.degTarget,v.out[this.easingType],x.out[this.easingType])},r=()=>{this.setDeg((this.deg+t)%360,y[this.easingType]),this.continueRepeat()};({[d.launch]:()=>{this.cb=()=>{this.step=d.loop,this.setDeg(t,y[this.easingType]),this.continueRepeat()},e()},[d.loop]:()=>{this.shouldHalt&&0===this.deg?this.shouldHalt():r()},[d.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=d.launch,this.ticker()}}const O=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;u(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,data:e}=null==t?void 0:t.data;"SpinLuckyWheelRes"===i&&this.isSpinning&&(e.State===n.fulfilled?this.handleSpinResult(e):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,e=this.settings.getDeg(i);this.spinner.halt(e,(()=>{this.isSpinning=!1,this.updateSpinable();const t=this.luckywheel.Program.WheelOfFortune.Partitions[i];window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeText:(null==t?void 0:t.PrizeText[this.language])||(null==t?void 0:t.PrizeText["*"]),PrizeMessage:(null==t?void 0:t.Name[this.language])||(null==t?void 0:t.Name["*"]),HasError:!1}})}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}async componentWillLoad(){this.options=await m(this.luckywheel,h.en),this.settings=new M({size:this.size,radius:this.radius,options:this.options,themeIndex:1,contentdirection:this.contentdirection}),this.spinner=new j({tick:(t,i)=>{u(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:"367a5a450ac76ff204a19dae3accd876489db2f7",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"495bb4100735d774acba268f74782e6229c96dc9",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",{key:"f3d621838e38e7dd137d3f503e981779e4d34902",ref:this.setSvgSize.bind(this),class:"Bottom Customable"},i("div",{key:"0a121c4e34233d90c4d0ec779b7de72e2bbf7624",style:t})),i("g",Object.assign({key:"59e52ed1e01bda791fca89e4a899fe145350e1b4",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"a4dd6e82848700b94dd4f339b728bd21fafd13d0",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:"6ffd6236635e09d242c608184871ee80be9ff645",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:"7d293dfa6dfb6e1b3d72c7125f836e79f2603ff1",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:"fa191eda9c4cdb6f4606d0d6ee4c7806352254ce",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:"eac9ca68af2ba9d48f14de4db2413f76e46ae01d",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:"93b00f644cf16b0aa9ca0bc3abd2d94b417fd1d8",ref:this.setSvgSize.bind(this),class:"Middle Customable",style:t},i("div",{key:"e52f4afc5296dcaeec3f13d30f90488081d53ff9",style:t})),i("foreignObject",{key:"962ba8b608688bdc2a12fc1c4026562de6cefbd7",ref:this.setSvgSize.bind(this),class:"Top Customable",style:t},i("div",{key:"04c020535414106aa927839af04328cc7ac142c4",style:t})),i("g",{key:"31d7c14471d43ba1e6cbd20a8fc6d052a3a79f97",class:{spinning:this.isSpinning,Center:!0}},i("foreignObject",{key:"df5c6082e8574d040e0b1d4a92e897977a2f4742",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:"033be93fc85fc556fb9f617b7353b16879dff5e8",style:{width:"100px",height:"100px",cursor:"pointer"},onClick:this.eventSpin}))),i("g",{key:"f95b7a08640ab6317b3ede93aa673f4fce1c41ee"},this.options.map(((t,e)=>i("clipPath",{id:`clip${e}`},i("path",Object.assign({},this.settings.getPartitionDraw(e)))))))))}get host(){return e(this)}};O.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{O as C}
@@ -1 +1 @@
1
- export{C as casino_engagement_suite_luckywheel}from"./casino-engagement-suite-luckywheel-f5786bfe.js";import"./index-48c42d04.js";
1
+ export{C as casino_engagement_suite_luckywheel}from"./casino-engagement-suite-luckywheel-9ebd9cfc.js";import"./index-48c42d04.js";
@@ -1 +1 @@
1
- export{C as CasinoEngagementSuiteLuckywheel}from"./casino-engagement-suite-luckywheel-f5786bfe.js";import"./index-48c42d04.js";
1
+ export{C as CasinoEngagementSuiteLuckywheel}from"./casino-engagement-suite-luckywheel-9ebd9cfc.js";import"./index-48c42d04.js";
@@ -2,6 +2,24 @@
2
2
 
3
3
  const index = require('./index-6096cc4b.js');
4
4
 
5
+ var CurrentInfo;
6
+ (function (CurrentInfo) {
7
+ CurrentInfo["ActiveTickets"] = "ActiveTickets";
8
+ CurrentInfo["ImplicitTickets"] = "ImplicitTickets";
9
+ CurrentInfo["RemainingTimes"] = "RemainingTimes";
10
+ })(CurrentInfo || (CurrentInfo = {}));
11
+ var ContentDirection$1;
12
+ (function (ContentDirection) {
13
+ ContentDirection[ContentDirection["clockwise"] = 1] = "clockwise";
14
+ ContentDirection[ContentDirection["anticlockwise"] = -1] = "anticlockwise";
15
+ ContentDirection[ContentDirection["outward"] = 0] = "outward";
16
+ })(ContentDirection$1 || (ContentDirection$1 = {}));
17
+ var ELuckyWheelResultState;
18
+ (function (ELuckyWheelResultState) {
19
+ ELuckyWheelResultState["fulfilled"] = "fulfilled";
20
+ ELuckyWheelResultState["drawn"] = "drawn";
21
+ })(ELuckyWheelResultState || (ELuckyWheelResultState = {}));
22
+
5
23
  var PointerMode;
6
24
  (function (PointerMode) {
7
25
  PointerMode["Arrow"] = "Arrow";
@@ -604,10 +622,11 @@ const CasinoEngagementSuiteLuckywheel = class {
604
622
  this.spinner = undefined;
605
623
  }
606
624
  handleEvent(e) {
607
- const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
625
+ const { type, data } = e === null || e === void 0 ? void 0 : e.data;
608
626
  switch (type) {
609
627
  case 'SpinLuckyWheelRes':
610
628
  if (this.isSpinning) {
629
+ const success = data.State === ELuckyWheelResultState.fulfilled;
611
630
  if (!success) {
612
631
  this.handleSpinError();
613
632
  }
@@ -699,13 +718,13 @@ const CasinoEngagementSuiteLuckywheel = class {
699
718
  }
700
719
  render() {
701
720
  const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
702
- return (index.h("div", { key: 'b6136edfd7add14e24354d5d429e6b120c752703', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, index.h("svg", { key: '8ced6524641989578eac427e49b96b32b05afb7e', width: this.size, height: this.size, ref: (el) => {
721
+ return (index.h("div", { key: '367a5a450ac76ff204a19dae3accd876489db2f7', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, index.h("svg", { key: '495bb4100735d774acba268f74782e6229c96dc9', width: this.size, height: this.size, ref: (el) => {
703
722
  this.svg = el;
704
- } }, index.h("foreignObject", { key: '1bf19a0e9114a3f28a4fa991fea492621d608e63', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, index.h("div", { key: '4ed19149d56ededcf304264e817e2ca11f27cdd3', style: foreignObjectAgentProps })), index.h("g", Object.assign({ key: 'e29b5fd47073124eda6b69464d5e80c776f5c3fa', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), index.h("g", { key: 'bff210be57b131b4716873beb9be0b30e0eab3bc', class: "PartitionsBackgrounds" }, this.options.map((_el, index$1) => {
723
+ } }, index.h("foreignObject", { key: 'f3d621838e38e7dd137d3f503e981779e4d34902', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, index.h("div", { key: '0a121c4e34233d90c4d0ec779b7de72e2bbf7624', style: foreignObjectAgentProps })), index.h("g", Object.assign({ key: '59e52ed1e01bda791fca89e4a899fe145350e1b4', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), index.h("g", { key: 'a4dd6e82848700b94dd4f339b728bd21fafd13d0', class: "PartitionsBackgrounds" }, this.options.map((_el, index$1) => {
705
724
  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 })));
706
- })), index.h("g", { key: '72ca2e0ab6daea08bd7cfd5494aef1e6730bc090', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index$1) => {
725
+ })), index.h("g", { key: '6ffd6236635e09d242c608184871ee80be9ff645', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index$1) => {
707
726
  return (index.h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index$1), { width: this.size, height: this.size })));
708
- })), index.h("g", { key: '93ee593c8cdc9cd90caedc79ef98243ff5658ed7', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index$1) => {
727
+ })), index.h("g", { key: '7d293dfa6dfb6e1b3d72c7125f836e79f2603ff1', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index$1) => {
709
728
  return [
710
729
  el.Image && (index.h("g", { class: `PartitionImage PartitionImage${index$1}`, ref: (el) => this.renderImage(el, index$1) })),
711
730
  el.Name && (index.h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
@@ -716,18 +735,18 @@ const CasinoEngagementSuiteLuckywheel = class {
716
735
  }
717
736
  } }, this.settings.getSvgTextPropsAdjustedByImage(index$1)), index.h("div", { class: "PartitionTextEntityContainer" }, index.h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
718
737
  ];
719
- }))), index.h("g", { key: '7e3de34870e47efe6b734724a018efbd77ead91e', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index$1) => {
738
+ }))), index.h("g", { key: 'fa191eda9c4cdb6f4606d0d6ee4c7806352254ce', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index$1) => {
720
739
  return (index.h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index$1.toString() } }, index.h("div", { style: foreignObjectAgentProps })));
721
- })), index.h("g", { key: 'c824d9aa998a3b130bf82f754fac96706a5a6cd4', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index$1) => {
740
+ })), index.h("g", { key: 'eac9ca68af2ba9d48f14de4db2413f76e46ae01d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index$1) => {
722
741
  return (index.h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index$1.toString() } }, index.h("div", { style: foreignObjectAgentProps })));
723
- })), index.h("foreignObject", { key: 'bb40a660810bf97d1efe221c9cd07c8375662360', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, index.h("div", { key: '54e4c470a9c6cf07dae7461202d4a40444e94a2a', style: foreignObjectAgentProps })), index.h("foreignObject", { key: '53a6d7853ad783030d275b4de8d070588f3021fd', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, index.h("div", { key: '5521d2e5e5d06d5386c5d546e5e726d7ca1b3b02', style: foreignObjectAgentProps })), index.h("g", { key: '51fe3d7e0dc2f2b27d49d1d69a4fd05347d3d0da', class: { spinning: this.isSpinning, Center: true } }, index.h("foreignObject", { key: '20f5bbb9f2259f30b606013068747e8f76afe69c', ref: (el) => {
742
+ })), index.h("foreignObject", { key: '93b00f644cf16b0aa9ca0bc3abd2d94b417fd1d8', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, index.h("div", { key: 'e52f4afc5296dcaeec3f13d30f90488081d53ff9', style: foreignObjectAgentProps })), index.h("foreignObject", { key: '962ba8b608688bdc2a12fc1c4026562de6cefbd7', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, index.h("div", { key: '04c020535414106aa927839af04328cc7ac142c4', style: foreignObjectAgentProps })), index.h("g", { key: '31d7c14471d43ba1e6cbd20a8fc6d052a3a79f97', class: { spinning: this.isSpinning, Center: true } }, index.h("foreignObject", { key: 'df5c6082e8574d040e0b1d4a92e897977a2f4742', ref: (el) => {
724
743
  if (el) {
725
744
  el.setAttribute('width', '100');
726
745
  el.setAttribute('height', '100');
727
746
  }
728
747
  }, style: {
729
748
  transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
730
- } }, index.h("div", { key: 'ee3bc5e723aa9be084dd7f93fe0a1ec3a27c8ed1', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), index.h("g", { key: 'c679b904e588c20484e353ba855172ca4077f057' }, this.options.map((_el, index$1) => {
749
+ } }, index.h("div", { key: '033be93fc85fc556fb9f617b7353b16879dff5e8', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), index.h("g", { key: 'f95b7a08640ab6317b3ede93aa673f4fce1c41ee' }, this.options.map((_el, index$1) => {
731
750
  return (index.h("clipPath", { id: `clip${index$1}` }, index.h("path", Object.assign({}, this.settings.getPartitionDraw(index$1)))));
732
751
  })))));
733
752
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-1190dd66.js');
5
+ const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-4bf8c89e.js');
6
6
  require('./index-6096cc4b.js');
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-1190dd66.js');
5
+ const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-4bf8c89e.js');
6
6
  require('./index-6096cc4b.js');
7
7
 
8
8
 
@@ -1,4 +1,5 @@
1
1
  import { h } from "@stencil/core";
2
+ import { ELuckyWheelResultState } from "../../models/luckywheel";
2
3
  import { SvgCalc } from "../../utils/class.svgcalc";
3
4
  import { Lang } from "../../utils/types";
4
5
  import { getOptions, setProps } from "../../utils/utils";
@@ -78,10 +79,11 @@ export class CasinoEngagementSuiteLuckywheel {
78
79
  this.spinner = undefined;
79
80
  }
80
81
  handleEvent(e) {
81
- const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
82
+ const { type, data } = e === null || e === void 0 ? void 0 : e.data;
82
83
  switch (type) {
83
84
  case 'SpinLuckyWheelRes':
84
85
  if (this.isSpinning) {
86
+ const success = data.State === ELuckyWheelResultState.fulfilled;
85
87
  if (!success) {
86
88
  this.handleSpinError();
87
89
  }
@@ -173,13 +175,13 @@ export class CasinoEngagementSuiteLuckywheel {
173
175
  }
174
176
  render() {
175
177
  const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
176
- return (h("div", { key: 'b6136edfd7add14e24354d5d429e6b120c752703', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '8ced6524641989578eac427e49b96b32b05afb7e', width: this.size, height: this.size, ref: (el) => {
178
+ return (h("div", { key: '367a5a450ac76ff204a19dae3accd876489db2f7', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '495bb4100735d774acba268f74782e6229c96dc9', width: this.size, height: this.size, ref: (el) => {
177
179
  this.svg = el;
178
- } }, h("foreignObject", { key: '1bf19a0e9114a3f28a4fa991fea492621d608e63', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '4ed19149d56ededcf304264e817e2ca11f27cdd3', style: foreignObjectAgentProps })), h("g", Object.assign({ key: 'e29b5fd47073124eda6b69464d5e80c776f5c3fa', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: 'bff210be57b131b4716873beb9be0b30e0eab3bc', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
180
+ } }, h("foreignObject", { key: 'f3d621838e38e7dd137d3f503e981779e4d34902', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '0a121c4e34233d90c4d0ec779b7de72e2bbf7624', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '59e52ed1e01bda791fca89e4a899fe145350e1b4', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: 'a4dd6e82848700b94dd4f339b728bd21fafd13d0', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
179
181
  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 })));
180
- })), h("g", { key: '72ca2e0ab6daea08bd7cfd5494aef1e6730bc090', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
182
+ })), h("g", { key: '6ffd6236635e09d242c608184871ee80be9ff645', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
181
183
  return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
182
- })), h("g", { key: '93ee593c8cdc9cd90caedc79ef98243ff5658ed7', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
184
+ })), h("g", { key: '7d293dfa6dfb6e1b3d72c7125f836e79f2603ff1', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
183
185
  return [
184
186
  el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
185
187
  el.Name && (h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
@@ -190,18 +192,18 @@ export class CasinoEngagementSuiteLuckywheel {
190
192
  }
191
193
  } }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
192
194
  ];
193
- }))), h("g", { key: '7e3de34870e47efe6b734724a018efbd77ead91e', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
195
+ }))), h("g", { key: 'fa191eda9c4cdb6f4606d0d6ee4c7806352254ce', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
194
196
  return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
195
- })), h("g", { key: 'c824d9aa998a3b130bf82f754fac96706a5a6cd4', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
197
+ })), h("g", { key: 'eac9ca68af2ba9d48f14de4db2413f76e46ae01d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
196
198
  return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
197
- })), h("foreignObject", { key: 'bb40a660810bf97d1efe221c9cd07c8375662360', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: '54e4c470a9c6cf07dae7461202d4a40444e94a2a', style: foreignObjectAgentProps })), h("foreignObject", { key: '53a6d7853ad783030d275b4de8d070588f3021fd', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '5521d2e5e5d06d5386c5d546e5e726d7ca1b3b02', style: foreignObjectAgentProps })), h("g", { key: '51fe3d7e0dc2f2b27d49d1d69a4fd05347d3d0da', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: '20f5bbb9f2259f30b606013068747e8f76afe69c', ref: (el) => {
199
+ })), h("foreignObject", { key: '93b00f644cf16b0aa9ca0bc3abd2d94b417fd1d8', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: 'e52f4afc5296dcaeec3f13d30f90488081d53ff9', style: foreignObjectAgentProps })), h("foreignObject", { key: '962ba8b608688bdc2a12fc1c4026562de6cefbd7', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '04c020535414106aa927839af04328cc7ac142c4', style: foreignObjectAgentProps })), h("g", { key: '31d7c14471d43ba1e6cbd20a8fc6d052a3a79f97', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: 'df5c6082e8574d040e0b1d4a92e897977a2f4742', ref: (el) => {
198
200
  if (el) {
199
201
  el.setAttribute('width', '100');
200
202
  el.setAttribute('height', '100');
201
203
  }
202
204
  }, style: {
203
205
  transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
204
- } }, h("div", { key: 'ee3bc5e723aa9be084dd7f93fe0a1ec3a27c8ed1', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: 'c679b904e588c20484e353ba855172ca4077f057' }, this.options.map((_el, index) => {
206
+ } }, h("div", { key: '033be93fc85fc556fb9f617b7353b16879dff5e8', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: 'f95b7a08640ab6317b3ede93aa673f4fce1c41ee' }, this.options.map((_el, index) => {
205
207
  return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
206
208
  })))));
207
209
  }
@@ -10,3 +10,8 @@ export var ContentDirection;
10
10
  ContentDirection[ContentDirection["anticlockwise"] = -1] = "anticlockwise";
11
11
  ContentDirection[ContentDirection["outward"] = 0] = "outward";
12
12
  })(ContentDirection || (ContentDirection = {}));
13
+ export var ELuckyWheelResultState;
14
+ (function (ELuckyWheelResultState) {
15
+ ELuckyWheelResultState["fulfilled"] = "fulfilled";
16
+ ELuckyWheelResultState["drawn"] = "drawn";
17
+ })(ELuckyWheelResultState || (ELuckyWheelResultState = {}));
@@ -1,5 +1,23 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-48c42d04.js';
2
2
 
3
+ var CurrentInfo;
4
+ (function (CurrentInfo) {
5
+ CurrentInfo["ActiveTickets"] = "ActiveTickets";
6
+ CurrentInfo["ImplicitTickets"] = "ImplicitTickets";
7
+ CurrentInfo["RemainingTimes"] = "RemainingTimes";
8
+ })(CurrentInfo || (CurrentInfo = {}));
9
+ var ContentDirection$1;
10
+ (function (ContentDirection) {
11
+ ContentDirection[ContentDirection["clockwise"] = 1] = "clockwise";
12
+ ContentDirection[ContentDirection["anticlockwise"] = -1] = "anticlockwise";
13
+ ContentDirection[ContentDirection["outward"] = 0] = "outward";
14
+ })(ContentDirection$1 || (ContentDirection$1 = {}));
15
+ var ELuckyWheelResultState;
16
+ (function (ELuckyWheelResultState) {
17
+ ELuckyWheelResultState["fulfilled"] = "fulfilled";
18
+ ELuckyWheelResultState["drawn"] = "drawn";
19
+ })(ELuckyWheelResultState || (ELuckyWheelResultState = {}));
20
+
3
21
  var PointerMode;
4
22
  (function (PointerMode) {
5
23
  PointerMode["Arrow"] = "Arrow";
@@ -602,10 +620,11 @@ const CasinoEngagementSuiteLuckywheel = class {
602
620
  this.spinner = undefined;
603
621
  }
604
622
  handleEvent(e) {
605
- const { type, success, data } = e === null || e === void 0 ? void 0 : e.data;
623
+ const { type, data } = e === null || e === void 0 ? void 0 : e.data;
606
624
  switch (type) {
607
625
  case 'SpinLuckyWheelRes':
608
626
  if (this.isSpinning) {
627
+ const success = data.State === ELuckyWheelResultState.fulfilled;
609
628
  if (!success) {
610
629
  this.handleSpinError();
611
630
  }
@@ -697,13 +716,13 @@ const CasinoEngagementSuiteLuckywheel = class {
697
716
  }
698
717
  render() {
699
718
  const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
700
- return (h("div", { key: 'b6136edfd7add14e24354d5d429e6b120c752703', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '8ced6524641989578eac427e49b96b32b05afb7e', width: this.size, height: this.size, ref: (el) => {
719
+ return (h("div", { key: '367a5a450ac76ff204a19dae3accd876489db2f7', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '495bb4100735d774acba268f74782e6229c96dc9', width: this.size, height: this.size, ref: (el) => {
701
720
  this.svg = el;
702
- } }, h("foreignObject", { key: '1bf19a0e9114a3f28a4fa991fea492621d608e63', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '4ed19149d56ededcf304264e817e2ca11f27cdd3', style: foreignObjectAgentProps })), h("g", Object.assign({ key: 'e29b5fd47073124eda6b69464d5e80c776f5c3fa', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: 'bff210be57b131b4716873beb9be0b30e0eab3bc', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
721
+ } }, h("foreignObject", { key: 'f3d621838e38e7dd137d3f503e981779e4d34902', ref: this.setSvgSize.bind(this), class: "Bottom Customable" }, h("div", { key: '0a121c4e34233d90c4d0ec779b7de72e2bbf7624', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '59e52ed1e01bda791fca89e4a899fe145350e1b4', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: 'a4dd6e82848700b94dd4f339b728bd21fafd13d0', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
703
722
  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 })));
704
- })), h("g", { key: '72ca2e0ab6daea08bd7cfd5494aef1e6730bc090', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
723
+ })), h("g", { key: '6ffd6236635e09d242c608184871ee80be9ff645', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
705
724
  return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
706
- })), h("g", { key: '93ee593c8cdc9cd90caedc79ef98243ff5658ed7', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
725
+ })), h("g", { key: '7d293dfa6dfb6e1b3d72c7125f836e79f2603ff1', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
707
726
  return [
708
727
  el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
709
728
  el.Name && (h("foreignObject", Object.assign({ class: "PartitionText", ref: (el) => {
@@ -714,18 +733,18 @@ const CasinoEngagementSuiteLuckywheel = class {
714
733
  }
715
734
  } }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
716
735
  ];
717
- }))), h("g", { key: '7e3de34870e47efe6b734724a018efbd77ead91e', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
736
+ }))), h("g", { key: 'fa191eda9c4cdb6f4606d0d6ee4c7806352254ce', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
718
737
  return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition1 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
719
- })), h("g", { key: 'c824d9aa998a3b130bf82f754fac96706a5a6cd4', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
738
+ })), h("g", { key: 'eac9ca68af2ba9d48f14de4db2413f76e46ae01d', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
720
739
  return (h("foreignObject", { ref: this.setSvgSize.bind(this), class: "Partition2 Customable", style: { '--index': index.toString() } }, h("div", { style: foreignObjectAgentProps })));
721
- })), h("foreignObject", { key: 'bb40a660810bf97d1efe221c9cd07c8375662360', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: '54e4c470a9c6cf07dae7461202d4a40444e94a2a', style: foreignObjectAgentProps })), h("foreignObject", { key: '53a6d7853ad783030d275b4de8d070588f3021fd', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '5521d2e5e5d06d5386c5d546e5e726d7ca1b3b02', style: foreignObjectAgentProps })), h("g", { key: '51fe3d7e0dc2f2b27d49d1d69a4fd05347d3d0da', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: '20f5bbb9f2259f30b606013068747e8f76afe69c', ref: (el) => {
740
+ })), h("foreignObject", { key: '93b00f644cf16b0aa9ca0bc3abd2d94b417fd1d8', ref: this.setSvgSize.bind(this), class: "Middle Customable", style: foreignObjectAgentProps }, h("div", { key: 'e52f4afc5296dcaeec3f13d30f90488081d53ff9', style: foreignObjectAgentProps })), h("foreignObject", { key: '962ba8b608688bdc2a12fc1c4026562de6cefbd7', ref: this.setSvgSize.bind(this), class: "Top Customable", style: foreignObjectAgentProps }, h("div", { key: '04c020535414106aa927839af04328cc7ac142c4', style: foreignObjectAgentProps })), h("g", { key: '31d7c14471d43ba1e6cbd20a8fc6d052a3a79f97', class: { spinning: this.isSpinning, Center: true } }, h("foreignObject", { key: 'df5c6082e8574d040e0b1d4a92e897977a2f4742', ref: (el) => {
722
741
  if (el) {
723
742
  el.setAttribute('width', '100');
724
743
  el.setAttribute('height', '100');
725
744
  }
726
745
  }, style: {
727
746
  transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
728
- } }, h("div", { key: 'ee3bc5e723aa9be084dd7f93fe0a1ec3a27c8ed1', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: 'c679b904e588c20484e353ba855172ca4077f057' }, this.options.map((_el, index) => {
747
+ } }, h("div", { key: '033be93fc85fc556fb9f617b7353b16879dff5e8', style: { width: '100px', height: '100px', cursor: 'pointer' }, onClick: this.eventSpin }))), h("g", { key: 'f95b7a08640ab6317b3ede93aa673f4fce1c41ee' }, this.options.map((_el, index) => {
729
748
  return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
730
749
  })))));
731
750
  }
@@ -1,2 +1,2 @@
1
- export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-f5786bfe.js';
1
+ export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-9ebd9cfc.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-f5786bfe.js';
1
+ export { C as CasinoEngagementSuiteLuckywheel } from './casino-engagement-suite-luckywheel-9ebd9cfc.js';
2
2
  import './index-48c42d04.js';
@@ -62,8 +62,12 @@ export interface ISpinLuckyWheelEventResult {
62
62
  LotteryProgramTicketID: string;
63
63
  IdempotencyKey: string;
64
64
  UserID: string;
65
- State: string;
65
+ State: ELuckyWheelResultState;
66
66
  Result: {
67
67
  WheelOfFortunePartitionIndex: string;
68
68
  };
69
69
  }
70
+ export declare enum ELuckyWheelResultState {
71
+ fulfilled = "fulfilled",
72
+ drawn = "drawn"
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-engagement-suite-luckywheel",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,h as i,g as e}from"./index-48c42d04.js";var s,r,a,n,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"}(a||(a={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(n||(n={})),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:a}){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=a,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,n.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:n[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:a,transformOrigin:n}=this.getPartitionPositions(t,e,i);return Object.assign(Object.assign({},a),{style:{"font-size":13*this.ratio+"px",transform:`rotate(${this.getAngleSelf(t,s)}deg) translate(${"clockwise"===this.contentdirection?a.x:a.x-100}px, ${a.y-50}px)`,"transform-origin":`${o=n,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),a=l(s),n=l(e);return{x:a.x+n.x*Math.cos(r),y:a.y+n.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)}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 a=null;const n=()=>{let o=(new Date).getTime();a||(a=o);const h=o-a,c=e*s(h/t)+i,d=Math.abs(r(h/t));this.setDeg(c,d),h<t?setTimeout((()=>n()),30):this.cb()};n()},this.animate=(t,i,e,s,r)=>{let a=null;window.cancelAnimationFrame(a);let n=null;const o=h=>{n||(n=h);const c=h-n,d=e*s(c/t)+i,l=Math.abs(r(c/t));this.setDeg(d,l),c<t?a=window.requestAnimationFrame(o):this.cb()};a=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,e=this.settings.getDeg(i);this.spinner.halt(e,(()=>{this.isSpinning=!1,this.updateSpinable();const t=this.luckywheel.Program.WheelOfFortune.Partitions[i];window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeText:(null==t?void 0:t.PrizeText[this.language])||(null==t?void 0:t.PrizeText["*"]),PrizeMessage:(null==t?void 0:t.Name[this.language])||(null==t?void 0:t.Name["*"]),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,a.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:"b6136edfd7add14e24354d5d429e6b120c752703",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"8ced6524641989578eac427e49b96b32b05afb7e",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",{key:"1bf19a0e9114a3f28a4fa991fea492621d608e63",ref:this.setSvgSize.bind(this),class:"Bottom Customable"},i("div",{key:"4ed19149d56ededcf304264e817e2ca11f27cdd3",style:t})),i("g",Object.assign({key:"e29b5fd47073124eda6b69464d5e80c776f5c3fa",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"bff210be57b131b4716873beb9be0b30e0eab3bc",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:"72ca2e0ab6daea08bd7cfd5494aef1e6730bc090",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:"93ee593c8cdc9cd90caedc79ef98243ff5658ed7",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:"7e3de34870e47efe6b734724a018efbd77ead91e",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:"c824d9aa998a3b130bf82f754fac96706a5a6cd4",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:"bb40a660810bf97d1efe221c9cd07c8375662360",ref:this.setSvgSize.bind(this),class:"Middle Customable",style:t},i("div",{key:"54e4c470a9c6cf07dae7461202d4a40444e94a2a",style:t})),i("foreignObject",{key:"53a6d7853ad783030d275b4de8d070588f3021fd",ref:this.setSvgSize.bind(this),class:"Top Customable",style:t},i("div",{key:"5521d2e5e5d06d5386c5d546e5e726d7ca1b3b02",style:t})),i("g",{key:"51fe3d7e0dc2f2b27d49d1d69a4fd05347d3d0da",class:{spinning:this.isSpinning,Center:!0}},i("foreignObject",{key:"20f5bbb9f2259f30b606013068747e8f76afe69c",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:"ee3bc5e723aa9be084dd7f93fe0a1ec3a27c8ed1",style:{width:"100px",height:"100px",cursor:"pointer"},onClick:this.eventSpin}))),i("g",{key:"c679b904e588c20484e353ba855172ca4077f057"},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}