@goodgamestudios/cxf-announcements
Advanced tools
Comparing version 0.19.9 to 0.19.10-qa.0
@@ -1,2 +0,2 @@ | ||
!function(){function t(t){return t&&t.__esModule?t.default:t}function e(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r={},o={},a=n.parcelRequire3fb7;null==a&&((a=function(t){if(t in r)return r[t].exports;if(t in o){var e=o[t];delete o[t];var n={id:t,exports:{}};return r[t]=n,e.call(n.exports,n,n.exports),n.exports}var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(t,e){o[t]=e},n.parcelRequire3fb7=a),a.register("jvuiF",(function(t,e){t.exports={getPlayerInfo:function(t){var e=JSON.parse(t[1]);return{playername:e.gpi.PN,level:e.gxp.LVL}},getLevel:function(t){return JSON.parse(t[1]).LVL},lastTutorialLevel:5,loginCmd:"gbd",levelUpCmd:"gxp"}})),a.register("7y43J",(function(t,e){t.exports={getPlayerInfo:function(t){return{playername:t.playerIdentity.name,level:t.xp.level}},getLevel:function(t){return t.newLevel},lastTutorialLevel:1,loginCmd:"LOGIN_BASIC_DATA",levelUpCmd:"LEVEL_UP"}})),a.register("5uSe0",(function(t,e){t.exports={getPlayerInfo:function(t){var e=JSON.parse(t[1]);return{playername:e.gpi.PN,level:e.gxp.LVL}},getLevel:function(t){return JSON.parse(t[1]).LVL},lastTutorialLevel:5,loginCmd:"gbd",levelUpCmd:"gxp",logoutCmd:"LOGOUT"}})),a.register("heU5C",(function(e,n){var r=a("amkHU"),o=a("5mFHf"),i=a("2omaZ").logger,c=a("8T4Pa").GAME_CALLBACK,u=a("71rQz"),s=u.tracking,l=u.OPEN_ANNOUNCEMENTS,f=u.ANNOUNCEMENT_READY,g=a("lm1GU"),h=g.getNewAnnouncements,d=g.getAnnouncementsCache,p=g.setLoginData,m=g.getLoginData,y=g.loadMessages,v=g.loadLoginMessages;e.exports=function(e,n){var a=function(a){return u=(0,r.default)(t(o).mark((function r(u){var l,g;return t(o).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return p(e,n)(u),l=m(),i.log(" onGetMessageStatus - ".concat(a),l),t.next=5,h(l);case 5:g=t.sent,e.gameApi.invokeFn(c.UNREAD_ANNOUNCEMENTS,g),a===n.loginCmd&&g&&s(f,d()),i.log(" call ".concat(c.UNREAD_ANNOUNCEMENTS," - ").concat(g));case 9:case"end":return t.stop()}}),r)}))),function(t){return u.apply(this,arguments)};var u};return{onLogin:function(t){i.info("Login event triggered",t),p(e,n)(t);var r=m();return a(n.loginCmd)(r),v(e)(r)},onLogout:function(){e.once(n.loginCmd,a(n.loginCmd))},onGetMessageStatus:a,onOpenAnnouncements:function(){var t=m();t&&(y(e)(t),i.info("onOpenAnnouncement handler for user %O",t),s(l,d()))}}}})),a.register("amkHU",(function(t,n){function r(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=t.apply(e,n);function c(t){r(i,o,a,c,u,"next",t)}function u(t){r(i,o,a,c,u,"throw",t)}c(void 0)}))}}e(t.exports,"default",(function(){return o}))})),a.register("5mFHf",(function(t,e){var n=function(t){"use strict";var e,n=function(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]},r=function(t,e,n,r){var o=e&&e.prototype instanceof a?e:a,i=Object.create(o.prototype),c=new h(r||[]);return i._invoke=l(t,n,c),i},o=function(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}},a=function(){},i=function(){},c=function(){},u=function(t){["next","throw","return"].forEach((function(e){n(t,e,(function(t){return this._invoke(e,t)}))}))},s=function(t,e){function n(r,a,i,c){var u=o(t[r],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&y.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,i,c)}),(function(t){n("throw",t,i,c)})):e.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return n("throw",t,i,c)}))}c(u.arg)}var r;this._invoke=function(t,o){function a(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(a,a):a()}},l=function(t,e,n){var r=A;return function(a,i){if(r===N)throw new Error("Generator is already running");if(r===S){if("throw"===a)throw i;return p()}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===L)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===A)throw r=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=N;var s=o(t,e,n);if("normal"===s.type){if(r=n.done?S:_,s.arg===L)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=S,n.method="throw",n.arg=s.arg)}}},f=function(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)},g=function(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e},h=function(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)},d=function(t){if(t){var n=t[w];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r<t.length;)if(y.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:p}},p=function(){return{value:e,done:!0}},m=Object.prototype,y=m.hasOwnProperty,v="function"==typeof Symbol?Symbol:{},w=v.iterator||"@@iterator",O=v.asyncIterator||"@@asyncIterator",E=v.toStringTag||"@@toStringTag";try{n({},"")}catch(t){n=function(t,e,n){return t[e]=n}}t.wrap=r;var A="suspendedStart",_="suspendedYield",N="executing",S="completed",L={},b={};b[w]=function(){return this};var C=Object.getPrototypeOf,x=C&&C(C(d([])));x&&x!==m&&y.call(x,w)&&(b=x);var P=c.prototype=a.prototype=Object.create(b);function I(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,I(t,n),"throw"===n.method))return L;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return L}var a=o(r,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,L;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,L):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,L)}return i.prototype=P.constructor=c,c.constructor=i,i.displayName=n(c,E,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,n(t,E,"GeneratorFunction")),t.prototype=Object.create(P),t},t.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[O]=function(){return this},t.AsyncIterator=s,t.async=function(e,n,o,a,i){void 0===i&&(i=Promise);var c=new s(r(e,n,o,a),i);return t.isGeneratorFunction(n)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},u(P),n(P,E,"Generator"),P[w]=function(){return this},P.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=d,h.prototype={constructor:h,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(g),!t)for(var n in this)"t"===n.charAt(0)&&y.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){var n=function(n,o){return i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o};if(this.done)throw t;for(var r=this,o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=y.call(a,"catchLoc"),u=y.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,L):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),L},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),g(n),L}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;g(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:d(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),L}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}})),a.register("2omaZ",(function(t,e){var n=a("iUML9");Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=new Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o<n;){var a=e[o];if(t.call(r,a,o,e))return a;o++}},configurable:!0,writable:!0});var r=function(t,e){t=new URL(t);var n=!0,r=!1,o=void 0;try{for(var a,i=Object.keys(e)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value;t.searchParams.append(c,e[c])}}catch(t){r=!0,o=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return t.toString()},o="CXF-ANNOUNCEMENT",i={info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n]},log:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n]},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n]},error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;(a=console).error.apply(a,["%c ".concat(o," ->"),"background: red; color: yellow"].concat((0,n.default)(e)))}};t.exports={containsInstance:function(t,e,n){var r=t.find((function(t){return t.id===e}));return!!r&&(r=r.instances.find((function(t){return t===n})),Boolean(r))},sharedCommands:{CLOSE_POPUP:"cxf.announcements.closePopup",MARK_AS_READ:"cxf.announcements.markAsRead",SHOW_ANNOUNCEMENTS:"cxf.announcements.getAllAnnouncements",TRACKING:"cxf.announcements.tracking",LINK_CLICKED:"cxf.announcements.hrefClicked"},appendLoginParameters:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e.network,a=e.instance,i=e.lang,c="".concat(t,"/").concat(o,"/").concat(a,"/").concat(i),u=r(c,n);return u},appendQueryParameters:r,ANNOUNCEMENTS_LOCALSTORAGE_KEY:"ggs.cxf.announcements.fetchedAnnouncements",hashCode:function(t){for(var e=0,n=0;n<t.length;n++)e=Math.imul(31,e)+t.charCodeAt(n)|0;return e},getHashKey:function(t,e,n,r){var o=[t,e,n,r].join("_");return"ggs.cxf.announcements.".concat(o,".messageHash")},logger:i,subtractArray:function(t,e){return t.filter((function(t){return!e.includes(t)}))}}})),a.register("iUML9",(function(t,n){e(t.exports,"default",(function(){return u}));var r=a("hyOnN"),o=a("9thIm"),i=a("9vwXY"),c=a("lFKal");function u(t){return(0,r.default)(t)||(0,o.default)(t)||(0,c.default)(t)||(0,i.default)()}})),a.register("hyOnN",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("4ewqO");function o(t){if(Array.isArray(t))return(0,r.default)(t)}})),a.register("4ewqO",(function(t,n){function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}e(t.exports,"default",(function(){return r}))})),a.register("9thIm",(function(t,n){function r(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}e(t.exports,"default",(function(){return r}))})),a.register("9vwXY",(function(t,n){function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e(t.exports,"default",(function(){return r}))})),a.register("lFKal",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("4ewqO");function o(t,e){if(t){if("string"==typeof t)return(0,r.default)(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,r.default)(t,e):void 0}}})),a.register("8T4Pa",(function(t,e){var n="game.button.clicked.",r={GET_ANNOUNCEMENTS:"".concat(n,"getAnnouncements"),OPEN_ANNOUNCEMENTS:"".concat(n,"openAnnouncements")};t.exports={GAME_CALLBACK:{UNREAD_ANNOUNCEMENTS:"setCapToolNotifications",PAGE_LOAD_STARTING:"pageLoadStarting"},GAME:{BIG_FARM:"bigfarm",EMPIRE:"empire",E4K:"empirefourkingdoms"},GAME_BUTTON_CLICKED_PREFIX:n,GAME_ANNOUNCEMENTS_EVENT:r,OPEN:r.OPEN_ANNOUNCEMENTS,GET:r.GET_ANNOUNCEMENTS}})),a.register("71rQz",(function(t,e){var n,r=a("kKpCo"),o=a("2omaZ").logger,i="cxf.tracking.message";t.exports={init:function(t){o.log("tracking has been initialized",t),n=t},tracking:function(t,e,a){var c=function(t){var e;return t&&(e=Array.isArray(t.Items)?t.Items[0]:t),e}(e),u={eventId:1236,gameId:Number.parseInt(n.gameId,10),networkId:Number.parseInt(n.networkId,10),instanceId:n.instanceId,playerId:n.playerId,language:n.countryCode,date:(new Date).toUTCString(),zoneId:n.zoneId,actionType:t},s=c.id,l=c.start_date,f=c.end_date,g=c.title;(u=(0,r.default)({},u,a)).id=s,u.scheduleStart=new Date(l).toUTCString(),u.scheduleEnd=new Date(f).toUTCString(),u.name=g,o.log(i,JSON.stringify(u,null,4)),n.emit(i,u)},OPEN_ANNOUNCEMENTS:"click",ANNOUNCEMENT_READY:"announcement_ready",CLOSE_CROSS:"close_cross",CLOSE_REGULAR:"close_regular",DONT_SHOW_AGAIN_ACTIVATE:"dont_show_again_activate",DONT_SHOW_AGAIN_DEACTIVATE:"dont_show_again_deactivate",SCROLL:"scroll",LOADED:"loaded"}})),a.register("kKpCo",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("iIrD4");function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),o.forEach((function(e){(0,r.default)(t,e,n[e])}))}return t}})),a.register("iIrD4",(function(t,n){function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}e(t.exports,"default",(function(){return r}))})),a.register("lm1GU",(function(e,n){var r=a("amkHU"),o=a("kKpCo"),i=a("7CCwL"),c=a("7mt7r"),u=a("5mFHf");a("6RIYV");var s,l,f=a("2lV2D").acronym,g=a("892gl").getDoNotShowMessages,h=a("h6sBR").CXF_DIALOG_OPEN,d=a("2omaZ"),p=d.appendLoginParameters,m=d.ANNOUNCEMENTS_LOCALSTORAGE_KEY,y=d.hashCode,v=d.getHashKey,w=d.logger,O=function(t){var e=t.game,n=t.playername,r=t.network,o=t.instance,a=v(e,n,r,o);return g(a)},E=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n){return n.filter((function(e){return!t.includes(y(e.title+e.message))})).filter((function(t){return Boolean(t.force_open)===e}))}},A=function(t){return t&&t.Count>0||!1},_=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r,a){var c=a.network,u=a.instance,s=a.lang,l=a.playername,f=e.game;if(A(r)){var g=O({game:f,playername:l,network:c,instance:u}),d=E(g,n)(r.Items);if(d&&0!==d.length){w.info("Received ".concat(d.length," valid announcements"));var p=d.map((function(t){return(0,i.default)((0,o.default)({},t),{body:t.message})}));localStorage.setItem(m,JSON.stringify(p));var y=v(f,l,c,u),_=new URLSearchParams({game:f,lang:s,network:c,instance:u,hash:y}),N="".concat(t,"/").concat(f,"_announcement.html?").concat(_.toString());w.info("templateUrl - ".concat(N)),e.emit(h,N)}else w.info("No valid announcements to show")}}},N=function(t){return{level:t.level}},S=(s=(0,r.default)(t(u).mark((function e(n,r,o){var a;return t(u).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=N(o),n=p(n,o,a),t.abrupt("return",fetch(n).then((function(t){return t.json()})).then((function(t){if(0!==Object.keys(t).length&&0!==t.Count)return r(t,o);w.info("".concat(n," shows empty response"))})).catch((function(t){return w.log("failed loading ".concat(n,": ").concat(t))})));case 3:case"end":return t.stop()}}),e)}))),function(t,e,n){return s.apply(this,arguments)}),L=function(t,e){if(t&&Array.isArray(t)&&!(t.length<4)){var n=(0,c.default)(t,4),r=n[0],o=n[1],a=n[2],i=n[3];return{userdata:e.getPlayerInfo(r),lang:o,network:a,instance:i}}w.warn("Received invalid payload from game - %O \n the valid payload is [userdata, lang, network, instance]",t)},b=function(t,e){return E(O(t))(e).length},C=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=_("https://community-announcement-template.ggs-stp.com",t,n);return S("https://community-announcements.ggs-stp.com/"+e.gameAcronym,r,e)}},x=function(t){l=t},P={};e.exports={getNewAnnouncements:function(t){w.log("getNewAnnouncements - loginData: %O",t);return S("https://community-announcements.ggs-stp.com/"+t.gameAcronym,(function(e){var n=0;return A(e)&&(n=b(t,e.Items),x(e)),w.log(" Has announcements: ",n>0),n}),t)},getAnnouncementsCache:function(){if(l&&0!==Object.keys(l).length)return l;w.warn("getAnnouncementsCache - annoucement data has not been set yet",l)},setLoginData:function(t,e){return function(n){if(n||0!==Object.keys(P).length){var r=L(n,e);n&&r&&Object.assign(P,{lang:r.lang,network:r.network,instance:r.instance,game:t.game,gameAcronym:f(t.game),playername:r.userdata.playername,level:r.userdata.level})}else w.warn("saveLoginData - the user data has not been set/initialized %O",P)}},getLoginData:function(){if(P&&0!==Object.keys(P).length)return P;w.warn("getLoginData - login data has not been set yet",P)},loadMessages:C,loadLoginMessages:function(t){return function(e){return C(t)(e,!0)}}},e.exports.__internals={alreadyShown:O,countUnread:b,filterUnreadForceOpen:E,getAnnouncementFilters:N,getRootGamePayload:L,handleAnnouncementMessage:_,hasAnnouncements:A,loadCurrentMessages:S,setAnnouncementsCache:x}})),a.register("7CCwL",(function(t,n){function r(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t}e(t.exports,"default",(function(){return r}))})),a.register("7mt7r",(function(t,n){e(t.exports,"default",(function(){return u}));var r=a("lq6bD"),o=a("9thIm"),i=a("hldnE"),c=a("lFKal");function u(t,e){return(0,r.default)(t)||(0,o.default)(t,e)||(0,c.default)(t,e)||(0,i.default)()}})),a.register("lq6bD",(function(t,n){function r(t){if(Array.isArray(t))return t}e(t.exports,"default",(function(){return r}))})),a.register("hldnE",(function(t,n){function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e(t.exports,"default",(function(){return r}))})),a.register("6RIYV",(function(t,e){ | ||
!function(){function t(t){return t&&t.__esModule?t.default:t}function e(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r={},o={},a=n.parcelRequire3fb7;null==a&&((a=function(t){if(t in r)return r[t].exports;if(t in o){var e=o[t];delete o[t];var n={id:t,exports:{}};return r[t]=n,e.call(n.exports,n,n.exports),n.exports}var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(t,e){o[t]=e},n.parcelRequire3fb7=a),a.register("jvuiF",(function(t,e){t.exports={getPlayerInfo:function(t){var e=JSON.parse(t[1]);return{playername:e.gpi.PN,level:e.gxp.LVL}},getLevel:function(t){return JSON.parse(t[1]).LVL},lastTutorialLevel:5,loginCmd:"gbd",levelUpCmd:"gxp"}})),a.register("7y43J",(function(t,e){t.exports={getPlayerInfo:function(t){return{playername:t.playerIdentity.name,level:t.xp.level}},getLevel:function(t){return t.newLevel},lastTutorialLevel:1,loginCmd:"LOGIN_BASIC_DATA",levelUpCmd:"LEVEL_UP"}})),a.register("5uSe0",(function(t,e){t.exports={getPlayerInfo:function(t){var e=JSON.parse(t[1]);return{playername:e.gpi.PN,level:e.gxp.LVL}},getLevel:function(t){return JSON.parse(t[1]).LVL},lastTutorialLevel:5,loginCmd:"gbd",levelUpCmd:"gxp",logoutCmd:"LOGOUT"}})),a.register("heU5C",(function(e,n){var r=a("amkHU"),o=a("5mFHf"),i=a("2omaZ").logger,c=a("8T4Pa").GAME_CALLBACK,u=a("71rQz"),s=u.tracking,l=u.OPEN_ANNOUNCEMENTS,f=u.ANNOUNCEMENT_READY,g=a("lm1GU"),d=g.getNewAnnouncements,h=g.getAnnouncementsCache,p=g.setLoginData,m=g.getLoginData,y=g.loadMessages,v=g.loadLoginMessages;e.exports=function(e,n){var a=function(a){return u=(0,r.default)(t(o).mark((function r(u){var l,g;return t(o).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return p(e,n)(u),l=m(),i.log(" onGetMessageStatus - ".concat(a),l),t.next=5,d(l);case 5:g=t.sent,e.gameApi.invokeFn(c.UNREAD_ANNOUNCEMENTS,g),a===n.loginCmd&&g&&s(f,h()),i.log(" call ".concat(c.UNREAD_ANNOUNCEMENTS," - ").concat(g));case 9:case"end":return t.stop()}}),r)}))),function(t){return u.apply(this,arguments)};var u};return{onLogin:function(t){i.info("Login event triggered",t),p(e,n)(t);var r=m();return a(n.loginCmd)(r),v(e)(r)},onLogout:function(){e.once(n.loginCmd,a(n.loginCmd))},onGetMessageStatus:a,onOpenAnnouncements:function(){var t=m();t&&(y(e)(t),i.info("onOpenAnnouncement handler for user %O",t),s(l,h()))}}}})),a.register("amkHU",(function(t,n){function r(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=t.apply(e,n);function c(t){r(i,o,a,c,u,"next",t)}function u(t){r(i,o,a,c,u,"throw",t)}c(void 0)}))}}e(t.exports,"default",(function(){return o}))})),a.register("5mFHf",(function(t,e){var n=function(t){"use strict";var e,n=function(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]},r=function(t,e,n,r){var o=e&&e.prototype instanceof a?e:a,i=Object.create(o.prototype),c=new d(r||[]);return i._invoke=l(t,n,c),i},o=function(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}},a=function(){},i=function(){},c=function(){},u=function(t){["next","throw","return"].forEach((function(e){n(t,e,(function(t){return this._invoke(e,t)}))}))},s=function(t,e){function n(r,a,i,c){var u=o(t[r],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&y.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,i,c)}),(function(t){n("throw",t,i,c)})):e.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return n("throw",t,i,c)}))}c(u.arg)}var r;this._invoke=function(t,o){function a(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(a,a):a()}},l=function(t,e,n){var r=A;return function(a,i){if(r===b)throw new Error("Generator is already running");if(r===S){if("throw"===a)throw i;return p()}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=T(c,n);if(u){if(u===L)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===A)throw r=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=b;var s=o(t,e,n);if("normal"===s.type){if(r=n.done?S:N,s.arg===L)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=S,n.method="throw",n.arg=s.arg)}}},f=function(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)},g=function(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e},d=function(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)},h=function(t){if(t){var n=t[w];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r<t.length;)if(y.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:p}},p=function(){return{value:e,done:!0}},m=Object.prototype,y=m.hasOwnProperty,v="function"==typeof Symbol?Symbol:{},w=v.iterator||"@@iterator",O=v.asyncIterator||"@@asyncIterator",E=v.toStringTag||"@@toStringTag";try{n({},"")}catch(t){n=function(t,e,n){return t[e]=n}}t.wrap=r;var A="suspendedStart",N="suspendedYield",b="executing",S="completed",L={},_={};_[w]=function(){return this};var C=Object.getPrototypeOf,x=C&&C(C(h([])));x&&x!==m&&y.call(x,w)&&(_=x);var I=c.prototype=a.prototype=Object.create(_);function T(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return L;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return L}var a=o(r,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,L;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,L):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,L)}return i.prototype=I.constructor=c,c.constructor=i,i.displayName=n(c,E,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,n(t,E,"GeneratorFunction")),t.prototype=Object.create(I),t},t.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[O]=function(){return this},t.AsyncIterator=s,t.async=function(e,n,o,a,i){void 0===i&&(i=Promise);var c=new s(r(e,n,o,a),i);return t.isGeneratorFunction(n)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},u(I),n(I,E,"Generator"),I[w]=function(){return this},I.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=h,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(g),!t)for(var n in this)"t"===n.charAt(0)&&y.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){var n=function(n,o){return i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o};if(this.done)throw t;for(var r=this,o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=y.call(a,"catchLoc"),u=y.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,L):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),L},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),g(n),L}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;g(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:h(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),L}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}})),a.register("2omaZ",(function(t,e){var n=a("iUML9");Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=new Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o<n;){var a=e[o];if(t.call(r,a,o,e))return a;o++}},configurable:!0,writable:!0});var r=function(t,e){t=new URL(t);var n=!0,r=!1,o=void 0;try{for(var a,i=Object.keys(e)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value;t.searchParams.append(c,e[c])}}catch(t){r=!0,o=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return t.toString()},o="CXF-ANNOUNCEMENT",i={info:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;(a=console).info.apply(a,["%c ".concat(o," ->"),"background: green; color: yellow"].concat((0,n.default)(e)))},log:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;(a=console).info.apply(a,["%c ".concat(o," ->"),"background: green; color: yellow"].concat((0,n.default)(e)))},warn:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;(a=console).warn.apply(a,["%c ".concat(o," ->"),"background: orange; color: yellow"].concat((0,n.default)(e)))},error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;(a=console).error.apply(a,["%c ".concat(o," ->"),"background: red; color: yellow"].concat((0,n.default)(e)))}};t.exports={containsInstance:function(t,e,n){var r=t.find((function(t){return t.id===e}));return!!r&&(r=r.instances.find((function(t){return t===n})),Boolean(r))},sharedCommands:{CLOSE_POPUP:"cxf.announcements.closePopup",MARK_AS_READ:"cxf.announcements.markAsRead",SHOW_ANNOUNCEMENTS:"cxf.announcements.getAllAnnouncements",TRACKING:"cxf.announcements.tracking",LINK_CLICKED:"cxf.announcements.hrefClicked"},appendLoginParameters:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e.network,a=e.instance,i=e.lang,c="".concat(t,"/").concat(o,"/").concat(a,"/").concat(i);return r(c,n)},appendQueryParameters:r,ANNOUNCEMENTS_LOCALSTORAGE_KEY:"ggs.cxf.announcements.fetchedAnnouncements",hashCode:function(t){for(var e=0,n=0;n<t.length;n++)e=Math.imul(31,e)+t.charCodeAt(n)|0;return e},getHashKey:function(t,e,n,r){var o=[t,e,n,r].join("_");return"ggs.cxf.announcements.".concat(o,".messageHash")},logger:i,subtractArray:function(t,e){return t.filter((function(t){return!e.includes(t)}))}}})),a.register("iUML9",(function(t,n){e(t.exports,"default",(function(){return u}));var r=a("hyOnN"),o=a("9thIm"),i=a("9vwXY"),c=a("lFKal");function u(t){return(0,r.default)(t)||(0,o.default)(t)||(0,c.default)(t)||(0,i.default)()}})),a.register("hyOnN",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("4ewqO");function o(t){if(Array.isArray(t))return(0,r.default)(t)}})),a.register("4ewqO",(function(t,n){function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}e(t.exports,"default",(function(){return r}))})),a.register("9thIm",(function(t,n){function r(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}e(t.exports,"default",(function(){return r}))})),a.register("9vwXY",(function(t,n){function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e(t.exports,"default",(function(){return r}))})),a.register("lFKal",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("4ewqO");function o(t,e){if(t){if("string"==typeof t)return(0,r.default)(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,r.default)(t,e):void 0}}})),a.register("8T4Pa",(function(t,e){var n="game.button.clicked.",r={GET_ANNOUNCEMENTS:"".concat(n,"getAnnouncements"),OPEN_ANNOUNCEMENTS:"".concat(n,"openAnnouncements")};t.exports={GAME_CALLBACK:{UNREAD_ANNOUNCEMENTS:"setCapToolNotifications",PAGE_LOAD_STARTING:"pageLoadStarting"},GAME:{BIG_FARM:"bigfarm",EMPIRE:"empire",E4K:"empirefourkingdoms"},GAME_BUTTON_CLICKED_PREFIX:n,GAME_ANNOUNCEMENTS_EVENT:r,OPEN:r.OPEN_ANNOUNCEMENTS,GET:r.GET_ANNOUNCEMENTS}})),a.register("71rQz",(function(t,e){var n,r=a("kKpCo"),o=a("2omaZ").logger,i="cxf.tracking.message";t.exports={init:function(t){o.log("tracking has been initialized",t),n=t},tracking:function(t,e,a){var c=function(t){var e;return t&&(e=Array.isArray(t.Items)?t.Items[0]:t),e}(e),u={eventId:1236,gameId:Number.parseInt(n.gameId,10),networkId:Number.parseInt(n.networkId,10),instanceId:n.instanceId,playerId:n.playerId,language:n.countryCode,date:(new Date).toUTCString(),zoneId:n.zoneId,actionType:t},s=c.id,l=c.start_date,f=c.end_date,g=c.title;(u=(0,r.default)({},u,a)).id=s,u.scheduleStart=new Date(l).toUTCString(),u.scheduleEnd=new Date(f).toUTCString(),u.name=g,o.log(i,JSON.stringify(u,null,4)),n.emit(i,u)},OPEN_ANNOUNCEMENTS:"click",ANNOUNCEMENT_READY:"announcement_ready",CLOSE_CROSS:"close_cross",CLOSE_REGULAR:"close_regular",DONT_SHOW_AGAIN_ACTIVATE:"dont_show_again_activate",DONT_SHOW_AGAIN_DEACTIVATE:"dont_show_again_deactivate",SCROLL:"scroll",LOADED:"loaded"}})),a.register("kKpCo",(function(t,n){e(t.exports,"default",(function(){return o}));var r=a("iIrD4");function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),o.forEach((function(e){(0,r.default)(t,e,n[e])}))}return t}})),a.register("iIrD4",(function(t,n){function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}e(t.exports,"default",(function(){return r}))})),a.register("lm1GU",(function(e,n){var r=a("amkHU"),o=a("kKpCo"),i=a("7CCwL"),c=a("7mt7r"),u=a("5mFHf");a("6RIYV");var s,l,f=a("2lV2D").acronym,g=a("892gl").getDoNotShowMessages,d=a("h6sBR").CXF_DIALOG_OPEN,h=a("2omaZ"),p=h.appendLoginParameters,m=h.ANNOUNCEMENTS_LOCALSTORAGE_KEY,y=h.hashCode,v=h.getHashKey,w=h.logger,O=function(t){var e=t.game,n=t.playername,r=t.network,o=t.instance,a=v(e,n,r,o);return g(a)},E=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n){return n.filter((function(e){return!t.includes(y(e.title+e.message))})).filter((function(t){return Boolean(t.force_open)===e}))}},A=function(t){return t&&t.Count>0||!1},N=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r,a){var c=a.network,u=a.instance,s=a.lang,l=a.playername,f=e.game;if(A(r)){var g=O({game:f,playername:l,network:c,instance:u}),h=E(g,n)(r.Items);if(h&&0!==h.length){w.info("Received ".concat(h.length," valid announcements"));var p=h.map((function(t){return(0,i.default)((0,o.default)({},t),{body:t.message})}));localStorage.setItem(m,JSON.stringify(p));var y=v(f,l,c,u),N=new URLSearchParams({game:f,lang:s,network:c,instance:u,hash:y}),b="".concat(t,"/").concat(f,"_announcement.html?").concat(N.toString());w.info("templateUrl - ".concat(b)),e.emit(d,b)}else w.info("No valid announcements to show")}}},b=function(t){return{level:t.level}},S=(s=(0,r.default)(t(u).mark((function e(n,r,o){var a;return t(u).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=b(o),n=p(n,o,a),t.abrupt("return",fetch(n).then((function(t){return t.json()})).then((function(t){if(0!==Object.keys(t).length&&0!==t.Count)return r(t,o);w.info("".concat(n," shows empty response"))})).catch((function(t){return w.log("failed loading ".concat(n,": ").concat(t))})));case 3:case"end":return t.stop()}}),e)}))),function(t,e,n){return s.apply(this,arguments)}),L=function(t,e){if(t&&Array.isArray(t)&&!(t.length<4)){var n=(0,c.default)(t,4),r=n[0],o=n[1],a=n[2],i=n[3];return{userdata:e.getPlayerInfo(r),lang:o,network:a,instance:i}}w.warn("Received invalid payload from game - %O \n the valid payload is [userdata, lang, network, instance]",t)},_=function(t,e){return E(O(t))(e).length},C=function(t){return function(e){var n=N("https://community-announcement-template-staging.ggs-stp.com",t,arguments.length>1&&void 0!==arguments[1]&&arguments[1]);return S("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+e.gameAcronym,n,e)}},x=function(t){l=t},I={};e.exports={getNewAnnouncements:function(t){w.log("getNewAnnouncements - loginData: %O",t);return S("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+t.gameAcronym,(function(e){var n=0;return A(e)&&(n=_(t,e.Items),x(e)),w.log(" Has announcements: ",n>0),n}),t)},getAnnouncementsCache:function(){if(l&&0!==Object.keys(l).length)return l;w.warn("getAnnouncementsCache - annoucement data has not been set yet",l)},setLoginData:function(t,e){return function(n){if(n||0!==Object.keys(I).length){var r=L(n,e);n&&r&&Object.assign(I,{lang:r.lang,network:r.network,instance:r.instance,game:t.game,gameAcronym:f(t.game),playername:r.userdata.playername,level:r.userdata.level})}else w.warn("saveLoginData - the user data has not been set/initialized %O",I)}},getLoginData:function(){if(I&&0!==Object.keys(I).length)return I;w.warn("getLoginData - login data has not been set yet",I)},loadMessages:C,loadLoginMessages:function(t){return function(e){return C(t)(e,!0)}}},e.exports.__internals={alreadyShown:O,countUnread:_,filterUnreadForceOpen:E,getAnnouncementFilters:b,getRootGamePayload:L,handleAnnouncementMessage:N,hasAnnouncements:A,loadCurrentMessages:S,setAnnouncementsCache:x}})),a.register("7CCwL",(function(t,n){function r(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t}e(t.exports,"default",(function(){return r}))})),a.register("7mt7r",(function(t,n){e(t.exports,"default",(function(){return u}));var r=a("lq6bD"),o=a("9thIm"),i=a("hldnE"),c=a("lFKal");function u(t,e){return(0,r.default)(t)||(0,o.default)(t,e)||(0,c.default)(t,e)||(0,i.default)()}})),a.register("lq6bD",(function(t,n){function r(t){if(Array.isArray(t))return t}e(t.exports,"default",(function(){return r}))})),a.register("hldnE",(function(t,n){function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e(t.exports,"default",(function(){return r}))})),a.register("6RIYV",(function(t,e){ | ||
/** | ||
@@ -9,3 +9,3 @@ * | ||
*/ | ||
!function(t){"use strict";var e,n=function(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'\(\)~]|%20|%00/g,(function(t){return e[t]}))},r=function(t){return t.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,(function(t){return decodeURIComponent(t)}))},o=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return d&&(n[t.Symbol.iterator]=function(){return n}),n},a=function(t){var e={};if("object"==typeof t)if(c(t))for(var n=0;n<t.length;n++){var o=t[n];if(!c(o)||2!==o.length)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");i(e,o[0],o[1])}else for(var a in t)t.hasOwnProperty(a)&&i(e,a,t[a]);else{0===t.indexOf("?")&&(t=t.slice(1));for(var u=t.split("&"),s=0;s<u.length;s++){var l=u[s],f=l.indexOf("=");-1<f?i(e,r(l.slice(0,f)),r(l.slice(f+1))):l&&i(e,r(l),"")}}return e},i=function(t,e,n){var r="string"==typeof n?n:null!=n&&"function"==typeof n.toString?n.toString():JSON.stringify(n);u(t,e)?t[e].push(r):t[e]=[r]},c=function(t){return!!t&&"[object Array]"===Object.prototype.toString.call(t)},u=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s=function(){try{if(t.URLSearchParams&&"bar"===new t.URLSearchParams("foo=bar").get("foo"))return t.URLSearchParams}catch(t){}return null}(),l=s&&"a=1"===new s({a:1}).toString(),f=s&&"+"===new s("s=%2B").get("s"),g=!s||((e=new s).append("s"," &"),"s=+%26"===e.toString()),h=y.prototype,d=!(!t.Symbol||!t.Symbol.iterator);if(!(s&&l&&f&&g)){var p;h.append=function(t,e){i(this.__URLSearchParams__,t,e)},h.delete=function(t){delete this.__URLSearchParams__[t]},h.get=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t][0]:null},h.getAll=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t].slice(0):[]},h.has=function(t){return u(this.__URLSearchParams__,t)},h.set=function(t,e){this.__URLSearchParams__[t]=[""+e]},h.toString=function(){var t,e,r,o,a=this.__URLSearchParams__,i=[];for(e in a)for(r=n(e),t=0,o=a[e];t<o.length;t++)i.push(r+"="+n(o[t]));return i.join("&")},!!f&&s&&!l&&t.Proxy?(p=new Proxy(s,{construct:function(t,e){return new t(new y(e[0]).toString())}})).toString=Function.prototype.toString.bind(y):p=y,Object.defineProperty(t,"URLSearchParams",{value:p});var m=t.URLSearchParams.prototype;m.polyfill=!0,m.forEach=m.forEach||function(t,e){var n=a(this.toString());Object.getOwnPropertyNames(n).forEach((function(r){n[r].forEach((function(n){t.call(e,n,r,this)}),this)}),this)},m.sort=m.sort||function(){var t,e,n,r=a(this.toString()),o=[];for(t in r)o.push(t);for(o.sort(),e=0;e<o.length;e++)this.delete(o[e]);for(e=0;e<o.length;e++){var i=o[e],c=r[i];for(n=0;n<c.length;n++)this.append(i,c[n])}},m.keys=m.keys||function(){var t=[];return this.forEach((function(e,n){t.push(n)})),o(t)},m.values=m.values||function(){var t=[];return this.forEach((function(e){t.push(e)})),o(t)},m.entries=m.entries||function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),o(t)},d&&(m[t.Symbol.iterator]=m[t.Symbol.iterator]||m.entries)}function y(t){((t=t||"")instanceof URLSearchParams||t instanceof y)&&(t=t.toString()),this.__URLSearchParams__=a(t)}}(void 0!==n?n:"undefined"!=typeof window?window:t.exports)})),a.register("2lV2D",(function(t,e){var n,r,o,a,i,c,u,s;r=function(t,e){return i(t)||a(t,e)||o()},o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n},i=function(t){if(Array.isArray(t))return t},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"]},u=Object.entries(c).reduce((function(t,e){var n=r(e,2),o=n[0],a=n[1];return o=parseInt(o,10),t[o]=o,a.forEach((function(e){t[e]=o})),t}),{}),n={id:function(t){t=t.toString().toLowerCase();var e=u[t];return e&&0|e},name:(s=function(t,e){return(e=u[e])&&c[e][t]}).bind(null,0),codename:s.bind(null,1),acronym:s.bind(null,2)},t.exports=n})),a.register("892gl",(function(t,e){var n,r,o=(n=a("2omaZ")).subtractArray,i=(n=a("2omaZ")).sharedCommands,c=n.ANNOUNCEMENTS_LOCALSTORAGE_KEY,u=a("h6sBR").CXF_DIALOG_CLOSE,s=a("8T4Pa"),l=s.GET,f=s.GAME_CALLBACK,g=a("71rQz"),h=g.tracking,d=g.CLOSE_CROSS,p=g.CLOSE_REGULAR,m=g.DONT_SHOW_AGAIN_ACTIVATE,y=g.DONT_SHOW_AGAIN_DEACTIVATE,v=g.SCROLL,w=g.LOADED;function O(t){var e=t.hash,n=t.wasRead,a=A(e.key),i=n?m:y,c=!0,u=!1,s=void 0;try{for(var l,f=r[Symbol.iterator]();!(c=(l=f.next()).done);c=!0){var g=l.value;h(i,g)}}catch(t){u=!0,s=t}finally{try{c||null==f.return||f.return()}finally{if(u)throw s}}var d=n?a.concat(e.hashList):o(a,e.hashList);0===d.length?localStorage.removeItem(e.key):localStorage.setItem(e.key,JSON.stringify(d))}function E(t){localStorage.removeItem(c),r=void 0,t.emit(u)}function A(t){var e=localStorage.getItem(t)||"[]";return JSON.parse(e)}function _(){var t=localStorage.getItem(c)||"[]";return JSON.parse(t)}var N=function(t,e){return e.start_date-t.start_date};function S(t){var e=t.frameId,n=_().sort(N);if(n&&n.length>0){var o=document.getElementById(e).contentWindow;r=n;var a=Date.now();o.postMessage({messages:n,triggeredTimestamp:a},"*"),localStorage.setItem(c,JSON.stringify([]))}}var L=new Map([["okBtn",p],["crossBtn",d],["scrolled",v],["loaded",w]]);t.exports={addWindowListeners:function(t){window.addEventListener("message",(function(e){if(e.data&&e.data.name)switch(e.data.name){case i.MARK_AS_READ:O(e.data),t.emit(l);break;case i.CLOSE_POPUP:E(t);break;case i.SHOW_ANNOUNCEMENTS:S(e.data);break;case i.TRACKING:var n=!0,o=!1,a=void 0;try{for(var c,u=r[Symbol.iterator]();!(n=(c=u.next()).done);n=!0){var s=c.value;if("scrolled"===e.data.action)e.data.params.scrolledAnnouncements.includes(s.id)&&h(L.get(e.data.action),s,e.data.params);else h(L.get(e.data.action),s,e.data.params)}}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}break;case i.LINK_CLICKED:t.gameApi.invokeFn(f.PAGE_LOAD_STARTING,e.data.href)}}),!1)},getDoNotShowMessages:A},t.exports.__internals={markAsRead:O,getDoNotShowMessages:A,getMessages:_,closeFrame:E,showAllMessages:S,setAllActiveAnnouncements:function(t){r=t}}})),a.register("h6sBR",(function(t,e){t.exports={CXF_DIALOG_OPEN:"cxf.dialog.open",CXF_DIALOG_CLOSE:"cxf.dialog.close"}}));var i,c,u=a("iIrD4"),s=a("892gl").addWindowListeners,l=a("2omaZ").logger,f=(c=a("8T4Pa")).GAME,g=(i={},(0,u.default)(i,f.EMPIRE,a("jvuiF")),(0,u.default)(i,f.BIG_FARM,a("7y43J")),(0,u.default)(i,f.E4K,a("5uSe0")),i),h=(c=a("8T4Pa")).OPEN,d=c.GET,p=a("71rQz").init;!function(t){l.log(" initialized successfully - waiting for player login",t.game),p(t);var e=g[t.game],n=a("heU5C")(t,e);s(t),e.logoutCmd&&t.on(e.logoutCmd,n.onLogout),t.once(3,(function(){})),t.once(24,(function(){})),t.once(e.loginCmd,n.onLogin),t.on(d,n.onGetMessageStatus(d)),t.on(h,n.onOpenAnnouncements)}(window.CXF)}(); | ||
!function(t){"use strict";var e,n=function(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'\(\)~]|%20|%00/g,(function(t){return e[t]}))},r=function(t){return t.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,(function(t){return decodeURIComponent(t)}))},o=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return p&&(n[t.Symbol.iterator]=function(){return n}),n},a=function(t){var e={};if("object"==typeof t)if(c(t))for(var n=0;n<t.length;n++){var o=t[n];if(!c(o)||2!==o.length)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");i(e,o[0],o[1])}else for(var a in t)t.hasOwnProperty(a)&&i(e,a,t[a]);else{0===t.indexOf("?")&&(t=t.slice(1));for(var u=t.split("&"),s=0;s<u.length;s++){var l=u[s],f=l.indexOf("=");-1<f?i(e,r(l.slice(0,f)),r(l.slice(f+1))):l&&i(e,r(l),"")}}return e},i=function(t,e,n){var r="string"==typeof n?n:null!=n&&"function"==typeof n.toString?n.toString():JSON.stringify(n);u(t,e)?t[e].push(r):t[e]=[r]},c=function(t){return!!t&&"[object Array]"===Object.prototype.toString.call(t)},u=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s=function(){try{if(t.URLSearchParams&&"bar"===new t.URLSearchParams("foo=bar").get("foo"))return t.URLSearchParams}catch(t){}return null}(),l=s&&"a=1"===new s({a:1}).toString(),f=s&&"+"===new s("s=%2B").get("s"),g="__URLSearchParams__",d=!s||((e=new s).append("s"," &"),"s=+%26"===e.toString()),h=v.prototype,p=!(!t.Symbol||!t.Symbol.iterator);if(!(s&&l&&f&&d)){var m;h.append=function(t,e){i(this[g],t,e)},h.delete=function(t){delete this[g][t]},h.get=function(t){var e=this[g];return this.has(t)?e[t][0]:null},h.getAll=function(t){var e=this[g];return this.has(t)?e[t].slice(0):[]},h.has=function(t){return u(this[g],t)},h.set=function(t,e){this[g][t]=[""+e]},h.toString=function(){var t,e,r,o,a=this[g],i=[];for(e in a)for(r=n(e),t=0,o=a[e];t<o.length;t++)i.push(r+"="+n(o[t]));return i.join("&")},!!f&&s&&!l&&t.Proxy?(m=new Proxy(s,{construct:function(t,e){return new t(new v(e[0]).toString())}})).toString=Function.prototype.toString.bind(v):m=v,Object.defineProperty(t,"URLSearchParams",{value:m});var y=t.URLSearchParams.prototype;y.polyfill=!0,y.forEach=y.forEach||function(t,e){var n=a(this.toString());Object.getOwnPropertyNames(n).forEach((function(r){n[r].forEach((function(n){t.call(e,n,r,this)}),this)}),this)},y.sort=y.sort||function(){var t,e,n,r=a(this.toString()),o=[];for(t in r)o.push(t);for(o.sort(),e=0;e<o.length;e++)this.delete(o[e]);for(e=0;e<o.length;e++){var i=o[e],c=r[i];for(n=0;n<c.length;n++)this.append(i,c[n])}},y.keys=y.keys||function(){var t=[];return this.forEach((function(e,n){t.push(n)})),o(t)},y.values=y.values||function(){var t=[];return this.forEach((function(e){t.push(e)})),o(t)},y.entries=y.entries||function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),o(t)},p&&(y[t.Symbol.iterator]=y[t.Symbol.iterator]||y.entries)}function v(t){((t=t||"")instanceof URLSearchParams||t instanceof v)&&(t=t.toString()),this[g]=a(t)}}(void 0!==n?n:"undefined"!=typeof window?window:t.exports)})),a.register("2lV2D",(function(t,e){var n,r,o,a,i,c,u,s;r=function(t,e){return i(t)||a(t,e)||o()},o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n},i=function(t){if(Array.isArray(t))return t},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"]},u=Object.entries(c).reduce((function(t,e){var n=r(e,2),o=n[0],a=n[1];return o=parseInt(o,10),t[o]=o,a.forEach((function(e){t[e]=o})),t}),{}),n={id:function(t){t=t.toString().toLowerCase();var e=u[t];return e&&0|e},name:(s=function(t,e){return(e=u[e])&&c[e][t]}).bind(null,0),codename:s.bind(null,1),acronym:s.bind(null,2)},t.exports=n})),a.register("892gl",(function(t,e){var n,r,o=(n=a("2omaZ")).subtractArray,i=(n=a("2omaZ")).sharedCommands,c=n.ANNOUNCEMENTS_LOCALSTORAGE_KEY,u=a("h6sBR").CXF_DIALOG_CLOSE,s=a("8T4Pa"),l=s.GET,f=s.GAME_CALLBACK,g=a("71rQz"),d=g.tracking,h=g.CLOSE_CROSS,p=g.CLOSE_REGULAR,m=g.DONT_SHOW_AGAIN_ACTIVATE,y=g.DONT_SHOW_AGAIN_DEACTIVATE,v=g.SCROLL,w=g.LOADED;function O(t){var e=t.hash,n=t.wasRead,a=A(e.key),i=n?m:y,c=!0,u=!1,s=void 0;try{for(var l,f=r[Symbol.iterator]();!(c=(l=f.next()).done);c=!0){var g=l.value;d(i,g)}}catch(t){u=!0,s=t}finally{try{c||null==f.return||f.return()}finally{if(u)throw s}}var h=n?a.concat(e.hashList):o(a,e.hashList);0===h.length?localStorage.removeItem(e.key):localStorage.setItem(e.key,JSON.stringify(h))}function E(t){localStorage.removeItem(c),r=void 0,t.emit(u)}function A(t){var e=localStorage.getItem(t)||"[]";return JSON.parse(e)}function N(){var t=localStorage.getItem(c)||"[]";return JSON.parse(t)}var b=function(t,e){return e.start_date-t.start_date};function S(t){var e=t.frameId,n=N().sort(b);if(n&&n.length>0){var o=document.getElementById(e).contentWindow;r=n;var a=Date.now();o.postMessage({messages:n,triggeredTimestamp:a},"*"),localStorage.setItem(c,JSON.stringify([]))}}var L=new Map([["okBtn",p],["crossBtn",h],["scrolled",v],["loaded",w]]);t.exports={addWindowListeners:function(t){window.addEventListener("message",(function(e){if(e.data&&e.data.name)switch(e.data.name){case i.MARK_AS_READ:O(e.data),t.emit(l);break;case i.CLOSE_POPUP:E(t);break;case i.SHOW_ANNOUNCEMENTS:S(e.data);break;case i.TRACKING:var n=!0,o=!1,a=void 0;try{for(var c,u=r[Symbol.iterator]();!(n=(c=u.next()).done);n=!0){var s=c.value;if("scrolled"===e.data.action)e.data.params.scrolledAnnouncements.includes(s.id)&&d(L.get(e.data.action),s,e.data.params);else d(L.get(e.data.action),s,e.data.params)}}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}break;case i.LINK_CLICKED:t.gameApi.invokeFn(f.PAGE_LOAD_STARTING,e.data.href)}}),!1)},getDoNotShowMessages:A},t.exports.__internals={markAsRead:O,getDoNotShowMessages:A,getMessages:N,closeFrame:E,showAllMessages:S,setAllActiveAnnouncements:function(t){r=t}}})),a.register("h6sBR",(function(t,e){t.exports={CXF_DIALOG_OPEN:"cxf.dialog.open",CXF_DIALOG_CLOSE:"cxf.dialog.close"}}));var i,c,u=a("iIrD4"),s=a("892gl").addWindowListeners,l=a("2omaZ").logger,f=(c=a("8T4Pa")).GAME,g=(i={},(0,u.default)(i,f.EMPIRE,a("jvuiF")),(0,u.default)(i,f.BIG_FARM,a("7y43J")),(0,u.default)(i,f.E4K,a("5uSe0")),i),d=(c=a("8T4Pa")).OPEN,h=c.GET,p=a("71rQz").init;!function(t){l.log(" initialized successfully - waiting for player login",t.game),p(t);var e=g[t.game],n=a("heU5C")(t,e);s(t),e.logoutCmd&&t.on(e.logoutCmd,n.onLogout),t.once(3,(function(){})),t.once(24,(function(){})),t.once(e.loginCmd,n.onLogin),t.on(h,n.onGetMessageStatus(h)),t.on(d,n.onOpenAnnouncements)}(window.CXF)}(); | ||
//# sourceMappingURL=announcements.js.map |
{ | ||
"name": "@goodgamestudios/cxf-announcements", | ||
"version": "0.19.9", | ||
"version": "0.19.10-qa.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "serve:locally": "http-server dist --port 4002", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1651958
114
2