var t = this;
return new Promise(function (e, r) {
t._platformSdk.features.GamesAPI.getAllGames()
.then(function (t) {
var r = t.games;
e(r);
})
.catch(r);
});
},
},
{
key: "getGameById",
value: function (t) {
var e = this;
return null != t && t.gameId
? new Promise(function (r, n) {
e._platformSdk.features.GamesAPI.getGameByID(
null == t ? void 0 : t.gameId
)
.then(function (t) {
var e = t.game,
n = t.isAvailable;
r(Do(Do({}, e), {}, { isAvailable: n }));
})
.catch(n);
})
: Promise.reject(new Error("Provide gameId"));
},
},
{
key: "authorizePlayer",
value: function () {
var t = this,
e = this._getPromiseDecorator(v.AUTHORIZE_PLAYER);
return (
e ||
((e = this._createPromiseDecorator(v.AUTHORIZE_PLAYER)),
this._isPlayerAuthorized
? (xo(this, zo, Bo(this, Zo, Yo).call(this)),
Ho(this, zo).then(function () {
t._resolvePromiseDecorator(v.AUTHORIZE_PLAYER);
}))
: this._platformSdk.auth
.openAuthDialog()
.then(function () {
xo(t, zo, Bo(t, Zo, Yo).call(t)),
Ho(t, zo).then(function () {
t._resolvePromiseDecorator(v.AUTHORIZE_PLAYER);
});
})
.catch(function (e) {
t._rejectPromiseDecorator(v.AUTHORIZE_PLAYER, e);
})),
e.promise
);
},
},
{
key: "isStorageSupported",
value: function (t) {
return (
t === u.PLATFORM_INTERNAL ||
Lo(Co(p.prototype), "isStorageSupported", this).call(this, t)
);
},
},
{
key: "isStorageAvailable",
value: function (t) {
return t === u.PLATFORM_INTERNAL
? this._isPlayerAuthorized
: Lo(Co(p.prototype), "isStorageAvailable", this).call(
this,
t
);
},
},
{
key: "getDataFromStorage",
value: function (t, e, r) {
var n = this;
return e === u.PLATFORM_INTERNAL
? this._isPlayerAuthorized
? Ho(this, zo).then(function () {
return new Promise(function (e) {
if (Array.isArray(t)) {
for (var r = [], o = 0; o < t.length; o++) {
var i =
void 0 === n._platformStorageCachedData[t[o]]
? null
: n._platformStorageCachedData[t[o]];
r.push(i);
}
e(r);
} else e(void 0 === n._platformStorageCachedData[t] ? null : n._platformStorageCachedData[t]);
});
})
: Promise.reject()
: Lo(Co(p.prototype), "getDataFromStorage", this).call(
this,
t,
e,
r
);
},
},
{
key: "setDataToStorage",
value: function (t, e, r) {
var n = this;
return r === u.PLATFORM_INTERNAL
? this._isPlayerAuthorized
? Ho(this, zo).then(function () {
return new Promise(function (r, o) {
var i =
null !== n._platformStorageCachedData
? Do({}, n._platformStorageCachedData)
: {};
if (Array.isArray(t))
for (var a = 0; a < t.length; a++) i[t[a]] = e[a];
else i[t] = e;
Ho(n, Vo)
.setData(i)
.then(function () {
(n._platformStorageCachedData = i), r();
})
.catch(function (t) {
o(t);
});
});
})
: Promise.reject()
: Lo(Co(p.prototype), "setDataToStorage", this).call(
this,
t,
e,
r
);
},
},
{
key: "deleteDataFromStorage",
value: function (t, e) {
var r = this;
return e === u.PLATFORM_INTERNAL
? this._isPlayerAuthorized
? Ho(this, zo).then(function () {
return new Promise(function (e, n) {
var o =
null !== r._platformStorageCachedData
? Do({}, r._platformStorageCachedData)
: {};
if (Array.isArray(t))
for (var i = 0; i < t.length; i++) delete o[t[i]];
else delete o[t];
Ho(r, Vo)
.setData(o)
.then(function () {
(r._platformStorageCachedData = o), e();
})
.catch(function (t) {
n(t);
});
});
})
: Promise.reject()
: Lo(Co(p.prototype), "deleteDataFromStorage", this).call(
this,
t,
e
);
},
},
{
key: "showBanner",
value: function () {
var t = this;
this._platformSdk.adv
.showBannerAdv()
.then(function (e) {
e.stickyAdvIsShowing
? t._setBannerState(s.SHOWN)
: t._setBannerState(s.FAILED);
})
.catch(function () {
t._setBannerState(s.FAILED);
});
},
},
{
key: "hideBanner",
value: function () {
var t = this;
this._platformSdk.adv.hideBannerAdv().then(function (e) {
e.stickyAdvIsShowing || t._setBannerState(s.HIDDEN);
});
},
},
{
key: "showInterstitial",
value: function () {
var t = this;
this._platformSdk.adv.showFullscreenAdv({
callbacks: {
onOpen: function () {
t._setInterstitialState(i.OPENED);
},
onClose: function (e) {
e
? t._setInterstitialState(i.CLOSED)
: t._setInterstitialState(i.FAILED);
},
onError: function (t) {
console.error(t);
},
},
});
},
},
{
key: "showRewarded",
value: function () {
var t = this;
this._platformSdk.adv.showRewardedVideo({
callbacks: {
onOpen: function () {
t._setRewardedState(a.OPENED);
},
onRewarded: function () {
t._setRewardedState(a.REWARDED);
},
onClose: function () {
t._setRewardedState(a.CLOSED);
},
onError: function () {
t._setRewardedState(a.FAILED);
},
},
});
},
},
{
key: "checkAdBlock",
value: function () {
return new Promise(function (t) {
t(!1);
});
},
},
{
key: "addToHomeScreen",
value: function () {
var t = this;
if (!this.isAddToHomeScreenSupported) return Promise.reject();
var e = this._getPromiseDecorator(v.ADD_TO_HOME_SCREEN);
return (
e ||
((e = this._createPromiseDecorator(v.ADD_TO_HOME_SCREEN)),
this._platformSdk.shortcut
.showPrompt()
.then(function (e) {
"accepted" !== e.outcome
? t._rejectPromiseDecorator(v.ADD_TO_HOME_SCREEN)
: t._resolvePromiseDecorator(v.ADD_TO_HOME_SCREEN);
})
.catch(function (e) {
t._rejectPromiseDecorator(v.ADD_TO_HOME_SCREEN, e);
})),
e.promise
);
},
},
{
key: "rate",
value: function () {
var t = this,
e = this._getPromiseDecorator(v.RATE);
|