From 4b769ddbea38d36d7d0668dbe4d4d84e7ac32b7f Mon Sep 17 00:00:00 2001 From: isstuev Date: Thu, 11 Jul 2024 14:25:41 +0200 Subject: [PATCH] bridge-test --- index.html | 733 +++++++++++++++++++++++++++++++++++++++- instant-games-bridge.js | 2 + 2 files changed, 734 insertions(+), 1 deletion(-) mode change 100644 => 100755 index.html create mode 100644 instant-games-bridge.js diff --git a/index.html b/index.html old mode 100644 new mode 100755 index 5e1c309..06c1848 --- a/index.html +++ b/index.html @@ -1 +1,732 @@ -Hello World \ No newline at end of file + + + + + + + + + + + +
+
+

Instant Games Bridge Sandbox

+

Loading..

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/instant-games-bridge.js b/instant-games-bridge.js new file mode 100644 index 0000000..f713ce8 --- /dev/null +++ b/instant-games-bridge.js @@ -0,0 +1,2 @@ +/*! For license information please see instant-games-bridge.js.LICENSE.txt */ +(()=>{var t={258:t=>{!function(e){t.exports=e;var r="listeners",n={on:function(t,e){return a(this,t).push(e),this},once:function(t,e){var r=this;return n.originalListener=e,a(r,t).push(n),r;function n(){i.call(r,t,n),e.apply(this,arguments)}},off:i,emit:function(t,e){var r=this,n=a(r,t,!0);if(!n)return!1;var o=arguments.length;if(1===o)n.forEach((function(t){t.call(r)}));else if(2===o)n.forEach((function(t){t.call(r,e)}));else{var i=Array.prototype.slice.call(arguments,1);n.forEach((function(t){t.apply(r,i)}))}return!!n.length}};function o(t){for(var e in n)t[e]=n[e];return t}function i(t,e){var n,o=this;if(arguments.length){if(e){if(n=a(o,t,!0)){if(!(n=n.filter((function(t){return t!==e&&t.originalListener!==e}))).length)return i.call(o,t);o[r][t]=n}}else if((n=o[r])&&(delete n[t],!Object.keys(n).length))return i.call(o)}else delete o[r];return o}function a(t,e,n){if(!n||t[r]){var o=t[r]||(t[r]={});return o[e]||(o[e]=[])}}o(e.prototype),e.mixin=o}((function t(){if(!(this instanceof t))return new t}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t={VK:"vk",VK_PLAY:"vk_play",OK:"ok",YANDEX:"yandex",CRAZY_GAMES:"crazy_games",ABSOLUTE_GAMES:"absolute_games",GAME_DISTRIBUTION:"game_distribution",PLAYGAMA:"playgama",WORTAL:"wortal",MOCK:"mock"},e={PLATFORM:"platform",PLAYER:"player",GAME:"game",STORAGE:"storage",ADVERTISEMENT:"advertisement",SOCIAL:"social",DEVICE:"device",LEADERBOARD:"leaderboard",PAYMENTS:"payments",REMOTE_CONFIG:"remote_config",CLIPBOARD:"clipboard"},n={INTERSTITIAL_STATE_CHANGED:"interstitial_state_changed",REWARDED_STATE_CHANGED:"rewarded_state_changed",BANNER_STATE_CHANGED:"banner_state_changed",VISIBILITY_STATE_CHANGED:"visibility_state_changed"},o={VISIBLE:"visible",HIDDEN:"hidden"},i={LOADING:"loading",OPENED:"opened",CLOSED:"closed",FAILED:"failed"},a={LOADING:"loading",OPENED:"opened",CLOSED:"closed",FAILED:"failed",REWARDED:"rewarded"},u={LOADING:"loading",SHOWN:"shown",HIDDEN:"hidden",FAILED:"failed"},s={LOCAL_STORAGE:"local_storage",PLATFORM_INTERNAL:"platform_internal"},c={DESKTOP:"desktop",MOBILE:"mobile",TABLET:"tablet",TV:"tv"},l={GAME_READY:"game_ready",IN_GAME_LOADING_STARTED:"in_game_loading_started",IN_GAME_LOADING_STOPPED:"in_game_loading_stopped",GAMEPLAY_STARTED:"gameplay_started",GAMEPLAY_STOPPED:"gameplay_stopped",PLAYER_GOT_ACHIEVEMENT:"player_got_achievement"},f={INITIALIZE:"initialize",AUTHORIZE_PLAYER:"authorize_player",SHARE:"share",INVITE_FRIENDS:"invite_friends",JOIN_COMMUNITY:"join_community",CREATE_POST:"create_post",ADD_TO_HOME_SCREEN:"add_to_home_screen",ADD_TO_FAVORITES:"add_to_favorites",RATE:"rate",SET_LEADERBOARD_SCORE:"set_leaderboard_score",GET_LEADERBOARD_SCORE:"get_leaderboard_score",GET_LEADERBOARD_ENTRIES:"get_leaderboard_entries",GET_PURCHASES:"get_purchases",GET_CATALOG:"get_catalog",PURCHASE:"purchase",CONSUME_PURCHASE:"consume_purchase",GET_REMOTE_CONFIG:"get_remote_config",GET_STORAGE_DATA:"get_storage_data",SHOW_LEADERBOARD_NATIVE_POPUP:"show_leaderboard_native_popup",CLIPBOARD_WRITE:"clipboard_write",ADBLOCK_DETECT:"adblock_detect"},p={message:"Before using the SDK you must initialize it"},y={message:"Storage not supported"},h={message:"Storage not available"},d={message:"GameDistribution Game ID is undefined"},m={message:"VK Play Game ID is undefined"},v={message:"OK Game params are not found"},_={message:"Message is too long"};function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function g(t,e){for(var r=0;r0&&Gt(Lt(e),xt,Zt).call(Lt(e)),e.emit(n.INTERSTITIAL_STATE_CHANGED,t)})),e._platformBridge.on(n.REWARDED_STATE_CHANGED,(function(t){return e.emit(n.REWARDED_STATE_CHANGED,t)})),e._platformBridge.on(n.BANNER_STATE_CHANGED,(function(t){return e.emit(n.BANNER_STATE_CHANGED,t)})),e}return e=l,(r=[{key:"isBannerSupported",get:function(){return this._platformBridge.isBannerSupported}},{key:"bannerState",get:function(){return this._platformBridge.bannerState}},{key:"interstitialState",get:function(){return this._platformBridge.interstitialState}},{key:"rewardedState",get:function(){return this._platformBridge.rewardedState}},{key:"minimumDelayBetweenInterstitial",get:function(){return Wt(this,Ut)}},{key:"setMinimumDelayBetweenInterstitial",value:function(t){if(t){var e=t[this._platformBridge.platformId];if(void 0!==e)return void this.setMinimumDelayBetweenInterstitial(e)}var r=Dt(t),n=Wt(this,Ut);switch(r){case"number":n=t;break;case"string":if(n=parseInt(t,10),Number.isNaN(n))return;break;default:return}Ft(this,Ut,n),Wt(this,zt)&&(Wt(this,zt).stop(),Gt(this,xt,Zt).call(this))}},{key:"showBanner",value:function(t){if(t){var e=t[this._platformBridge.platformId];if(e)return void this.showBanner(e)}this.bannerState!==u.LOADING&&this.bannerState!==u.SHOWN&&(this._platformBridge._setBannerState(u.LOADING),this.isBannerSupported?this._platformBridge.showBanner(t):this._platformBridge._setBannerState(u.FAILED))}},{key:"hideBanner",value:function(){this.bannerState!==u.LOADING&&this.bannerState!==u.HIDDEN&&this.isBannerSupported&&this._platformBridge.hideBanner()}},{key:"showInterstitial",value:function(t){if(!Gt(this,Vt,Kt).call(this)){if(t){var e=t[this._platformBridge.platformId];if(e)return void this.showInterstitial(e)}var r=!1;t&&"boolean"==typeof t.ignoreDelay&&(r=t.ignoreDelay),this._platformBridge._setInterstitialState(i.LOADING),!Wt(this,zt)||Wt(this,zt).state===_t||r?this._platformBridge.showInterstitial(t):this._platformBridge._setInterstitialState(i.FAILED)}}},{key:"showRewarded",value:function(t){if(!Gt(this,Vt,Kt).call(this)){if(t){var e=t[this._platformBridge.platformId];if(e)return void this.showRewarded(e)}this._platformBridge._setRewardedState(a.LOADING),this._platformBridge.showRewarded(t)}}},{key:"isAdBlockDetected",value:function(){return this._platformBridge.isAdBlockDetected()}}])&&It(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),l}(L);function Zt(){Ft(this,zt,new Tt(Wt(this,Ut))),Wt(this,zt).start()}function Kt(){return this.interstitialState===i.LOADING||this.interstitialState===i.OPENED||!![a.LOADING,a.OPENED,a.REWARDED].includes(this.rewardedState)}Z().mixin(Yt.prototype);const Jt=Yt;function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function Xt(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"result",i=this._getPromiseDecorator(t);return i||(i=this._createPromiseDecorator(t),this._platformSdk.send(e,n).then((function(e){e[o]?r._resolvePromiseDecorator(t):r._rejectPromiseDecorator(t)})).catch((function(e){r._rejectPromiseDecorator(t,e)}))),i.promise}const nr=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ze(t,e)}(y,e);var r,n,o,l,p=(o=y,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Je(o);if(l){var r=Je(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ue(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ke(t)}(this,t)});function y(){var t,e,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,y);for(var n=arguments.length,o=new Array(n),i=0;i0&&(r=t.entries.map((function(t){var e=[],r=t.player.getAvatarSrc("small"),n=t.player.getAvatarSrc("medium"),o=t.player.getAvatarSrc("large");return r&&e.push(r),n&&e.push(n),o&&e.push(o),{id:t.player.uniqueID,score:t.score,rank:t.rank,name:t.player.publicName,photos:e}}))),e._resolvePromiseDecorator(f.GET_LEADERBOARD_ENTRIES,r)})).catch((function(t){e._rejectPromiseDecorator(f.GET_LEADERBOARD_ENTRIES,t)}))}return r.promise}},{key:"purchase",value:function(t){var e=this;if(!vr(this,wr)||!t.id)return Promise.reject();var r=this._getPromiseDecorator(f.PURCHASE);return r||(r=this._createPromiseDecorator(f.PURCHASE),vr(this,wr).purchase(t).then((function(t){e._resolvePromiseDecorator(f.PURCHASE,t)})).catch((function(t){e._rejectPromiseDecorator(f.PURCHASE,t)}))),r.promise}},{key:"getPaymentsPurchases",value:function(){var t=this;if(!vr(this,wr))return Promise.reject();var e=this._getPromiseDecorator(f.GET_PURCHASES);return e||(e=this._createPromiseDecorator(f.GET_PURCHASES),vr(this,wr).getPurchases().then((function(e){t._resolvePromiseDecorator(f.GET_PURCHASES,e)})).catch((function(e){t._rejectPromiseDecorator(f.GET_PURCHASES,e)}))),e.promise}},{key:"getPaymentsCatalog",value:function(){var t=this;if(!vr(this,wr))return Promise.reject();var e=this._getPromiseDecorator(f.GET_CATALOG);return e||(e=this._createPromiseDecorator(f.GET_CATALOG),vr(this,wr).getCatalog().then((function(e){t._resolvePromiseDecorator(f.GET_CATALOG,e)})).catch((function(e){t._rejectPromiseDecorator(f.GET_CATALOG,e)}))),e.promise}},{key:"consumePurchase",value:function(t){var e=this;if(!vr(this,wr)||!t.purchaseToken)return Promise.reject();var r=this._getPromiseDecorator(f.CONSUME_PURCHASE);return r||(r=this._createPromiseDecorator(f.CONSUME_PURCHASE),vr(this,wr).consumePurchase(t.purchaseToken).then((function(t){e._resolvePromiseDecorator(f.CONSUME_PURCHASE,t)})).catch((function(t){e._rejectPromiseDecorator(f.CONSUME_PURCHASE,t)}))),r.promise}},{key:"getRemoteConfig",value:function(t){var e=this;if(!this._platformSdk)return Promise.reject();if(t&&(null==t||!t.defaultFlags)&&(null==t||!t.clientFeatures))return Promise.reject();var r=this._getPromiseDecorator(f.GET_REMOTE_CONFIG);return r||(r=this._createPromiseDecorator(f.GET_REMOTE_CONFIG),(t?this._platformSdk.getFlags(t):this._platformSdk.getFlags()).then((function(t){e._resolvePromiseDecorator(f.GET_REMOTE_CONFIG,t)})).catch((function(t){e._rejectPromiseDecorator(f.GET_REMOTE_CONFIG,t)}))),r.promise}},{key:"clipboardWrite",value:function(t){var e=this,r=this._getPromiseDecorator(f.CLIPBOARD_WRITE);return r||(r=this._createPromiseDecorator(f.CLIPBOARD_WRITE),this._platformSdk.clipboard.writeText(t).then((function(){e._resolvePromiseDecorator(f.CLIPBOARD_WRITE,!0)})).catch((function(t){e._rejectPromiseDecorator(f.CLIPBOARD_WRITE,t)}))),r.promise}}])&&ur(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),h}(We);class Or extends Error{}function kr(t){return kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(t)}function Tr(t,e){for(var r=0;r{let r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return atob(e)}}(n)}catch(t){throw new Or(`Invalid token specified: invalid base64 for part #${r+1} (${t.message})`)}try{return JSON.parse(o)}catch(t){throw new Or(`Invalid token specified: invalid json for part #${r+1} (${t.message})`)}}(r);t._isPlayerAuthorized=!0,t._defaultStorageType=s.PLATFORM_INTERNAL,n.userId&&(t._playerId=n.userId),n.username&&(t._playerName=n.username),n.profilePictureUrl&&(t._playerPhotos=[n.profilePictureUrl]),e()})).catch((function(t){r(t)}))})):Promise.reject()}const Vr=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rr(t,e)}(h,e);var r,n,o,p,y=(o=h,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Lr(o);if(p){var r=Lr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jr(t)}(this,t)});function h(){var t,e,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h);for(var n=arguments.length,o=new Array(n),u=0;u120?this._rejectPromiseDecorator(f.INVITE_FRIENDS,_):this._platformSdk.UI.showInvite(e)),r.promise}},{key:"rate",value:function(){var t=this._getPromiseDecorator(f.RATE);return t||(t=this._createPromiseDecorator(f.RATE),this._platformSdk.UI.showRatingDialog()),t.promise}},{key:"createPost",value:function(t){if(!t||null==t||!t.media)return Promise.reject();var e,r=this._getPromiseDecorator(f.CREATE_POST);return r||(r=this._createPromiseDecorator(f.CREATE_POST),this._platformSdk.UI.postMediatopic(t,null!==(e=t.status)&&void 0!==e&&e)),r.promise}},{key:"joinCommunity",value:function(t){if(!t||null==t||!t.groupId)return Promise.reject();var e,r=this._getPromiseDecorator(f.JOIN_COMMUNITY);return r||(r=this._createPromiseDecorator(f.JOIN_COMMUNITY),this._platformSdk.UI.joinGroup(t.groupId,null!==(e=t.enableMessages)&&void 0!==e&&e)),r.promise}}])&&Vn(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),l}(We);function Vo(t){return Vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vo(t)}function Yo(t,e){for(var r=0;r