@opexa/portal-sdk 0.52.3 → 0.52.5
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 +205 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +205 -91
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -845,7 +845,25 @@ var CREATE_MAYA_DEPOSIT_MUTATION = gql`
|
|
|
845
845
|
var CREATE_TEST_DEPOSIT_MUTATION = gql`
|
|
846
846
|
mutation CreateTestDeposit($input: CreateTestDepositInput!) {
|
|
847
847
|
createTestDeposit(input: $input) {
|
|
848
|
-
|
|
848
|
+
... on DepositPromoMaximumAmountExceededError {
|
|
849
|
+
__typename
|
|
850
|
+
}
|
|
851
|
+
... on DepositPromoMinimumAmountNotMetError {
|
|
852
|
+
__typename
|
|
853
|
+
}
|
|
854
|
+
... on MaximumDepositAmountExceededError {
|
|
855
|
+
__typename
|
|
856
|
+
}
|
|
857
|
+
... on MinimumDepositAmountNotMetError {
|
|
858
|
+
__typename
|
|
859
|
+
}
|
|
860
|
+
... on MinimumFirstDepositAmountNotMetError {
|
|
861
|
+
__typename
|
|
862
|
+
}
|
|
863
|
+
... on PromoNotEnabledError {
|
|
864
|
+
__typename
|
|
865
|
+
}
|
|
866
|
+
... on WalletDoesNotExistError {
|
|
849
867
|
__typename
|
|
850
868
|
}
|
|
851
869
|
}
|
|
@@ -2664,6 +2682,22 @@ var TOP_WINS_QUERY = gql`
|
|
|
2664
2682
|
}
|
|
2665
2683
|
}
|
|
2666
2684
|
`;
|
|
2685
|
+
var TOP_WINS_NEXT_QUERY = gql`
|
|
2686
|
+
query TopWinsNext {
|
|
2687
|
+
_topWins {
|
|
2688
|
+
id
|
|
2689
|
+
game {
|
|
2690
|
+
id
|
|
2691
|
+
}
|
|
2692
|
+
member {
|
|
2693
|
+
id
|
|
2694
|
+
name
|
|
2695
|
+
}
|
|
2696
|
+
multiplier
|
|
2697
|
+
payout
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
`;
|
|
2667
2701
|
var JACKPOTS_QUERY = gql`
|
|
2668
2702
|
query Jackpots(
|
|
2669
2703
|
$first: Int
|
|
@@ -2890,6 +2924,17 @@ var TOURNAMENTS_QUERY = gql`
|
|
|
2890
2924
|
}
|
|
2891
2925
|
}
|
|
2892
2926
|
`;
|
|
2927
|
+
var MEMBER_CABINET_SITE_MACHINE_QUERY = gql`
|
|
2928
|
+
query MemberCabinetSiteMachine {
|
|
2929
|
+
memberCabinetSiteMachine {
|
|
2930
|
+
id
|
|
2931
|
+
name
|
|
2932
|
+
fingerprint
|
|
2933
|
+
status
|
|
2934
|
+
dateTimeCreated
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
`;
|
|
2893
2938
|
|
|
2894
2939
|
// src/services/utils.ts
|
|
2895
2940
|
function createOperationError(code) {
|
|
@@ -2955,7 +3000,8 @@ function createOperationError(code) {
|
|
|
2955
3000
|
VerificationDataIncompleteError: "Verification data is incomplete",
|
|
2956
3001
|
TurnoverRequirementNotYetFulfilledError: "Turnover requirement not yet fulfilled",
|
|
2957
3002
|
FirstDepositRequiredError: "First deposit is required",
|
|
2958
|
-
VerificationLockedError: "Verification is locked"
|
|
3003
|
+
VerificationLockedError: "Verification is locked",
|
|
3004
|
+
MachineNotFound: "Machine not found"
|
|
2959
3005
|
};
|
|
2960
3006
|
return {
|
|
2961
3007
|
name: code,
|
|
@@ -4051,6 +4097,14 @@ var PortalService = class {
|
|
|
4051
4097
|
data: res.data.topWins
|
|
4052
4098
|
};
|
|
4053
4099
|
}
|
|
4100
|
+
async topWinsNext() {
|
|
4101
|
+
const res = await this.client.request(TOP_WINS_NEXT_QUERY);
|
|
4102
|
+
if (!res.ok) return res;
|
|
4103
|
+
return {
|
|
4104
|
+
ok: true,
|
|
4105
|
+
data: res.data._topWins
|
|
4106
|
+
};
|
|
4107
|
+
}
|
|
4054
4108
|
};
|
|
4055
4109
|
|
|
4056
4110
|
// src/services/report.service.ts
|
|
@@ -5076,6 +5130,10 @@ var ExtensionService = class {
|
|
|
5076
5130
|
ok: true
|
|
5077
5131
|
};
|
|
5078
5132
|
}
|
|
5133
|
+
async memberCabinetSiteMachine() {
|
|
5134
|
+
const res = await this.client.request(MEMBER_CABINET_SITE_MACHINE_QUERY);
|
|
5135
|
+
return res.ok ? { ok: res.ok, data: res.data.memberCabinetSiteMachine } : res;
|
|
5136
|
+
}
|
|
5079
5137
|
};
|
|
5080
5138
|
|
|
5081
5139
|
// src/utils/clone-date.ts
|
|
@@ -5518,8 +5576,8 @@ function pollable(func, config) {
|
|
|
5518
5576
|
};
|
|
5519
5577
|
}
|
|
5520
5578
|
|
|
5521
|
-
// src/sdk/session-manager.ts
|
|
5522
|
-
var
|
|
5579
|
+
// src/sdk/session-manager-cookie.ts
|
|
5580
|
+
var SessionManagerCookie = class {
|
|
5523
5581
|
logger;
|
|
5524
5582
|
storageKey = "session";
|
|
5525
5583
|
platformStorageKey = "session/platform";
|
|
@@ -5530,10 +5588,6 @@ var SessionManager = class {
|
|
|
5530
5588
|
this.authService = config.authService;
|
|
5531
5589
|
this.walletService = config.walletService;
|
|
5532
5590
|
this.logger = config.logger;
|
|
5533
|
-
if (config.sessionPrefix) {
|
|
5534
|
-
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
5535
|
-
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
5536
|
-
}
|
|
5537
5591
|
}
|
|
5538
5592
|
get refreshing() {
|
|
5539
5593
|
return this._refreshing;
|
|
@@ -5542,16 +5596,6 @@ var SessionManager = class {
|
|
|
5542
5596
|
this._refreshing = value;
|
|
5543
5597
|
}
|
|
5544
5598
|
async create(input) {
|
|
5545
|
-
if (this.isServer) {
|
|
5546
|
-
this.logger.warn("'localStorage' is not available on the server.");
|
|
5547
|
-
return {
|
|
5548
|
-
ok: false,
|
|
5549
|
-
error: {
|
|
5550
|
-
name: "UnknownError",
|
|
5551
|
-
message: "Server sign in is not supported."
|
|
5552
|
-
}
|
|
5553
|
-
};
|
|
5554
|
-
}
|
|
5555
5599
|
if (input.type === "MAYA") {
|
|
5556
5600
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
5557
5601
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -5578,13 +5622,14 @@ var SessionManager = class {
|
|
|
5578
5622
|
})();
|
|
5579
5623
|
if (!r1.ok) return r1;
|
|
5580
5624
|
const now2 = /* @__PURE__ */ new Date();
|
|
5581
|
-
|
|
5625
|
+
cookies.set(
|
|
5582
5626
|
this.storageKey,
|
|
5583
5627
|
JSON.stringify({
|
|
5584
5628
|
...r1.data,
|
|
5585
5629
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5586
5630
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5587
|
-
})
|
|
5631
|
+
}),
|
|
5632
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5588
5633
|
);
|
|
5589
5634
|
return {
|
|
5590
5635
|
ok: true,
|
|
@@ -5595,13 +5640,16 @@ var SessionManager = class {
|
|
|
5595
5640
|
const res2 = await this.authService.createSession(input);
|
|
5596
5641
|
if (res2.ok) {
|
|
5597
5642
|
const now2 = /* @__PURE__ */ new Date();
|
|
5598
|
-
|
|
5643
|
+
cookies.set(
|
|
5599
5644
|
this.storageKey,
|
|
5600
5645
|
JSON.stringify({
|
|
5601
5646
|
...res2.data,
|
|
5602
5647
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5603
5648
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5604
|
-
})
|
|
5649
|
+
}),
|
|
5650
|
+
{
|
|
5651
|
+
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5652
|
+
}
|
|
5605
5653
|
);
|
|
5606
5654
|
return {
|
|
5607
5655
|
ok: true,
|
|
@@ -5613,18 +5661,18 @@ var SessionManager = class {
|
|
|
5613
5661
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
5614
5662
|
const res2 = await this.authService.createSession({
|
|
5615
5663
|
type: "SOCIALS",
|
|
5616
|
-
token: input.token
|
|
5617
|
-
channel: input.channel
|
|
5664
|
+
token: input.token
|
|
5618
5665
|
});
|
|
5619
5666
|
if (res2.ok) {
|
|
5620
5667
|
const now2 = /* @__PURE__ */ new Date();
|
|
5621
|
-
|
|
5668
|
+
cookies.set(
|
|
5622
5669
|
this.storageKey,
|
|
5623
5670
|
JSON.stringify({
|
|
5624
5671
|
...res2.data,
|
|
5625
5672
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5626
5673
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5627
|
-
})
|
|
5674
|
+
}),
|
|
5675
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5628
5676
|
);
|
|
5629
5677
|
return {
|
|
5630
5678
|
ok: true,
|
|
@@ -5638,13 +5686,14 @@ var SessionManager = class {
|
|
|
5638
5686
|
const res2 = await this.authService.createSession(input);
|
|
5639
5687
|
if (res2.ok) {
|
|
5640
5688
|
const now2 = /* @__PURE__ */ new Date();
|
|
5641
|
-
|
|
5689
|
+
cookies.set(
|
|
5642
5690
|
this.storageKey,
|
|
5643
5691
|
JSON.stringify({
|
|
5644
5692
|
...res2.data,
|
|
5645
5693
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5646
5694
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5647
|
-
})
|
|
5695
|
+
}),
|
|
5696
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5648
5697
|
);
|
|
5649
5698
|
return {
|
|
5650
5699
|
ok: true,
|
|
@@ -5664,13 +5713,14 @@ var SessionManager = class {
|
|
|
5664
5713
|
};
|
|
5665
5714
|
}
|
|
5666
5715
|
const now = /* @__PURE__ */ new Date();
|
|
5667
|
-
|
|
5716
|
+
cookies.set(
|
|
5668
5717
|
this.storageKey,
|
|
5669
5718
|
JSON.stringify({
|
|
5670
5719
|
...res.data,
|
|
5671
5720
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5672
5721
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5673
|
-
})
|
|
5722
|
+
}),
|
|
5723
|
+
{}
|
|
5674
5724
|
);
|
|
5675
5725
|
return {
|
|
5676
5726
|
ok: true,
|
|
@@ -5682,15 +5732,18 @@ var SessionManager = class {
|
|
|
5682
5732
|
if (res.ok) {
|
|
5683
5733
|
const now = /* @__PURE__ */ new Date();
|
|
5684
5734
|
if (this.isServer) {
|
|
5685
|
-
this.logger.warn("'
|
|
5735
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5686
5736
|
} else {
|
|
5687
|
-
|
|
5737
|
+
cookies.set(
|
|
5688
5738
|
this.storageKey,
|
|
5689
5739
|
JSON.stringify({
|
|
5690
5740
|
...res.data,
|
|
5691
5741
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5692
5742
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5693
|
-
})
|
|
5743
|
+
}),
|
|
5744
|
+
{
|
|
5745
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5746
|
+
}
|
|
5694
5747
|
);
|
|
5695
5748
|
}
|
|
5696
5749
|
return { ok: true };
|
|
@@ -5700,7 +5753,7 @@ var SessionManager = class {
|
|
|
5700
5753
|
}
|
|
5701
5754
|
async get() {
|
|
5702
5755
|
if (this.isServer) {
|
|
5703
|
-
this.logger.warn("'
|
|
5756
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5704
5757
|
return {
|
|
5705
5758
|
ok: true,
|
|
5706
5759
|
data: null
|
|
@@ -5710,7 +5763,7 @@ var SessionManager = class {
|
|
|
5710
5763
|
await sleep(1e3);
|
|
5711
5764
|
return await this.get();
|
|
5712
5765
|
}
|
|
5713
|
-
const val =
|
|
5766
|
+
const val = cookies.get(this.storageKey);
|
|
5714
5767
|
if (!val) {
|
|
5715
5768
|
return {
|
|
5716
5769
|
ok: true,
|
|
@@ -5724,7 +5777,7 @@ var SessionManager = class {
|
|
|
5724
5777
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
5725
5778
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
5726
5779
|
this.logger.warn("Session expired. Logging out..");
|
|
5727
|
-
|
|
5780
|
+
cookies.remove(this.storageKey);
|
|
5728
5781
|
return {
|
|
5729
5782
|
ok: false,
|
|
5730
5783
|
error: {
|
|
@@ -5741,7 +5794,7 @@ var SessionManager = class {
|
|
|
5741
5794
|
if (!res.ok) {
|
|
5742
5795
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5743
5796
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5744
|
-
|
|
5797
|
+
cookies.remove(this.storageKey);
|
|
5745
5798
|
return {
|
|
5746
5799
|
ok: false,
|
|
5747
5800
|
error: res.error
|
|
@@ -5762,7 +5815,9 @@ var SessionManager = class {
|
|
|
5762
5815
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5763
5816
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5764
5817
|
};
|
|
5765
|
-
|
|
5818
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
5819
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5820
|
+
});
|
|
5766
5821
|
}
|
|
5767
5822
|
return {
|
|
5768
5823
|
ok: true,
|
|
@@ -5780,13 +5835,13 @@ var SessionManager = class {
|
|
|
5780
5835
|
}
|
|
5781
5836
|
async refresh() {
|
|
5782
5837
|
if (this.isServer) {
|
|
5783
|
-
this.logger.warn("'
|
|
5838
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5784
5839
|
return {
|
|
5785
5840
|
ok: true,
|
|
5786
5841
|
data: null
|
|
5787
5842
|
};
|
|
5788
5843
|
}
|
|
5789
|
-
const val =
|
|
5844
|
+
const val = cookies.get(this.storageKey);
|
|
5790
5845
|
if (!val) {
|
|
5791
5846
|
return {
|
|
5792
5847
|
ok: true,
|
|
@@ -5803,7 +5858,7 @@ var SessionManager = class {
|
|
|
5803
5858
|
if (!res.ok) {
|
|
5804
5859
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5805
5860
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5806
|
-
|
|
5861
|
+
cookies.remove(this.storageKey);
|
|
5807
5862
|
return {
|
|
5808
5863
|
ok: false,
|
|
5809
5864
|
error: res.error
|
|
@@ -5824,7 +5879,9 @@ var SessionManager = class {
|
|
|
5824
5879
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5825
5880
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5826
5881
|
};
|
|
5827
|
-
|
|
5882
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
5883
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5884
|
+
});
|
|
5828
5885
|
return {
|
|
5829
5886
|
ok: true,
|
|
5830
5887
|
data: obj
|
|
@@ -5841,18 +5898,18 @@ var SessionManager = class {
|
|
|
5841
5898
|
}
|
|
5842
5899
|
async destroy() {
|
|
5843
5900
|
if (this.isServer) {
|
|
5844
|
-
this.logger.warn("'
|
|
5901
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5845
5902
|
return;
|
|
5846
5903
|
}
|
|
5847
5904
|
const res = await this.get();
|
|
5848
5905
|
if (res.data?.accessToken) {
|
|
5849
5906
|
await this.authService.destroySession(res.data.accessToken);
|
|
5850
5907
|
}
|
|
5851
|
-
|
|
5908
|
+
cookies.remove(this.storageKey);
|
|
5852
5909
|
}
|
|
5853
5910
|
async verify() {
|
|
5854
5911
|
if (this.isServer) {
|
|
5855
|
-
this.logger.warn("'
|
|
5912
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5856
5913
|
return true;
|
|
5857
5914
|
}
|
|
5858
5915
|
const s = await this.get();
|
|
@@ -5862,13 +5919,13 @@ var SessionManager = class {
|
|
|
5862
5919
|
if (!s.data) return true;
|
|
5863
5920
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
5864
5921
|
if (!v) {
|
|
5865
|
-
|
|
5922
|
+
cookies.remove(this.storageKey);
|
|
5866
5923
|
}
|
|
5867
5924
|
return v;
|
|
5868
5925
|
}
|
|
5869
5926
|
get onMaya() {
|
|
5870
5927
|
if (this.isServer) {
|
|
5871
|
-
this.logger.warn("'
|
|
5928
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
5872
5929
|
return false;
|
|
5873
5930
|
}
|
|
5874
5931
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -5884,7 +5941,9 @@ var SessionManager = class {
|
|
|
5884
5941
|
return typeof window === "undefined";
|
|
5885
5942
|
}
|
|
5886
5943
|
};
|
|
5887
|
-
|
|
5944
|
+
|
|
5945
|
+
// src/sdk/session-manager.ts
|
|
5946
|
+
var SessionManager = class {
|
|
5888
5947
|
logger;
|
|
5889
5948
|
storageKey = "session";
|
|
5890
5949
|
platformStorageKey = "session/platform";
|
|
@@ -5895,6 +5954,10 @@ var SessionManagerCookie = class {
|
|
|
5895
5954
|
this.authService = config.authService;
|
|
5896
5955
|
this.walletService = config.walletService;
|
|
5897
5956
|
this.logger = config.logger;
|
|
5957
|
+
if (config.sessionPrefix) {
|
|
5958
|
+
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
5959
|
+
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
5960
|
+
}
|
|
5898
5961
|
}
|
|
5899
5962
|
get refreshing() {
|
|
5900
5963
|
return this._refreshing;
|
|
@@ -5903,6 +5966,16 @@ var SessionManagerCookie = class {
|
|
|
5903
5966
|
this._refreshing = value;
|
|
5904
5967
|
}
|
|
5905
5968
|
async create(input) {
|
|
5969
|
+
if (this.isServer) {
|
|
5970
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5971
|
+
return {
|
|
5972
|
+
ok: false,
|
|
5973
|
+
error: {
|
|
5974
|
+
name: "UnknownError",
|
|
5975
|
+
message: "Server sign in is not supported."
|
|
5976
|
+
}
|
|
5977
|
+
};
|
|
5978
|
+
}
|
|
5906
5979
|
if (input.type === "MAYA") {
|
|
5907
5980
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
5908
5981
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -5929,14 +6002,13 @@ var SessionManagerCookie = class {
|
|
|
5929
6002
|
})();
|
|
5930
6003
|
if (!r1.ok) return r1;
|
|
5931
6004
|
const now2 = /* @__PURE__ */ new Date();
|
|
5932
|
-
|
|
6005
|
+
localStorage.setItem(
|
|
5933
6006
|
this.storageKey,
|
|
5934
6007
|
JSON.stringify({
|
|
5935
6008
|
...r1.data,
|
|
5936
6009
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5937
6010
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5938
|
-
})
|
|
5939
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6011
|
+
})
|
|
5940
6012
|
);
|
|
5941
6013
|
return {
|
|
5942
6014
|
ok: true,
|
|
@@ -5947,16 +6019,13 @@ var SessionManagerCookie = class {
|
|
|
5947
6019
|
const res2 = await this.authService.createSession(input);
|
|
5948
6020
|
if (res2.ok) {
|
|
5949
6021
|
const now2 = /* @__PURE__ */ new Date();
|
|
5950
|
-
|
|
6022
|
+
localStorage.setItem(
|
|
5951
6023
|
this.storageKey,
|
|
5952
6024
|
JSON.stringify({
|
|
5953
6025
|
...res2.data,
|
|
5954
6026
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5955
6027
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5956
|
-
})
|
|
5957
|
-
{
|
|
5958
|
-
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5959
|
-
}
|
|
6028
|
+
})
|
|
5960
6029
|
);
|
|
5961
6030
|
return {
|
|
5962
6031
|
ok: true,
|
|
@@ -5968,18 +6037,18 @@ var SessionManagerCookie = class {
|
|
|
5968
6037
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
5969
6038
|
const res2 = await this.authService.createSession({
|
|
5970
6039
|
type: "SOCIALS",
|
|
5971
|
-
token: input.token
|
|
6040
|
+
token: input.token,
|
|
6041
|
+
channel: input.channel
|
|
5972
6042
|
});
|
|
5973
6043
|
if (res2.ok) {
|
|
5974
6044
|
const now2 = /* @__PURE__ */ new Date();
|
|
5975
|
-
|
|
6045
|
+
localStorage.setItem(
|
|
5976
6046
|
this.storageKey,
|
|
5977
6047
|
JSON.stringify({
|
|
5978
6048
|
...res2.data,
|
|
5979
6049
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5980
6050
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5981
|
-
})
|
|
5982
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6051
|
+
})
|
|
5983
6052
|
);
|
|
5984
6053
|
return {
|
|
5985
6054
|
ok: true,
|
|
@@ -5993,14 +6062,13 @@ var SessionManagerCookie = class {
|
|
|
5993
6062
|
const res2 = await this.authService.createSession(input);
|
|
5994
6063
|
if (res2.ok) {
|
|
5995
6064
|
const now2 = /* @__PURE__ */ new Date();
|
|
5996
|
-
|
|
6065
|
+
localStorage.setItem(
|
|
5997
6066
|
this.storageKey,
|
|
5998
6067
|
JSON.stringify({
|
|
5999
6068
|
...res2.data,
|
|
6000
6069
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
6001
6070
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6002
|
-
})
|
|
6003
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6071
|
+
})
|
|
6004
6072
|
);
|
|
6005
6073
|
return {
|
|
6006
6074
|
ok: true,
|
|
@@ -6020,14 +6088,13 @@ var SessionManagerCookie = class {
|
|
|
6020
6088
|
};
|
|
6021
6089
|
}
|
|
6022
6090
|
const now = /* @__PURE__ */ new Date();
|
|
6023
|
-
|
|
6091
|
+
localStorage.setItem(
|
|
6024
6092
|
this.storageKey,
|
|
6025
6093
|
JSON.stringify({
|
|
6026
6094
|
...res.data,
|
|
6027
6095
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6028
6096
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6029
|
-
})
|
|
6030
|
-
{}
|
|
6097
|
+
})
|
|
6031
6098
|
);
|
|
6032
6099
|
return {
|
|
6033
6100
|
ok: true,
|
|
@@ -6039,18 +6106,15 @@ var SessionManagerCookie = class {
|
|
|
6039
6106
|
if (res.ok) {
|
|
6040
6107
|
const now = /* @__PURE__ */ new Date();
|
|
6041
6108
|
if (this.isServer) {
|
|
6042
|
-
this.logger.warn("'
|
|
6109
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6043
6110
|
} else {
|
|
6044
|
-
|
|
6111
|
+
localStorage.setItem(
|
|
6045
6112
|
this.storageKey,
|
|
6046
6113
|
JSON.stringify({
|
|
6047
6114
|
...res.data,
|
|
6048
6115
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6049
6116
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6050
|
-
})
|
|
6051
|
-
{
|
|
6052
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6053
|
-
}
|
|
6117
|
+
})
|
|
6054
6118
|
);
|
|
6055
6119
|
}
|
|
6056
6120
|
return { ok: true };
|
|
@@ -6060,7 +6124,7 @@ var SessionManagerCookie = class {
|
|
|
6060
6124
|
}
|
|
6061
6125
|
async get() {
|
|
6062
6126
|
if (this.isServer) {
|
|
6063
|
-
this.logger.warn("'
|
|
6127
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6064
6128
|
return {
|
|
6065
6129
|
ok: true,
|
|
6066
6130
|
data: null
|
|
@@ -6070,7 +6134,7 @@ var SessionManagerCookie = class {
|
|
|
6070
6134
|
await sleep(1e3);
|
|
6071
6135
|
return await this.get();
|
|
6072
6136
|
}
|
|
6073
|
-
const val =
|
|
6137
|
+
const val = localStorage.getItem(this.storageKey);
|
|
6074
6138
|
if (!val) {
|
|
6075
6139
|
return {
|
|
6076
6140
|
ok: true,
|
|
@@ -6084,7 +6148,7 @@ var SessionManagerCookie = class {
|
|
|
6084
6148
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
6085
6149
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
6086
6150
|
this.logger.warn("Session expired. Logging out..");
|
|
6087
|
-
|
|
6151
|
+
localStorage.removeItem(this.storageKey);
|
|
6088
6152
|
return {
|
|
6089
6153
|
ok: false,
|
|
6090
6154
|
error: {
|
|
@@ -6101,7 +6165,7 @@ var SessionManagerCookie = class {
|
|
|
6101
6165
|
if (!res.ok) {
|
|
6102
6166
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6103
6167
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6104
|
-
|
|
6168
|
+
localStorage.removeItem(this.storageKey);
|
|
6105
6169
|
return {
|
|
6106
6170
|
ok: false,
|
|
6107
6171
|
error: res.error
|
|
@@ -6122,9 +6186,7 @@ var SessionManagerCookie = class {
|
|
|
6122
6186
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6123
6187
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6124
6188
|
};
|
|
6125
|
-
|
|
6126
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6127
|
-
});
|
|
6189
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
6128
6190
|
}
|
|
6129
6191
|
return {
|
|
6130
6192
|
ok: true,
|
|
@@ -6142,13 +6204,13 @@ var SessionManagerCookie = class {
|
|
|
6142
6204
|
}
|
|
6143
6205
|
async refresh() {
|
|
6144
6206
|
if (this.isServer) {
|
|
6145
|
-
this.logger.warn("'
|
|
6207
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6146
6208
|
return {
|
|
6147
6209
|
ok: true,
|
|
6148
6210
|
data: null
|
|
6149
6211
|
};
|
|
6150
6212
|
}
|
|
6151
|
-
const val =
|
|
6213
|
+
const val = localStorage.getItem(this.storageKey);
|
|
6152
6214
|
if (!val) {
|
|
6153
6215
|
return {
|
|
6154
6216
|
ok: true,
|
|
@@ -6165,7 +6227,7 @@ var SessionManagerCookie = class {
|
|
|
6165
6227
|
if (!res.ok) {
|
|
6166
6228
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6167
6229
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6168
|
-
|
|
6230
|
+
localStorage.removeItem(this.storageKey);
|
|
6169
6231
|
return {
|
|
6170
6232
|
ok: false,
|
|
6171
6233
|
error: res.error
|
|
@@ -6186,9 +6248,7 @@ var SessionManagerCookie = class {
|
|
|
6186
6248
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6187
6249
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6188
6250
|
};
|
|
6189
|
-
|
|
6190
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6191
|
-
});
|
|
6251
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
6192
6252
|
return {
|
|
6193
6253
|
ok: true,
|
|
6194
6254
|
data: obj
|
|
@@ -6205,18 +6265,18 @@ var SessionManagerCookie = class {
|
|
|
6205
6265
|
}
|
|
6206
6266
|
async destroy() {
|
|
6207
6267
|
if (this.isServer) {
|
|
6208
|
-
this.logger.warn("'
|
|
6268
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6209
6269
|
return;
|
|
6210
6270
|
}
|
|
6211
6271
|
const res = await this.get();
|
|
6212
6272
|
if (res.data?.accessToken) {
|
|
6213
6273
|
await this.authService.destroySession(res.data.accessToken);
|
|
6214
6274
|
}
|
|
6215
|
-
|
|
6275
|
+
localStorage.removeItem(this.storageKey);
|
|
6216
6276
|
}
|
|
6217
6277
|
async verify() {
|
|
6218
6278
|
if (this.isServer) {
|
|
6219
|
-
this.logger.warn("'
|
|
6279
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6220
6280
|
return true;
|
|
6221
6281
|
}
|
|
6222
6282
|
const s = await this.get();
|
|
@@ -6226,13 +6286,13 @@ var SessionManagerCookie = class {
|
|
|
6226
6286
|
if (!s.data) return true;
|
|
6227
6287
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
6228
6288
|
if (!v) {
|
|
6229
|
-
|
|
6289
|
+
localStorage.removeItem(this.storageKey);
|
|
6230
6290
|
}
|
|
6231
6291
|
return v;
|
|
6232
6292
|
}
|
|
6233
6293
|
get onMaya() {
|
|
6234
6294
|
if (this.isServer) {
|
|
6235
|
-
this.logger.warn("'
|
|
6295
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6236
6296
|
return false;
|
|
6237
6297
|
}
|
|
6238
6298
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -6348,6 +6408,7 @@ var Transformer = class {
|
|
|
6348
6408
|
cashback: this.cashback.bind(this),
|
|
6349
6409
|
bonus: this.bonus.bind(this),
|
|
6350
6410
|
cashbackBonus: this.cashbackBonus.bind(this),
|
|
6411
|
+
memberCabinetSiteMachine: this.memberCabinetSiteMachine.bind(this),
|
|
6351
6412
|
file: this.file.bind(this),
|
|
6352
6413
|
pointsWallet: this.pointsWallet.bind(this),
|
|
6353
6414
|
pointsWalletTransaction: this.pointsWalletTransaction.bind(this),
|
|
@@ -7453,6 +7514,16 @@ var Transformer = class {
|
|
|
7453
7514
|
};
|
|
7454
7515
|
return o;
|
|
7455
7516
|
}
|
|
7517
|
+
memberCabinetSiteMachine(data) {
|
|
7518
|
+
const o = {
|
|
7519
|
+
id: data.id,
|
|
7520
|
+
name: data.name,
|
|
7521
|
+
fingerprint: data.fingerprint,
|
|
7522
|
+
status: data.status,
|
|
7523
|
+
dateTimeCreated: new Date(data.dateTimeCreated)
|
|
7524
|
+
};
|
|
7525
|
+
return o;
|
|
7526
|
+
}
|
|
7456
7527
|
file(data) {
|
|
7457
7528
|
const o = {
|
|
7458
7529
|
id: data.id,
|
|
@@ -8240,6 +8311,19 @@ var Sdk = class {
|
|
|
8240
8311
|
data: this.transformer.transform.site(res.data)
|
|
8241
8312
|
};
|
|
8242
8313
|
}
|
|
8314
|
+
/*
|
|
8315
|
+
*=============================================
|
|
8316
|
+
* MACHINE EXTENSION
|
|
8317
|
+
*=============================================
|
|
8318
|
+
*/
|
|
8319
|
+
async memberCabinetSiteMachine() {
|
|
8320
|
+
const res = await this.extensionService.memberCabinetSiteMachine();
|
|
8321
|
+
if (!res.ok) return res;
|
|
8322
|
+
return {
|
|
8323
|
+
ok: true,
|
|
8324
|
+
data: res.data ? this.transformer.transform.memberCabinetSiteMachine(res.data) : null
|
|
8325
|
+
};
|
|
8326
|
+
}
|
|
8243
8327
|
/*
|
|
8244
8328
|
*=============================================
|
|
8245
8329
|
* PLATFORM
|
|
@@ -9660,6 +9744,36 @@ var Sdk = class {
|
|
|
9660
9744
|
})
|
|
9661
9745
|
};
|
|
9662
9746
|
}
|
|
9747
|
+
async topWinsNext() {
|
|
9748
|
+
const res0 = await this.portalService.topWinsNext();
|
|
9749
|
+
const ids = res0.data?.length ? [...new Set(res0.data.map((e) => e.game.id))] : [];
|
|
9750
|
+
if (ids.length <= 0) {
|
|
9751
|
+
return {
|
|
9752
|
+
ok: true,
|
|
9753
|
+
data: []
|
|
9754
|
+
};
|
|
9755
|
+
}
|
|
9756
|
+
const res1 = await this.cmsPortalService.games({
|
|
9757
|
+
filter: {
|
|
9758
|
+
reference: {
|
|
9759
|
+
in: ids
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
});
|
|
9763
|
+
if (!res1.ok) return res1;
|
|
9764
|
+
return {
|
|
9765
|
+
ok: true,
|
|
9766
|
+
data: res0?.data?.map((o) => {
|
|
9767
|
+
const game = res1.data.edges.find(
|
|
9768
|
+
(e) => e.node.reference === o.game.id
|
|
9769
|
+
)?.node;
|
|
9770
|
+
return this.transformer.transform.topWin({
|
|
9771
|
+
...o,
|
|
9772
|
+
game
|
|
9773
|
+
});
|
|
9774
|
+
})
|
|
9775
|
+
};
|
|
9776
|
+
}
|
|
9663
9777
|
/*
|
|
9664
9778
|
*=============================================
|
|
9665
9779
|
* JACKPOT
|
|
@@ -9813,7 +9927,7 @@ var ENDPOINTS = {
|
|
|
9813
9927
|
opexapay: "https://external.opexapay.opexa.io"
|
|
9814
9928
|
},
|
|
9815
9929
|
staging: {
|
|
9816
|
-
auth: "https://auth.staging.
|
|
9930
|
+
auth: "https://auth.staging.opexacms.io",
|
|
9817
9931
|
game: "https://game.staging.atalos.io/graphql",
|
|
9818
9932
|
extension: "https://extension.staging.atalos.io/graphql",
|
|
9819
9933
|
file: "https://file.staging.atalos.io/graphql",
|