@goodgamestudios/cxf-webshop 7.0.0-qa.2 → 7.0.0-qa.22
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/README.md +1 -1
- package/cdn.jsdelivr.net/npm/@goodgamestudios/cxf-webshop@qa/dist/webshop-cxf.js +1499 -0
- package/dist/webshop-cxf.js +1540 -1
- package/dist/webshop-cxf.js.map +4 -4
- package/package.json +128 -127
- package/.eslintrc.js +0 -25
- package/.prettierignore +0 -6
- package/.prettierrc.js +0 -10
- package/REFACTORING_README.md +0 -265
- package/TEST_MIGRATION.md +0 -441
- package/TYPES_REFACTORING.md +0 -308
- package/esbuild.build.js +0 -14
- package/esbuild.serve.js +0 -25
- package/src_old/@types/global.d.ts +0 -2
- package/src_old/ArgumentNullError.ts +0 -6
- package/src_old/app.ts +0 -30
- package/src_old/combineReaders.ts +0 -8
- package/src_old/common.ts +0 -35
- package/src_old/config.ts +0 -42
- package/src_old/cxf.ts +0 -32
- package/src_old/dialog.ts +0 -25
- package/src_old/env.ts +0 -127
- package/src_old/fetch.ts +0 -46
- package/src_old/handlers/eventHandlers.ts +0 -43
- package/src_old/handlers/postMessageHandlers.ts +0 -43
- package/src_old/handlers/pushHandlers.ts +0 -95
- package/src_old/handlers/reducers.ts +0 -207
- package/src_old/helpers.ts +0 -143
- package/src_old/index.ts +0 -35
- package/src_old/messages/IShopMessageBus.ts +0 -3
- package/src_old/messages/ShopMessageBus.ts +0 -10
- package/src_old/messages/TestShopMessageBus.ts +0 -8
- package/src_old/ping.ts +0 -15
- package/src_old/preFetch.ts +0 -43
- package/src_old/storage.ts +0 -32
- package/src_old/store.ts +0 -82
- package/src_old/track.ts +0 -59
- package/src_old/url.ts +0 -95
- package/src_old/utils.ts +0 -64
package/dist/webshop-cxf.js
CHANGED
|
@@ -1,2 +1,1541 @@
|
|
|
1
|
-
"use strict";(()=>{var Xe=Object.create;var fe=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var Ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $e=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Be(t))!je.call(e,s)&&s!==r&&fe(e,s,{get:()=>t[s],enumerable:!(i=ze(t,s))||i.enumerable});return e};var B=(e,t,r)=>(r=e!=null?Xe(He(e)):{},$e(t||!e||!e.__esModule?fe(r,"default",{value:e,enumerable:!0}):r,e));var u,n=Ve(()=>{u={env:{BASE_URL:"https://canvas-test.goodgamestudios.com",CUSTOMIZATION_URL_TEMPLATE:"https://hotpkg.com/@lemonstand.org/config-goodgamestudios@{1}/dist/goodgamestudios-{0}.json",CUSTOMIZATION_URL:"https://hotpkg.com/@lemonstand.org/config-goodgamestudios@qa/dist/goodgamestudios-{0}.json"}}});var me=P((Pt,de)=>{n();var L=1e3,T=L*60,U=T*60,_=U*24,Ze=_*7,qe=_*365.25;de.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return We(e);if(r==="number"&&isFinite(e))return t.long?Qe(e):Ke(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function We(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),i=(t[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*qe;case"weeks":case"week":case"w":return r*Ze;case"days":case"day":case"d":return r*_;case"hours":case"hour":case"hrs":case"hr":case"h":return r*U;case"minutes":case"minute":case"mins":case"min":case"m":return r*T;case"seconds":case"second":case"secs":case"sec":case"s":return r*L;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Ke(e){var t=Math.abs(e);return t>=_?Math.round(e/_)+"d":t>=U?Math.round(e/U)+"h":t>=T?Math.round(e/T)+"m":t>=L?Math.round(e/L)+"s":e+"ms"}function Qe(e){var t=Math.abs(e);return t>=_?H(e,t,_,"day"):t>=U?H(e,t,U,"hour"):t>=T?H(e,t,T,"minute"):t>=L?H(e,t,L,"second"):e+" ms"}function H(e,t,r,i){var s=t>=r*1.5;return Math.round(e/r)+" "+i+(s?"s":"")}});var pe=P((Tt,le)=>{n();function Ye(e){r.debug=r,r.default=r,r.coerce=F,r.disable=S,r.enable=s,r.enabled=b,r.humanize=me(),r.destroy=y,Object.keys(e).forEach(c=>{r[c]=e[c]}),r.names=[],r.skips=[],r.formatters={};function t(c){let a=0;for(let p=0;p<c.length;p++)a=(a<<5)-a+c.charCodeAt(p),a|=0;return r.colors[Math.abs(a)%r.colors.length]}r.selectColor=t;function r(c){let a,p=null,C,O;function d(...l){if(!d.enabled)return;let v=d,x=Number(new Date),A=x-(a||x);v.diff=A,v.prev=a,v.curr=x,a=x,l[0]=r.coerce(l[0]),typeof l[0]!="string"&&l.unshift("%O");let E=0;l[0]=l[0].replace(/%([a-zA-Z%])/g,(w,Q)=>{if(w==="%%")return"%";E++;let ue=r.formatters[Q];if(typeof ue=="function"){let ke=l[E];w=ue.call(v,ke),l.splice(E,1),E--}return w}),r.formatArgs.call(v,l),(v.log||r.log).apply(v,l)}return d.namespace=c,d.useColors=r.useColors(),d.color=r.selectColor(c),d.extend=i,d.destroy=r.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(C!==r.namespaces&&(C=r.namespaces,O=r.enabled(c)),O),set:l=>{p=l}}),typeof r.init=="function"&&r.init(d),d}function i(c,a){let p=r(this.namespace+(typeof a>"u"?":":a)+c);return p.log=this.log,p}function s(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let a=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of a)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function m(c,a){let p=0,C=0,O=-1,d=0;for(;p<c.length;)if(C<a.length&&(a[C]===c[p]||a[C]==="*"))a[C]==="*"?(O=C,d=p,C++):(p++,C++);else if(O!==-1)C=O+1,d++,p=d;else return!1;for(;C<a.length&&a[C]==="*";)C++;return C===a.length}function S(){let c=[...r.names,...r.skips.map(a=>"-"+a)].join(",");return r.enable(""),c}function b(c){for(let a of r.skips)if(m(c,a))return!1;for(let a of r.names)if(m(c,a))return!0;return!1}function F(c){return c instanceof Error?c.stack||c.message:c}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}le.exports=Ye});var ge=P((h,j)=>{n();h.formatArgs=tt;h.save=rt;h.load=ot;h.useColors=et;h.storage=nt();h.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();h.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function et(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function tt(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+j.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(r++,s==="%c"&&(i=r))}),e.splice(i,0,t)}h.log=console.debug||console.log||(()=>{});function rt(e){try{e?h.storage.setItem("debug",e):h.storage.removeItem("debug")}catch{}}function ot(){let e;try{e=h.storage.getItem("debug")||h.storage.getItem("DEBUG")}catch{}return!e&&typeof u<"u"&&"env"in u&&(e=u.env.DEBUG),e}function nt(){try{return localStorage}catch{}}j.exports=pe()(h);var{formatters:it}=j.exports;it.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var oe=P((er,he)=>{"use strict";n();var V=window&&window.CXF;he.exports=new Promise(function(e,t){if(window||t(),V)return e(V);window.addEventListener("cxf.initialized",function(r){V=r.cxf,e(V)},{capture:!0,once:!0,passive:!0})})});var Ae=P((_e,ne)=>{n();(function(){var e={};function t(d,l){return s(d)||i(d,l)||r()}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function i(d,l){var v=[],x=!0,A=!1,E=void 0;try{for(var K,w=d[Symbol.iterator]();!(x=(K=w.next()).done)&&(v.push(K.value),!l||v.length!==l);x=!0);}catch(Q){A=!0,E=Q}finally{try{x||w.return==null||w.return()}finally{if(A)throw E}}return v}function s(d){if(Array.isArray(d))return d}var m=0,S=1,b=2,F={1:["poker","poker2","poker"],12:["empire","castle","em"],15:["bigfarm","ranch","bf"],16:["empirefourkingdoms","fourkingdoms","e4k"],23:["legendsofhonor",void 0,"loh"],41:["empiremillenniumwars",void 0,"emmw"]},y=Object.entries(F).reduce(function(d,l){var v=t(l,2),x=v[0],A=v[1];return x=parseInt(x,10),d[x]=x,A.forEach(function(E){d[E]=x}),d},{}),c=function(d){d=d.toString().toLowerCase();var l=y[d];return l&&0|l},a=function(d,l){return(l=y[l])&&F[l][d]},p=a.bind(null,m),C=a.bind(null,S),O=a.bind(null,b);e={id:c,name:p,codename:C,acronym:O},typeof _e=="object"&&typeof ne<"u"?ne.exports=e:typeof define=="function"&&define.amd&&define(function(){return e})})()});var ce=P(z=>{"use strict";n();Object.defineProperty(z,"__esModule",{value:!0});z.CxfEvents=void 0;var gt;(function(e){e.Token="cxf.token",e.Login="cxf.login",e.Signup="cxf.signup",e.GameEventUpdate="cxf.gameEvent.update",e.GameEventAdd="cxf.gameEvent.add",e.GameEventRemove="cxf.gameEvent.remove",e.XpChanged="cxf.xp.changed",e.LevelChanged="cxf.level.changed",e.LegendLevelChanged="cxf.legendLevel.changed",e.Push="cxf.push",e.OpenIGS="cxf.igs.open",e.JoinTempServer="cxf.join.temp.server",e.Subscription="cxf.subscription",e.RewardedAdStart="cxf.rewardedad.start",e.RewardedAdDone="cxf.rewardedad.done"})(gt=z.CxfEvents||(z.CxfEvents={}))});n();n();n();n();n();var ye=B(ge());n();n();var I=[];for(let e=0;e<256;++e)I.push((e+256).toString(16).slice(1));function Ce(e,t=0){return(I[e[t+0]]+I[e[t+1]]+I[e[t+2]]+I[e[t+3]]+"-"+I[e[t+4]]+I[e[t+5]]+"-"+I[e[t+6]]+I[e[t+7]]+"-"+I[e[t+8]]+I[e[t+9]]+"-"+I[e[t+10]]+I[e[t+11]]+I[e[t+12]]+I[e[t+13]]+I[e[t+14]]+I[e[t+15]]).toLowerCase()}n();var Y,st=new Uint8Array(16);function ee(){if(!Y){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Y=crypto.getRandomValues.bind(crypto)}return Y(st)}n();n();var at=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),te={randomUUID:at};function ct(e,t,r){if(te.randomUUID&&!t&&!e)return te.randomUUID();e=e||{};let i=e.random??e.rng?.()??ee();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=i[s];return t}return Ce(i)}var re=ct;n();var N=class extends Error{constructor(t,r){super(`${t} has null value: ${r}`),this.name="ArgumentNullError"}};n();var ut=(e,t)=>{let r=setTimeout(e,t);return()=>clearTimeout(r)},Ie=(e,t)=>r=>new Promise((i,s)=>{let m=ut(()=>{s(new Error(`Timeout has exceeded ${t}`))},t);e(r).then(S=>{i(S),m()}).catch(s)}),Se=e=>{for(let t of Object.keys(e)){let r=e[t];if(r==null||Number.isNaN(r))throw new N(t,r)}};function ve(e){return Math.floor(e/1e3)}var xe=e=>{let t=e.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);if(!t||!t[1])return;let r=t[1].match(/[^.]+\.[^.]+$/);if(r)return r[0]};function ft({gameId:e,networkId:t,instanceId:r,playerId:i}){return[e,t,r,i].join("-")}function be(e){return Object.entries(e).filter(([t,r])=>r!=null).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}var $=e=>{let{playerId:t,token:r,zoneId:i,language:s}=e;if(!t)throw new N("playerId",t);return{token:r,zoneId:i,locale:s,ping:ft({...e,playerId:t})}};var X=e=>(...t)=>{try{return e(...t)}catch(r){R(r),dt(r)}},dt=e=>{let t=o.getConfig();o.getCxf().emit(t.CXF_ERROR,e)};var sr=Ie(()=>oe(),1e4),mt=(0,ye.default)("CXF-WEBSHOP"),f=(e,...t)=>mt(e,...t),R=(...e)=>console.error("%c CXF-WEBSHOP:","background: #ff0000; color: #fff",...e),D=()=>re(),Ee=e=>xe(e),Fe=()=>ggsGetQueryParameters(),Oe=()=>ggsGetReferrer();n();function we(e){return{playerId:e.playerId,instanceId:e.instanceId,networkId:e.networkId,gameId:e.gameId,gameApi:e.gameApi,language:e.language,token:e.token,zoneId:e.zoneId,gameEvents:[],xp:0,level:0,legendLevel:void 0,countryCode:"",lastPurchaseTab:"",subscriptionDisabled:!1,isTempServer:!1,customizationSuffix:"",resolvedCustomizationUrl:"",sourceId:"unknown",unreadOfferNotifsCountUrl:""}}function J({legendLevel:e,level:t}){return{legendLevel:e,level:t}}var G=async()=>{let e=o.getConfig(),t=o.getStore();if(e.LEGEND_LEVEL_IS_USED&&t.legendLevel===void 0){f("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");return}if(f("fetchUnreadOfferNotificationsCount"),t.token&&t.unreadOfferNotifsCountUrl){let r=0,i={Authorization:`Bearer ${t.token}`},s=t.unreadOfferNotifsCountUrl.replace("{locale}",t.language||"").replace("{zoneId}",t.zoneId||"").replace("{criteria}",encodeURIComponent(JSON.stringify(J(t))));try{f("fetch",s);let m=await fetch(s,{headers:i});if(m.ok){let S=await m.json();r=Number(S?.notifCount)}}catch(m){R(`cannot fetch ${s}`,m)}f("setUnseenOffersCounter",r),t.gameApi.invokeFn("setUnseenOffersCounter",r).catch(m=>{R("setUnseenOffersCounter error:",m)})}};n();var Z=class{post(t){let r=document.querySelector("#dialog");r&&r.tagName.toLocaleLowerCase()==="iframe"&&r.contentWindow?.postMessage(t,"*")}};n();n();var Pe=B(Ae());var M=({page:e,route:t,sid:r,config:i={}})=>{let s=o.getConfig(),m=o.getStore(),{token:S,zoneId:b,locale:F}=$(m),y={token:S,zoneId:b,locale:F,sid:r||D()};Object.keys(i).length>0&&(y.config=JSON.stringify(i)),Se(y);let c=new URLSearchParams(Fe()),a={...y,"lemonstand.customization.url":m.resolvedCustomizationUrl||q(),domain:Ee(Oe()),websiteId:c.get("w"),criteria:JSON.stringify(J(m)),level:m.level},p=c.get("network");return c.get("usekeybaselogin")==="false"&&Number(p)>0&&(a.network=p),m.adStatus?.areBannersAvailable&&(a.ads=!0),`${s.BASE_URL}/?${be(a)}${e?`#${e}`:""}${t?`--${t}--${Date.now()}`:""}`},q=()=>{let e=o.getConfig(),t=o.getStore(),r=o.getCxf(),i=(0,Pe.acronym)(t.gameId),s=t.customizationSuffix?`-${t.customizationSuffix}`:"",m=`${i}${s}`;if(r.env==="test"){let S=new URLSearchParams(window.location.search).get("configGGS");if(S!==null)return e.CUSTOMIZATION_URL_TEMPLATE.replace("{0}",m).replace("{1}",S)}return e.CUSTOMIZATION_URL.replace("{0}",m)};var Le=()=>{if(typeof fetch!="function")return;let e=q(),t="";fetch(e).then(r=>{if(q()===e)return t=r.url,f("parsed customization url is "+t),o.updateStore({resolvedCustomizationUrl:t}),r.json()}).then(r=>{r&&o.updateStore({unreadOfferNotifsCountUrl:r.unreadOfferNotifsCountUrl||""})})};var ie=e=>{let t=e;return{get:()=>t,set:r=>{t=r}}},se=class{constructor(){this.config=void 0;this.cxfProvider=ie();this.dialogProvider=ie();this.storeProvider=ie();this.shopMessageBus=new Z;this.fetchUnreadOfferNotificationsCount=G;this.preResolveConfig=Le}setConfig(t){this.config=t}getConfig(){if(this.config===void 0)throw new Error("Config is not initialized");return this.config}setCxf(t){this.cxfProvider.set(t)}getCxf(){let t=this.cxfProvider.get();if(!t)throw new Error("CXF is not loaded");return t}setStore(t){this.storeProvider.set(t)}getStore(){let t=this.storeProvider.get();if(!t)throw new Error("Store is not initialized");return t}updateStore(t){let r=this.getStore();this.setStore({...r,...t})}},o=new se;n();n();var k=e=>{let t=o.getConfig();o.getCxf().emit(t.CXF_DIALOG_OPEN,e)};n();var lt=()=>{f("OnOpenSalesOffersPage");let e=D(),t=M({page:"sale-offers",sid:e});k(t)},pt=()=>{let e=o.getStore();f("onLemonstandClose",e),G()},Te=()=>({"cxf.webshop.sales.open":lt,"cxf.dialog.close":pt});n();var g=B(ce());n();n();var W=e=>{let t=o.getConfig(),r=o.getStore(),i=Date.now(),s=$(r),{zoneId:m}=s,S=e,{playerId:b,gameId:F,networkId:y,instanceId:c,sourceId:a}=r;Ct({eventId:t.WEB_SHOP_CALL_TRACK_ID,date:ve(i),unixtimeMS:i,sessionId:S,zoneId:m?Number.parseInt(m,10):void 0,playerId:Number.parseInt(b,10),gameId:Number.parseInt(F,10),networkId:Number.parseInt(y,10),instanceId:Number.parseInt(c,10),sourceId:a})},Ct=e=>{let t=o.getConfig();o.getCxf().emit(t.CXF_TRACK_MSG,e)};var Ue=(e={})=>{f("OnOpen payload:",e),e.sourceId&&o.updateStore({sourceId:e.sourceId});let t=o.getStore(),r=D();W(r);let i=M({sid:r,page:t.lastPurchaseTab,...e});k(i),setTimeout(()=>{t.gameApi.invokeFn("setUnseenOffersCounter",0)},1e3)};n();var It=e=>{f("OnReward: offerId",e.offerId,"Page",e.page);let t=M({route:encodeURIComponent(e.successUrl),...e});o.updateStore({lastPurchaseTab:e.page,sourceId:"successfulPayoutReward"}),W(e.sid),k(t)},St=({target:e,action:t,data:r})=>{o.shopMessageBus.post({eventName:"lemonstand.category.update",target:e,data:{action:t,data:r}})},vt=({notifCount:e})=>{f("onLemonstandNotificationsCreated -> notifCount:",e);let t=o.getStore();if(e>0){let r=Math.floor(Math.random()*(Number(t.networkId)<250?12e4:15e3));setTimeout(()=>{G()},r)}else t.gameApi.invokeFn("setUnseenOffersCounter",0).catch(r=>{R("setUnseenOffersCounter error:",r)})},Ne=()=>({reward:It,"lemonstand.category.update":St,"lemonstand.notifs.created":vt});var xt=()=>{let e=o.getCxf(),t=Ne();e.on(g.CxfEvents.OpenIGS,X(Ue)),e.on(g.CxfEvents.Push,X(({id:r,payload:i})=>{f("cxf.push",r,i);let s=t[r];s&&s(i)}))},ht=()=>{let e=o.getCxf();e.on(g.CxfEvents.Login,t=>{let{gameEvents:r}=o.getStore(),{gameEvents:i}=t,s=m=>S=>!m.map(b=>b.type).includes(S.type);o.updateStore({...t,gameEvents:[...r.filter(s(i)),...i]}),f(g.CxfEvents.Login,"reducer",o.getStore()),o.fetchUnreadOfferNotificationsCount()}),e.on(g.CxfEvents.GameEventUpdate,t=>{f(g.CxfEvents.GameEventUpdate,t);let r=o.getStore(),i=new Set(t.map(s=>s.type));o.updateStore({gameEvents:[...r.gameEvents.filter(s=>!i.has(s.type)),...t]}),f(g.CxfEvents.GameEventUpdate,"reducer",o.getStore())}),e.on(g.CxfEvents.GameEventAdd,t=>{f(g.CxfEvents.GameEventAdd,t);let r=o.getStore();o.updateStore({gameEvents:[...r.gameEvents,t]}),f(g.CxfEvents.GameEventAdd,"reducer",o.getStore())}),e.on(g.CxfEvents.GameEventRemove,t=>{f(g.CxfEvents.GameEventRemove,t);let r=o.getStore();o.updateStore({gameEvents:r.gameEvents.filter(({type:i})=>i!==t)}),f(g.CxfEvents.GameEventRemove,"reducer",o.getStore())}),e.on(g.CxfEvents.LevelChanged,t=>{f(g.CxfEvents.LevelChanged,t),o.updateStore({level:t}),f(g.CxfEvents.LevelChanged,"reducer",o.getStore()),o.fetchUnreadOfferNotificationsCount()}),e.on(g.CxfEvents.LegendLevelChanged,t=>{f(g.CxfEvents.LegendLevelChanged,`legendLevel: ${t}`),o.updateStore({legendLevel:t});let r=o.getStore();f(g.CxfEvents.LegendLevelChanged,"reducer",r),o.fetchUnreadOfferNotificationsCount()})},yt=()=>{o.getCxf().on("cxf.native.subscription.enable",t=>{o.updateStore({subscriptionDisabled:t===0,customizationSuffix:t===0?"no-subscription":""}),o.preResolveConfig()})},bt=()=>{o.getCxf().on("cxf.set.customization.surfix",t=>{let r=o.getStore();t!==r.customizationSuffix&&(o.updateStore({customizationSuffix:t||""}),o.preResolveConfig())})},Et=()=>{let e=o.getConfig();o.getCxf().on(e.CXF_AD_STATUS,({areBannersAvailable:r,bannersDetails:i})=>{o.updateStore({adStatus:{areBannersAvailable:r,bannersDetails:i}})})},Ft=()=>{o.getCxf().on("cxf.join.temp.server",t=>{let r=o.getStore();o.updateStore({isTempServer:!!t}),(r.customizationSuffix===""||r.customizationSuffix==="temp")&&(o.updateStore({customizationSuffix:t?"temp":""}),o.preResolveConfig())})},Re=()=>({common:xt,gameEvents:ht,receiveAdStatus:Et,tempServerContext:Ft,nativeSubscription:yt,setCustomizationSuffix:bt});var De=()=>{f("App has started");let e=Te(),t=Re();window.addEventListener("message",X(({data:r})=>{if(r){let i=e[r.name];i&&(f("POST MESSAGE",r),i(r.payload))}}));for(let r of Object.values(t))r();o.preResolveConfig()};n();var Ge=B(ce());var Ot={CUSTOMIZATION_URL:u.env.CUSTOMIZATION_URL,CUSTOMIZATION_URL_TEMPLATE:u.env.CUSTOMIZATION_URL_TEMPLATE,BASE_URL:u.env.BASE_URL,CXF_DIALOG_OPEN:"cxf.dialog.open",CXF_DIALOG_CLOSE:"cxf.dialog.close",CXF_TRACK_MSG:"cxf.tracking.message",CXF_BTN_CLICK_MSG:Ge.CxfEvents.OpenIGS,CXF_OPEN_SALES_MSG:"cxf.webshop.sales.open",WEB_SHOP_CALL_TRACK_ID:1181,CXF_ERROR:"cxf.error",CXF_PUSH:"cxf.push",CXF_AD_STATUS:"cxf.adBanner.status"},wt={12:{LEGEND_LEVEL_IS_USED:!0},15:{LEGEND_LEVEL_IS_USED:!1},16:{LEGEND_LEVEL_IS_USED:!0}},Me=e=>({...Ot,...wt[e]});localStorage.getItem("cxf_canvas")==="enabled"?f("Skip cxf-webshop loading..."):oe().then(e=>{let t=Me(e.gameId);o.setConfig(t),o.setCxf(e);let r=we(e);o.setStore(r),De()});})();
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
// <define:process>
|
|
33
|
+
var define_process_default;
|
|
34
|
+
var init_define_process = __esm({
|
|
35
|
+
"<define:process>"() {
|
|
36
|
+
define_process_default = { env: { BASE_URL: "https://canvas-test.goodgamestudios.com", CANVAS_AGENT_URL: "https://app.canvas.stillfront.com/agent.js", CANVAS_APP_ID_BY_GAME: { "12": "81199abb-592e-465c-b926-8656628a64c7", "15": { google: "25facd0c-e850-4ebf-b6c4-8c60240e4cf8", stillpay: "bec451f9-8db4-4ca1-8a5a-54494429ff5e" }, "16": "18f5521d-7df2-4bb3-88a3-c162ba072d73" }, CUSTOMIZATION_URL_TEMPLATE: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@{1}/dist/goodgamestudios-{0}.json", CUSTOMIZATION_URL: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@qa/dist/goodgamestudios-{0}.json" } };
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// node_modules/debug/node_modules/ms/index.js
|
|
41
|
+
var require_ms = __commonJS({
|
|
42
|
+
"node_modules/debug/node_modules/ms/index.js"(exports, module) {
|
|
43
|
+
init_define_process();
|
|
44
|
+
var s = 1e3;
|
|
45
|
+
var m = s * 60;
|
|
46
|
+
var h = m * 60;
|
|
47
|
+
var d = h * 24;
|
|
48
|
+
var w = d * 7;
|
|
49
|
+
var y = d * 365.25;
|
|
50
|
+
module.exports = function(val, options) {
|
|
51
|
+
options = options || {};
|
|
52
|
+
var type = typeof val;
|
|
53
|
+
if (type === "string" && val.length > 0) {
|
|
54
|
+
return parse(val);
|
|
55
|
+
} else if (type === "number" && isFinite(val)) {
|
|
56
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
57
|
+
}
|
|
58
|
+
throw new Error(
|
|
59
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
function parse(str) {
|
|
63
|
+
str = String(str);
|
|
64
|
+
if (str.length > 100) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
68
|
+
str
|
|
69
|
+
);
|
|
70
|
+
if (!match) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
var n = parseFloat(match[1]);
|
|
74
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
75
|
+
switch (type) {
|
|
76
|
+
case "years":
|
|
77
|
+
case "year":
|
|
78
|
+
case "yrs":
|
|
79
|
+
case "yr":
|
|
80
|
+
case "y":
|
|
81
|
+
return n * y;
|
|
82
|
+
case "weeks":
|
|
83
|
+
case "week":
|
|
84
|
+
case "w":
|
|
85
|
+
return n * w;
|
|
86
|
+
case "days":
|
|
87
|
+
case "day":
|
|
88
|
+
case "d":
|
|
89
|
+
return n * d;
|
|
90
|
+
case "hours":
|
|
91
|
+
case "hour":
|
|
92
|
+
case "hrs":
|
|
93
|
+
case "hr":
|
|
94
|
+
case "h":
|
|
95
|
+
return n * h;
|
|
96
|
+
case "minutes":
|
|
97
|
+
case "minute":
|
|
98
|
+
case "mins":
|
|
99
|
+
case "min":
|
|
100
|
+
case "m":
|
|
101
|
+
return n * m;
|
|
102
|
+
case "seconds":
|
|
103
|
+
case "second":
|
|
104
|
+
case "secs":
|
|
105
|
+
case "sec":
|
|
106
|
+
case "s":
|
|
107
|
+
return n * s;
|
|
108
|
+
case "milliseconds":
|
|
109
|
+
case "millisecond":
|
|
110
|
+
case "msecs":
|
|
111
|
+
case "msec":
|
|
112
|
+
case "ms":
|
|
113
|
+
return n;
|
|
114
|
+
default:
|
|
115
|
+
return void 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function fmtShort(ms) {
|
|
119
|
+
var msAbs = Math.abs(ms);
|
|
120
|
+
if (msAbs >= d) {
|
|
121
|
+
return Math.round(ms / d) + "d";
|
|
122
|
+
}
|
|
123
|
+
if (msAbs >= h) {
|
|
124
|
+
return Math.round(ms / h) + "h";
|
|
125
|
+
}
|
|
126
|
+
if (msAbs >= m) {
|
|
127
|
+
return Math.round(ms / m) + "m";
|
|
128
|
+
}
|
|
129
|
+
if (msAbs >= s) {
|
|
130
|
+
return Math.round(ms / s) + "s";
|
|
131
|
+
}
|
|
132
|
+
return ms + "ms";
|
|
133
|
+
}
|
|
134
|
+
function fmtLong(ms) {
|
|
135
|
+
var msAbs = Math.abs(ms);
|
|
136
|
+
if (msAbs >= d) {
|
|
137
|
+
return plural(ms, msAbs, d, "day");
|
|
138
|
+
}
|
|
139
|
+
if (msAbs >= h) {
|
|
140
|
+
return plural(ms, msAbs, h, "hour");
|
|
141
|
+
}
|
|
142
|
+
if (msAbs >= m) {
|
|
143
|
+
return plural(ms, msAbs, m, "minute");
|
|
144
|
+
}
|
|
145
|
+
if (msAbs >= s) {
|
|
146
|
+
return plural(ms, msAbs, s, "second");
|
|
147
|
+
}
|
|
148
|
+
return ms + " ms";
|
|
149
|
+
}
|
|
150
|
+
function plural(ms, msAbs, n, name) {
|
|
151
|
+
var isPlural = msAbs >= n * 1.5;
|
|
152
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// node_modules/debug/src/common.js
|
|
158
|
+
var require_common = __commonJS({
|
|
159
|
+
"node_modules/debug/src/common.js"(exports, module) {
|
|
160
|
+
init_define_process();
|
|
161
|
+
function setup(env) {
|
|
162
|
+
createDebug.debug = createDebug;
|
|
163
|
+
createDebug.default = createDebug;
|
|
164
|
+
createDebug.coerce = coerce;
|
|
165
|
+
createDebug.disable = disable;
|
|
166
|
+
createDebug.enable = enable;
|
|
167
|
+
createDebug.enabled = enabled;
|
|
168
|
+
createDebug.humanize = require_ms();
|
|
169
|
+
createDebug.destroy = destroy;
|
|
170
|
+
Object.keys(env).forEach((key) => {
|
|
171
|
+
createDebug[key] = env[key];
|
|
172
|
+
});
|
|
173
|
+
createDebug.names = [];
|
|
174
|
+
createDebug.skips = [];
|
|
175
|
+
createDebug.formatters = {};
|
|
176
|
+
function selectColor(namespace) {
|
|
177
|
+
let hash = 0;
|
|
178
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
179
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
180
|
+
hash |= 0;
|
|
181
|
+
}
|
|
182
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
183
|
+
}
|
|
184
|
+
createDebug.selectColor = selectColor;
|
|
185
|
+
function createDebug(namespace) {
|
|
186
|
+
let prevTime;
|
|
187
|
+
let enableOverride = null;
|
|
188
|
+
let namespacesCache;
|
|
189
|
+
let enabledCache;
|
|
190
|
+
function debug2(...args) {
|
|
191
|
+
if (!debug2.enabled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const self = debug2;
|
|
195
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
196
|
+
const ms = curr - (prevTime || curr);
|
|
197
|
+
self.diff = ms;
|
|
198
|
+
self.prev = prevTime;
|
|
199
|
+
self.curr = curr;
|
|
200
|
+
prevTime = curr;
|
|
201
|
+
args[0] = createDebug.coerce(args[0]);
|
|
202
|
+
if (typeof args[0] !== "string") {
|
|
203
|
+
args.unshift("%O");
|
|
204
|
+
}
|
|
205
|
+
let index = 0;
|
|
206
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
207
|
+
if (match === "%%") {
|
|
208
|
+
return "%";
|
|
209
|
+
}
|
|
210
|
+
index++;
|
|
211
|
+
const formatter = createDebug.formatters[format];
|
|
212
|
+
if (typeof formatter === "function") {
|
|
213
|
+
const val = args[index];
|
|
214
|
+
match = formatter.call(self, val);
|
|
215
|
+
args.splice(index, 1);
|
|
216
|
+
index--;
|
|
217
|
+
}
|
|
218
|
+
return match;
|
|
219
|
+
});
|
|
220
|
+
createDebug.formatArgs.call(self, args);
|
|
221
|
+
const logFn = self.log || createDebug.log;
|
|
222
|
+
logFn.apply(self, args);
|
|
223
|
+
}
|
|
224
|
+
debug2.namespace = namespace;
|
|
225
|
+
debug2.useColors = createDebug.useColors();
|
|
226
|
+
debug2.color = createDebug.selectColor(namespace);
|
|
227
|
+
debug2.extend = extend;
|
|
228
|
+
debug2.destroy = createDebug.destroy;
|
|
229
|
+
Object.defineProperty(debug2, "enabled", {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
configurable: false,
|
|
232
|
+
get: () => {
|
|
233
|
+
if (enableOverride !== null) {
|
|
234
|
+
return enableOverride;
|
|
235
|
+
}
|
|
236
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
237
|
+
namespacesCache = createDebug.namespaces;
|
|
238
|
+
enabledCache = createDebug.enabled(namespace);
|
|
239
|
+
}
|
|
240
|
+
return enabledCache;
|
|
241
|
+
},
|
|
242
|
+
set: (v) => {
|
|
243
|
+
enableOverride = v;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
if (typeof createDebug.init === "function") {
|
|
247
|
+
createDebug.init(debug2);
|
|
248
|
+
}
|
|
249
|
+
return debug2;
|
|
250
|
+
}
|
|
251
|
+
function extend(namespace, delimiter) {
|
|
252
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
253
|
+
newDebug.log = this.log;
|
|
254
|
+
return newDebug;
|
|
255
|
+
}
|
|
256
|
+
function enable(namespaces) {
|
|
257
|
+
createDebug.save(namespaces);
|
|
258
|
+
createDebug.namespaces = namespaces;
|
|
259
|
+
createDebug.names = [];
|
|
260
|
+
createDebug.skips = [];
|
|
261
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
262
|
+
for (const ns of split) {
|
|
263
|
+
if (ns[0] === "-") {
|
|
264
|
+
createDebug.skips.push(ns.slice(1));
|
|
265
|
+
} else {
|
|
266
|
+
createDebug.names.push(ns);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function matchesTemplate(search, template) {
|
|
271
|
+
let searchIndex = 0;
|
|
272
|
+
let templateIndex = 0;
|
|
273
|
+
let starIndex = -1;
|
|
274
|
+
let matchIndex = 0;
|
|
275
|
+
while (searchIndex < search.length) {
|
|
276
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
277
|
+
if (template[templateIndex] === "*") {
|
|
278
|
+
starIndex = templateIndex;
|
|
279
|
+
matchIndex = searchIndex;
|
|
280
|
+
templateIndex++;
|
|
281
|
+
} else {
|
|
282
|
+
searchIndex++;
|
|
283
|
+
templateIndex++;
|
|
284
|
+
}
|
|
285
|
+
} else if (starIndex !== -1) {
|
|
286
|
+
templateIndex = starIndex + 1;
|
|
287
|
+
matchIndex++;
|
|
288
|
+
searchIndex = matchIndex;
|
|
289
|
+
} else {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
294
|
+
templateIndex++;
|
|
295
|
+
}
|
|
296
|
+
return templateIndex === template.length;
|
|
297
|
+
}
|
|
298
|
+
function disable() {
|
|
299
|
+
const namespaces = [
|
|
300
|
+
...createDebug.names,
|
|
301
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
302
|
+
].join(",");
|
|
303
|
+
createDebug.enable("");
|
|
304
|
+
return namespaces;
|
|
305
|
+
}
|
|
306
|
+
function enabled(name) {
|
|
307
|
+
for (const skip of createDebug.skips) {
|
|
308
|
+
if (matchesTemplate(name, skip)) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
for (const ns of createDebug.names) {
|
|
313
|
+
if (matchesTemplate(name, ns)) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
function coerce(val) {
|
|
320
|
+
if (val instanceof Error) {
|
|
321
|
+
return val.stack || val.message;
|
|
322
|
+
}
|
|
323
|
+
return val;
|
|
324
|
+
}
|
|
325
|
+
function destroy() {
|
|
326
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
327
|
+
}
|
|
328
|
+
createDebug.enable(createDebug.load());
|
|
329
|
+
return createDebug;
|
|
330
|
+
}
|
|
331
|
+
module.exports = setup;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// node_modules/debug/src/browser.js
|
|
336
|
+
var require_browser = __commonJS({
|
|
337
|
+
"node_modules/debug/src/browser.js"(exports, module) {
|
|
338
|
+
init_define_process();
|
|
339
|
+
exports.formatArgs = formatArgs;
|
|
340
|
+
exports.save = save;
|
|
341
|
+
exports.load = load;
|
|
342
|
+
exports.useColors = useColors;
|
|
343
|
+
exports.storage = localstorage();
|
|
344
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
345
|
+
let warned = false;
|
|
346
|
+
return () => {
|
|
347
|
+
if (!warned) {
|
|
348
|
+
warned = true;
|
|
349
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
})();
|
|
353
|
+
exports.colors = [
|
|
354
|
+
"#0000CC",
|
|
355
|
+
"#0000FF",
|
|
356
|
+
"#0033CC",
|
|
357
|
+
"#0033FF",
|
|
358
|
+
"#0066CC",
|
|
359
|
+
"#0066FF",
|
|
360
|
+
"#0099CC",
|
|
361
|
+
"#0099FF",
|
|
362
|
+
"#00CC00",
|
|
363
|
+
"#00CC33",
|
|
364
|
+
"#00CC66",
|
|
365
|
+
"#00CC99",
|
|
366
|
+
"#00CCCC",
|
|
367
|
+
"#00CCFF",
|
|
368
|
+
"#3300CC",
|
|
369
|
+
"#3300FF",
|
|
370
|
+
"#3333CC",
|
|
371
|
+
"#3333FF",
|
|
372
|
+
"#3366CC",
|
|
373
|
+
"#3366FF",
|
|
374
|
+
"#3399CC",
|
|
375
|
+
"#3399FF",
|
|
376
|
+
"#33CC00",
|
|
377
|
+
"#33CC33",
|
|
378
|
+
"#33CC66",
|
|
379
|
+
"#33CC99",
|
|
380
|
+
"#33CCCC",
|
|
381
|
+
"#33CCFF",
|
|
382
|
+
"#6600CC",
|
|
383
|
+
"#6600FF",
|
|
384
|
+
"#6633CC",
|
|
385
|
+
"#6633FF",
|
|
386
|
+
"#66CC00",
|
|
387
|
+
"#66CC33",
|
|
388
|
+
"#9900CC",
|
|
389
|
+
"#9900FF",
|
|
390
|
+
"#9933CC",
|
|
391
|
+
"#9933FF",
|
|
392
|
+
"#99CC00",
|
|
393
|
+
"#99CC33",
|
|
394
|
+
"#CC0000",
|
|
395
|
+
"#CC0033",
|
|
396
|
+
"#CC0066",
|
|
397
|
+
"#CC0099",
|
|
398
|
+
"#CC00CC",
|
|
399
|
+
"#CC00FF",
|
|
400
|
+
"#CC3300",
|
|
401
|
+
"#CC3333",
|
|
402
|
+
"#CC3366",
|
|
403
|
+
"#CC3399",
|
|
404
|
+
"#CC33CC",
|
|
405
|
+
"#CC33FF",
|
|
406
|
+
"#CC6600",
|
|
407
|
+
"#CC6633",
|
|
408
|
+
"#CC9900",
|
|
409
|
+
"#CC9933",
|
|
410
|
+
"#CCCC00",
|
|
411
|
+
"#CCCC33",
|
|
412
|
+
"#FF0000",
|
|
413
|
+
"#FF0033",
|
|
414
|
+
"#FF0066",
|
|
415
|
+
"#FF0099",
|
|
416
|
+
"#FF00CC",
|
|
417
|
+
"#FF00FF",
|
|
418
|
+
"#FF3300",
|
|
419
|
+
"#FF3333",
|
|
420
|
+
"#FF3366",
|
|
421
|
+
"#FF3399",
|
|
422
|
+
"#FF33CC",
|
|
423
|
+
"#FF33FF",
|
|
424
|
+
"#FF6600",
|
|
425
|
+
"#FF6633",
|
|
426
|
+
"#FF9900",
|
|
427
|
+
"#FF9933",
|
|
428
|
+
"#FFCC00",
|
|
429
|
+
"#FFCC33"
|
|
430
|
+
];
|
|
431
|
+
function useColors() {
|
|
432
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
let m;
|
|
439
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
440
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
441
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
442
|
+
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
443
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
444
|
+
}
|
|
445
|
+
function formatArgs(args) {
|
|
446
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
447
|
+
if (!this.useColors) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const c = "color: " + this.color;
|
|
451
|
+
args.splice(1, 0, c, "color: inherit");
|
|
452
|
+
let index = 0;
|
|
453
|
+
let lastC = 0;
|
|
454
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
455
|
+
if (match === "%%") {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
index++;
|
|
459
|
+
if (match === "%c") {
|
|
460
|
+
lastC = index;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
args.splice(lastC, 0, c);
|
|
464
|
+
}
|
|
465
|
+
exports.log = console.debug || console.log || (() => {
|
|
466
|
+
});
|
|
467
|
+
function save(namespaces) {
|
|
468
|
+
try {
|
|
469
|
+
if (namespaces) {
|
|
470
|
+
exports.storage.setItem("debug", namespaces);
|
|
471
|
+
} else {
|
|
472
|
+
exports.storage.removeItem("debug");
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function load() {
|
|
478
|
+
let r;
|
|
479
|
+
try {
|
|
480
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
481
|
+
} catch (error) {
|
|
482
|
+
}
|
|
483
|
+
if (!r && typeof define_process_default !== "undefined" && "env" in define_process_default) {
|
|
484
|
+
r = define_process_default.env.DEBUG;
|
|
485
|
+
}
|
|
486
|
+
return r;
|
|
487
|
+
}
|
|
488
|
+
function localstorage() {
|
|
489
|
+
try {
|
|
490
|
+
return localStorage;
|
|
491
|
+
} catch (error) {
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
module.exports = require_common()(exports);
|
|
495
|
+
var { formatters } = module.exports;
|
|
496
|
+
formatters.j = function(v) {
|
|
497
|
+
try {
|
|
498
|
+
return JSON.stringify(v);
|
|
499
|
+
} catch (error) {
|
|
500
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// node_modules/@goodgamestudios/cxf-ready/dist/index.js
|
|
507
|
+
var require_dist = __commonJS({
|
|
508
|
+
"node_modules/@goodgamestudios/cxf-ready/dist/index.js"(exports, module) {
|
|
509
|
+
"use strict";
|
|
510
|
+
init_define_process();
|
|
511
|
+
var cxf = window && window.CXF;
|
|
512
|
+
module.exports = new Promise(function(resolve, reject) {
|
|
513
|
+
if (!window) {
|
|
514
|
+
reject();
|
|
515
|
+
}
|
|
516
|
+
if (cxf) {
|
|
517
|
+
return resolve(cxf);
|
|
518
|
+
}
|
|
519
|
+
window.addEventListener("cxf.initialized", function(event) {
|
|
520
|
+
cxf = event.cxf;
|
|
521
|
+
resolve(cxf);
|
|
522
|
+
}, {
|
|
523
|
+
capture: true,
|
|
524
|
+
once: true,
|
|
525
|
+
passive: true
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// node_modules/@goodgamestudios/game-alias/dist/index.js
|
|
532
|
+
var require_dist2 = __commonJS({
|
|
533
|
+
"node_modules/@goodgamestudios/game-alias/dist/index.js"(exports, module) {
|
|
534
|
+
init_define_process();
|
|
535
|
+
(function() {
|
|
536
|
+
var b = {};
|
|
537
|
+
function f(r, $) {
|
|
538
|
+
return h(r) || g(r, $) || e();
|
|
539
|
+
}
|
|
540
|
+
function e() {
|
|
541
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
542
|
+
}
|
|
543
|
+
function g(r, $) {
|
|
544
|
+
var a2 = [], o2 = true, e2 = false, n2 = void 0;
|
|
545
|
+
try {
|
|
546
|
+
for (var c2, i2 = r[Symbol.iterator](); !(o2 = (c2 = i2.next()).done) && (a2.push(c2.value), !$ || a2.length !== $); o2 = true) ;
|
|
547
|
+
} catch (m2) {
|
|
548
|
+
e2 = true, n2 = m2;
|
|
549
|
+
} finally {
|
|
550
|
+
try {
|
|
551
|
+
o2 || null == i2.return || i2.return();
|
|
552
|
+
} finally {
|
|
553
|
+
if (e2) throw n2;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return a2;
|
|
557
|
+
}
|
|
558
|
+
function h(r) {
|
|
559
|
+
if (Array.isArray(r)) return r;
|
|
560
|
+
}
|
|
561
|
+
var i = 0, j = 1, k = 2, c = { 1: ["poker", "poker2", "poker"], 12: ["empire", "castle", "em"], 15: ["bigfarm", "ranch", "bf"], 16: ["empirefourkingdoms", "fourkingdoms", "e4k"], 23: ["legendsofhonor", void 0, "loh"], 41: ["empiremillenniumwars", void 0, "emmw"] }, d = Object.entries(c).reduce(function(r, $) {
|
|
562
|
+
var a2 = f($, 2), o2 = a2[0], e2 = a2[1];
|
|
563
|
+
return o2 = parseInt(o2, 10), r[o2] = o2, e2.forEach(function($2) {
|
|
564
|
+
r[$2] = o2;
|
|
565
|
+
}), r;
|
|
566
|
+
}, {}), l = function(r) {
|
|
567
|
+
r = r.toString().toLowerCase();
|
|
568
|
+
var $ = d[r];
|
|
569
|
+
return $ && 0 | $;
|
|
570
|
+
}, a = function(r, $) {
|
|
571
|
+
return ($ = d[$]) && c[$][r];
|
|
572
|
+
}, m = a.bind(null, i), n = a.bind(null, j), o = a.bind(null, k);
|
|
573
|
+
b = { id: l, name: m, codename: n, acronym: o };
|
|
574
|
+
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
575
|
+
module.exports = b;
|
|
576
|
+
} else if (typeof define === "function" && define.amd) {
|
|
577
|
+
define(function() {
|
|
578
|
+
return b;
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
})();
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// node_modules/@goodgamestudios/cxf-events/dist/typings.js
|
|
586
|
+
var require_typings = __commonJS({
|
|
587
|
+
"node_modules/@goodgamestudios/cxf-events/dist/typings.js"(exports) {
|
|
588
|
+
"use strict";
|
|
589
|
+
init_define_process();
|
|
590
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
591
|
+
exports.CxfEvents = void 0;
|
|
592
|
+
var CxfEvents3;
|
|
593
|
+
(function(CxfEvents4) {
|
|
594
|
+
CxfEvents4["Token"] = "cxf.token";
|
|
595
|
+
CxfEvents4["Login"] = "cxf.login";
|
|
596
|
+
CxfEvents4["Signup"] = "cxf.signup";
|
|
597
|
+
CxfEvents4["GameEventUpdate"] = "cxf.gameEvent.update";
|
|
598
|
+
CxfEvents4["GameEventAdd"] = "cxf.gameEvent.add";
|
|
599
|
+
CxfEvents4["GameEventRemove"] = "cxf.gameEvent.remove";
|
|
600
|
+
CxfEvents4["XpChanged"] = "cxf.xp.changed";
|
|
601
|
+
CxfEvents4["LevelChanged"] = "cxf.level.changed";
|
|
602
|
+
CxfEvents4["LegendLevelChanged"] = "cxf.legendLevel.changed";
|
|
603
|
+
CxfEvents4["Push"] = "cxf.push";
|
|
604
|
+
CxfEvents4["OpenIGS"] = "cxf.igs.open";
|
|
605
|
+
CxfEvents4["JoinTempServer"] = "cxf.join.temp.server";
|
|
606
|
+
CxfEvents4["Subscription"] = "cxf.subscription";
|
|
607
|
+
CxfEvents4["RewardedAdStart"] = "cxf.rewardedad.start";
|
|
608
|
+
CxfEvents4["RewardedAdDone"] = "cxf.rewardedad.done";
|
|
609
|
+
})(CxfEvents3 = exports.CxfEvents || (exports.CxfEvents = {}));
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// src/index.ts
|
|
614
|
+
init_define_process();
|
|
615
|
+
|
|
616
|
+
// src/app.ts
|
|
617
|
+
init_define_process();
|
|
618
|
+
|
|
619
|
+
// src/globalState.ts
|
|
620
|
+
init_define_process();
|
|
621
|
+
|
|
622
|
+
// src/fetch.ts
|
|
623
|
+
init_define_process();
|
|
624
|
+
|
|
625
|
+
// src/store.ts
|
|
626
|
+
init_define_process();
|
|
627
|
+
function initializeStore(cxf) {
|
|
628
|
+
return {
|
|
629
|
+
isCanvas: false,
|
|
630
|
+
playerId: cxf.playerId,
|
|
631
|
+
instanceId: cxf.instanceId,
|
|
632
|
+
networkId: cxf.networkId,
|
|
633
|
+
gameId: cxf.gameId,
|
|
634
|
+
gameApi: cxf.gameApi,
|
|
635
|
+
language: cxf.language,
|
|
636
|
+
token: cxf.token,
|
|
637
|
+
zoneId: cxf.zoneId,
|
|
638
|
+
gameEvents: [],
|
|
639
|
+
xp: 0,
|
|
640
|
+
level: 0,
|
|
641
|
+
legendLevel: void 0,
|
|
642
|
+
countryCode: "",
|
|
643
|
+
lastPurchaseTab: "",
|
|
644
|
+
subscriptionDisabled: false,
|
|
645
|
+
isTempServer: false,
|
|
646
|
+
customizationSuffix: "",
|
|
647
|
+
resolvedCustomizationUrl: "",
|
|
648
|
+
sourceId: "unknown",
|
|
649
|
+
unreadOfferNotifsCountUrl: ""
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function criteriaSelector({ legendLevel, level }) {
|
|
653
|
+
return {
|
|
654
|
+
legendLevel,
|
|
655
|
+
level
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// src/utils/index.ts
|
|
660
|
+
init_define_process();
|
|
661
|
+
|
|
662
|
+
// src/utils/domain.ts
|
|
663
|
+
init_define_process();
|
|
664
|
+
var parentDomain = (referrer) => {
|
|
665
|
+
const matches = referrer.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);
|
|
666
|
+
if (!matches || !matches[1]) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const result = matches[1].match(/[^.]+\.[^.]+$/);
|
|
670
|
+
if (!result) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
return result[0];
|
|
674
|
+
};
|
|
675
|
+
var getDomain = (referrer) => {
|
|
676
|
+
return parentDomain(referrer);
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
// src/utils/error-handling.ts
|
|
680
|
+
init_define_process();
|
|
681
|
+
|
|
682
|
+
// src/utils/logging.ts
|
|
683
|
+
init_define_process();
|
|
684
|
+
var import_debug = __toESM(require_browser());
|
|
685
|
+
var logger = (0, import_debug.default)("CXF-WEBSHOP");
|
|
686
|
+
var log = (argument0, ...rest) => logger(argument0, ...rest);
|
|
687
|
+
var logError = (...arguments_) => (
|
|
688
|
+
// tslint:disable-next-line:no-console
|
|
689
|
+
console.error("%c CXF-WEBSHOP ->", "background: #ff0000; color: #fff", ...arguments_)
|
|
690
|
+
);
|
|
691
|
+
|
|
692
|
+
// src/utils/error-handling.ts
|
|
693
|
+
var tryCatch = (fn) => (...args) => {
|
|
694
|
+
try {
|
|
695
|
+
return fn(...args);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
logError(error);
|
|
698
|
+
throwCxfError(error);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var throwCxfError = (e) => {
|
|
702
|
+
const config = globalState.getConfig();
|
|
703
|
+
const cxf = globalState.getCxf();
|
|
704
|
+
cxf.emit(config.CXF_ERROR, e);
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// src/utils/loaders.ts
|
|
708
|
+
init_define_process();
|
|
709
|
+
var startTimer = (function_, time) => {
|
|
710
|
+
const id = setTimeout(function_, time);
|
|
711
|
+
return () => clearTimeout(id);
|
|
712
|
+
};
|
|
713
|
+
var timeout = (function_, time) => (a) => {
|
|
714
|
+
return new Promise((resolve, reject) => {
|
|
715
|
+
const stopTimer = startTimer(() => {
|
|
716
|
+
reject(new Error(`Timeout has exceeded ${time}`));
|
|
717
|
+
}, time);
|
|
718
|
+
function_(a).then((value) => {
|
|
719
|
+
resolve(value);
|
|
720
|
+
stopTimer();
|
|
721
|
+
}).catch(reject);
|
|
722
|
+
});
|
|
723
|
+
};
|
|
724
|
+
var loadScript = (src) => new Promise((resolve, reject) => {
|
|
725
|
+
const script = document.createElement("script");
|
|
726
|
+
script.type = "text/javascript";
|
|
727
|
+
script.type = "module";
|
|
728
|
+
script.async = true;
|
|
729
|
+
script.src = src;
|
|
730
|
+
script.addEventListener("load", resolve);
|
|
731
|
+
script.addEventListener("error", reject);
|
|
732
|
+
document.body.append(script);
|
|
733
|
+
});
|
|
734
|
+
var loadCxf = timeout(() => require_dist(), 1e4);
|
|
735
|
+
|
|
736
|
+
// src/utils/payment.ts
|
|
737
|
+
init_define_process();
|
|
738
|
+
var transformPaymentContractIdsToNativePriceEvent = (ids) => (
|
|
739
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
740
|
+
ids.reduce(
|
|
741
|
+
(prev, cur, idx) => {
|
|
742
|
+
prev.offers.push({
|
|
743
|
+
id: cur,
|
|
744
|
+
tier: 0,
|
|
745
|
+
productIds: {
|
|
746
|
+
googleplay: cur
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
return prev;
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
category: "all",
|
|
753
|
+
offers: [],
|
|
754
|
+
eventName: "lemonstand.nativePrice",
|
|
755
|
+
eventType: "bubble"
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
// src/utils/platform.ts
|
|
761
|
+
init_define_process();
|
|
762
|
+
var userAgentToDistribPlatformMatrix = {
|
|
763
|
+
itunes: "apple",
|
|
764
|
+
Android: "google",
|
|
765
|
+
googleplay: "google",
|
|
766
|
+
amazonmobile: "amazon",
|
|
767
|
+
facebook: "facebook",
|
|
768
|
+
samsung: "samsung",
|
|
769
|
+
huawei: "huawei"
|
|
770
|
+
};
|
|
771
|
+
var detectPlatform = (defaultPlatform = "stillpay") => {
|
|
772
|
+
const nativePlatform = navigator.userAgent.match(
|
|
773
|
+
/(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g
|
|
774
|
+
);
|
|
775
|
+
if (!nativePlatform) return defaultPlatform;
|
|
776
|
+
const activePlatform = nativePlatform[0];
|
|
777
|
+
return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform) ? userAgentToDistribPlatformMatrix[activePlatform] : defaultPlatform;
|
|
778
|
+
};
|
|
779
|
+
var distribPlatformToProviderMatrix = {
|
|
780
|
+
apple: "itunes",
|
|
781
|
+
google: "googleplay",
|
|
782
|
+
amazon: "amazonmobile",
|
|
783
|
+
facebook: "facebook",
|
|
784
|
+
samsung: "samsung",
|
|
785
|
+
huawei: "huawei"
|
|
786
|
+
};
|
|
787
|
+
var createProductIdsForPlatform = (platform, id) => {
|
|
788
|
+
if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))
|
|
789
|
+
throw new Error(`Platform ${platform} is not supported`);
|
|
790
|
+
const res = /* @__PURE__ */ Object.create(null);
|
|
791
|
+
res[distribPlatformToProviderMatrix[platform]] = id;
|
|
792
|
+
return res;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
// src/utils/query-params.ts
|
|
796
|
+
init_define_process();
|
|
797
|
+
function formatQueryString(object) {
|
|
798
|
+
return Object.entries(object).filter(([key, value]) => value !== null && value !== void 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
|
|
799
|
+
}
|
|
800
|
+
var ggsGetQueryParams = () => {
|
|
801
|
+
return ggsGetQueryParameters();
|
|
802
|
+
};
|
|
803
|
+
var ggsGetReferrerValue = () => {
|
|
804
|
+
return ggsGetReferrer();
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
// src/utils/session.ts
|
|
808
|
+
init_define_process();
|
|
809
|
+
|
|
810
|
+
// node_modules/@lukeed/uuid/dist/index.mjs
|
|
811
|
+
init_define_process();
|
|
812
|
+
var IDX = 256;
|
|
813
|
+
var HEX = [];
|
|
814
|
+
var BUFFER;
|
|
815
|
+
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
|
816
|
+
function v4() {
|
|
817
|
+
var i = 0, num, out = "";
|
|
818
|
+
if (!BUFFER || IDX + 16 > 256) {
|
|
819
|
+
BUFFER = Array(i = 256);
|
|
820
|
+
while (i--) BUFFER[i] = 256 * Math.random() | 0;
|
|
821
|
+
i = IDX = 0;
|
|
822
|
+
}
|
|
823
|
+
for (; i < 16; i++) {
|
|
824
|
+
num = BUFFER[IDX + i];
|
|
825
|
+
if (i == 6) out += HEX[num & 15 | 64];
|
|
826
|
+
else if (i == 8) out += HEX[num & 63 | 128];
|
|
827
|
+
else out += HEX[num];
|
|
828
|
+
if (i & 1 && i > 1 && i < 11) out += "-";
|
|
829
|
+
}
|
|
830
|
+
IDX++;
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// src/ArgumentNullError.ts
|
|
835
|
+
init_define_process();
|
|
836
|
+
var ArgumentNullError = class extends Error {
|
|
837
|
+
constructor(parameterName, parameterValue) {
|
|
838
|
+
super(`${parameterName} has null value: ${parameterValue}`);
|
|
839
|
+
this.name = "ArgumentNullError";
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
// src/types/models.ts
|
|
844
|
+
init_define_process();
|
|
845
|
+
function encodeGnip({ gameId, networkId, instanceId, playerId }) {
|
|
846
|
+
return [gameId, networkId, instanceId, playerId].join("-");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// src/utils/session.ts
|
|
850
|
+
var createSessionId = () => v4();
|
|
851
|
+
var getTokenAndLanguage = (store) => {
|
|
852
|
+
const { playerId, token, zoneId, language } = store;
|
|
853
|
+
if (!playerId) {
|
|
854
|
+
throw new ArgumentNullError("playerId", playerId);
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
token,
|
|
858
|
+
zoneId,
|
|
859
|
+
locale: language,
|
|
860
|
+
ping: encodeGnip({ ...store, playerId })
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
// src/utils/time.ts
|
|
865
|
+
init_define_process();
|
|
866
|
+
function msToSec(value) {
|
|
867
|
+
return Math.floor(value / 1e3);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/utils/url.ts
|
|
871
|
+
init_define_process();
|
|
872
|
+
var import_game_alias = __toESM(require_dist2());
|
|
873
|
+
|
|
874
|
+
// src/utils/validation.ts
|
|
875
|
+
init_define_process();
|
|
876
|
+
var validateForNull = (properties) => {
|
|
877
|
+
for (const key of Object.keys(properties)) {
|
|
878
|
+
const value = properties[key];
|
|
879
|
+
if (value === void 0 || value === null || Number.isNaN(value)) {
|
|
880
|
+
throw new ArgumentNullError(key, value);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/utils/url.ts
|
|
886
|
+
var createIframeUrl = ({ page, route, sid, config: igsConfig = {} }) => {
|
|
887
|
+
const config = globalState.getConfig();
|
|
888
|
+
const store = globalState.getStore();
|
|
889
|
+
const { token, zoneId, locale } = getTokenAndLanguage(store);
|
|
890
|
+
const parameters = {
|
|
891
|
+
token,
|
|
892
|
+
zoneId,
|
|
893
|
+
locale,
|
|
894
|
+
sid: sid || createSessionId()
|
|
895
|
+
};
|
|
896
|
+
if (Object.keys(igsConfig).length > 0) {
|
|
897
|
+
parameters.config = JSON.stringify(igsConfig);
|
|
898
|
+
}
|
|
899
|
+
validateForNull(parameters);
|
|
900
|
+
const urlParameters = new URLSearchParams(ggsGetQueryParams());
|
|
901
|
+
const queryParameters = {
|
|
902
|
+
...parameters,
|
|
903
|
+
"lemonstand.customization.url": store.resolvedCustomizationUrl || createCustomizationUrl(),
|
|
904
|
+
domain: getDomain(ggsGetReferrerValue()),
|
|
905
|
+
websiteId: urlParameters.get("w"),
|
|
906
|
+
criteria: JSON.stringify(criteriaSelector(store)),
|
|
907
|
+
level: store.level
|
|
908
|
+
};
|
|
909
|
+
const network = urlParameters.get("network");
|
|
910
|
+
if (urlParameters.get("usekeybaselogin") === "false" && Number(network) > 0) {
|
|
911
|
+
queryParameters.network = network;
|
|
912
|
+
}
|
|
913
|
+
if (store.adStatus?.areBannersAvailable) {
|
|
914
|
+
queryParameters.ads = true;
|
|
915
|
+
}
|
|
916
|
+
return `${config.BASE_URL}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ""}${route ? `--${route}--${Date.now()}` : ""}`;
|
|
917
|
+
};
|
|
918
|
+
var createCustomizationUrl = () => {
|
|
919
|
+
const config = globalState.getConfig();
|
|
920
|
+
const store = globalState.getStore();
|
|
921
|
+
const cxf = globalState.getCxf();
|
|
922
|
+
const configBase = (0, import_game_alias.acronym)(store.gameId);
|
|
923
|
+
const configVariance = store.customizationSuffix ? `-${store.customizationSuffix}` : "";
|
|
924
|
+
const configBranch = `${configBase}${configVariance}`;
|
|
925
|
+
if (cxf.env === "test") {
|
|
926
|
+
const configVersion = new URLSearchParams(window.location.search).get("configGGS");
|
|
927
|
+
if (configVersion !== null) {
|
|
928
|
+
return config.CUSTOMIZATION_URL_TEMPLATE.replace("{0}", configBranch).replace("{1}", configVersion);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return config.CUSTOMIZATION_URL.replace("{0}", configBranch);
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
// src/fetch.ts
|
|
935
|
+
var fetchUnreadOfferNotificationsCount = async () => {
|
|
936
|
+
const config = globalState.getConfig();
|
|
937
|
+
const store = globalState.getStore();
|
|
938
|
+
if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === void 0) {
|
|
939
|
+
log("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {
|
|
943
|
+
log("fetchUnreadOfferNotificationsCount");
|
|
944
|
+
let unreadCount = 0;
|
|
945
|
+
const headers = {
|
|
946
|
+
Authorization: `Bearer ${store.token}`
|
|
947
|
+
};
|
|
948
|
+
const url = store.unreadOfferNotifsCountUrl.replace("{locale}", store.language || "").replace("{zoneId}", store.zoneId || "").replace("{criteria}", encodeURIComponent(JSON.stringify(criteriaSelector(store))));
|
|
949
|
+
try {
|
|
950
|
+
log("fetch", url);
|
|
951
|
+
const resp = await fetch(url, {
|
|
952
|
+
headers
|
|
953
|
+
});
|
|
954
|
+
if (resp.ok) {
|
|
955
|
+
const data = await resp.json();
|
|
956
|
+
unreadCount = Number(data?.notifCount);
|
|
957
|
+
}
|
|
958
|
+
} catch (error) {
|
|
959
|
+
logError(`cannot fetch ${url}`, error);
|
|
960
|
+
}
|
|
961
|
+
log("setUnseenOffersCounter", unreadCount);
|
|
962
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", unreadCount).catch((error) => {
|
|
963
|
+
logError("setUnseenOffersCounter error:", error);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
// src/messages/ShopMessageBus.ts
|
|
969
|
+
init_define_process();
|
|
970
|
+
var ShopMessageBus = class {
|
|
971
|
+
post(message) {
|
|
972
|
+
const element = document.querySelector("#dialog");
|
|
973
|
+
if (element && element.tagName.toLocaleLowerCase() === "iframe") {
|
|
974
|
+
element.contentWindow?.postMessage(message, "*");
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// src/preFetch.ts
|
|
980
|
+
init_define_process();
|
|
981
|
+
var preResolveConfig = () => {
|
|
982
|
+
if (typeof fetch !== "function") {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
const originalCustomUrl = createCustomizationUrl();
|
|
986
|
+
let resolvedUrl = "";
|
|
987
|
+
fetch(originalCustomUrl).then((resp) => {
|
|
988
|
+
const currentCustomUrl = createCustomizationUrl();
|
|
989
|
+
if (currentCustomUrl === originalCustomUrl) {
|
|
990
|
+
resolvedUrl = resp.url;
|
|
991
|
+
log("parsed customization url is " + resolvedUrl);
|
|
992
|
+
globalState.updateStore({
|
|
993
|
+
resolvedCustomizationUrl: resolvedUrl
|
|
994
|
+
});
|
|
995
|
+
return resp.json();
|
|
996
|
+
}
|
|
997
|
+
}).then((config) => {
|
|
998
|
+
if (config) {
|
|
999
|
+
globalState.updateStore({
|
|
1000
|
+
unreadOfferNotifsCountUrl: config.unreadOfferNotifsCountUrl || ""
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/types/store.ts
|
|
1007
|
+
init_define_process();
|
|
1008
|
+
var entityProvider = (initial) => {
|
|
1009
|
+
let element = initial;
|
|
1010
|
+
return {
|
|
1011
|
+
get: () => element,
|
|
1012
|
+
set: (value) => {
|
|
1013
|
+
element = value;
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
// src/globalState.ts
|
|
1019
|
+
var GlobalState = class {
|
|
1020
|
+
constructor() {
|
|
1021
|
+
this.config = void 0;
|
|
1022
|
+
this.cxfProvider = entityProvider();
|
|
1023
|
+
this.dialogProvider = entityProvider();
|
|
1024
|
+
this.storeProvider = entityProvider();
|
|
1025
|
+
this.shopMessageBus = new ShopMessageBus();
|
|
1026
|
+
this.fetchUnreadOfferNotificationsCount = fetchUnreadOfferNotificationsCount;
|
|
1027
|
+
this.preResolveConfig = preResolveConfig;
|
|
1028
|
+
}
|
|
1029
|
+
setConfig(config) {
|
|
1030
|
+
this.config = config;
|
|
1031
|
+
}
|
|
1032
|
+
getConfig() {
|
|
1033
|
+
if (this.config === void 0) {
|
|
1034
|
+
throw new Error("Config is not initialized");
|
|
1035
|
+
}
|
|
1036
|
+
return this.config;
|
|
1037
|
+
}
|
|
1038
|
+
setCxf(cxf) {
|
|
1039
|
+
this.cxfProvider.set(cxf);
|
|
1040
|
+
}
|
|
1041
|
+
getCxf() {
|
|
1042
|
+
const cxf = this.cxfProvider.get();
|
|
1043
|
+
if (!cxf) {
|
|
1044
|
+
throw new Error("CXF is not loaded");
|
|
1045
|
+
}
|
|
1046
|
+
return cxf;
|
|
1047
|
+
}
|
|
1048
|
+
setStore(store) {
|
|
1049
|
+
this.storeProvider.set(store);
|
|
1050
|
+
}
|
|
1051
|
+
getStore() {
|
|
1052
|
+
const store = this.storeProvider.get();
|
|
1053
|
+
if (!store) {
|
|
1054
|
+
throw new Error("Store is not initialized");
|
|
1055
|
+
}
|
|
1056
|
+
return store;
|
|
1057
|
+
}
|
|
1058
|
+
updateStore(data) {
|
|
1059
|
+
const currentStore = this.getStore();
|
|
1060
|
+
this.setStore({
|
|
1061
|
+
...currentStore,
|
|
1062
|
+
...data
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
var globalState = new GlobalState();
|
|
1067
|
+
|
|
1068
|
+
// src/handlers/cxfEventHandlers.ts
|
|
1069
|
+
init_define_process();
|
|
1070
|
+
var import_cxf_events = __toESM(require_typings());
|
|
1071
|
+
|
|
1072
|
+
// src/dialog.ts
|
|
1073
|
+
init_define_process();
|
|
1074
|
+
var createDialog = (url) => {
|
|
1075
|
+
const config = globalState.getConfig();
|
|
1076
|
+
const cxf = globalState.getCxf();
|
|
1077
|
+
cxf.emit(config.CXF_DIALOG_OPEN, url);
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
// src/track.ts
|
|
1081
|
+
init_define_process();
|
|
1082
|
+
var trackOpenAction = (sid) => {
|
|
1083
|
+
const config = globalState.getConfig();
|
|
1084
|
+
const store = globalState.getStore();
|
|
1085
|
+
const now = Date.now();
|
|
1086
|
+
const parameters = getTokenAndLanguage(store);
|
|
1087
|
+
const { zoneId } = parameters;
|
|
1088
|
+
const sessionId = sid;
|
|
1089
|
+
const { playerId, gameId, networkId, instanceId, sourceId } = store;
|
|
1090
|
+
trackAction({
|
|
1091
|
+
eventId: config.WEB_SHOP_CALL_TRACK_ID,
|
|
1092
|
+
date: msToSec(now),
|
|
1093
|
+
unixtimeMS: now,
|
|
1094
|
+
sessionId,
|
|
1095
|
+
zoneId: zoneId ? Number.parseInt(zoneId, 10) : void 0,
|
|
1096
|
+
playerId: Number.parseInt(playerId, 10),
|
|
1097
|
+
gameId: Number.parseInt(gameId, 10),
|
|
1098
|
+
networkId: Number.parseInt(networkId, 10),
|
|
1099
|
+
instanceId: Number.parseInt(instanceId, 10),
|
|
1100
|
+
sourceId
|
|
1101
|
+
});
|
|
1102
|
+
};
|
|
1103
|
+
var trackAction = (payload) => {
|
|
1104
|
+
const config = globalState.getConfig();
|
|
1105
|
+
const cxf = globalState.getCxf();
|
|
1106
|
+
cxf.emit(config.CXF_TRACK_MSG, payload);
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
// src/types/index.ts
|
|
1110
|
+
init_define_process();
|
|
1111
|
+
|
|
1112
|
+
// src/types/config.ts
|
|
1113
|
+
init_define_process();
|
|
1114
|
+
|
|
1115
|
+
// src/whitelist.ts
|
|
1116
|
+
init_define_process();
|
|
1117
|
+
var whitelistedZones = /* @__PURE__ */ new Set([
|
|
1118
|
+
// 264, Poland
|
|
1119
|
+
316,
|
|
1120
|
+
318,
|
|
1121
|
+
460,
|
|
1122
|
+
461,
|
|
1123
|
+
767,
|
|
1124
|
+
768,
|
|
1125
|
+
// 767 DEV-QUADRUPLEX
|
|
1126
|
+
802,
|
|
1127
|
+
814,
|
|
1128
|
+
830,
|
|
1129
|
+
877
|
|
1130
|
+
]);
|
|
1131
|
+
|
|
1132
|
+
// src/handlers/pushHandlers.ts
|
|
1133
|
+
init_define_process();
|
|
1134
|
+
var onReward = (payload) => {
|
|
1135
|
+
log("OnReward: payload", payload);
|
|
1136
|
+
const { isCanvas } = globalState.getStore();
|
|
1137
|
+
if (isCanvas) {
|
|
1138
|
+
window.CanvasAgent?.instance?.hide();
|
|
1139
|
+
window.CanvasAgent?.instance?.navigate();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
const url = createIframeUrl({
|
|
1143
|
+
route: encodeURIComponent(payload.successUrl),
|
|
1144
|
+
...payload
|
|
1145
|
+
});
|
|
1146
|
+
globalState.updateStore({
|
|
1147
|
+
lastPurchaseTab: payload.page,
|
|
1148
|
+
sourceId: "successfulPayoutReward"
|
|
1149
|
+
});
|
|
1150
|
+
trackOpenAction(payload.sid);
|
|
1151
|
+
createDialog(url);
|
|
1152
|
+
};
|
|
1153
|
+
var onLemonstandCategoryUpdate = ({ target, action, data }) => {
|
|
1154
|
+
globalState.shopMessageBus.post({
|
|
1155
|
+
eventName: "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */,
|
|
1156
|
+
target,
|
|
1157
|
+
data: { action, data }
|
|
1158
|
+
});
|
|
1159
|
+
};
|
|
1160
|
+
var onLemonstandNotificationsCreated = ({ notifCount }) => {
|
|
1161
|
+
log("onLemonstandNotificationsCreated -> notifCount:", notifCount);
|
|
1162
|
+
const store = globalState.getStore();
|
|
1163
|
+
if (notifCount > 0) {
|
|
1164
|
+
const randomDelayMs = Math.floor(Math.random() * (Number(store.networkId) < 250 ? 12e4 : 15e3));
|
|
1165
|
+
setTimeout(() => {
|
|
1166
|
+
fetchUnreadOfferNotificationsCount();
|
|
1167
|
+
}, randomDelayMs);
|
|
1168
|
+
} else {
|
|
1169
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", 0).catch((error) => {
|
|
1170
|
+
logError("setUnseenOffersCounter error:", error);
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
var createPushHandlers = () => {
|
|
1175
|
+
return {
|
|
1176
|
+
reward: onReward,
|
|
1177
|
+
reward_received: onReward,
|
|
1178
|
+
["lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */]: onLemonstandCategoryUpdate,
|
|
1179
|
+
["lemonstand.notifs.created" /* LEMONSTAND_NOTIFICATIONS_CREATED */]: onLemonstandNotificationsCreated
|
|
1180
|
+
};
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
// src/handlers/cxfEventHandlers.ts
|
|
1184
|
+
var isWindowMessageListenerAttached = false;
|
|
1185
|
+
var eventListener = (event) => {
|
|
1186
|
+
log(`Canvas event "${event.eventType}" received:`, event);
|
|
1187
|
+
switch (event.eventType) {
|
|
1188
|
+
case "native_catalog_request" /* NATIVE_CATALOG_REQUEST */: {
|
|
1189
|
+
if (event?.paymentContractIds?.length > 0) {
|
|
1190
|
+
if (!isWindowMessageListenerAttached) {
|
|
1191
|
+
window.addEventListener("message", ({ data }) => {
|
|
1192
|
+
if (data?.eventName === "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */ && data?.data?.action === "nativePriceUpdate") {
|
|
1193
|
+
log(`${"lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */} event`, data.data);
|
|
1194
|
+
if (!data.data.data) return;
|
|
1195
|
+
const nativeCatalog = {};
|
|
1196
|
+
for (const key in data.data.data) {
|
|
1197
|
+
const { priceString, ...rest } = data.data.data[key];
|
|
1198
|
+
nativeCatalog[key] = rest;
|
|
1199
|
+
}
|
|
1200
|
+
log("nativeCatalog:", nativeCatalog);
|
|
1201
|
+
window.CanvasAgent?.instance?.setNativeCatalog(nativeCatalog);
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
isWindowMessageListenerAttached = true;
|
|
1205
|
+
}
|
|
1206
|
+
const msg = transformPaymentContractIdsToNativePriceEvent(event.paymentContractIds);
|
|
1207
|
+
window.postMessage(msg, "*");
|
|
1208
|
+
log("Event `lemonstand.nativePrice` sent");
|
|
1209
|
+
}
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case "native_checkout_request" /* NATIVE_CHECKOUT_REQUEST */: {
|
|
1213
|
+
const { paymentContract, sessionId, collectionAlias, offerId, distributionPlatform } = event;
|
|
1214
|
+
const { zoneId } = globalState.getStore();
|
|
1215
|
+
window.postMessage(
|
|
1216
|
+
{
|
|
1217
|
+
eventName: "lemonstand.nativePay",
|
|
1218
|
+
eventType: "bubble",
|
|
1219
|
+
nativePayInfo: {
|
|
1220
|
+
pkg: {
|
|
1221
|
+
price: paymentContract?.price?.amount,
|
|
1222
|
+
productIdMS: "",
|
|
1223
|
+
productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),
|
|
1224
|
+
tier: Number(paymentContract?.id?.split("_")?.at(-1))
|
|
1225
|
+
},
|
|
1226
|
+
meta: {
|
|
1227
|
+
criteria: JSON.stringify({}),
|
|
1228
|
+
lemonstand: true,
|
|
1229
|
+
offerId,
|
|
1230
|
+
sid: sessionId,
|
|
1231
|
+
type: collectionAlias,
|
|
1232
|
+
zoneId,
|
|
1233
|
+
successUrl: window.location.href
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
"*"
|
|
1238
|
+
);
|
|
1239
|
+
log("Event `lemonstand.nativePay` sent");
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
default: {
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
var onOpen = (payload = {}) => {
|
|
1248
|
+
log(import_cxf_events.CxfEvents.OpenIGS, "payload:", payload);
|
|
1249
|
+
if (payload.sourceId) {
|
|
1250
|
+
globalState.updateStore({
|
|
1251
|
+
sourceId: payload.sourceId
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
const { isCanvas, lastPurchaseTab, gameApi } = globalState.getStore();
|
|
1255
|
+
if (isCanvas) {
|
|
1256
|
+
if (payload.page) {
|
|
1257
|
+
window.CanvasAgent?.instance?.navigate(payload.page);
|
|
1258
|
+
}
|
|
1259
|
+
window.CanvasAgent?.instance?.show();
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
const sid = createSessionId();
|
|
1263
|
+
trackOpenAction(sid);
|
|
1264
|
+
const url = createIframeUrl({
|
|
1265
|
+
sid,
|
|
1266
|
+
page: lastPurchaseTab,
|
|
1267
|
+
...payload
|
|
1268
|
+
});
|
|
1269
|
+
createDialog(url);
|
|
1270
|
+
setTimeout(() => {
|
|
1271
|
+
gameApi.invokeFn("setUnseenOffersCounter", 0);
|
|
1272
|
+
}, 1e3);
|
|
1273
|
+
};
|
|
1274
|
+
var subscribeToCommonCxfEvents = (cxf) => {
|
|
1275
|
+
const pushHandlers = createPushHandlers();
|
|
1276
|
+
cxf.on(import_cxf_events.CxfEvents.OpenIGS, tryCatch(onOpen));
|
|
1277
|
+
cxf.on(
|
|
1278
|
+
import_cxf_events.CxfEvents.Push,
|
|
1279
|
+
tryCatch(({ id, payload }) => {
|
|
1280
|
+
log(import_cxf_events.CxfEvents.Push, id, payload);
|
|
1281
|
+
const handler = pushHandlers[id];
|
|
1282
|
+
handler && handler(payload);
|
|
1283
|
+
})
|
|
1284
|
+
);
|
|
1285
|
+
};
|
|
1286
|
+
var subscribeToGameEvents = (cxf) => {
|
|
1287
|
+
cxf.on(import_cxf_events.CxfEvents.Login, (e) => {
|
|
1288
|
+
const { gameEvents: eventsInLogin, language, token, zoneId } = e;
|
|
1289
|
+
if (whitelistedZones.has(Number(zoneId)) && (Number(zoneId) > 300 || localStorage.getItem("cxf_canvas") === "enabled")) {
|
|
1290
|
+
globalState.updateStore({
|
|
1291
|
+
isCanvas: true
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1295
|
+
const eventNotExistPredicateGenerator = (existingEvents) => (event) => !existingEvents.map((event_) => event_.type).includes(event.type);
|
|
1296
|
+
globalState.updateStore({
|
|
1297
|
+
...e,
|
|
1298
|
+
gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin]
|
|
1299
|
+
});
|
|
1300
|
+
log(import_cxf_events.CxfEvents.Login, globalState.getStore());
|
|
1301
|
+
if (!isCanvas) {
|
|
1302
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
if (typeof window.CanvasAgent?.create === "function") {
|
|
1306
|
+
const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig();
|
|
1307
|
+
const platform = detectPlatform();
|
|
1308
|
+
const canvasApps = CANVAS_APP_ID_BY_GAME[cxf.gameId];
|
|
1309
|
+
const canvasAppId = typeof canvasApps === "string" ? canvasApps : canvasApps?.[platform];
|
|
1310
|
+
window.CanvasAgent.create({
|
|
1311
|
+
authClientId: "lemonstand",
|
|
1312
|
+
canvasAppId,
|
|
1313
|
+
eventListener,
|
|
1314
|
+
locale: language,
|
|
1315
|
+
token
|
|
1316
|
+
}).then((res) => {
|
|
1317
|
+
window.CanvasAgent.instance = res;
|
|
1318
|
+
log(import_cxf_events.CxfEvents.Login, "Canvas created");
|
|
1319
|
+
}).catch((error) => {
|
|
1320
|
+
logError("Cannot create instance of Canvas", error);
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventUpdate, (e) => {
|
|
1325
|
+
log(import_cxf_events.CxfEvents.GameEventUpdate, e);
|
|
1326
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1327
|
+
const updatedEventTypes = new Set(e.map((event) => event.type));
|
|
1328
|
+
globalState.updateStore({
|
|
1329
|
+
gameEvents: [...gameEvents.filter((event) => !updatedEventTypes.has(event.type)), ...e]
|
|
1330
|
+
});
|
|
1331
|
+
if (isCanvas) {
|
|
1332
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1333
|
+
}
|
|
1334
|
+
log(import_cxf_events.CxfEvents.GameEventUpdate, "reducer", globalState.getStore());
|
|
1335
|
+
});
|
|
1336
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventAdd, (e) => {
|
|
1337
|
+
log(import_cxf_events.CxfEvents.GameEventAdd, e);
|
|
1338
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1339
|
+
globalState.updateStore({
|
|
1340
|
+
gameEvents: [...gameEvents, e]
|
|
1341
|
+
});
|
|
1342
|
+
if (isCanvas) {
|
|
1343
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1344
|
+
}
|
|
1345
|
+
log(import_cxf_events.CxfEvents.GameEventAdd, "reducer", globalState.getStore());
|
|
1346
|
+
});
|
|
1347
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventRemove, (e) => {
|
|
1348
|
+
log(import_cxf_events.CxfEvents.GameEventRemove, e);
|
|
1349
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1350
|
+
globalState.updateStore({
|
|
1351
|
+
gameEvents: gameEvents.filter(({ type }) => type !== e)
|
|
1352
|
+
});
|
|
1353
|
+
if (isCanvas) {
|
|
1354
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1355
|
+
}
|
|
1356
|
+
log(import_cxf_events.CxfEvents.GameEventRemove, "reducer", globalState.getStore());
|
|
1357
|
+
});
|
|
1358
|
+
cxf.on(import_cxf_events.CxfEvents.LevelChanged, (level) => {
|
|
1359
|
+
log(import_cxf_events.CxfEvents.LevelChanged, level);
|
|
1360
|
+
const { isCanvas } = globalState.getStore();
|
|
1361
|
+
globalState.updateStore({
|
|
1362
|
+
level
|
|
1363
|
+
});
|
|
1364
|
+
log(import_cxf_events.CxfEvents.LevelChanged, "reducer", globalState.getStore());
|
|
1365
|
+
if (isCanvas) {
|
|
1366
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1367
|
+
} else {
|
|
1368
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
cxf.on(import_cxf_events.CxfEvents.LegendLevelChanged, (legendLevel) => {
|
|
1372
|
+
log(import_cxf_events.CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`);
|
|
1373
|
+
globalState.updateStore({
|
|
1374
|
+
legendLevel
|
|
1375
|
+
});
|
|
1376
|
+
const store = globalState.getStore();
|
|
1377
|
+
log(import_cxf_events.CxfEvents.LegendLevelChanged, "reducer", store);
|
|
1378
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1379
|
+
});
|
|
1380
|
+
};
|
|
1381
|
+
var subscribeToNativeSubscriptionEnable = (cxf) => {
|
|
1382
|
+
cxf.on("cxf.native.subscription.enable" /* CXF_NATIVE_SUBSCRIPTION_ENABLE */, (enabled) => {
|
|
1383
|
+
globalState.updateStore({
|
|
1384
|
+
subscriptionDisabled: enabled === 0,
|
|
1385
|
+
customizationSuffix: enabled === 0 ? "no-subscription" : ""
|
|
1386
|
+
});
|
|
1387
|
+
globalState.preResolveConfig();
|
|
1388
|
+
});
|
|
1389
|
+
};
|
|
1390
|
+
var subscribeToCustomizationSuffix = (cxf) => {
|
|
1391
|
+
cxf.on("cxf.set.customization.surfix" /* CXF_SET_CUSTOMIZATION_SUFFIX */, (suffix) => {
|
|
1392
|
+
const { customizationSuffix } = globalState.getStore();
|
|
1393
|
+
if (suffix === customizationSuffix) {
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
globalState.updateStore({
|
|
1397
|
+
customizationSuffix: suffix || ""
|
|
1398
|
+
});
|
|
1399
|
+
globalState.preResolveConfig();
|
|
1400
|
+
});
|
|
1401
|
+
};
|
|
1402
|
+
var subscribeToAdStatus = (cxf) => {
|
|
1403
|
+
const config = globalState.getConfig();
|
|
1404
|
+
cxf.on(config.CXF_AD_STATUS, ({ areBannersAvailable, bannersDetails }) => {
|
|
1405
|
+
globalState.updateStore({
|
|
1406
|
+
adStatus: {
|
|
1407
|
+
areBannersAvailable,
|
|
1408
|
+
bannersDetails
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
});
|
|
1412
|
+
};
|
|
1413
|
+
var subscribeToTempServerContext = (cxf) => {
|
|
1414
|
+
cxf.on("cxf.join.temp.server" /* CXF_JOIN_TEMP_SERVER */, (isTemp) => {
|
|
1415
|
+
const store = globalState.getStore();
|
|
1416
|
+
globalState.updateStore({
|
|
1417
|
+
isTempServer: Boolean(isTemp)
|
|
1418
|
+
});
|
|
1419
|
+
if (store.customizationSuffix === "" || store.customizationSuffix === "temp") {
|
|
1420
|
+
globalState.updateStore({
|
|
1421
|
+
customizationSuffix: isTemp ? "temp" : ""
|
|
1422
|
+
});
|
|
1423
|
+
globalState.preResolveConfig();
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
};
|
|
1427
|
+
var createCxfEventHandlers = () => {
|
|
1428
|
+
return [
|
|
1429
|
+
subscribeToCommonCxfEvents,
|
|
1430
|
+
subscribeToGameEvents,
|
|
1431
|
+
subscribeToAdStatus,
|
|
1432
|
+
subscribeToTempServerContext,
|
|
1433
|
+
subscribeToNativeSubscriptionEnable,
|
|
1434
|
+
subscribeToCustomizationSuffix
|
|
1435
|
+
];
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
// src/handlers/postMessageHandlers.ts
|
|
1439
|
+
init_define_process();
|
|
1440
|
+
var onSalesPageOpen = () => {
|
|
1441
|
+
log("OnOpenSalesOffersPage");
|
|
1442
|
+
const { isCanvas } = globalState.getStore();
|
|
1443
|
+
if (isCanvas) {
|
|
1444
|
+
window.CanvasAgent?.instance?.navigate("supersale");
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
const sid = createSessionId();
|
|
1448
|
+
const url = createIframeUrl({
|
|
1449
|
+
page: "sale-offers",
|
|
1450
|
+
sid
|
|
1451
|
+
});
|
|
1452
|
+
createDialog(url);
|
|
1453
|
+
};
|
|
1454
|
+
var onLemonstandClose = () => {
|
|
1455
|
+
const store = globalState.getStore();
|
|
1456
|
+
log("onLemonstandClose", store);
|
|
1457
|
+
fetchUnreadOfferNotificationsCount();
|
|
1458
|
+
};
|
|
1459
|
+
var createPostMessageHandlers = () => {
|
|
1460
|
+
return {
|
|
1461
|
+
["cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */]: onSalesPageOpen,
|
|
1462
|
+
["cxf.dialog.close" /* CXF_DIALOG_CLOSE */]: onLemonstandClose
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
// src/app.ts
|
|
1467
|
+
var app = (cxf) => {
|
|
1468
|
+
const postMessageHandlers = createPostMessageHandlers();
|
|
1469
|
+
const subscribeCxf = createCxfEventHandlers();
|
|
1470
|
+
window.addEventListener(
|
|
1471
|
+
"message",
|
|
1472
|
+
tryCatch(({ data }) => {
|
|
1473
|
+
if (data) {
|
|
1474
|
+
const handler = postMessageHandlers[data.name];
|
|
1475
|
+
if (handler) {
|
|
1476
|
+
log("POST MESSAGE", data);
|
|
1477
|
+
handler(data.payload);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
})
|
|
1481
|
+
);
|
|
1482
|
+
for (const handler of subscribeCxf) {
|
|
1483
|
+
handler(cxf);
|
|
1484
|
+
}
|
|
1485
|
+
globalState.preResolveConfig();
|
|
1486
|
+
log("App has started");
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
// src/config.ts
|
|
1490
|
+
init_define_process();
|
|
1491
|
+
var import_cxf_events2 = __toESM(require_typings());
|
|
1492
|
+
var COMMON_CONFIG = {
|
|
1493
|
+
CANVAS_AGENT_URL: define_process_default.env.CANVAS_AGENT_URL,
|
|
1494
|
+
CANVAS_APP_ID_BY_GAME: define_process_default.env.CANVAS_APP_ID_BY_GAME,
|
|
1495
|
+
CUSTOMIZATION_URL: define_process_default.env.CUSTOMIZATION_URL,
|
|
1496
|
+
CUSTOMIZATION_URL_TEMPLATE: define_process_default.env.CUSTOMIZATION_URL_TEMPLATE,
|
|
1497
|
+
BASE_URL: define_process_default.env.BASE_URL,
|
|
1498
|
+
CXF_DIALOG_OPEN: "cxf.dialog.open",
|
|
1499
|
+
CXF_DIALOG_CLOSE: "cxf.dialog.close",
|
|
1500
|
+
CXF_TRACK_MSG: "cxf.tracking.message",
|
|
1501
|
+
CXF_BTN_CLICK_MSG: import_cxf_events2.CxfEvents.OpenIGS,
|
|
1502
|
+
CXF_OPEN_SALES_MSG: "cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */,
|
|
1503
|
+
WEB_SHOP_CALL_TRACK_ID: 1181,
|
|
1504
|
+
CXF_ERROR: "cxf.error",
|
|
1505
|
+
CXF_PUSH: "cxf.push",
|
|
1506
|
+
CXF_AD_STATUS: "cxf.adBanner.status"
|
|
1507
|
+
};
|
|
1508
|
+
var GAME_SPECIFIC_CONFIG = {
|
|
1509
|
+
12: {
|
|
1510
|
+
LEGEND_LEVEL_IS_USED: true
|
|
1511
|
+
},
|
|
1512
|
+
15: {
|
|
1513
|
+
LEGEND_LEVEL_IS_USED: false
|
|
1514
|
+
},
|
|
1515
|
+
16: {
|
|
1516
|
+
LEGEND_LEVEL_IS_USED: true
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
var createConfig = (gameId) => {
|
|
1520
|
+
return {
|
|
1521
|
+
...COMMON_CONFIG,
|
|
1522
|
+
...GAME_SPECIFIC_CONFIG[gameId]
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// src/index.ts
|
|
1527
|
+
require_dist().then((cxf) => {
|
|
1528
|
+
const config = createConfig(cxf.gameId);
|
|
1529
|
+
globalState.setConfig(config);
|
|
1530
|
+
globalState.setCxf(cxf);
|
|
1531
|
+
const store = initializeStore(cxf);
|
|
1532
|
+
globalState.setStore(store);
|
|
1533
|
+
loadScript(config.CANVAS_AGENT_URL).then(() => {
|
|
1534
|
+
log(`Canvas agent loaded: ${config.CANVAS_AGENT_URL}`);
|
|
1535
|
+
}).catch((error) => {
|
|
1536
|
+
logError("Canvas agent load error", error);
|
|
1537
|
+
});
|
|
1538
|
+
app(cxf);
|
|
1539
|
+
});
|
|
1540
|
+
})();
|
|
2
1541
|
//# sourceMappingURL=webshop-cxf.js.map
|