@opexa/portal-sdk 0.50.2 → 0.50.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +92 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +92 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -104,7 +104,7 @@ interface AnnouncementsQueryVariables {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
type GameType$1 = 'SLOTS' | 'SPORTS' | 'FISHING' | 'BINGO' | 'LIVE' | 'GAMES' | 'TABLE' | 'SPECIALTY' | 'NUMERICAL' | 'NUMERIC' | 'ARCADE';
|
|
107
|
-
type GameProvider$1 = 'JILI' | 'JILI_BINGO' | 'PGSOFT' | 'FACHAI' | 'BTI' | 'DG' | 'PLAYTECH' | 'E2E' | 'ONEAPI_EVOLUTION' | 'EVOLUTION' | 'EVOLUTION_NETENT' | 'EVOLUTION_REDTIGER' | 'MEGABALL' | 'MEGA2SPIN' | 'DARWIN' | 'RTG' | 'DRBINGO' | 'HOLLYWOODTV' | 'CQ9' | 'JDB' | 'HABANERO' | 'DIGITAIN' | 'SPINIX' | 'JOKER' | 'HACKSAW' | 'EVOLUTIONNETENT' | 'JDBGTF' | 'JDBSPRIBE' | 'MICROGAMING' | 'RELAXGAMING' | 'EVOPLAY' | 'BOOONGO' | 'BGAMING' | 'KINGMAKER' | 'KINGMIDAS' | 'YELLOWBAT' | 'ETENGJUE' | 'SABA' | 'PRAGMATICPLAY' | 'SPRIBE' | 'EZUGI' | 'ALIZE' | 'NO_LIMIT_CITY' | 'BIG_TIME_GAMING' | 'SAGAMING' | 'ONEAPI_SPADEGAMING' | '
|
|
107
|
+
type GameProvider$1 = 'JILI' | 'JILI_BINGO' | 'PGSOFT' | 'FACHAI' | 'BTI' | 'DG' | 'PLAYTECH' | 'E2E' | 'ONEAPI_EVOLUTION' | 'EVOLUTION' | 'EVOLUTION_NETENT' | 'EVOLUTION_REDTIGER' | 'MEGABALL' | 'MEGA2SPIN' | 'DARWIN' | 'RTG' | 'DRBINGO' | 'HOLLYWOODTV' | 'CQ9' | 'JDB' | 'HABANERO' | 'DIGITAIN' | 'SPINIX' | 'JOKER' | 'HACKSAW' | 'EVOLUTIONNETENT' | 'JDBGTF' | 'JDBSPRIBE' | 'MICROGAMING' | 'RELAXGAMING' | 'EVOPLAY' | 'BOOONGO' | 'BGAMING' | 'KINGMAKER' | 'KINGMIDAS' | 'YELLOWBAT' | 'ETENGJUE' | 'SABA' | 'PRAGMATICPLAY' | 'SPRIBE' | 'EZUGI' | 'ALIZE' | 'NO_LIMIT_CITY' | 'BIG_TIME_GAMING' | 'SAGAMING' | 'ONEAPI_SPADEGAMING' | 'JK8' | 'TEST';
|
|
108
108
|
type GameTag$1 = 'HOT' | 'hot' | 'NEW' | 'new' | 'TOP' | 'top' | 'POPULAR' | 'popular' | (string & {});
|
|
109
109
|
interface GamesQueryVariables {
|
|
110
110
|
after?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ interface AnnouncementsQueryVariables {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
type GameType$1 = 'SLOTS' | 'SPORTS' | 'FISHING' | 'BINGO' | 'LIVE' | 'GAMES' | 'TABLE' | 'SPECIALTY' | 'NUMERICAL' | 'NUMERIC' | 'ARCADE';
|
|
107
|
-
type GameProvider$1 = 'JILI' | 'JILI_BINGO' | 'PGSOFT' | 'FACHAI' | 'BTI' | 'DG' | 'PLAYTECH' | 'E2E' | 'ONEAPI_EVOLUTION' | 'EVOLUTION' | 'EVOLUTION_NETENT' | 'EVOLUTION_REDTIGER' | 'MEGABALL' | 'MEGA2SPIN' | 'DARWIN' | 'RTG' | 'DRBINGO' | 'HOLLYWOODTV' | 'CQ9' | 'JDB' | 'HABANERO' | 'DIGITAIN' | 'SPINIX' | 'JOKER' | 'HACKSAW' | 'EVOLUTIONNETENT' | 'JDBGTF' | 'JDBSPRIBE' | 'MICROGAMING' | 'RELAXGAMING' | 'EVOPLAY' | 'BOOONGO' | 'BGAMING' | 'KINGMAKER' | 'KINGMIDAS' | 'YELLOWBAT' | 'ETENGJUE' | 'SABA' | 'PRAGMATICPLAY' | 'SPRIBE' | 'EZUGI' | 'ALIZE' | 'NO_LIMIT_CITY' | 'BIG_TIME_GAMING' | 'SAGAMING' | 'ONEAPI_SPADEGAMING' | '
|
|
107
|
+
type GameProvider$1 = 'JILI' | 'JILI_BINGO' | 'PGSOFT' | 'FACHAI' | 'BTI' | 'DG' | 'PLAYTECH' | 'E2E' | 'ONEAPI_EVOLUTION' | 'EVOLUTION' | 'EVOLUTION_NETENT' | 'EVOLUTION_REDTIGER' | 'MEGABALL' | 'MEGA2SPIN' | 'DARWIN' | 'RTG' | 'DRBINGO' | 'HOLLYWOODTV' | 'CQ9' | 'JDB' | 'HABANERO' | 'DIGITAIN' | 'SPINIX' | 'JOKER' | 'HACKSAW' | 'EVOLUTIONNETENT' | 'JDBGTF' | 'JDBSPRIBE' | 'MICROGAMING' | 'RELAXGAMING' | 'EVOPLAY' | 'BOOONGO' | 'BGAMING' | 'KINGMAKER' | 'KINGMIDAS' | 'YELLOWBAT' | 'ETENGJUE' | 'SABA' | 'PRAGMATICPLAY' | 'SPRIBE' | 'EZUGI' | 'ALIZE' | 'NO_LIMIT_CITY' | 'BIG_TIME_GAMING' | 'SAGAMING' | 'ONEAPI_SPADEGAMING' | 'JK8' | 'TEST';
|
|
108
108
|
type GameTag$1 = 'HOT' | 'hot' | 'NEW' | 'new' | 'TOP' | 'top' | 'POPULAR' | 'popular' | (string & {});
|
|
109
109
|
interface GamesQueryVariables {
|
|
110
110
|
after?: string;
|
package/dist/index.js
CHANGED
|
@@ -5441,8 +5441,8 @@ function pollable(func, config) {
|
|
|
5441
5441
|
};
|
|
5442
5442
|
}
|
|
5443
5443
|
|
|
5444
|
-
// src/sdk/session-manager.ts
|
|
5445
|
-
var
|
|
5444
|
+
// src/sdk/session-manager-cookie.ts
|
|
5445
|
+
var SessionManagerCookie = class {
|
|
5446
5446
|
logger;
|
|
5447
5447
|
storageKey = "session";
|
|
5448
5448
|
platformStorageKey = "session/platform";
|
|
@@ -5453,10 +5453,6 @@ var SessionManager = class {
|
|
|
5453
5453
|
this.authService = config.authService;
|
|
5454
5454
|
this.walletService = config.walletService;
|
|
5455
5455
|
this.logger = config.logger;
|
|
5456
|
-
if (config.sessionPrefix) {
|
|
5457
|
-
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
5458
|
-
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
5459
|
-
}
|
|
5460
5456
|
}
|
|
5461
5457
|
get refreshing() {
|
|
5462
5458
|
return this._refreshing;
|
|
@@ -5465,16 +5461,6 @@ var SessionManager = class {
|
|
|
5465
5461
|
this._refreshing = value;
|
|
5466
5462
|
}
|
|
5467
5463
|
async create(input) {
|
|
5468
|
-
if (this.isServer) {
|
|
5469
|
-
this.logger.warn("'localStorage' is not available on the server.");
|
|
5470
|
-
return {
|
|
5471
|
-
ok: false,
|
|
5472
|
-
error: {
|
|
5473
|
-
name: "UnknownError",
|
|
5474
|
-
message: "Server sign in is not supported."
|
|
5475
|
-
}
|
|
5476
|
-
};
|
|
5477
|
-
}
|
|
5478
5464
|
if (input.type === "MAYA") {
|
|
5479
5465
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
5480
5466
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -5501,13 +5487,14 @@ var SessionManager = class {
|
|
|
5501
5487
|
})();
|
|
5502
5488
|
if (!r1.ok) return r1;
|
|
5503
5489
|
const now2 = /* @__PURE__ */ new Date();
|
|
5504
|
-
|
|
5490
|
+
cookies.set(
|
|
5505
5491
|
this.storageKey,
|
|
5506
5492
|
JSON.stringify({
|
|
5507
5493
|
...r1.data,
|
|
5508
5494
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5509
5495
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5510
|
-
})
|
|
5496
|
+
}),
|
|
5497
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5511
5498
|
);
|
|
5512
5499
|
return {
|
|
5513
5500
|
ok: true,
|
|
@@ -5518,13 +5505,16 @@ var SessionManager = class {
|
|
|
5518
5505
|
const res2 = await this.authService.createSession(input);
|
|
5519
5506
|
if (res2.ok) {
|
|
5520
5507
|
const now2 = /* @__PURE__ */ new Date();
|
|
5521
|
-
|
|
5508
|
+
cookies.set(
|
|
5522
5509
|
this.storageKey,
|
|
5523
5510
|
JSON.stringify({
|
|
5524
5511
|
...res2.data,
|
|
5525
5512
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5526
5513
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5527
|
-
})
|
|
5514
|
+
}),
|
|
5515
|
+
{
|
|
5516
|
+
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5517
|
+
}
|
|
5528
5518
|
);
|
|
5529
5519
|
return {
|
|
5530
5520
|
ok: true,
|
|
@@ -5536,18 +5526,18 @@ var SessionManager = class {
|
|
|
5536
5526
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
5537
5527
|
const res2 = await this.authService.createSession({
|
|
5538
5528
|
type: "SOCIALS",
|
|
5539
|
-
token: input.token
|
|
5540
|
-
channel: input.channel
|
|
5529
|
+
token: input.token
|
|
5541
5530
|
});
|
|
5542
5531
|
if (res2.ok) {
|
|
5543
5532
|
const now2 = /* @__PURE__ */ new Date();
|
|
5544
|
-
|
|
5533
|
+
cookies.set(
|
|
5545
5534
|
this.storageKey,
|
|
5546
5535
|
JSON.stringify({
|
|
5547
5536
|
...res2.data,
|
|
5548
5537
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5549
5538
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5550
|
-
})
|
|
5539
|
+
}),
|
|
5540
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5551
5541
|
);
|
|
5552
5542
|
return {
|
|
5553
5543
|
ok: true,
|
|
@@ -5561,13 +5551,14 @@ var SessionManager = class {
|
|
|
5561
5551
|
const res2 = await this.authService.createSession(input);
|
|
5562
5552
|
if (res2.ok) {
|
|
5563
5553
|
const now2 = /* @__PURE__ */ new Date();
|
|
5564
|
-
|
|
5554
|
+
cookies.set(
|
|
5565
5555
|
this.storageKey,
|
|
5566
5556
|
JSON.stringify({
|
|
5567
5557
|
...res2.data,
|
|
5568
5558
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5569
5559
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5570
|
-
})
|
|
5560
|
+
}),
|
|
5561
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5571
5562
|
);
|
|
5572
5563
|
return {
|
|
5573
5564
|
ok: true,
|
|
@@ -5587,13 +5578,14 @@ var SessionManager = class {
|
|
|
5587
5578
|
};
|
|
5588
5579
|
}
|
|
5589
5580
|
const now = /* @__PURE__ */ new Date();
|
|
5590
|
-
|
|
5581
|
+
cookies.set(
|
|
5591
5582
|
this.storageKey,
|
|
5592
5583
|
JSON.stringify({
|
|
5593
5584
|
...res.data,
|
|
5594
5585
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5595
5586
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5596
|
-
})
|
|
5587
|
+
}),
|
|
5588
|
+
{}
|
|
5597
5589
|
);
|
|
5598
5590
|
return {
|
|
5599
5591
|
ok: true,
|
|
@@ -5605,15 +5597,18 @@ var SessionManager = class {
|
|
|
5605
5597
|
if (res.ok) {
|
|
5606
5598
|
const now = /* @__PURE__ */ new Date();
|
|
5607
5599
|
if (this.isServer) {
|
|
5608
|
-
this.logger.warn("'
|
|
5600
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5609
5601
|
} else {
|
|
5610
|
-
|
|
5602
|
+
cookies.set(
|
|
5611
5603
|
this.storageKey,
|
|
5612
5604
|
JSON.stringify({
|
|
5613
5605
|
...res.data,
|
|
5614
5606
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5615
5607
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5616
|
-
})
|
|
5608
|
+
}),
|
|
5609
|
+
{
|
|
5610
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5611
|
+
}
|
|
5617
5612
|
);
|
|
5618
5613
|
}
|
|
5619
5614
|
return { ok: true };
|
|
@@ -5623,7 +5618,7 @@ var SessionManager = class {
|
|
|
5623
5618
|
}
|
|
5624
5619
|
async get() {
|
|
5625
5620
|
if (this.isServer) {
|
|
5626
|
-
this.logger.warn("'
|
|
5621
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5627
5622
|
return {
|
|
5628
5623
|
ok: true,
|
|
5629
5624
|
data: null
|
|
@@ -5633,7 +5628,7 @@ var SessionManager = class {
|
|
|
5633
5628
|
await sleep(1e3);
|
|
5634
5629
|
return await this.get();
|
|
5635
5630
|
}
|
|
5636
|
-
const val =
|
|
5631
|
+
const val = cookies.get(this.storageKey);
|
|
5637
5632
|
if (!val) {
|
|
5638
5633
|
return {
|
|
5639
5634
|
ok: true,
|
|
@@ -5647,7 +5642,7 @@ var SessionManager = class {
|
|
|
5647
5642
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
5648
5643
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
5649
5644
|
this.logger.warn("Session expired. Logging out..");
|
|
5650
|
-
|
|
5645
|
+
cookies.remove(this.storageKey);
|
|
5651
5646
|
return {
|
|
5652
5647
|
ok: false,
|
|
5653
5648
|
error: {
|
|
@@ -5664,7 +5659,7 @@ var SessionManager = class {
|
|
|
5664
5659
|
if (!res.ok) {
|
|
5665
5660
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5666
5661
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5667
|
-
|
|
5662
|
+
cookies.remove(this.storageKey);
|
|
5668
5663
|
return {
|
|
5669
5664
|
ok: false,
|
|
5670
5665
|
error: res.error
|
|
@@ -5685,7 +5680,9 @@ var SessionManager = class {
|
|
|
5685
5680
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5686
5681
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5687
5682
|
};
|
|
5688
|
-
|
|
5683
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
5684
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5685
|
+
});
|
|
5689
5686
|
}
|
|
5690
5687
|
return {
|
|
5691
5688
|
ok: true,
|
|
@@ -5703,13 +5700,13 @@ var SessionManager = class {
|
|
|
5703
5700
|
}
|
|
5704
5701
|
async refresh() {
|
|
5705
5702
|
if (this.isServer) {
|
|
5706
|
-
this.logger.warn("'
|
|
5703
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5707
5704
|
return {
|
|
5708
5705
|
ok: true,
|
|
5709
5706
|
data: null
|
|
5710
5707
|
};
|
|
5711
5708
|
}
|
|
5712
|
-
const val =
|
|
5709
|
+
const val = cookies.get(this.storageKey);
|
|
5713
5710
|
if (!val) {
|
|
5714
5711
|
return {
|
|
5715
5712
|
ok: true,
|
|
@@ -5726,7 +5723,7 @@ var SessionManager = class {
|
|
|
5726
5723
|
if (!res.ok) {
|
|
5727
5724
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5728
5725
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5729
|
-
|
|
5726
|
+
cookies.remove(this.storageKey);
|
|
5730
5727
|
return {
|
|
5731
5728
|
ok: false,
|
|
5732
5729
|
error: res.error
|
|
@@ -5747,7 +5744,9 @@ var SessionManager = class {
|
|
|
5747
5744
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5748
5745
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5749
5746
|
};
|
|
5750
|
-
|
|
5747
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
5748
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5749
|
+
});
|
|
5751
5750
|
return {
|
|
5752
5751
|
ok: true,
|
|
5753
5752
|
data: obj
|
|
@@ -5764,18 +5763,18 @@ var SessionManager = class {
|
|
|
5764
5763
|
}
|
|
5765
5764
|
async destroy() {
|
|
5766
5765
|
if (this.isServer) {
|
|
5767
|
-
this.logger.warn("'
|
|
5766
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5768
5767
|
return;
|
|
5769
5768
|
}
|
|
5770
5769
|
const res = await this.get();
|
|
5771
5770
|
if (res.data?.accessToken) {
|
|
5772
5771
|
await this.authService.destroySession(res.data.accessToken);
|
|
5773
5772
|
}
|
|
5774
|
-
|
|
5773
|
+
cookies.remove(this.storageKey);
|
|
5775
5774
|
}
|
|
5776
5775
|
async verify() {
|
|
5777
5776
|
if (this.isServer) {
|
|
5778
|
-
this.logger.warn("'
|
|
5777
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5779
5778
|
return true;
|
|
5780
5779
|
}
|
|
5781
5780
|
const s = await this.get();
|
|
@@ -5785,13 +5784,13 @@ var SessionManager = class {
|
|
|
5785
5784
|
if (!s.data) return true;
|
|
5786
5785
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
5787
5786
|
if (!v) {
|
|
5788
|
-
|
|
5787
|
+
cookies.remove(this.storageKey);
|
|
5789
5788
|
}
|
|
5790
5789
|
return v;
|
|
5791
5790
|
}
|
|
5792
5791
|
get onMaya() {
|
|
5793
5792
|
if (this.isServer) {
|
|
5794
|
-
this.logger.warn("'
|
|
5793
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5795
5794
|
return false;
|
|
5796
5795
|
}
|
|
5797
5796
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -5807,7 +5806,9 @@ var SessionManager = class {
|
|
|
5807
5806
|
return typeof window === "undefined";
|
|
5808
5807
|
}
|
|
5809
5808
|
};
|
|
5810
|
-
|
|
5809
|
+
|
|
5810
|
+
// src/sdk/session-manager.ts
|
|
5811
|
+
var SessionManager = class {
|
|
5811
5812
|
logger;
|
|
5812
5813
|
storageKey = "session";
|
|
5813
5814
|
platformStorageKey = "session/platform";
|
|
@@ -5818,6 +5819,10 @@ var SessionManagerCookie = class {
|
|
|
5818
5819
|
this.authService = config.authService;
|
|
5819
5820
|
this.walletService = config.walletService;
|
|
5820
5821
|
this.logger = config.logger;
|
|
5822
|
+
if (config.sessionPrefix) {
|
|
5823
|
+
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
5824
|
+
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
5825
|
+
}
|
|
5821
5826
|
}
|
|
5822
5827
|
get refreshing() {
|
|
5823
5828
|
return this._refreshing;
|
|
@@ -5826,6 +5831,16 @@ var SessionManagerCookie = class {
|
|
|
5826
5831
|
this._refreshing = value;
|
|
5827
5832
|
}
|
|
5828
5833
|
async create(input) {
|
|
5834
|
+
if (this.isServer) {
|
|
5835
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5836
|
+
return {
|
|
5837
|
+
ok: false,
|
|
5838
|
+
error: {
|
|
5839
|
+
name: "UnknownError",
|
|
5840
|
+
message: "Server sign in is not supported."
|
|
5841
|
+
}
|
|
5842
|
+
};
|
|
5843
|
+
}
|
|
5829
5844
|
if (input.type === "MAYA") {
|
|
5830
5845
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
5831
5846
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -5852,14 +5867,13 @@ var SessionManagerCookie = class {
|
|
|
5852
5867
|
})();
|
|
5853
5868
|
if (!r1.ok) return r1;
|
|
5854
5869
|
const now2 = /* @__PURE__ */ new Date();
|
|
5855
|
-
|
|
5870
|
+
localStorage.setItem(
|
|
5856
5871
|
this.storageKey,
|
|
5857
5872
|
JSON.stringify({
|
|
5858
5873
|
...r1.data,
|
|
5859
5874
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5860
5875
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5861
|
-
})
|
|
5862
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5876
|
+
})
|
|
5863
5877
|
);
|
|
5864
5878
|
return {
|
|
5865
5879
|
ok: true,
|
|
@@ -5870,16 +5884,13 @@ var SessionManagerCookie = class {
|
|
|
5870
5884
|
const res2 = await this.authService.createSession(input);
|
|
5871
5885
|
if (res2.ok) {
|
|
5872
5886
|
const now2 = /* @__PURE__ */ new Date();
|
|
5873
|
-
|
|
5887
|
+
localStorage.setItem(
|
|
5874
5888
|
this.storageKey,
|
|
5875
5889
|
JSON.stringify({
|
|
5876
5890
|
...res2.data,
|
|
5877
5891
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5878
5892
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5879
|
-
})
|
|
5880
|
-
{
|
|
5881
|
-
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5882
|
-
}
|
|
5893
|
+
})
|
|
5883
5894
|
);
|
|
5884
5895
|
return {
|
|
5885
5896
|
ok: true,
|
|
@@ -5891,18 +5902,18 @@ var SessionManagerCookie = class {
|
|
|
5891
5902
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
5892
5903
|
const res2 = await this.authService.createSession({
|
|
5893
5904
|
type: "SOCIALS",
|
|
5894
|
-
token: input.token
|
|
5905
|
+
token: input.token,
|
|
5906
|
+
channel: input.channel
|
|
5895
5907
|
});
|
|
5896
5908
|
if (res2.ok) {
|
|
5897
5909
|
const now2 = /* @__PURE__ */ new Date();
|
|
5898
|
-
|
|
5910
|
+
localStorage.setItem(
|
|
5899
5911
|
this.storageKey,
|
|
5900
5912
|
JSON.stringify({
|
|
5901
5913
|
...res2.data,
|
|
5902
5914
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5903
5915
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5904
|
-
})
|
|
5905
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5916
|
+
})
|
|
5906
5917
|
);
|
|
5907
5918
|
return {
|
|
5908
5919
|
ok: true,
|
|
@@ -5916,14 +5927,13 @@ var SessionManagerCookie = class {
|
|
|
5916
5927
|
const res2 = await this.authService.createSession(input);
|
|
5917
5928
|
if (res2.ok) {
|
|
5918
5929
|
const now2 = /* @__PURE__ */ new Date();
|
|
5919
|
-
|
|
5930
|
+
localStorage.setItem(
|
|
5920
5931
|
this.storageKey,
|
|
5921
5932
|
JSON.stringify({
|
|
5922
5933
|
...res2.data,
|
|
5923
5934
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5924
5935
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5925
|
-
})
|
|
5926
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5936
|
+
})
|
|
5927
5937
|
);
|
|
5928
5938
|
return {
|
|
5929
5939
|
ok: true,
|
|
@@ -5943,14 +5953,13 @@ var SessionManagerCookie = class {
|
|
|
5943
5953
|
};
|
|
5944
5954
|
}
|
|
5945
5955
|
const now = /* @__PURE__ */ new Date();
|
|
5946
|
-
|
|
5956
|
+
localStorage.setItem(
|
|
5947
5957
|
this.storageKey,
|
|
5948
5958
|
JSON.stringify({
|
|
5949
5959
|
...res.data,
|
|
5950
5960
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5951
5961
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5952
|
-
})
|
|
5953
|
-
{}
|
|
5962
|
+
})
|
|
5954
5963
|
);
|
|
5955
5964
|
return {
|
|
5956
5965
|
ok: true,
|
|
@@ -5962,18 +5971,15 @@ var SessionManagerCookie = class {
|
|
|
5962
5971
|
if (res.ok) {
|
|
5963
5972
|
const now = /* @__PURE__ */ new Date();
|
|
5964
5973
|
if (this.isServer) {
|
|
5965
|
-
this.logger.warn("'
|
|
5974
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5966
5975
|
} else {
|
|
5967
|
-
|
|
5976
|
+
localStorage.setItem(
|
|
5968
5977
|
this.storageKey,
|
|
5969
5978
|
JSON.stringify({
|
|
5970
5979
|
...res.data,
|
|
5971
5980
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5972
5981
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5973
|
-
})
|
|
5974
|
-
{
|
|
5975
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5976
|
-
}
|
|
5982
|
+
})
|
|
5977
5983
|
);
|
|
5978
5984
|
}
|
|
5979
5985
|
return { ok: true };
|
|
@@ -5983,7 +5989,7 @@ var SessionManagerCookie = class {
|
|
|
5983
5989
|
}
|
|
5984
5990
|
async get() {
|
|
5985
5991
|
if (this.isServer) {
|
|
5986
|
-
this.logger.warn("'
|
|
5992
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5987
5993
|
return {
|
|
5988
5994
|
ok: true,
|
|
5989
5995
|
data: null
|
|
@@ -5993,7 +5999,7 @@ var SessionManagerCookie = class {
|
|
|
5993
5999
|
await sleep(1e3);
|
|
5994
6000
|
return await this.get();
|
|
5995
6001
|
}
|
|
5996
|
-
const val =
|
|
6002
|
+
const val = localStorage.getItem(this.storageKey);
|
|
5997
6003
|
if (!val) {
|
|
5998
6004
|
return {
|
|
5999
6005
|
ok: true,
|
|
@@ -6007,7 +6013,7 @@ var SessionManagerCookie = class {
|
|
|
6007
6013
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
6008
6014
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
6009
6015
|
this.logger.warn("Session expired. Logging out..");
|
|
6010
|
-
|
|
6016
|
+
localStorage.removeItem(this.storageKey);
|
|
6011
6017
|
return {
|
|
6012
6018
|
ok: false,
|
|
6013
6019
|
error: {
|
|
@@ -6024,7 +6030,7 @@ var SessionManagerCookie = class {
|
|
|
6024
6030
|
if (!res.ok) {
|
|
6025
6031
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6026
6032
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6027
|
-
|
|
6033
|
+
localStorage.removeItem(this.storageKey);
|
|
6028
6034
|
return {
|
|
6029
6035
|
ok: false,
|
|
6030
6036
|
error: res.error
|
|
@@ -6045,9 +6051,7 @@ var SessionManagerCookie = class {
|
|
|
6045
6051
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6046
6052
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6047
6053
|
};
|
|
6048
|
-
|
|
6049
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6050
|
-
});
|
|
6054
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
6051
6055
|
}
|
|
6052
6056
|
return {
|
|
6053
6057
|
ok: true,
|
|
@@ -6065,13 +6069,13 @@ var SessionManagerCookie = class {
|
|
|
6065
6069
|
}
|
|
6066
6070
|
async refresh() {
|
|
6067
6071
|
if (this.isServer) {
|
|
6068
|
-
this.logger.warn("'
|
|
6072
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6069
6073
|
return {
|
|
6070
6074
|
ok: true,
|
|
6071
6075
|
data: null
|
|
6072
6076
|
};
|
|
6073
6077
|
}
|
|
6074
|
-
const val =
|
|
6078
|
+
const val = localStorage.getItem(this.storageKey);
|
|
6075
6079
|
if (!val) {
|
|
6076
6080
|
return {
|
|
6077
6081
|
ok: true,
|
|
@@ -6088,7 +6092,7 @@ var SessionManagerCookie = class {
|
|
|
6088
6092
|
if (!res.ok) {
|
|
6089
6093
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6090
6094
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6091
|
-
|
|
6095
|
+
localStorage.removeItem(this.storageKey);
|
|
6092
6096
|
return {
|
|
6093
6097
|
ok: false,
|
|
6094
6098
|
error: res.error
|
|
@@ -6109,9 +6113,7 @@ var SessionManagerCookie = class {
|
|
|
6109
6113
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6110
6114
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6111
6115
|
};
|
|
6112
|
-
|
|
6113
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6114
|
-
});
|
|
6116
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
6115
6117
|
return {
|
|
6116
6118
|
ok: true,
|
|
6117
6119
|
data: obj
|
|
@@ -6128,18 +6130,18 @@ var SessionManagerCookie = class {
|
|
|
6128
6130
|
}
|
|
6129
6131
|
async destroy() {
|
|
6130
6132
|
if (this.isServer) {
|
|
6131
|
-
this.logger.warn("'
|
|
6133
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6132
6134
|
return;
|
|
6133
6135
|
}
|
|
6134
6136
|
const res = await this.get();
|
|
6135
6137
|
if (res.data?.accessToken) {
|
|
6136
6138
|
await this.authService.destroySession(res.data.accessToken);
|
|
6137
6139
|
}
|
|
6138
|
-
|
|
6140
|
+
localStorage.removeItem(this.storageKey);
|
|
6139
6141
|
}
|
|
6140
6142
|
async verify() {
|
|
6141
6143
|
if (this.isServer) {
|
|
6142
|
-
this.logger.warn("'
|
|
6144
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6143
6145
|
return true;
|
|
6144
6146
|
}
|
|
6145
6147
|
const s = await this.get();
|
|
@@ -6149,13 +6151,13 @@ var SessionManagerCookie = class {
|
|
|
6149
6151
|
if (!s.data) return true;
|
|
6150
6152
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
6151
6153
|
if (!v) {
|
|
6152
|
-
|
|
6154
|
+
localStorage.removeItem(this.storageKey);
|
|
6153
6155
|
}
|
|
6154
6156
|
return v;
|
|
6155
6157
|
}
|
|
6156
6158
|
get onMaya() {
|
|
6157
6159
|
if (this.isServer) {
|
|
6158
|
-
this.logger.warn("'
|
|
6160
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6159
6161
|
return false;
|
|
6160
6162
|
}
|
|
6161
6163
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -9647,7 +9649,8 @@ var NEW_GAME_PROVIDERS = [
|
|
|
9647
9649
|
"NO_LIMIT_CITY",
|
|
9648
9650
|
"BIG_TIME_GAMING",
|
|
9649
9651
|
"SAGAMING",
|
|
9650
|
-
"
|
|
9652
|
+
"JK8",
|
|
9653
|
+
"TEST"
|
|
9651
9654
|
];
|
|
9652
9655
|
var ENDPOINTS = {
|
|
9653
9656
|
development: {
|