Comparing version 1.0.20 to 1.0.21
@@ -77,3 +77,3 @@ var AgRuSdkMethods = /* @__PURE__ */ ((AgRuSdkMethods2) => { | ||
getUsers(ids, callback) { | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids); | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids.join(",")); | ||
return this._handleEvent(AgRuSdkMethods.GetUsers, callback); | ||
@@ -80,0 +80,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||{});class t{constructor(e={}){if(this.options=e,t._instance)return t._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.'),t._instance=this,t._instance._emitter=this._createEmitter(),t._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),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}on(e,t){return this._emitter.on(e,t)}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{t as AgRuSdk,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||{});class t{constructor(e={}){if(this.options=e,t._instance)return t._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.'),t._instance=this,t._instance._emitter=this._createEmitter(),t._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)}on(e,t){return this._emitter.on(e,t)}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{t as AgRuSdk,e as AgRuSdkMethods}; |
@@ -24,3 +24,3 @@ import { Emitter } from 'mitt'; | ||
[AgRuSdkMethods.GetSaveData]: Record<string, unknown>; | ||
[AgRuSdkMethods.GetUsers]: number[]; | ||
[AgRuSdkMethods.GetUsers]: string; | ||
[AgRuSdkMethods.IsAppUser]: number; | ||
@@ -126,3 +126,3 @@ [AgRuSdkMethods.SayHello]: string; | ||
*/ | ||
getUsers(ids: AgRuSdkMethodsData[AgRuSdkMethods.GetUsers], callback?: AgRuCallback<AgRuSdkMethods.GetUsers>): void | AgRuPromise<AgRuSdkMethods.GetUsers>; | ||
getUsers(ids: number[], callback?: AgRuCallback<AgRuSdkMethods.GetUsers>): void | AgRuPromise<AgRuSdkMethods.GetUsers>; | ||
/** | ||
@@ -129,0 +129,0 @@ * Validate if user is belong to the game. |
@@ -81,3 +81,3 @@ 'use strict'; | ||
getUsers(ids, callback) { | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids); | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids.join(",")); | ||
return this._handleEvent(AgRuSdkMethods.GetUsers, callback); | ||
@@ -84,0 +84,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||{});class t{constructor(e={}){if(this.options=e,t._instance)return t._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.'),t._instance=this,t._instance._emitter=this._createEmitter(),t._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),this._handleEvent(e.GetUsers,s)}isAppUser(t,s){return this._sendMessage(e.IsAppUser,t),this._handleEvent(e.IsAppUser,s)}on(e,t){return this._emitter.on(e,t)}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=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||{});class t{constructor(e={}){if(this.options=e,t._instance)return t._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.'),t._instance=this,t._instance._emitter=this._createEmitter(),t._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)}on(e,t){return this._emitter.on(e,t)}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=t,exports.AgRuSdkMethods=e; |
@@ -83,3 +83,3 @@ (function (global, factory) { | ||
getUsers(ids, callback) { | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids); | ||
this._sendMessage(AgRuSdkMethods.GetUsers, ids.join(",")); | ||
return this._handleEvent(AgRuSdkMethods.GetUsers, callback); | ||
@@ -86,0 +86,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||{});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(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),this._handleEvent(t.GetUsers,s)}isAppUser(e,s){return this._sendMessage(t.IsAppUser,e),this._handleEvent(t.IsAppUser,s)}on(e,t){return this._emitter.on(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=s,e.AgRuSdkMethods=t,Object.defineProperty(e,"__esModule",{value:!0}),window.AgRuSdk=agru.AgRuSdk,window.AgRuSdkMethods=agru.AgRuSdkMethods})); | ||
!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||{});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(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)}on(e,t){return this._emitter.on(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=s,e.AgRuSdkMethods=t,Object.defineProperty(e,"__esModule",{value:!0}),window.AgRuSdk=agru.AgRuSdk,window.AgRuSdkMethods=agru.AgRuSdkMethods})); |
{ | ||
"name": "@agru/sdk", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"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
36862
559