@goodgamestudios/cxf-webshop 7.0.0-qa.2 → 7.0.0-qa.20
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 +1247 -1
- package/dist/webshop-cxf.js.map +4 -4
- package/package.json +127 -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,1248 @@
|
|
|
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/w/lib/context.js
|
|
41
|
+
var require_context = __commonJS({
|
|
42
|
+
"node_modules/w/lib/context.js"(exports) {
|
|
43
|
+
"use strict";
|
|
44
|
+
init_define_process();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.context = void 0;
|
|
47
|
+
exports.context = globalThis;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// node_modules/w/lib/colours.js
|
|
52
|
+
var require_colours = __commonJS({
|
|
53
|
+
"node_modules/w/lib/colours.js"(exports) {
|
|
54
|
+
"use strict";
|
|
55
|
+
init_define_process();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.colourNs = void 0;
|
|
58
|
+
exports.selectColour = selectColour;
|
|
59
|
+
var genColours = (n = 72) => {
|
|
60
|
+
const colors = [];
|
|
61
|
+
for (let i = 0; i < n; i++) {
|
|
62
|
+
const h = i * 137.5 % 360;
|
|
63
|
+
const r = Math.round(Math.sin(h * Math.PI / 180) * 105 + 105);
|
|
64
|
+
const g = Math.round(Math.sin((h + 120) * Math.PI / 180) * 105 + 105);
|
|
65
|
+
const b = Math.round(Math.sin((h + 240) * Math.PI / 180) * 105 + 105);
|
|
66
|
+
colors.push([r, g, b, [r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")]);
|
|
67
|
+
}
|
|
68
|
+
return colors;
|
|
69
|
+
};
|
|
70
|
+
var colours = genColours();
|
|
71
|
+
var hash = (str) => {
|
|
72
|
+
let h = 5381;
|
|
73
|
+
for (let i = 0; i < str.length; i++)
|
|
74
|
+
h = (h << 5) + h ^ str.charCodeAt(i);
|
|
75
|
+
return h >>> 0;
|
|
76
|
+
};
|
|
77
|
+
function selectColour(ns) {
|
|
78
|
+
return colours[Math.abs(hash(ns)) % colours.length];
|
|
79
|
+
}
|
|
80
|
+
var colourNs = (ns) => {
|
|
81
|
+
const [r, g, b] = selectColour(ns);
|
|
82
|
+
return `\x1B[38;2;${r};${g};${b}m${ns}\x1B[1;0m`;
|
|
83
|
+
};
|
|
84
|
+
exports.colourNs = colourNs;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// node_modules/w/lib/env.js
|
|
89
|
+
var require_env = __commonJS({
|
|
90
|
+
"node_modules/w/lib/env.js"(exports) {
|
|
91
|
+
"use strict";
|
|
92
|
+
init_define_process();
|
|
93
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
94
|
+
exports.env = void 0;
|
|
95
|
+
var context_ts_1 = require_context();
|
|
96
|
+
var prompts = (variable) => context_ts_1.context.Deno?.permissions.querySync?.({ name: "env", variable })?.state === "prompt";
|
|
97
|
+
var env = (variable) => !prompts(variable) && (context_ts_1.context.process?.env ?? context_ts_1.context.env)?.[variable] || "";
|
|
98
|
+
exports.env = env;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// node_modules/w/lib/namespacing.js
|
|
103
|
+
var require_namespacing = __commonJS({
|
|
104
|
+
"node_modules/w/lib/namespacing.js"(exports) {
|
|
105
|
+
"use strict";
|
|
106
|
+
init_define_process();
|
|
107
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
108
|
+
exports.Namespaces = void 0;
|
|
109
|
+
var Namespaces = class {
|
|
110
|
+
parsed = { allowed: false, children: {} };
|
|
111
|
+
constructor(debugspec) {
|
|
112
|
+
this.update(debugspec);
|
|
113
|
+
}
|
|
114
|
+
update(debugspec) {
|
|
115
|
+
const parsed = this.parsed;
|
|
116
|
+
const debugs = debugspec.split(/[\s,]+/).map((each) => each.trim());
|
|
117
|
+
for (const item of debugs) {
|
|
118
|
+
const negative = item.startsWith("-");
|
|
119
|
+
const chain = item.slice(negative ? 1 : 0).split(":");
|
|
120
|
+
let current = parsed;
|
|
121
|
+
for (const part of chain) {
|
|
122
|
+
if (part === "*")
|
|
123
|
+
break;
|
|
124
|
+
const picked = current.children[part] ?? {
|
|
125
|
+
allowed: false,
|
|
126
|
+
children: {}
|
|
127
|
+
};
|
|
128
|
+
current.children[part] = picked;
|
|
129
|
+
current = picked;
|
|
130
|
+
}
|
|
131
|
+
current.allowed = !negative;
|
|
132
|
+
}
|
|
133
|
+
this.parsed = parsed;
|
|
134
|
+
}
|
|
135
|
+
check(namespace) {
|
|
136
|
+
if (namespace === "")
|
|
137
|
+
return this.parsed.allowed;
|
|
138
|
+
const chain = namespace.split(":").map((part) => part.trim());
|
|
139
|
+
let current = this.parsed;
|
|
140
|
+
let tentative = current.allowed;
|
|
141
|
+
for (const part of chain) {
|
|
142
|
+
let picked = current.children[part];
|
|
143
|
+
if (!picked)
|
|
144
|
+
return tentative ?? false;
|
|
145
|
+
tentative = picked.allowed;
|
|
146
|
+
current = picked;
|
|
147
|
+
}
|
|
148
|
+
return current.allowed;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
exports.Namespaces = Namespaces;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// node_modules/w/lib/w.js
|
|
156
|
+
var require_w = __commonJS({
|
|
157
|
+
"node_modules/w/lib/w.js"(exports) {
|
|
158
|
+
"use strict";
|
|
159
|
+
init_define_process();
|
|
160
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
161
|
+
exports.namespaces = void 0;
|
|
162
|
+
exports.w = w2;
|
|
163
|
+
var context_ts_1 = require_context();
|
|
164
|
+
var colours_ts_1 = require_colours();
|
|
165
|
+
var env_ts_1 = require_env();
|
|
166
|
+
var namespacing_ts_1 = require_namespacing();
|
|
167
|
+
function noop() {
|
|
168
|
+
}
|
|
169
|
+
var DEBUG = (0, env_ts_1.env)("DEBUG");
|
|
170
|
+
var stderr = context_ts_1.context.process?.stderr;
|
|
171
|
+
var useColour = (0, env_ts_1.env)("FORCE_COLOR") || !(0, env_ts_1.env)("NO_COLOR") && (stderr?.isTTY ?? context_ts_1.context.document) && !(0, env_ts_1.env)("CI");
|
|
172
|
+
var cons = context_ts_1.context.console.Console?.(stderr) ?? context_ts_1.context.console;
|
|
173
|
+
var pick = (level) => (cons[level] ?? cons.log ?? noop).bind(cons);
|
|
174
|
+
var ns = (n) => n ? n + " " : "";
|
|
175
|
+
exports.namespaces = new namespacing_ts_1.Namespaces(DEBUG);
|
|
176
|
+
function w2(namespace = "") {
|
|
177
|
+
const debugfn = (...data) => {
|
|
178
|
+
const start = data.length ? data.shift() : "";
|
|
179
|
+
if (!debugfn.enabled)
|
|
180
|
+
return;
|
|
181
|
+
if (context_ts_1.context.document && useColour)
|
|
182
|
+
debugfn.logger(`%c${ns(namespace)}%c${start}`, `color: #${(0, colours_ts_1.selectColour)(namespace)[3]}`, "color: inherit", ...data);
|
|
183
|
+
else {
|
|
184
|
+
const name = useColour ? (0, colours_ts_1.colourNs)(namespace) : namespace;
|
|
185
|
+
debugfn.logger(ns(name) + start, ...data);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
debugfn.enabled = exports.namespaces.check(namespace);
|
|
189
|
+
debugfn.logger = pick("debug");
|
|
190
|
+
debugfn.panic = function panic(...data) {
|
|
191
|
+
const alertmsg = "PANIC! " + data.join(" ");
|
|
192
|
+
if ((0, env_ts_1.env)("W_PANIC_THROWS"))
|
|
193
|
+
throw new Error(alertmsg);
|
|
194
|
+
try {
|
|
195
|
+
debugfn.logger = pick("error");
|
|
196
|
+
debugfn.enabled = true;
|
|
197
|
+
debugfn("PANIC! " + (data.shift() ?? ""), ...data, "\n");
|
|
198
|
+
debugfn.logger(new Error());
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
debugger;
|
|
202
|
+
for (; ; )
|
|
203
|
+
try {
|
|
204
|
+
context_ts_1.context.process?.exit(1);
|
|
205
|
+
context_ts_1.context.alert?.(alertmsg);
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return debugfn;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// node_modules/@goodgamestudios/cxf-ready/dist/index.js
|
|
215
|
+
var require_dist = __commonJS({
|
|
216
|
+
"node_modules/@goodgamestudios/cxf-ready/dist/index.js"(exports, module) {
|
|
217
|
+
"use strict";
|
|
218
|
+
init_define_process();
|
|
219
|
+
var cxf = window && window.CXF;
|
|
220
|
+
module.exports = new Promise(function(resolve, reject) {
|
|
221
|
+
if (!window) {
|
|
222
|
+
reject();
|
|
223
|
+
}
|
|
224
|
+
if (cxf) {
|
|
225
|
+
return resolve(cxf);
|
|
226
|
+
}
|
|
227
|
+
window.addEventListener("cxf.initialized", function(event) {
|
|
228
|
+
cxf = event.cxf;
|
|
229
|
+
resolve(cxf);
|
|
230
|
+
}, {
|
|
231
|
+
capture: true,
|
|
232
|
+
once: true,
|
|
233
|
+
passive: true
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// node_modules/@goodgamestudios/game-alias/dist/index.js
|
|
240
|
+
var require_dist2 = __commonJS({
|
|
241
|
+
"node_modules/@goodgamestudios/game-alias/dist/index.js"(exports, module) {
|
|
242
|
+
init_define_process();
|
|
243
|
+
(function() {
|
|
244
|
+
var b = {};
|
|
245
|
+
function f(r, $) {
|
|
246
|
+
return h(r) || g(r, $) || e();
|
|
247
|
+
}
|
|
248
|
+
function e() {
|
|
249
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
250
|
+
}
|
|
251
|
+
function g(r, $) {
|
|
252
|
+
var a2 = [], o2 = true, e2 = false, n2 = void 0;
|
|
253
|
+
try {
|
|
254
|
+
for (var c2, i2 = r[Symbol.iterator](); !(o2 = (c2 = i2.next()).done) && (a2.push(c2.value), !$ || a2.length !== $); o2 = true) ;
|
|
255
|
+
} catch (m2) {
|
|
256
|
+
e2 = true, n2 = m2;
|
|
257
|
+
} finally {
|
|
258
|
+
try {
|
|
259
|
+
o2 || null == i2.return || i2.return();
|
|
260
|
+
} finally {
|
|
261
|
+
if (e2) throw n2;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return a2;
|
|
265
|
+
}
|
|
266
|
+
function h(r) {
|
|
267
|
+
if (Array.isArray(r)) return r;
|
|
268
|
+
}
|
|
269
|
+
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, $) {
|
|
270
|
+
var a2 = f($, 2), o2 = a2[0], e2 = a2[1];
|
|
271
|
+
return o2 = parseInt(o2, 10), r[o2] = o2, e2.forEach(function($2) {
|
|
272
|
+
r[$2] = o2;
|
|
273
|
+
}), r;
|
|
274
|
+
}, {}), l = function(r) {
|
|
275
|
+
r = r.toString().toLowerCase();
|
|
276
|
+
var $ = d[r];
|
|
277
|
+
return $ && 0 | $;
|
|
278
|
+
}, a = function(r, $) {
|
|
279
|
+
return ($ = d[$]) && c[$][r];
|
|
280
|
+
}, m = a.bind(null, i), n = a.bind(null, j), o = a.bind(null, k);
|
|
281
|
+
b = { id: l, name: m, codename: n, acronym: o };
|
|
282
|
+
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
283
|
+
module.exports = b;
|
|
284
|
+
} else if (typeof define === "function" && define.amd) {
|
|
285
|
+
define(function() {
|
|
286
|
+
return b;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
})();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// node_modules/@goodgamestudios/cxf-events/dist/typings.js
|
|
294
|
+
var require_typings = __commonJS({
|
|
295
|
+
"node_modules/@goodgamestudios/cxf-events/dist/typings.js"(exports) {
|
|
296
|
+
"use strict";
|
|
297
|
+
init_define_process();
|
|
298
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
299
|
+
exports.CxfEvents = void 0;
|
|
300
|
+
var CxfEvents3;
|
|
301
|
+
(function(CxfEvents4) {
|
|
302
|
+
CxfEvents4["Token"] = "cxf.token";
|
|
303
|
+
CxfEvents4["Login"] = "cxf.login";
|
|
304
|
+
CxfEvents4["Signup"] = "cxf.signup";
|
|
305
|
+
CxfEvents4["GameEventUpdate"] = "cxf.gameEvent.update";
|
|
306
|
+
CxfEvents4["GameEventAdd"] = "cxf.gameEvent.add";
|
|
307
|
+
CxfEvents4["GameEventRemove"] = "cxf.gameEvent.remove";
|
|
308
|
+
CxfEvents4["XpChanged"] = "cxf.xp.changed";
|
|
309
|
+
CxfEvents4["LevelChanged"] = "cxf.level.changed";
|
|
310
|
+
CxfEvents4["LegendLevelChanged"] = "cxf.legendLevel.changed";
|
|
311
|
+
CxfEvents4["Push"] = "cxf.push";
|
|
312
|
+
CxfEvents4["OpenIGS"] = "cxf.igs.open";
|
|
313
|
+
CxfEvents4["JoinTempServer"] = "cxf.join.temp.server";
|
|
314
|
+
CxfEvents4["Subscription"] = "cxf.subscription";
|
|
315
|
+
CxfEvents4["RewardedAdStart"] = "cxf.rewardedad.start";
|
|
316
|
+
CxfEvents4["RewardedAdDone"] = "cxf.rewardedad.done";
|
|
317
|
+
})(CxfEvents3 = exports.CxfEvents || (exports.CxfEvents = {}));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// src/index.ts
|
|
322
|
+
init_define_process();
|
|
323
|
+
|
|
324
|
+
// src/app.ts
|
|
325
|
+
init_define_process();
|
|
326
|
+
|
|
327
|
+
// src/globalState.ts
|
|
328
|
+
init_define_process();
|
|
329
|
+
|
|
330
|
+
// src/fetch.ts
|
|
331
|
+
init_define_process();
|
|
332
|
+
|
|
333
|
+
// src/store.ts
|
|
334
|
+
init_define_process();
|
|
335
|
+
function initializeStore(cxf) {
|
|
336
|
+
return {
|
|
337
|
+
isCanvas: false,
|
|
338
|
+
playerId: cxf.playerId,
|
|
339
|
+
instanceId: cxf.instanceId,
|
|
340
|
+
networkId: cxf.networkId,
|
|
341
|
+
gameId: cxf.gameId,
|
|
342
|
+
gameApi: cxf.gameApi,
|
|
343
|
+
language: cxf.language,
|
|
344
|
+
token: cxf.token,
|
|
345
|
+
zoneId: cxf.zoneId,
|
|
346
|
+
gameEvents: [],
|
|
347
|
+
xp: 0,
|
|
348
|
+
level: 0,
|
|
349
|
+
legendLevel: void 0,
|
|
350
|
+
countryCode: "",
|
|
351
|
+
lastPurchaseTab: "",
|
|
352
|
+
subscriptionDisabled: false,
|
|
353
|
+
isTempServer: false,
|
|
354
|
+
customizationSuffix: "",
|
|
355
|
+
resolvedCustomizationUrl: "",
|
|
356
|
+
sourceId: "unknown",
|
|
357
|
+
unreadOfferNotifsCountUrl: ""
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function criteriaSelector({ legendLevel, level }) {
|
|
361
|
+
return {
|
|
362
|
+
legendLevel,
|
|
363
|
+
level
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/utils/index.ts
|
|
368
|
+
init_define_process();
|
|
369
|
+
|
|
370
|
+
// src/utils/domain.ts
|
|
371
|
+
init_define_process();
|
|
372
|
+
var parentDomain = (referrer) => {
|
|
373
|
+
const matches = referrer.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);
|
|
374
|
+
if (!matches || !matches[1]) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const result = matches[1].match(/[^.]+\.[^.]+$/);
|
|
378
|
+
if (!result) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
return result[0];
|
|
382
|
+
};
|
|
383
|
+
var getDomain = (referrer) => {
|
|
384
|
+
return parentDomain(referrer);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// src/utils/error-handling.ts
|
|
388
|
+
init_define_process();
|
|
389
|
+
|
|
390
|
+
// src/utils/logging.ts
|
|
391
|
+
init_define_process();
|
|
392
|
+
var import_w = __toESM(require_w());
|
|
393
|
+
var logger = (0, import_w.w)("CXF-WEBSHOP");
|
|
394
|
+
var log = (argument0, ...rest) => logger(argument0, ...rest);
|
|
395
|
+
var logError = (...arguments_) => (
|
|
396
|
+
// tslint:disable-next-line:no-console
|
|
397
|
+
console.error("%c CXF-WEBSHOP ->", "background: #ff0000; color: #fff", ...arguments_)
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
// src/utils/error-handling.ts
|
|
401
|
+
var tryCatch = (fn) => (...args) => {
|
|
402
|
+
try {
|
|
403
|
+
return fn(...args);
|
|
404
|
+
} catch (error) {
|
|
405
|
+
logError(error);
|
|
406
|
+
throwCxfError(error);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
var throwCxfError = (e) => {
|
|
410
|
+
const config = globalState.getConfig();
|
|
411
|
+
const cxf = globalState.getCxf();
|
|
412
|
+
cxf.emit(config.CXF_ERROR, e);
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// src/utils/loaders.ts
|
|
416
|
+
init_define_process();
|
|
417
|
+
var startTimer = (function_, time) => {
|
|
418
|
+
const id = setTimeout(function_, time);
|
|
419
|
+
return () => clearTimeout(id);
|
|
420
|
+
};
|
|
421
|
+
var timeout = (function_, time) => (a) => {
|
|
422
|
+
return new Promise((resolve, reject) => {
|
|
423
|
+
const stopTimer = startTimer(() => {
|
|
424
|
+
reject(new Error(`Timeout has exceeded ${time}`));
|
|
425
|
+
}, time);
|
|
426
|
+
function_(a).then((value) => {
|
|
427
|
+
resolve(value);
|
|
428
|
+
stopTimer();
|
|
429
|
+
}).catch(reject);
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
var loadScript = (src) => new Promise((resolve, reject) => {
|
|
433
|
+
const script = document.createElement("script");
|
|
434
|
+
script.type = "text/javascript";
|
|
435
|
+
script.type = "module";
|
|
436
|
+
script.async = true;
|
|
437
|
+
script.src = src;
|
|
438
|
+
script.addEventListener("load", resolve);
|
|
439
|
+
script.addEventListener("error", reject);
|
|
440
|
+
document.body.append(script);
|
|
441
|
+
});
|
|
442
|
+
var loadCxf = timeout(() => require_dist(), 1e4);
|
|
443
|
+
|
|
444
|
+
// src/utils/payment.ts
|
|
445
|
+
init_define_process();
|
|
446
|
+
var transformPaymentContractIdsToNativePriceEvent = (ids) => (
|
|
447
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
448
|
+
ids.reduce(
|
|
449
|
+
(prev, cur, idx) => {
|
|
450
|
+
prev.offers.push({
|
|
451
|
+
id: cur,
|
|
452
|
+
tier: 0,
|
|
453
|
+
productIds: {
|
|
454
|
+
googleplay: cur
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
return prev;
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
category: "all",
|
|
461
|
+
offers: [],
|
|
462
|
+
eventName: "lemonstand.nativePrice",
|
|
463
|
+
eventType: "bubble"
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
// src/utils/platform.ts
|
|
469
|
+
init_define_process();
|
|
470
|
+
var userAgentToDistribPlatformMatrix = {
|
|
471
|
+
itunes: "apple",
|
|
472
|
+
Android: "google",
|
|
473
|
+
googleplay: "google",
|
|
474
|
+
amazonmobile: "amazon",
|
|
475
|
+
facebook: "facebook",
|
|
476
|
+
samsung: "samsung",
|
|
477
|
+
huawei: "huawei"
|
|
478
|
+
};
|
|
479
|
+
var detectPlatform = (defaultPlatform = "stillpay") => {
|
|
480
|
+
const nativePlatform = navigator.userAgent.match(
|
|
481
|
+
/(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g
|
|
482
|
+
);
|
|
483
|
+
if (!nativePlatform) return defaultPlatform;
|
|
484
|
+
const activePlatform = nativePlatform[0];
|
|
485
|
+
return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform) ? userAgentToDistribPlatformMatrix[activePlatform] : defaultPlatform;
|
|
486
|
+
};
|
|
487
|
+
var distribPlatformToProviderMatrix = {
|
|
488
|
+
apple: "itunes",
|
|
489
|
+
google: "googleplay",
|
|
490
|
+
amazon: "amazonmobile",
|
|
491
|
+
facebook: "facebook",
|
|
492
|
+
samsung: "samsung",
|
|
493
|
+
huawei: "huawei"
|
|
494
|
+
};
|
|
495
|
+
var createProductIdsForPlatform = (platform, id) => {
|
|
496
|
+
if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))
|
|
497
|
+
throw new Error(`Platform ${platform} is not supported`);
|
|
498
|
+
const res = /* @__PURE__ */ Object.create(null);
|
|
499
|
+
res[distribPlatformToProviderMatrix[platform]] = id;
|
|
500
|
+
return res;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
// src/utils/query-params.ts
|
|
504
|
+
init_define_process();
|
|
505
|
+
function formatQueryString(object) {
|
|
506
|
+
return Object.entries(object).filter(([key, value]) => value !== null && value !== void 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
|
|
507
|
+
}
|
|
508
|
+
var ggsGetQueryParams = () => {
|
|
509
|
+
return ggsGetQueryParameters();
|
|
510
|
+
};
|
|
511
|
+
var ggsGetReferrerValue = () => {
|
|
512
|
+
return ggsGetReferrer();
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
// src/utils/session.ts
|
|
516
|
+
init_define_process();
|
|
517
|
+
|
|
518
|
+
// node_modules/@lukeed/uuid/dist/index.mjs
|
|
519
|
+
init_define_process();
|
|
520
|
+
var IDX = 256;
|
|
521
|
+
var HEX = [];
|
|
522
|
+
var BUFFER;
|
|
523
|
+
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
|
524
|
+
function v4() {
|
|
525
|
+
var i = 0, num, out = "";
|
|
526
|
+
if (!BUFFER || IDX + 16 > 256) {
|
|
527
|
+
BUFFER = Array(i = 256);
|
|
528
|
+
while (i--) BUFFER[i] = 256 * Math.random() | 0;
|
|
529
|
+
i = IDX = 0;
|
|
530
|
+
}
|
|
531
|
+
for (; i < 16; i++) {
|
|
532
|
+
num = BUFFER[IDX + i];
|
|
533
|
+
if (i == 6) out += HEX[num & 15 | 64];
|
|
534
|
+
else if (i == 8) out += HEX[num & 63 | 128];
|
|
535
|
+
else out += HEX[num];
|
|
536
|
+
if (i & 1 && i > 1 && i < 11) out += "-";
|
|
537
|
+
}
|
|
538
|
+
IDX++;
|
|
539
|
+
return out;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// src/ArgumentNullError.ts
|
|
543
|
+
init_define_process();
|
|
544
|
+
var ArgumentNullError = class extends Error {
|
|
545
|
+
constructor(parameterName, parameterValue) {
|
|
546
|
+
super(`${parameterName} has null value: ${parameterValue}`);
|
|
547
|
+
this.name = "ArgumentNullError";
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/types/models.ts
|
|
552
|
+
init_define_process();
|
|
553
|
+
function encodeGnip({ gameId, networkId, instanceId, playerId }) {
|
|
554
|
+
return [gameId, networkId, instanceId, playerId].join("-");
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// src/utils/session.ts
|
|
558
|
+
var createSessionId = () => v4();
|
|
559
|
+
var getTokenAndLanguage = (store) => {
|
|
560
|
+
const { playerId, token, zoneId, language } = store;
|
|
561
|
+
if (!playerId) {
|
|
562
|
+
throw new ArgumentNullError("playerId", playerId);
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
token,
|
|
566
|
+
zoneId,
|
|
567
|
+
locale: language,
|
|
568
|
+
ping: encodeGnip({ ...store, playerId })
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
// src/utils/time.ts
|
|
573
|
+
init_define_process();
|
|
574
|
+
function msToSec(value) {
|
|
575
|
+
return Math.floor(value / 1e3);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/utils/url.ts
|
|
579
|
+
init_define_process();
|
|
580
|
+
var import_game_alias = __toESM(require_dist2());
|
|
581
|
+
|
|
582
|
+
// src/utils/validation.ts
|
|
583
|
+
init_define_process();
|
|
584
|
+
var validateForNull = (properties) => {
|
|
585
|
+
for (const key of Object.keys(properties)) {
|
|
586
|
+
const value = properties[key];
|
|
587
|
+
if (value === void 0 || value === null || Number.isNaN(value)) {
|
|
588
|
+
throw new ArgumentNullError(key, value);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
// src/utils/url.ts
|
|
594
|
+
var createIframeUrl = ({ page, route, sid, config: igsConfig = {} }) => {
|
|
595
|
+
const config = globalState.getConfig();
|
|
596
|
+
const store = globalState.getStore();
|
|
597
|
+
const { token, zoneId, locale } = getTokenAndLanguage(store);
|
|
598
|
+
const parameters = {
|
|
599
|
+
token,
|
|
600
|
+
zoneId,
|
|
601
|
+
locale,
|
|
602
|
+
sid: sid || createSessionId()
|
|
603
|
+
};
|
|
604
|
+
if (Object.keys(igsConfig).length > 0) {
|
|
605
|
+
parameters.config = JSON.stringify(igsConfig);
|
|
606
|
+
}
|
|
607
|
+
validateForNull(parameters);
|
|
608
|
+
const urlParameters = new URLSearchParams(ggsGetQueryParams());
|
|
609
|
+
const queryParameters = {
|
|
610
|
+
...parameters,
|
|
611
|
+
"lemonstand.customization.url": store.resolvedCustomizationUrl || createCustomizationUrl(),
|
|
612
|
+
domain: getDomain(ggsGetReferrerValue()),
|
|
613
|
+
websiteId: urlParameters.get("w"),
|
|
614
|
+
criteria: JSON.stringify(criteriaSelector(store)),
|
|
615
|
+
level: store.level
|
|
616
|
+
};
|
|
617
|
+
const network = urlParameters.get("network");
|
|
618
|
+
if (urlParameters.get("usekeybaselogin") === "false" && Number(network) > 0) {
|
|
619
|
+
queryParameters.network = network;
|
|
620
|
+
}
|
|
621
|
+
if (store.adStatus?.areBannersAvailable) {
|
|
622
|
+
queryParameters.ads = true;
|
|
623
|
+
}
|
|
624
|
+
return `${config.BASE_URL}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ""}${route ? `--${route}--${Date.now()}` : ""}`;
|
|
625
|
+
};
|
|
626
|
+
var createCustomizationUrl = () => {
|
|
627
|
+
const config = globalState.getConfig();
|
|
628
|
+
const store = globalState.getStore();
|
|
629
|
+
const cxf = globalState.getCxf();
|
|
630
|
+
const configBase = (0, import_game_alias.acronym)(store.gameId);
|
|
631
|
+
const configVariance = store.customizationSuffix ? `-${store.customizationSuffix}` : "";
|
|
632
|
+
const configBranch = `${configBase}${configVariance}`;
|
|
633
|
+
if (cxf.env === "test") {
|
|
634
|
+
const configVersion = new URLSearchParams(window.location.search).get("configGGS");
|
|
635
|
+
if (configVersion !== null) {
|
|
636
|
+
return config.CUSTOMIZATION_URL_TEMPLATE.replace("{0}", configBranch).replace("{1}", configVersion);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return config.CUSTOMIZATION_URL.replace("{0}", configBranch);
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// src/fetch.ts
|
|
643
|
+
var fetchUnreadOfferNotificationsCount = async () => {
|
|
644
|
+
const config = globalState.getConfig();
|
|
645
|
+
const store = globalState.getStore();
|
|
646
|
+
if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === void 0) {
|
|
647
|
+
log("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {
|
|
651
|
+
log("fetchUnreadOfferNotificationsCount");
|
|
652
|
+
let unreadCount = 0;
|
|
653
|
+
const headers = {
|
|
654
|
+
Authorization: `Bearer ${store.token}`
|
|
655
|
+
};
|
|
656
|
+
const url = store.unreadOfferNotifsCountUrl.replace("{locale}", store.language || "").replace("{zoneId}", store.zoneId || "").replace("{criteria}", encodeURIComponent(JSON.stringify(criteriaSelector(store))));
|
|
657
|
+
try {
|
|
658
|
+
log("fetch", url);
|
|
659
|
+
const resp = await fetch(url, {
|
|
660
|
+
headers
|
|
661
|
+
});
|
|
662
|
+
if (resp.ok) {
|
|
663
|
+
const data = await resp.json();
|
|
664
|
+
unreadCount = Number(data?.notifCount);
|
|
665
|
+
}
|
|
666
|
+
} catch (error) {
|
|
667
|
+
logError(`cannot fetch ${url}`, error);
|
|
668
|
+
}
|
|
669
|
+
log("setUnseenOffersCounter", unreadCount);
|
|
670
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", unreadCount).catch((error) => {
|
|
671
|
+
logError("setUnseenOffersCounter error:", error);
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// src/messages/ShopMessageBus.ts
|
|
677
|
+
init_define_process();
|
|
678
|
+
var ShopMessageBus = class {
|
|
679
|
+
post(message) {
|
|
680
|
+
const element = document.querySelector("#dialog");
|
|
681
|
+
if (element && element.tagName.toLocaleLowerCase() === "iframe") {
|
|
682
|
+
element.contentWindow?.postMessage(message, "*");
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// src/preFetch.ts
|
|
688
|
+
init_define_process();
|
|
689
|
+
var preResolveConfig = () => {
|
|
690
|
+
if (typeof fetch !== "function") {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const originalCustomUrl = createCustomizationUrl();
|
|
694
|
+
let resolvedUrl = "";
|
|
695
|
+
fetch(originalCustomUrl).then((resp) => {
|
|
696
|
+
const currentCustomUrl = createCustomizationUrl();
|
|
697
|
+
if (currentCustomUrl === originalCustomUrl) {
|
|
698
|
+
resolvedUrl = resp.url;
|
|
699
|
+
log("parsed customization url is " + resolvedUrl);
|
|
700
|
+
globalState.updateStore({
|
|
701
|
+
resolvedCustomizationUrl: resolvedUrl
|
|
702
|
+
});
|
|
703
|
+
return resp.json();
|
|
704
|
+
}
|
|
705
|
+
}).then((config) => {
|
|
706
|
+
if (config) {
|
|
707
|
+
globalState.updateStore({
|
|
708
|
+
unreadOfferNotifsCountUrl: config.unreadOfferNotifsCountUrl || ""
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
// src/types/store.ts
|
|
715
|
+
init_define_process();
|
|
716
|
+
var entityProvider = (initial) => {
|
|
717
|
+
let element = initial;
|
|
718
|
+
return {
|
|
719
|
+
get: () => element,
|
|
720
|
+
set: (value) => {
|
|
721
|
+
element = value;
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
// src/globalState.ts
|
|
727
|
+
var GlobalState = class {
|
|
728
|
+
constructor() {
|
|
729
|
+
this.config = void 0;
|
|
730
|
+
this.cxfProvider = entityProvider();
|
|
731
|
+
this.dialogProvider = entityProvider();
|
|
732
|
+
this.storeProvider = entityProvider();
|
|
733
|
+
this.shopMessageBus = new ShopMessageBus();
|
|
734
|
+
this.fetchUnreadOfferNotificationsCount = fetchUnreadOfferNotificationsCount;
|
|
735
|
+
this.preResolveConfig = preResolveConfig;
|
|
736
|
+
}
|
|
737
|
+
setConfig(config) {
|
|
738
|
+
this.config = config;
|
|
739
|
+
}
|
|
740
|
+
getConfig() {
|
|
741
|
+
if (this.config === void 0) {
|
|
742
|
+
throw new Error("Config is not initialized");
|
|
743
|
+
}
|
|
744
|
+
return this.config;
|
|
745
|
+
}
|
|
746
|
+
setCxf(cxf) {
|
|
747
|
+
this.cxfProvider.set(cxf);
|
|
748
|
+
}
|
|
749
|
+
getCxf() {
|
|
750
|
+
const cxf = this.cxfProvider.get();
|
|
751
|
+
if (!cxf) {
|
|
752
|
+
throw new Error("CXF is not loaded");
|
|
753
|
+
}
|
|
754
|
+
return cxf;
|
|
755
|
+
}
|
|
756
|
+
setStore(store) {
|
|
757
|
+
this.storeProvider.set(store);
|
|
758
|
+
}
|
|
759
|
+
getStore() {
|
|
760
|
+
const store = this.storeProvider.get();
|
|
761
|
+
if (!store) {
|
|
762
|
+
throw new Error("Store is not initialized");
|
|
763
|
+
}
|
|
764
|
+
return store;
|
|
765
|
+
}
|
|
766
|
+
updateStore(data) {
|
|
767
|
+
const currentStore = this.getStore();
|
|
768
|
+
this.setStore({
|
|
769
|
+
...currentStore,
|
|
770
|
+
...data
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
var globalState = new GlobalState();
|
|
775
|
+
|
|
776
|
+
// src/handlers/cxfEventHandlers.ts
|
|
777
|
+
init_define_process();
|
|
778
|
+
var import_cxf_events = __toESM(require_typings());
|
|
779
|
+
|
|
780
|
+
// src/dialog.ts
|
|
781
|
+
init_define_process();
|
|
782
|
+
var createDialog = (url) => {
|
|
783
|
+
const config = globalState.getConfig();
|
|
784
|
+
const cxf = globalState.getCxf();
|
|
785
|
+
cxf.emit(config.CXF_DIALOG_OPEN, url);
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
// src/track.ts
|
|
789
|
+
init_define_process();
|
|
790
|
+
var trackOpenAction = (sid) => {
|
|
791
|
+
const config = globalState.getConfig();
|
|
792
|
+
const store = globalState.getStore();
|
|
793
|
+
const now = Date.now();
|
|
794
|
+
const parameters = getTokenAndLanguage(store);
|
|
795
|
+
const { zoneId } = parameters;
|
|
796
|
+
const sessionId = sid;
|
|
797
|
+
const { playerId, gameId, networkId, instanceId, sourceId } = store;
|
|
798
|
+
trackAction({
|
|
799
|
+
eventId: config.WEB_SHOP_CALL_TRACK_ID,
|
|
800
|
+
date: msToSec(now),
|
|
801
|
+
unixtimeMS: now,
|
|
802
|
+
sessionId,
|
|
803
|
+
zoneId: zoneId ? Number.parseInt(zoneId, 10) : void 0,
|
|
804
|
+
playerId: Number.parseInt(playerId, 10),
|
|
805
|
+
gameId: Number.parseInt(gameId, 10),
|
|
806
|
+
networkId: Number.parseInt(networkId, 10),
|
|
807
|
+
instanceId: Number.parseInt(instanceId, 10),
|
|
808
|
+
sourceId
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
var trackAction = (payload) => {
|
|
812
|
+
const config = globalState.getConfig();
|
|
813
|
+
const cxf = globalState.getCxf();
|
|
814
|
+
cxf.emit(config.CXF_TRACK_MSG, payload);
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
// src/types/index.ts
|
|
818
|
+
init_define_process();
|
|
819
|
+
|
|
820
|
+
// src/types/config.ts
|
|
821
|
+
init_define_process();
|
|
822
|
+
|
|
823
|
+
// src/whitelist.ts
|
|
824
|
+
init_define_process();
|
|
825
|
+
var whitelistedZones = /* @__PURE__ */ new Set([
|
|
826
|
+
// 264, Poland
|
|
827
|
+
316,
|
|
828
|
+
318,
|
|
829
|
+
460,
|
|
830
|
+
461,
|
|
831
|
+
767,
|
|
832
|
+
768,
|
|
833
|
+
802,
|
|
834
|
+
814,
|
|
835
|
+
830,
|
|
836
|
+
877
|
|
837
|
+
]);
|
|
838
|
+
|
|
839
|
+
// src/handlers/pushHandlers.ts
|
|
840
|
+
init_define_process();
|
|
841
|
+
var onReward = (payload) => {
|
|
842
|
+
log("OnReward: payload", payload);
|
|
843
|
+
const { isCanvas } = globalState.getStore();
|
|
844
|
+
if (isCanvas) {
|
|
845
|
+
window.CanvasAgent?.instance?.hide();
|
|
846
|
+
window.CanvasAgent?.instance?.navigate();
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
const url = createIframeUrl({
|
|
850
|
+
route: encodeURIComponent(payload.successUrl),
|
|
851
|
+
...payload
|
|
852
|
+
});
|
|
853
|
+
globalState.updateStore({
|
|
854
|
+
lastPurchaseTab: payload.page,
|
|
855
|
+
sourceId: "successfulPayoutReward"
|
|
856
|
+
});
|
|
857
|
+
trackOpenAction(payload.sid);
|
|
858
|
+
createDialog(url);
|
|
859
|
+
};
|
|
860
|
+
var onLemonstandCategoryUpdate = ({ target, action, data }) => {
|
|
861
|
+
globalState.shopMessageBus.post({
|
|
862
|
+
eventName: "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */,
|
|
863
|
+
target,
|
|
864
|
+
data: { action, data }
|
|
865
|
+
});
|
|
866
|
+
};
|
|
867
|
+
var onLemonstandNotificationsCreated = ({ notifCount }) => {
|
|
868
|
+
log("onLemonstandNotificationsCreated -> notifCount:", notifCount);
|
|
869
|
+
const store = globalState.getStore();
|
|
870
|
+
if (notifCount > 0) {
|
|
871
|
+
const randomDelayMs = Math.floor(Math.random() * (Number(store.networkId) < 250 ? 12e4 : 15e3));
|
|
872
|
+
setTimeout(() => {
|
|
873
|
+
fetchUnreadOfferNotificationsCount();
|
|
874
|
+
}, randomDelayMs);
|
|
875
|
+
} else {
|
|
876
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", 0).catch((error) => {
|
|
877
|
+
logError("setUnseenOffersCounter error:", error);
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
var createPushHandlers = () => {
|
|
882
|
+
return {
|
|
883
|
+
reward: onReward,
|
|
884
|
+
reward_received: onReward,
|
|
885
|
+
["lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */]: onLemonstandCategoryUpdate,
|
|
886
|
+
["lemonstand.notifs.created" /* LEMONSTAND_NOTIFICATIONS_CREATED */]: onLemonstandNotificationsCreated
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
// src/handlers/cxfEventHandlers.ts
|
|
891
|
+
var isWindowMessageListenerAttached = false;
|
|
892
|
+
var eventListener = (event) => {
|
|
893
|
+
log(`Canvas event "${event.eventType}" received:`, event);
|
|
894
|
+
switch (event.eventType) {
|
|
895
|
+
case "native_catalog_request" /* NATIVE_CATALOG_REQUEST */: {
|
|
896
|
+
if (event?.paymentContractIds?.length > 0) {
|
|
897
|
+
if (!isWindowMessageListenerAttached) {
|
|
898
|
+
window.addEventListener("message", ({ data }) => {
|
|
899
|
+
if (data?.eventName === "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */ && data?.data?.action === "nativePriceUpdate") {
|
|
900
|
+
log(`${"lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */} event`, data.data);
|
|
901
|
+
if (!data.data.data) return;
|
|
902
|
+
const nativeCatalog = {};
|
|
903
|
+
for (const key in data.data.data) {
|
|
904
|
+
const { priceString, ...rest } = data.data.data[key];
|
|
905
|
+
nativeCatalog[key] = rest;
|
|
906
|
+
}
|
|
907
|
+
log("nativeCatalog:", nativeCatalog);
|
|
908
|
+
window.CanvasAgent?.instance?.setNativeCatalog(nativeCatalog);
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
isWindowMessageListenerAttached = true;
|
|
912
|
+
}
|
|
913
|
+
const msg = transformPaymentContractIdsToNativePriceEvent(event.paymentContractIds);
|
|
914
|
+
window.postMessage(msg, "*");
|
|
915
|
+
log("Event `lemonstand.nativePrice` sent");
|
|
916
|
+
}
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
case "native_checkout_request" /* NATIVE_CHECKOUT_REQUEST */: {
|
|
920
|
+
const { paymentContract, sessionId, collectionAlias, offerId, distributionPlatform } = event;
|
|
921
|
+
const { zoneId } = globalState.getStore();
|
|
922
|
+
window.postMessage(
|
|
923
|
+
{
|
|
924
|
+
eventName: "lemonstand.nativePay",
|
|
925
|
+
eventType: "bubble",
|
|
926
|
+
nativePayInfo: {
|
|
927
|
+
pkg: {
|
|
928
|
+
price: paymentContract?.price?.amount,
|
|
929
|
+
productIdMS: "",
|
|
930
|
+
productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),
|
|
931
|
+
tier: Number(paymentContract?.id?.split("_")?.at(-1))
|
|
932
|
+
},
|
|
933
|
+
meta: {
|
|
934
|
+
criteria: JSON.stringify({}),
|
|
935
|
+
lemonstand: true,
|
|
936
|
+
offerId,
|
|
937
|
+
sid: sessionId,
|
|
938
|
+
type: collectionAlias,
|
|
939
|
+
zoneId,
|
|
940
|
+
successUrl: window.location.href
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
"*"
|
|
945
|
+
);
|
|
946
|
+
log("Event `lemonstand.nativePay` sent");
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
default: {
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
var onOpen = (payload = {}) => {
|
|
955
|
+
log(import_cxf_events.CxfEvents.OpenIGS, "payload:", payload);
|
|
956
|
+
if (payload.sourceId) {
|
|
957
|
+
globalState.updateStore({
|
|
958
|
+
sourceId: payload.sourceId
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
const { isCanvas, lastPurchaseTab, gameApi } = globalState.getStore();
|
|
962
|
+
if (isCanvas) {
|
|
963
|
+
if (payload.page) {
|
|
964
|
+
window.CanvasAgent?.instance?.navigate(payload.page);
|
|
965
|
+
}
|
|
966
|
+
window.CanvasAgent?.instance?.show();
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const sid = createSessionId();
|
|
970
|
+
trackOpenAction(sid);
|
|
971
|
+
const url = createIframeUrl({
|
|
972
|
+
sid,
|
|
973
|
+
page: lastPurchaseTab,
|
|
974
|
+
...payload
|
|
975
|
+
});
|
|
976
|
+
createDialog(url);
|
|
977
|
+
setTimeout(() => {
|
|
978
|
+
gameApi.invokeFn("setUnseenOffersCounter", 0);
|
|
979
|
+
}, 1e3);
|
|
980
|
+
};
|
|
981
|
+
var subscribeToCommonCxfEvents = (cxf) => {
|
|
982
|
+
const pushHandlers = createPushHandlers();
|
|
983
|
+
cxf.on(import_cxf_events.CxfEvents.OpenIGS, tryCatch(onOpen));
|
|
984
|
+
cxf.on(
|
|
985
|
+
import_cxf_events.CxfEvents.Push,
|
|
986
|
+
tryCatch(({ id, payload }) => {
|
|
987
|
+
log(import_cxf_events.CxfEvents.Push, id, payload);
|
|
988
|
+
const handler = pushHandlers[id];
|
|
989
|
+
handler && handler(payload);
|
|
990
|
+
})
|
|
991
|
+
);
|
|
992
|
+
};
|
|
993
|
+
var subscribeToGameEvents = (cxf) => {
|
|
994
|
+
cxf.on(import_cxf_events.CxfEvents.Login, (e) => {
|
|
995
|
+
const { gameEvents: eventsInLogin, language, token, zoneId } = e;
|
|
996
|
+
if (whitelistedZones.has(Number(zoneId)) && (Number(zoneId) > 300 || localStorage.getItem("cxf_canvas") === "enabled")) {
|
|
997
|
+
globalState.updateStore({
|
|
998
|
+
isCanvas: true
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1002
|
+
const eventNotExistPredicateGenerator = (existingEvents) => (event) => !existingEvents.map((event_) => event_.type).includes(event.type);
|
|
1003
|
+
globalState.updateStore({
|
|
1004
|
+
...e,
|
|
1005
|
+
gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin]
|
|
1006
|
+
});
|
|
1007
|
+
log(import_cxf_events.CxfEvents.Login, globalState.getStore());
|
|
1008
|
+
if (!isCanvas) {
|
|
1009
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (typeof window.CanvasAgent?.create === "function") {
|
|
1013
|
+
const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig();
|
|
1014
|
+
const platform = detectPlatform();
|
|
1015
|
+
const canvasApps = CANVAS_APP_ID_BY_GAME[cxf.gameId];
|
|
1016
|
+
const canvasAppId = typeof canvasApps === "string" ? canvasApps : canvasApps?.[platform];
|
|
1017
|
+
window.CanvasAgent.create({
|
|
1018
|
+
authClientId: "lemonstand",
|
|
1019
|
+
canvasAppId,
|
|
1020
|
+
eventListener,
|
|
1021
|
+
locale: language,
|
|
1022
|
+
token
|
|
1023
|
+
}).then((res) => {
|
|
1024
|
+
window.CanvasAgent.instance = res;
|
|
1025
|
+
log(import_cxf_events.CxfEvents.Login, "Canvas created");
|
|
1026
|
+
}).catch((error) => {
|
|
1027
|
+
logError("Cannot create instance of Canvas", error);
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventUpdate, (e) => {
|
|
1032
|
+
log(import_cxf_events.CxfEvents.GameEventUpdate, e);
|
|
1033
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1034
|
+
const updatedEventTypes = new Set(e.map((event) => event.type));
|
|
1035
|
+
globalState.updateStore({
|
|
1036
|
+
gameEvents: [...gameEvents.filter((event) => !updatedEventTypes.has(event.type)), ...e]
|
|
1037
|
+
});
|
|
1038
|
+
if (isCanvas) {
|
|
1039
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1040
|
+
}
|
|
1041
|
+
log(import_cxf_events.CxfEvents.GameEventUpdate, "reducer", globalState.getStore());
|
|
1042
|
+
});
|
|
1043
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventAdd, (e) => {
|
|
1044
|
+
log(import_cxf_events.CxfEvents.GameEventAdd, e);
|
|
1045
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1046
|
+
globalState.updateStore({
|
|
1047
|
+
gameEvents: [...gameEvents, e]
|
|
1048
|
+
});
|
|
1049
|
+
if (isCanvas) {
|
|
1050
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1051
|
+
}
|
|
1052
|
+
log(import_cxf_events.CxfEvents.GameEventAdd, "reducer", globalState.getStore());
|
|
1053
|
+
});
|
|
1054
|
+
cxf.on(import_cxf_events.CxfEvents.GameEventRemove, (e) => {
|
|
1055
|
+
log(import_cxf_events.CxfEvents.GameEventRemove, e);
|
|
1056
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1057
|
+
globalState.updateStore({
|
|
1058
|
+
gameEvents: gameEvents.filter(({ type }) => type !== e)
|
|
1059
|
+
});
|
|
1060
|
+
if (isCanvas) {
|
|
1061
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1062
|
+
}
|
|
1063
|
+
log(import_cxf_events.CxfEvents.GameEventRemove, "reducer", globalState.getStore());
|
|
1064
|
+
});
|
|
1065
|
+
cxf.on(import_cxf_events.CxfEvents.LevelChanged, (level) => {
|
|
1066
|
+
log(import_cxf_events.CxfEvents.LevelChanged, level);
|
|
1067
|
+
const { isCanvas } = globalState.getStore();
|
|
1068
|
+
globalState.updateStore({
|
|
1069
|
+
level
|
|
1070
|
+
});
|
|
1071
|
+
log(import_cxf_events.CxfEvents.LevelChanged, "reducer", globalState.getStore());
|
|
1072
|
+
if (isCanvas) {
|
|
1073
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1074
|
+
} else {
|
|
1075
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
cxf.on(import_cxf_events.CxfEvents.LegendLevelChanged, (legendLevel) => {
|
|
1079
|
+
log(import_cxf_events.CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`);
|
|
1080
|
+
globalState.updateStore({
|
|
1081
|
+
legendLevel
|
|
1082
|
+
});
|
|
1083
|
+
const store = globalState.getStore();
|
|
1084
|
+
log(import_cxf_events.CxfEvents.LegendLevelChanged, "reducer", store);
|
|
1085
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1086
|
+
});
|
|
1087
|
+
};
|
|
1088
|
+
var subscribeToNativeSubscriptionEnable = (cxf) => {
|
|
1089
|
+
cxf.on("cxf.native.subscription.enable" /* CXF_NATIVE_SUBSCRIPTION_ENABLE */, (enabled) => {
|
|
1090
|
+
globalState.updateStore({
|
|
1091
|
+
subscriptionDisabled: enabled === 0,
|
|
1092
|
+
customizationSuffix: enabled === 0 ? "no-subscription" : ""
|
|
1093
|
+
});
|
|
1094
|
+
globalState.preResolveConfig();
|
|
1095
|
+
});
|
|
1096
|
+
};
|
|
1097
|
+
var subscribeToCustomizationSuffix = (cxf) => {
|
|
1098
|
+
cxf.on("cxf.set.customization.surfix" /* CXF_SET_CUSTOMIZATION_SUFFIX */, (suffix) => {
|
|
1099
|
+
const { customizationSuffix } = globalState.getStore();
|
|
1100
|
+
if (suffix === customizationSuffix) {
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
globalState.updateStore({
|
|
1104
|
+
customizationSuffix: suffix || ""
|
|
1105
|
+
});
|
|
1106
|
+
globalState.preResolveConfig();
|
|
1107
|
+
});
|
|
1108
|
+
};
|
|
1109
|
+
var subscribeToAdStatus = (cxf) => {
|
|
1110
|
+
const config = globalState.getConfig();
|
|
1111
|
+
cxf.on(config.CXF_AD_STATUS, ({ areBannersAvailable, bannersDetails }) => {
|
|
1112
|
+
globalState.updateStore({
|
|
1113
|
+
adStatus: {
|
|
1114
|
+
areBannersAvailable,
|
|
1115
|
+
bannersDetails
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
});
|
|
1119
|
+
};
|
|
1120
|
+
var subscribeToTempServerContext = (cxf) => {
|
|
1121
|
+
cxf.on("cxf.join.temp.server" /* CXF_JOIN_TEMP_SERVER */, (isTemp) => {
|
|
1122
|
+
const store = globalState.getStore();
|
|
1123
|
+
globalState.updateStore({
|
|
1124
|
+
isTempServer: Boolean(isTemp)
|
|
1125
|
+
});
|
|
1126
|
+
if (store.customizationSuffix === "" || store.customizationSuffix === "temp") {
|
|
1127
|
+
globalState.updateStore({
|
|
1128
|
+
customizationSuffix: isTemp ? "temp" : ""
|
|
1129
|
+
});
|
|
1130
|
+
globalState.preResolveConfig();
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
};
|
|
1134
|
+
var createCxfEventHandlers = () => {
|
|
1135
|
+
return [
|
|
1136
|
+
subscribeToCommonCxfEvents,
|
|
1137
|
+
subscribeToGameEvents,
|
|
1138
|
+
subscribeToAdStatus,
|
|
1139
|
+
subscribeToTempServerContext,
|
|
1140
|
+
subscribeToNativeSubscriptionEnable,
|
|
1141
|
+
subscribeToCustomizationSuffix
|
|
1142
|
+
];
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
// src/handlers/postMessageHandlers.ts
|
|
1146
|
+
init_define_process();
|
|
1147
|
+
var onSalesPageOpen = () => {
|
|
1148
|
+
log("OnOpenSalesOffersPage");
|
|
1149
|
+
const { isCanvas } = globalState.getStore();
|
|
1150
|
+
if (isCanvas) {
|
|
1151
|
+
window.CanvasAgent?.instance?.navigate("supersale");
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
const sid = createSessionId();
|
|
1155
|
+
const url = createIframeUrl({
|
|
1156
|
+
page: "sale-offers",
|
|
1157
|
+
sid
|
|
1158
|
+
});
|
|
1159
|
+
createDialog(url);
|
|
1160
|
+
};
|
|
1161
|
+
var onLemonstandClose = () => {
|
|
1162
|
+
const store = globalState.getStore();
|
|
1163
|
+
log("onLemonstandClose", store);
|
|
1164
|
+
fetchUnreadOfferNotificationsCount();
|
|
1165
|
+
};
|
|
1166
|
+
var createPostMessageHandlers = () => {
|
|
1167
|
+
return {
|
|
1168
|
+
["cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */]: onSalesPageOpen,
|
|
1169
|
+
["cxf.dialog.close" /* CXF_DIALOG_CLOSE */]: onLemonstandClose
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// src/app.ts
|
|
1174
|
+
var app = (cxf) => {
|
|
1175
|
+
const postMessageHandlers = createPostMessageHandlers();
|
|
1176
|
+
const subscribeCxf = createCxfEventHandlers();
|
|
1177
|
+
window.addEventListener(
|
|
1178
|
+
"message",
|
|
1179
|
+
tryCatch(({ data }) => {
|
|
1180
|
+
if (data) {
|
|
1181
|
+
const handler = postMessageHandlers[data.name];
|
|
1182
|
+
if (handler) {
|
|
1183
|
+
log("POST MESSAGE", data);
|
|
1184
|
+
handler(data.payload);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
})
|
|
1188
|
+
);
|
|
1189
|
+
for (const handler of subscribeCxf) {
|
|
1190
|
+
handler(cxf);
|
|
1191
|
+
}
|
|
1192
|
+
globalState.preResolveConfig();
|
|
1193
|
+
log("App has started");
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
// src/config.ts
|
|
1197
|
+
init_define_process();
|
|
1198
|
+
var import_cxf_events2 = __toESM(require_typings());
|
|
1199
|
+
var COMMON_CONFIG = {
|
|
1200
|
+
CANVAS_AGENT_URL: define_process_default.env.CANVAS_AGENT_URL,
|
|
1201
|
+
CANVAS_APP_ID_BY_GAME: define_process_default.env.CANVAS_APP_ID_BY_GAME,
|
|
1202
|
+
CUSTOMIZATION_URL: define_process_default.env.CUSTOMIZATION_URL,
|
|
1203
|
+
CUSTOMIZATION_URL_TEMPLATE: define_process_default.env.CUSTOMIZATION_URL_TEMPLATE,
|
|
1204
|
+
BASE_URL: define_process_default.env.BASE_URL,
|
|
1205
|
+
CXF_DIALOG_OPEN: "cxf.dialog.open",
|
|
1206
|
+
CXF_DIALOG_CLOSE: "cxf.dialog.close",
|
|
1207
|
+
CXF_TRACK_MSG: "cxf.tracking.message",
|
|
1208
|
+
CXF_BTN_CLICK_MSG: import_cxf_events2.CxfEvents.OpenIGS,
|
|
1209
|
+
CXF_OPEN_SALES_MSG: "cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */,
|
|
1210
|
+
WEB_SHOP_CALL_TRACK_ID: 1181,
|
|
1211
|
+
CXF_ERROR: "cxf.error",
|
|
1212
|
+
CXF_PUSH: "cxf.push",
|
|
1213
|
+
CXF_AD_STATUS: "cxf.adBanner.status"
|
|
1214
|
+
};
|
|
1215
|
+
var GAME_SPECIFIC_CONFIG = {
|
|
1216
|
+
12: {
|
|
1217
|
+
LEGEND_LEVEL_IS_USED: true
|
|
1218
|
+
},
|
|
1219
|
+
15: {
|
|
1220
|
+
LEGEND_LEVEL_IS_USED: false
|
|
1221
|
+
},
|
|
1222
|
+
16: {
|
|
1223
|
+
LEGEND_LEVEL_IS_USED: true
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
var createConfig = (gameId) => {
|
|
1227
|
+
return {
|
|
1228
|
+
...COMMON_CONFIG,
|
|
1229
|
+
...GAME_SPECIFIC_CONFIG[gameId]
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
// src/index.ts
|
|
1234
|
+
require_dist().then((cxf) => {
|
|
1235
|
+
const config = createConfig(cxf.gameId);
|
|
1236
|
+
globalState.setConfig(config);
|
|
1237
|
+
globalState.setCxf(cxf);
|
|
1238
|
+
const store = initializeStore(cxf);
|
|
1239
|
+
globalState.setStore(store);
|
|
1240
|
+
loadScript(config.CANVAS_AGENT_URL).then(() => {
|
|
1241
|
+
log(`Canvas agent loaded: ${config.CANVAS_AGENT_URL}`);
|
|
1242
|
+
}).catch((error) => {
|
|
1243
|
+
logError("Canvas agent load error", error);
|
|
1244
|
+
});
|
|
1245
|
+
app(cxf);
|
|
1246
|
+
});
|
|
1247
|
+
})();
|
|
2
1248
|
//# sourceMappingURL=webshop-cxf.js.map
|