Comparing version 1.0.25-1 to 1.0.25-2
@@ -50,3 +50,3 @@ var AgRuSdkMethods = /* @__PURE__ */ ((AgRuSdkMethods2) => { | ||
if (typeof handler === "function") { | ||
handler.apply(null, ...args); | ||
handler.call(null, ...args); | ||
} | ||
@@ -53,0 +53,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
var e=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(e||{}),t=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(t||{});class s{constructor(e={}){if(this.options=e,s._instance)return s._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),s._instance=this,s._instance._emitter=this._createEmitter(),s._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.apply(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(t){return this._sendMessage(e.Authorize,void 0),this._handleEvent(e.Authorize,t)}getSaveData(t){return this._sendMessage(e.GetSaveData,this.options),this._handleEvent(e.GetSaveData,t)}getUsers(t,s){return this._sendMessage(e.GetUsers,t.join(",")),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,s){this._emitter.on(e,s);return Object.values(t).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,s)}once(e,t){return this._emitter.once(e,t)}sayHello(t){return this._sendMessage(e.SayHello,"And here's Johnny"),this._handleEvent(e.SayHello,t)}showCampaign(t="default",s){return this._sendMessage(e.ShowCampaign,{options:this.options,type:t}),this._handleEvent(e.ShowCampaign,s)}showPayment(t,s){return this._sendMessage(e.ShowPayment,t),this._handleEvent(e.ShowPayment,s)}toggleFullscreen(t){return this._sendMessage(e.ToggleFullscreen,null),this._handleEvent(e.ToggleFullscreen,t)}setSaveData(t,s){return this._sendMessage(e.SetSaveData,{data:t,options:this.options}),this._handleEvent(e.SetSaveData,s)}}export{s as AgRuSdk,t as AgRuSdkEvents,e as AgRuSdkMethods}; | ||
var e=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(e||{}),t=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(t||{});class s{constructor(e={}){if(this.options=e,s._instance)return s._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),s._instance=this,s._instance._emitter=this._createEmitter(),s._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.call(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(t){return this._sendMessage(e.Authorize,void 0),this._handleEvent(e.Authorize,t)}getSaveData(t){return this._sendMessage(e.GetSaveData,this.options),this._handleEvent(e.GetSaveData,t)}getUsers(t,s){return this._sendMessage(e.GetUsers,t.join(",")),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,s){this._emitter.on(e,s);return Object.values(t).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,s)}once(e,t){return this._emitter.once(e,t)}sayHello(t){return this._sendMessage(e.SayHello,"And here's Johnny"),this._handleEvent(e.SayHello,t)}showCampaign(t="default",s){return this._sendMessage(e.ShowCampaign,{options:this.options,type:t}),this._handleEvent(e.ShowCampaign,s)}showPayment(t,s){return this._sendMessage(e.ShowPayment,t),this._handleEvent(e.ShowPayment,s)}toggleFullscreen(t){return this._sendMessage(e.ToggleFullscreen,null),this._handleEvent(e.ToggleFullscreen,t)}setSaveData(t,s){return this._sendMessage(e.SetSaveData,{data:t,options:this.options}),this._handleEvent(e.SetSaveData,s)}}export{s as AgRuSdk,t as AgRuSdkEvents,e as AgRuSdkMethods}; |
@@ -54,3 +54,3 @@ 'use strict'; | ||
if (typeof handler === "function") { | ||
handler.apply(null, ...args); | ||
handler.call(null, ...args); | ||
} | ||
@@ -57,0 +57,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(e||{}),t=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(t||{});class s{constructor(e={}){if(this.options=e,s._instance)return s._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),s._instance=this,s._instance._emitter=this._createEmitter(),s._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.apply(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(t){return this._sendMessage(e.Authorize,void 0),this._handleEvent(e.Authorize,t)}getSaveData(t){return this._sendMessage(e.GetSaveData,this.options),this._handleEvent(e.GetSaveData,t)}getUsers(t,s){return this._sendMessage(e.GetUsers,t.join(",")),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,s){this._emitter.on(e,s);return Object.values(t).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,s)}once(e,t){return this._emitter.once(e,t)}sayHello(t){return this._sendMessage(e.SayHello,"And here's Johnny"),this._handleEvent(e.SayHello,t)}showCampaign(t="default",s){return this._sendMessage(e.ShowCampaign,{options:this.options,type:t}),this._handleEvent(e.ShowCampaign,s)}showPayment(t,s){return this._sendMessage(e.ShowPayment,t),this._handleEvent(e.ShowPayment,s)}toggleFullscreen(t){return this._sendMessage(e.ToggleFullscreen,null),this._handleEvent(e.ToggleFullscreen,t)}setSaveData(t,s){return this._sendMessage(e.SetSaveData,{data:t,options:this.options}),this._handleEvent(e.SetSaveData,s)}}exports.AgRuSdk=s,exports.AgRuSdkEvents=t,exports.AgRuSdkMethods=e; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(e||{}),t=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(t||{});class s{constructor(e={}){if(this.options=e,s._instance)return s._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),s._instance=this,s._instance._emitter=this._createEmitter(),s._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.call(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(t){return this._sendMessage(e.Authorize,void 0),this._handleEvent(e.Authorize,t)}getSaveData(t){return this._sendMessage(e.GetSaveData,this.options),this._handleEvent(e.GetSaveData,t)}getUsers(t,s){return this._sendMessage(e.GetUsers,t.join(",")),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,s){this._emitter.on(e,s);return Object.values(t).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,s)}once(e,t){return this._emitter.once(e,t)}sayHello(t){return this._sendMessage(e.SayHello,"And here's Johnny"),this._handleEvent(e.SayHello,t)}showCampaign(t="default",s){return this._sendMessage(e.ShowCampaign,{options:this.options,type:t}),this._handleEvent(e.ShowCampaign,s)}showPayment(t,s){return this._sendMessage(e.ShowPayment,t),this._handleEvent(e.ShowPayment,s)}toggleFullscreen(t){return this._sendMessage(e.ToggleFullscreen,null),this._handleEvent(e.ToggleFullscreen,t)}setSaveData(t,s){return this._sendMessage(e.SetSaveData,{data:t,options:this.options}),this._handleEvent(e.SetSaveData,s)}}exports.AgRuSdk=s,exports.AgRuSdkEvents=t,exports.AgRuSdkMethods=e; |
@@ -56,3 +56,3 @@ (function (global, factory) { | ||
if (typeof handler === "function") { | ||
handler.apply(null, ...args); | ||
handler.call(null, ...args); | ||
} | ||
@@ -59,0 +59,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).agru={})}(this,(function(e){"use strict";var t=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(t||{}),s=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(s||{});class n{constructor(e={}){if(this.options=e,n._instance)return n._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),n._instance=this,n._instance._emitter=this._createEmitter(),n._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.apply(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(e){return this._sendMessage(t.Authorize,void 0),this._handleEvent(t.Authorize,e)}getSaveData(e){return this._sendMessage(t.GetSaveData,this.options),this._handleEvent(t.GetSaveData,e)}getUsers(e,s){return this._sendMessage(t.GetUsers,e.join(",")),this._handleEvent(t.GetUsers,s)}isAppUser(e,s){return this._sendMessage(t.IsAppUser,e),this._handleEvent(t.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,t){this._emitter.on(e,t);return Object.values(s).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,t)}once(e,t){return this._emitter.once(e,t)}sayHello(e){return this._sendMessage(t.SayHello,"And here's Johnny"),this._handleEvent(t.SayHello,e)}showCampaign(e="default",s){return this._sendMessage(t.ShowCampaign,{options:this.options,type:e}),this._handleEvent(t.ShowCampaign,s)}showPayment(e,s){return this._sendMessage(t.ShowPayment,e),this._handleEvent(t.ShowPayment,s)}toggleFullscreen(e){return this._sendMessage(t.ToggleFullscreen,null),this._handleEvent(t.ToggleFullscreen,e)}setSaveData(e,s){return this._sendMessage(t.SetSaveData,{data:e,options:this.options}),this._handleEvent(t.SetSaveData,s)}}e.AgRuSdk=n,e.AgRuSdkEvents=s,e.AgRuSdkMethods=t,Object.defineProperty(e,"__esModule",{value:!0}),window.AgRuSdk=agru.AgRuSdk,window.AgRuSdkMethods=agru.AgRuSdkMethods,window.AgRuSdkEvents=agru.AgRuSdkEvents})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).agru={})}(this,(function(e){"use strict";var t=(e=>(e.Authorize="agru-authorize",e.GetSaveData="agru-getSaveData",e.GetUsers="agru-getUsers",e.IsAppUser="agru-isAppUser",e.SayHello="agru-sayHello",e.ShowCampaign="agru-showCampaign",e.ShowPayment="agru-showPayment",e.SetSaveData="agru-setSaveData",e.ToggleFullscreen="agru-toggleFullscreen",e))(t||{}),s=(e=>(e.OptionsUpdates="agru-optionsUpdates",e))(s||{});class n{constructor(e={}){if(this.options=e,n._instance)return n._instance;for(const[e,t]of new URLSearchParams(location.search).entries())this.options[e]=t;return this.options.auth_key||console.warn('You need to pass the "auth_key" in options, to be able to use the SDK.'),n._instance=this,n._instance._emitter=this._createEmitter(),n._instance.options=e,this._listen(),this}_createEmitter(){const e={all:t=t||new Map,on:function(e,s){var n=t.get(e);n?n.push(s):t.set(e,[s])},off:function(e,s){var n=t.get(e);n&&(s?n.splice(n.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var n=t.get(e);n&&n.slice().map((function(e){e(s)})),(n=t.get("*"))&&n.slice().map((function(t){t(e,s)}))}};var t;const s=e.on;return e.on=(e,t)=>{"function"==typeof t&&s(e,(e=>t.call(null,...e)))},e.once=(t,n)=>{const a=(...s)=>{e.off(t,a),"function"==typeof n&&n.call(null,...s)};s(t,a)},e}_handleEvent(e,t){return t?this._emitter.once(e,t):new Promise((t=>this._emitter.once(e,((...e)=>t(e)))))}_listen(){window.addEventListener("message",(e=>{const{data:t,type:s}=e.data;this._emitter.emit(s,t)}))}_sendMessage(e,t){return null==top?void 0:top.postMessage({data:t,type:e},"*")}authorize(e){return this._sendMessage(t.Authorize,void 0),this._handleEvent(t.Authorize,e)}getSaveData(e){return this._sendMessage(t.GetSaveData,this.options),this._handleEvent(t.GetSaveData,e)}getUsers(e,s){return this._sendMessage(t.GetUsers,e.join(",")),this._handleEvent(t.GetUsers,s)}isAppUser(e,s){return this._sendMessage(t.IsAppUser,e),this._handleEvent(t.IsAppUser,s)}off(e,t){return this._emitter.off(e,t)}on(e,t){this._emitter.on(e,t);return Object.values(s).includes(e)&&this._sendMessage("event",e),()=>this._emitter.off(e,t)}once(e,t){return this._emitter.once(e,t)}sayHello(e){return this._sendMessage(t.SayHello,"And here's Johnny"),this._handleEvent(t.SayHello,e)}showCampaign(e="default",s){return this._sendMessage(t.ShowCampaign,{options:this.options,type:e}),this._handleEvent(t.ShowCampaign,s)}showPayment(e,s){return this._sendMessage(t.ShowPayment,e),this._handleEvent(t.ShowPayment,s)}toggleFullscreen(e){return this._sendMessage(t.ToggleFullscreen,null),this._handleEvent(t.ToggleFullscreen,e)}setSaveData(e,s){return this._sendMessage(t.SetSaveData,{data:e,options:this.options}),this._handleEvent(t.SetSaveData,s)}}e.AgRuSdk=n,e.AgRuSdkEvents=s,e.AgRuSdkMethods=t,Object.defineProperty(e,"__esModule",{value:!0}),window.AgRuSdk=agru.AgRuSdk,window.AgRuSdkMethods=agru.AgRuSdkMethods,window.AgRuSdkEvents=agru.AgRuSdkEvents})); |
{ | ||
"name": "@agru/sdk", | ||
"version": "1.0.25-1", | ||
"version": "1.0.25-2", | ||
"description": "AG RU SDK for the games integration", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
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
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
42129