@goodgamestudios/cxf-announcements
Advanced tools
Comparing version 0.19.3-qa.11 to 0.19.3-qa.12
@@ -1,2 +0,2 @@ | ||
!function(){function t(t){return t&&t.__esModule?t.default:t}var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n={},r={},o=e.parcelRequire3fb7;function a(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 i(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function c(t){a(i,r,o,c,u,"next",t)}function u(t){a(i,r,o,c,u,"throw",t)}c(void 0)}))}}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){c(t,e,n[e])}))}return t}function s(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}null==o&&((o=function(t){if(t in n)return n[t].exports;if(t in r){var e=r[t];delete r[t];var o={id:t,exports:{}};return n[t]=o,e.call(o.exports,o,o.exports),o.exports}var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(t,e){r[t]=e},e.parcelRequire3fb7=o),o.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"}})),o.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"}})),o.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"}})),o.register("4y3pw",(function(e,n){var r=o("5mFHf");o("6RIYV");var a=o("2lV2D").acronym,c=f.appendLoginParams,l=f.ANNOUNCEMENTS_LOCALSTORAGE_KEY,h=f.hashCode,g=f.getHashKey,d=f.logger,p=m.getDoNotShowMessages,y=E.CXF_DIALOG_OPEN,v=N.GAME_CALLBACK,w=L.tracking,_=L.OPEN_ANNOUNCEMENTS,O=L.ANNOUNCEMENT_READY,A=function(t){var e=t.game,n=t.playername,r=t.network,o=t.instance,a=g(e,n,r,o);return p(a)},S=function(t){return function(e){return e.filter((function(e){return!t.includes(h(e.title+e.message))}))}},b=function(t){return t&&t.Count>0||!1},C=function(t,e){return function(n,r){var o=r.network,a=r.instance,i=r.lang,c=r.playername,s=e.game;if(b(n)){var f=A({game:s,playername:c,network:o,instance:a}),h=S(f)(n.Items);d.info("Received ".concat(h.length>0?h.length:0," valid announcements"));var p=h.map((function(t){return u({},t,{body:t.message})}));localStorage.setItem(l,JSON.stringify(p));var m=g(s,c,o,a),v=new URLSearchParams({game:s,lang:i,network:o,instance:a,hash:m}),w="".concat(t,"/").concat(s,"_announcement.html?").concat(v.toString());e.emit(y,w)}}};function x(t,e,n){return T.apply(this,arguments)}function T(){return(T=i(t(r).mark((function e(n,o,a){return t(r).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c(n,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 o(t,a);d.info("".concat(n," shows empty response"))})).catch((function(t){return d.log("failed loading ".concat(n,": ").concat(t))})));case 2:case"end":return t.stop()}}),e)})))).apply(this,arguments)}var I=function(t,e){(!t||!Array.isArray(t)||t.length<4)&&d.error("Received invalid payload from game - ".concat(t," \n the valid payload is [userdata, lang, network, instance]"));var n,r=function(t){if(Array.isArray(t))return t}(n=t)||s(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),o=r[0],a=r[1],i=r[2],c=r[3];return{userdata:e.getPlayerInfo(o),lang:a,network:i,instance:c}};e.exports=function(e,n){var o,c=C("https://community-announcement-template-staging.ggs-stp.com",e),u=a(e.game)||"",s=function(t){!function(t){x("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+u,c,t)}(t)},l={},f=function(t){if(t||0!==Object.keys(l).length){if(t){var r=I(t,n);Object.assign(l,{lang:r.lang,network:r.network,instance:r.instance,game:e.game,playername:r.userdata.playername})}}else d.warn(" saveLoginData - the user data has not been set/initialized ".concat(l))},h=function(t){f(t),d.log("[getNewAnnouncements] - ".concat(JSON.stringify(l,null,4)));return x("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+u,(function(t){var e=0;return b(t)&&(e=function(t,e){return S(A(t))(e).length}(l,t.Items),o=t),d.log(" Has announcements: ",e>0),e}),l)},g=function(a){return i(t(r).mark((function i(c){var u;return t(r).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.log(" onGetMessageStatus - ".concat(a),c),t.next=3,h(c);case 3:u=t.sent,e.gameApi.invokeFn(v.UNREAD_ANNOUNCEMENTS,u),a===n.loginCmd&&u&&w(O,o),d.log(" call ".concat(v.UNREAD_ANNOUNCEMENTS," - ").concat(u));case 7:case"end":return t.stop()}}),i)})))};return{onLogin:function(t){return d.info(" onLogin",t),f(t),s(l)},onLogout:function(){e.once(n.loginCmd,g(n.loginCmd))},placeholder:function(){},onGetMessageStatus:g,onOpenAnnouncements:function(){0!==Object.keys(l).length?(s(l),d.info("onOpenAnnouncement handler for user ".concat(l)),w(_,o)):d.info(" onOpenAnnouncement handler - the user data has not been set/initialized ".concat(l))}}},e.exports.__internals={loadCurrentMessages:x,handleAnnouncementMessage:C,getHashKey:g,hashCode:h,getRootGamePayload:I,hasAnnouncements:b}})),o.register("5mFHf",(function(t,e){var n=function(t){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 g(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=N;return function(a,i){if(r===A)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===N)throw r=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=A;var s=o(t,e,n);if("normal"===s.type){if(r=n.done?S:O,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)},h=function(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e},g=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",E=v.asyncIterator||"@@asyncIterator",_=v.toStringTag||"@@toStringTag";try{n({},"")}catch(t){n=function(t,e,n){return t[e]=n}}t.wrap=r;var N="suspendedStart",O="suspendedYield",A="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 T=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=T.constructor=c,c.constructor=i,i.displayName=n(c,_,"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,_,"GeneratorFunction")),t.prototype=Object.create(T),t},t.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[E]=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(T),n(T,_,"Generator"),T[w]=function(){return this},T.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,g.prototype={constructor:g,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(h),!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),h(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;h(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)}})),o.register("6RIYV",(function(t,n){ | ||
!function(){function t(t){return t&&t.__esModule?t.default:t}var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n={},r={},o=e.parcelRequire3fb7;function a(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 i(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function c(t){a(i,r,o,c,u,"next",t)}function u(t){a(i,r,o,c,u,"throw",t)}c(void 0)}))}}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){c(t,e,n[e])}))}return t}function s(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}null==o&&((o=function(t){if(t in n)return n[t].exports;if(t in r){var e=r[t];delete r[t];var o={id:t,exports:{}};return n[t]=o,e.call(o.exports,o,o.exports),o.exports}var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(t,e){r[t]=e},e.parcelRequire3fb7=o),o.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"}})),o.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"}})),o.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"}})),o.register("4y3pw",(function(e,n){var r=o("5mFHf");o("6RIYV");var a=o("2lV2D").acronym,c=f.appendLoginParams,l=f.ANNOUNCEMENTS_LOCALSTORAGE_KEY,h=f.hashCode,g=f.getHashKey,d=f.logger,p=m.getDoNotShowMessages,y=E.CXF_DIALOG_OPEN,v=A.GAME_CALLBACK,w=b.tracking,_=b.OPEN_ANNOUNCEMENTS,N=b.ANNOUNCEMENT_READY,O=function(t){var e=t.game,n=t.playername,r=t.network,o=t.instance,a=g(e,n,r,o);return p(a)},S=function(t){return function(e){return e.filter((function(e){return!t.includes(h(e.title+e.message))}))}},L=function(t){return t&&t.Count>0||!1},C=function(t,e){return function(n,r){var o=r.network,a=r.instance,i=r.lang,c=r.playername,s=e.game;if(L(n)){var f=O({game:s,playername:c,network:o,instance:a}),h=S(f)(n.Items);d.info("Received ".concat(h.length>0?h.length:0," valid announcements"));var p=h.map((function(t){return u({},t,{body:t.message})}));localStorage.setItem(l,JSON.stringify(p));var m=g(s,c,o,a),v=new URLSearchParams({game:s,lang:i,network:o,instance:a,hash:m}),w="".concat(t,"/").concat(s,"_announcement.html?").concat(v.toString());e.emit(y,w)}}};function T(t,e,n){return I.apply(this,arguments)}function I(){return(I=i(t(r).mark((function e(n,o,a){return t(r).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=c(n,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 o(t,a);d.info("".concat(n," shows empty response"))})).catch((function(t){return d.log("failed loading ".concat(n,": ").concat(t))})));case 2:case"end":return t.stop()}}),e)})))).apply(this,arguments)}var x=function(t,e){(!t||!Array.isArray(t)||t.length<4)&&d.error("Received invalid payload from game - ".concat(t," \n the valid payload is [userdata, lang, network, instance]"));var n,r=function(t){if(Array.isArray(t))return t}(n=t)||s(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),o=r[0],a=r[1],i=r[2],c=r[3];return{userdata:e.getPlayerInfo(o),lang:a,network:i,instance:c}};e.exports=function(e,n){var o,c=C("https://community-announcement-template-staging.ggs-stp.com",e),u=a(e.game)||"",s=function(t){!function(t){T("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+u,c,t)}(t)},l={},f=function(t){if(t||0!==Object.keys(l).length){if(t){var r=x(t,n);Object.assign(l,{lang:r.lang,network:r.network,instance:r.instance,game:e.game,playername:r.userdata.playername})}}else d.warn(" saveLoginData - the user data has not been set/initialized ".concat(l))},h=function(t){f(t),d.log("[getNewAnnouncements] - ".concat(JSON.stringify(l,null,4)));return T("https://bcybh10xrg.execute-api.eu-west-1.amazonaws.com/staging/messages/"+u,(function(t){var e=0;return L(t)&&(e=function(t,e){return S(O(t))(e).length}(l,t.Items),o=t),d.log(" Has announcements: ",e>0),e}),l)},g=function(a){return i(t(r).mark((function i(c){var u;return t(r).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.log(" onGetMessageStatus - ".concat(a),c),t.next=3,h(c);case 3:u=t.sent,e.gameApi.invokeFn(v.UNREAD_ANNOUNCEMENTS,u),a===n.loginCmd&&u&&w(N,o),d.log(" call ".concat(v.UNREAD_ANNOUNCEMENTS," - ").concat(u));case 7:case"end":return t.stop()}}),i)})))};return{onLogin:function(t){return d.info(" onLogin",t),f(t),s(l)},onLogout:function(){e.once(n.loginCmd,g(n.loginCmd))},placeholder:function(){},onGetMessageStatus:g,onOpenAnnouncements:function(){0!==Object.keys(l).length?(s(l),d.info("onOpenAnnouncement handler for user ".concat(l)),w(_,o)):d.info(" onOpenAnnouncement handler - the user data has not been set/initialized ".concat(l))}}},e.exports.__internals={loadCurrentMessages:T,handleAnnouncementMessage:C,getHashKey:g,hashCode:h,getRootGamePayload:x,hasAnnouncements:L}})),o.register("5mFHf",(function(t,e){var n=function(t){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 g(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===O)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=x(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=O;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)},h=function(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e},g=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",E=v.asyncIterator||"@@asyncIterator",_=v.toStringTag||"@@toStringTag";try{n({},"")}catch(t){n=function(t,e,n){return t[e]=n}}t.wrap=r;var A="suspendedStart",N="suspendedYield",O="executing",S="completed",L={},b={};b[w]=function(){return this};var C=Object.getPrototypeOf,T=C&&C(C(d([])));T&&T!==m&&y.call(T,w)&&(b=T);var I=c.prototype=a.prototype=Object.create(b);function x(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,x(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,_,"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,_,"GeneratorFunction")),t.prototype=Object.create(I),t},t.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[E]=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,_,"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=d,g.prototype={constructor:g,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(h),!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),h(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;h(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)}})),o.register("6RIYV",(function(t,n){ | ||
/** | ||
@@ -9,3 +9,3 @@ * | ||
*/ | ||
!function(t){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"),h=!s||((e=new s).append("s"," &"),"s=+%26"===e.toString()),g=y.prototype,d=!(!t.Symbol||!t.Symbol.iterator);if(!(s&&l&&f&&h)){var p;g.append=function(t,e){i(this.__URLSearchParams__,t,e)},g.delete=function(t){delete this.__URLSearchParams__[t]},g.get=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t][0]:null},g.getAll=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t].slice(0):[]},g.has=function(t){return u(this.__URLSearchParams__,t)},g.set=function(t,e){this.__URLSearchParams__[t]=[""+e]},g.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!==e?e:"undefined"!=typeof window?window:t.exports)})),o.register("2lV2D",(function(t,e){var n,r,o,a,i,c,u,s,l,f,h;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}),{}),l=(s=function(t,e){return(e=u[e])&&c[e][t]}).bind(null,0),f=s.bind(null,1),h=s.bind(null,2),n={id:function(t){t=t.toString().toLowerCase();var e=u[t];return e&&0|e},name:l,codename:f,acronym:h},"object"==typeof t.exports?t.exports=n:"function"==typeof define&&define.amd&&define((function(){return n}))}));var f={};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 h,g,d="CXF-ANNOUNCEMENT",p={info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).info.apply(r,["%c ".concat(d," ->"),"background: green; color: yellow"].concat(l(e)))},log:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).info.apply(r,["%c ".concat(d," ->"),"background: green; color: yellow"].concat(l(e)))},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).warn.apply(r,["%c ".concat(d," ->"),"background: orange; color: yellow"].concat(l(e)))},error:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).error.apply(r,["%c ".concat(d," ->"),"background: red; color: yellow"].concat(l(e)))}},m={},y=(f={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"},appendLoginParams:function(t,e){return t+"/"+e.network+"/"+e.instance+"/"+e.lang},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:p,subtractArray:function(t,e){return t.filter((function(t){return!e.includes(t)}))}}).subtractArray,v=f.sharedCommands,w=f.ANNOUNCEMENTS_LOCALSTORAGE_KEY,E={},_=(E={CXF_DIALOG_OPEN:"cxf.dialog.open",CXF_DIALOG_CLOSE:"cxf.dialog.close"}).CXF_DIALOG_CLOSE,N={},O="game.button.clicked.",A={GET_ANNOUNCEMENTS:"".concat(O,"getAnnouncements"),OPEN_ANNOUNCEMENTS:"".concat(O,"openAnnouncements")},S=(N={GAME_CALLBACK:{UNREAD_ANNOUNCEMENTS:"setCapToolNotifications"},GAME:{BIG_FARM:"bigfarm",EMPIRE:"empire",E4K:"empirefourkingdoms"},GAME_BUTTON_CLICKED_PREFIX:O,GAME_ANNOUNCEMENTS_EVENT:A,OPEN:A.OPEN_ANNOUNCEMENTS,GET:A.GET_ANNOUNCEMENTS}).GET,L={},b=f.logger,C="cxf.tracking.message",x=(L={init:function(t){b.log("tracking has been initialized",t),h=t},tracking:function(t,e,n){var r=function(t){var e;return t&&(e=Array.isArray(t.Items)?t.Items[0]:t),e}(e),o={eventId:1236,gameId:Number.parseInt(h.gameId,10),networkId:Number.parseInt(h.networkId,10),instanceId:h.instanceId,playerId:h.playerId,language:h.countryCode,date:(new Date).toUTCString(),zoneId:h.zoneId,actionType:t},a=r.id,i=r.start_date,c=r.end_date,s=r.title;(o=u({},o,n)).id=a,o.scheduleStart=new Date(i).toUTCString(),o.scheduleEnd=new Date(c).toUTCString(),o.name=s,b.log(C,JSON.stringify(o,null,4)),h.emit(C,o)},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"}).tracking,T=L.CLOSE_CROSS,I=L.CLOSE_REGULAR,P=L.DONT_SHOW_AGAIN_ACTIVATE,R=L.DONT_SHOW_AGAIN_DEACTIVATE,k=L.SCROLL,U=L.LOADED;function M(t){var e=t.hash,n=t.wasRead,r=j(e.key),o=n?P:R,a=!0,i=!1,c=void 0;try{for(var u,s=g[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var l=u.value;x(o,l)}}catch(t){i=!0,c=t}finally{try{a||null==s.return||s.return()}finally{if(i)throw c}}var f=n?r.concat(e.hashList):y(r,e.hashList);0===f.length?localStorage.removeItem(e.key):localStorage.setItem(e.key,JSON.stringify(f))}function G(t){localStorage.removeItem(w),g=void 0,t.emit(_)}function j(t){var e=localStorage.getItem(t)||"[]";return JSON.parse(e)}function D(){var t=localStorage.getItem(w)||"[]";return JSON.parse(t)}var F=function(t,e){return e.start_date-t.start_date};function K(t){var e=t.frameId,n=D().sort(F);if(n&&n.length>0){var r=document.getElementById(e).contentWindow;g=n;var o=Date.now();r.postMessage({messages:n,triggeredTimestamp:o},"*"),localStorage.setItem(w,JSON.stringify([]))}}var J=new Map([["okBtn",I],["crossBtn",T],["scrolled",k],["loaded",U]]);(m={addWindowListeners:function(t){window.addEventListener("message",(function(e){if(e.data&&e.data.name)switch(e.data.name){case v.MARK_AS_READ:M(e.data),t.emit(S);break;case v.CLOSE_POPUP:G(t);break;case v.SHOW_ANNOUNCEMENTS:K(e.data);break;case v.TRACKING:var n=!0,r=!1,o=void 0;try{for(var a,i=g[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value;if("scrolled"===e.data.action)e.data.params.scrolledAnnouncements.includes(c.id)&&x(J.get(e.data.action),c,e.data.params);else x(J.get(e.data.action),c,e.data.params)}}catch(t){r=!0,o=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}}}),!1)},getDoNotShowMessages:j}).__internals={markAsRead:M,getDoNotShowMessages:j,getMessages:D,closeFrame:G,showAllMessages:K,setAllActiveAnnouncements:function(t){g=t}};var V,H=m.addWindowListeners,B=f.logger,z=N.GAME,W=(c(V={},z.EMPIRE,o("jvuiF")),c(V,z.BIG_FARM,o("7y43J")),c(V,z.E4K,o("5uSe0")),V),Y=N.OPEN,X=N.GET,q=L.init;!function(t){B.log(" initialized successfully - waiting for player login",t.game),q(t);var e=W[t.game],n=o("4y3pw")(t,e);H(t),e.logoutCmd&&t.on(e.logoutCmd,n.onLogout),t.once(3,n.placeholder),t.once(24,n.placeholder),t.on(X,n.onGetMessageStatus(X)),t.once(e.loginCmd,n.onGetMessageStatus(e.loginCmd)),t.on(Y,n.onOpenAnnouncements)}(window.CXF)}(); | ||
!function(t){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"),h=!s||((e=new s).append("s"," &"),"s=+%26"===e.toString()),g=y.prototype,d=!(!t.Symbol||!t.Symbol.iterator);if(!(s&&l&&f&&h)){var p;g.append=function(t,e){i(this.__URLSearchParams__,t,e)},g.delete=function(t){delete this.__URLSearchParams__[t]},g.get=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t][0]:null},g.getAll=function(t){var e=this.__URLSearchParams__;return this.has(t)?e[t].slice(0):[]},g.has=function(t){return u(this.__URLSearchParams__,t)},g.set=function(t,e){this.__URLSearchParams__[t]=[""+e]},g.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!==e?e:"undefined"!=typeof window?window:t.exports)})),o.register("2lV2D",(function(t,e){var n,r,o,a,i,c,u,s,l,f,h;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}),{}),l=(s=function(t,e){return(e=u[e])&&c[e][t]}).bind(null,0),f=s.bind(null,1),h=s.bind(null,2),n={id:function(t){t=t.toString().toLowerCase();var e=u[t];return e&&0|e},name:l,codename:f,acronym:h},"object"==typeof t.exports?t.exports=n:"function"==typeof define&&define.amd&&define((function(){return n}))}));var f={};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 h,g,d="CXF-ANNOUNCEMENT",p={info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).info.apply(r,["%c ".concat(d," ->"),"background: green; color: yellow"].concat(l(e)))},log:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).info.apply(r,["%c ".concat(d," ->"),"background: green; color: yellow"].concat(l(e)))},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).warn.apply(r,["%c ".concat(d," ->"),"background: orange; color: yellow"].concat(l(e)))},error:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r;(r=console).error.apply(r,["%c ".concat(d," ->"),"background: red; color: yellow"].concat(l(e)))}},m={},y=(f={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"},appendLoginParams:function(t,e){return t+"/"+e.network+"/"+e.instance+"/"+e.lang},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:p,subtractArray:function(t,e){return t.filter((function(t){return!e.includes(t)}))}}).subtractArray,v=f.sharedCommands,w=f.ANNOUNCEMENTS_LOCALSTORAGE_KEY,E={},_=(E={CXF_DIALOG_OPEN:"cxf.dialog.open",CXF_DIALOG_CLOSE:"cxf.dialog.close"}).CXF_DIALOG_CLOSE,A={},N="game.button.clicked.",O={GET_ANNOUNCEMENTS:"".concat(N,"getAnnouncements"),OPEN_ANNOUNCEMENTS:"".concat(N,"openAnnouncements")},S=(A={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:O,OPEN:O.OPEN_ANNOUNCEMENTS,GET:O.GET_ANNOUNCEMENTS}).GET,L=A.GAME_CALLBACK,b={},C=f.logger,T="cxf.tracking.message",I=(b={init:function(t){C.log("tracking has been initialized",t),h=t},tracking:function(t,e,n){var r=function(t){var e;return t&&(e=Array.isArray(t.Items)?t.Items[0]:t),e}(e),o={eventId:1236,gameId:Number.parseInt(h.gameId,10),networkId:Number.parseInt(h.networkId,10),instanceId:h.instanceId,playerId:h.playerId,language:h.countryCode,date:(new Date).toUTCString(),zoneId:h.zoneId,actionType:t},a=r.id,i=r.start_date,c=r.end_date,s=r.title;(o=u({},o,n)).id=a,o.scheduleStart=new Date(i).toUTCString(),o.scheduleEnd=new Date(c).toUTCString(),o.name=s,C.log(T,JSON.stringify(o,null,4)),h.emit(T,o)},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"}).tracking,x=b.CLOSE_CROSS,P=b.CLOSE_REGULAR,k=b.DONT_SHOW_AGAIN_ACTIVATE,R=b.DONT_SHOW_AGAIN_DEACTIVATE,U=b.SCROLL,G=b.LOADED;function M(t){var e=t.hash,n=t.wasRead,r=j(e.key),o=n?k:R,a=!0,i=!1,c=void 0;try{for(var u,s=g[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var l=u.value;I(o,l)}}catch(t){i=!0,c=t}finally{try{a||null==s.return||s.return()}finally{if(i)throw c}}var f=n?r.concat(e.hashList):y(r,e.hashList);0===f.length?localStorage.removeItem(e.key):localStorage.setItem(e.key,JSON.stringify(f))}function D(t){localStorage.removeItem(w),g=void 0,t.emit(_)}function j(t){var e=localStorage.getItem(t)||"[]";return JSON.parse(e)}function F(){var t=localStorage.getItem(w)||"[]";return JSON.parse(t)}var K=function(t,e){return e.start_date-t.start_date};function J(t){var e=t.frameId,n=F().sort(K);if(n&&n.length>0){var r=document.getElementById(e).contentWindow;g=n;var o=Date.now();r.postMessage({messages:n,triggeredTimestamp:o},"*"),localStorage.setItem(w,JSON.stringify([]))}}var V=new Map([["okBtn",P],["crossBtn",x],["scrolled",U],["loaded",G]]);(m={addWindowListeners:function(t){window.addEventListener("message",(function(e){if(e.data&&e.data.name)switch(e.data.name){case v.MARK_AS_READ:M(e.data),t.emit(S);break;case v.CLOSE_POPUP:D(t);break;case v.SHOW_ANNOUNCEMENTS:J(e.data);break;case v.TRACKING:var n=!0,r=!1,o=void 0;try{for(var a,i=g[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value;if("scrolled"===e.data.action)e.data.params.scrolledAnnouncements.includes(c.id)&&I(V.get(e.data.action),c,e.data.params);else I(V.get(e.data.action),c,e.data.params)}}catch(t){r=!0,o=t}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}break;case v.LINK_CLICKED:t.gameApi.invokeFn(L.PAGE_LOAD_STARTING,e.data.href)}}),!1)},getDoNotShowMessages:j}).__internals={markAsRead:M,getDoNotShowMessages:j,getMessages:F,closeFrame:D,showAllMessages:J,setAllActiveAnnouncements:function(t){g=t}};var H,B=m.addWindowListeners,z=f.logger,W=A.GAME,Y=(c(H={},W.EMPIRE,o("jvuiF")),c(H,W.BIG_FARM,o("7y43J")),c(H,W.E4K,o("5uSe0")),H),X=A.OPEN,q=A.GET,Q=b.init;!function(t){z.log(" initialized successfully - waiting for player login",t.game),Q(t);var e=Y[t.game],n=o("4y3pw")(t,e);B(t),e.logoutCmd&&t.on(e.logoutCmd,n.onLogout),t.once(3,n.placeholder),t.once(24,n.placeholder),t.on(q,n.onGetMessageStatus(q)),t.once(e.loginCmd,n.onGetMessageStatus(e.loginCmd)),t.on(X,n.onOpenAnnouncements)}(window.CXF)}(); | ||
//# sourceMappingURL=announcements.js.map |
{ | ||
"name": "@goodgamestudios/cxf-announcements", | ||
"version": "0.19.3-qa.11", | ||
"version": "0.19.3-qa.12", | ||
"scripts": { | ||
"serve:locally": "http-server dist --port 4002", | ||
"serve:local:parcel": "parcel ./src/*.** --port 4002", | ||
"build:dev": "cross-env NODE_ENV=dev npm run build && cross-env NODE_ENV=dev npm run build-popup", | ||
@@ -7,0 +8,0 @@ "build:staging": "cross-env NODE_ENV=staging npm run build && cross-env NODE_ENV=staging npm run build-popup", |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
2438095
56
7113
1
8