@opexa/portal-sdk 0.54.2 → 0.54.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 +135 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +135 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -608,6 +608,7 @@ interface Account {
|
|
|
608
608
|
achievementPointsLevelUpProgressPercentage?: number;
|
|
609
609
|
currentUniqueGamesCount?: number;
|
|
610
610
|
currentNewGamesCount?: number;
|
|
611
|
+
currentAchievements?: Array<AchievementType>;
|
|
611
612
|
currentBetsCount?: number;
|
|
612
613
|
currentActiveDaysCount?: number;
|
|
613
614
|
dateTimeLastLeveledUp?: Date;
|
|
@@ -1862,7 +1863,7 @@ interface CabinetSiteMachine {
|
|
|
1862
1863
|
status: CabinetSiteMachineStatus;
|
|
1863
1864
|
dateTimeCreated: Date;
|
|
1864
1865
|
}
|
|
1865
|
-
type CabinetSiteMachineStatus =
|
|
1866
|
+
type CabinetSiteMachineStatus = 'ENABLED' | 'DISABLED';
|
|
1866
1867
|
type CabinetWithdrawalReturn = OperationResult<never, WithdrawalRecord | null>;
|
|
1867
1868
|
|
|
1868
1869
|
interface SdkConfig {
|
package/dist/index.d.ts
CHANGED
|
@@ -608,6 +608,7 @@ interface Account {
|
|
|
608
608
|
achievementPointsLevelUpProgressPercentage?: number;
|
|
609
609
|
currentUniqueGamesCount?: number;
|
|
610
610
|
currentNewGamesCount?: number;
|
|
611
|
+
currentAchievements?: Array<AchievementType>;
|
|
611
612
|
currentBetsCount?: number;
|
|
612
613
|
currentActiveDaysCount?: number;
|
|
613
614
|
dateTimeLastLeveledUp?: Date;
|
|
@@ -1862,7 +1863,7 @@ interface CabinetSiteMachine {
|
|
|
1862
1863
|
status: CabinetSiteMachineStatus;
|
|
1863
1864
|
dateTimeCreated: Date;
|
|
1864
1865
|
}
|
|
1865
|
-
type CabinetSiteMachineStatus =
|
|
1866
|
+
type CabinetSiteMachineStatus = 'ENABLED' | 'DISABLED';
|
|
1866
1867
|
type CabinetWithdrawalReturn = OperationResult<never, WithdrawalRecord | null>;
|
|
1867
1868
|
|
|
1868
1869
|
interface SdkConfig {
|
package/dist/index.js
CHANGED
|
@@ -1556,7 +1556,7 @@ gql`
|
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
`;
|
|
1559
|
-
var
|
|
1559
|
+
var MEMBER_ACCOUNT_QUERY_DEVELOPMENT = gql`
|
|
1560
1560
|
query MemberAccount {
|
|
1561
1561
|
memberAccount: self {
|
|
1562
1562
|
... on MemberAccount {
|
|
@@ -1579,6 +1579,7 @@ var MEMBER_ACCOUNT_QUERY = gql`
|
|
|
1579
1579
|
currentNewGamesCount
|
|
1580
1580
|
currentBetsCount
|
|
1581
1581
|
currentActiveDaysCount
|
|
1582
|
+
currentAchievements
|
|
1582
1583
|
dateTimeLastLeveledUp
|
|
1583
1584
|
currentMonthlyTurnover
|
|
1584
1585
|
turnoverLevelUpProgressPercentage
|
|
@@ -1595,6 +1596,42 @@ var MEMBER_ACCOUNT_QUERY = gql`
|
|
|
1595
1596
|
}
|
|
1596
1597
|
}
|
|
1597
1598
|
`;
|
|
1599
|
+
var MEMBER_ACCOUNT_QUERY = gql`
|
|
1600
|
+
query MemberAccount {
|
|
1601
|
+
memberAccount: self {
|
|
1602
|
+
... on MemberAccount {
|
|
1603
|
+
id
|
|
1604
|
+
name
|
|
1605
|
+
status
|
|
1606
|
+
realName
|
|
1607
|
+
emailAddress
|
|
1608
|
+
mobileNumber
|
|
1609
|
+
birthDay
|
|
1610
|
+
verified
|
|
1611
|
+
verificationStatus
|
|
1612
|
+
nickName
|
|
1613
|
+
validId
|
|
1614
|
+
mobileNumberVerified
|
|
1615
|
+
mobileNumberVerificationRequired
|
|
1616
|
+
currentMonthlyAchievementPoints
|
|
1617
|
+
achievementPointsLevelUpProgressPercentage
|
|
1618
|
+
currentUniqueGamesCount
|
|
1619
|
+
currentNewGamesCount
|
|
1620
|
+
currentBetsCount
|
|
1621
|
+
currentActiveDaysCount
|
|
1622
|
+
dateTimeLastLeveledUp
|
|
1623
|
+
currentMonthlyTurnover
|
|
1624
|
+
turnoverLevelUpProgressPercentage
|
|
1625
|
+
transactionPassword
|
|
1626
|
+
secretAnswerSubmitted
|
|
1627
|
+
dateTimeCreated
|
|
1628
|
+
dateTimeLastUpdated
|
|
1629
|
+
domain
|
|
1630
|
+
branchCode
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
`;
|
|
1598
1635
|
var MEMBER_VERIFICATION_QUERY = gql`
|
|
1599
1636
|
${FILE_FRAGMENT}
|
|
1600
1637
|
|
|
@@ -3044,12 +3081,16 @@ function createOperationError(code) {
|
|
|
3044
3081
|
// src/services/account.service.ts
|
|
3045
3082
|
var AccountService = class {
|
|
3046
3083
|
client;
|
|
3047
|
-
|
|
3084
|
+
environment;
|
|
3085
|
+
constructor(client, environment) {
|
|
3048
3086
|
this.client = client;
|
|
3087
|
+
this.environment = environment;
|
|
3049
3088
|
}
|
|
3050
3089
|
/** aka `Query.self` */
|
|
3051
3090
|
async memberAccount() {
|
|
3052
|
-
const res = await this.client.request(
|
|
3091
|
+
const res = await this.client.request(
|
|
3092
|
+
this.environment === "production" ? MEMBER_ACCOUNT_QUERY : MEMBER_ACCOUNT_QUERY_DEVELOPMENT
|
|
3093
|
+
);
|
|
3053
3094
|
if (!res.ok) return res;
|
|
3054
3095
|
return {
|
|
3055
3096
|
ok: true,
|
|
@@ -5664,8 +5705,8 @@ function pollable(func, config) {
|
|
|
5664
5705
|
};
|
|
5665
5706
|
}
|
|
5666
5707
|
|
|
5667
|
-
// src/sdk/session-manager
|
|
5668
|
-
var
|
|
5708
|
+
// src/sdk/session-manager.ts
|
|
5709
|
+
var SessionManager = class {
|
|
5669
5710
|
logger;
|
|
5670
5711
|
storageKey = "session";
|
|
5671
5712
|
platformStorageKey = "session/platform";
|
|
@@ -5676,6 +5717,10 @@ var SessionManagerCookie = class {
|
|
|
5676
5717
|
this.authService = config.authService;
|
|
5677
5718
|
this.walletService = config.walletService;
|
|
5678
5719
|
this.logger = config.logger;
|
|
5720
|
+
if (config.sessionPrefix) {
|
|
5721
|
+
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
5722
|
+
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
5723
|
+
}
|
|
5679
5724
|
}
|
|
5680
5725
|
get refreshing() {
|
|
5681
5726
|
return this._refreshing;
|
|
@@ -5684,6 +5729,16 @@ var SessionManagerCookie = class {
|
|
|
5684
5729
|
this._refreshing = value;
|
|
5685
5730
|
}
|
|
5686
5731
|
async create(input) {
|
|
5732
|
+
if (this.isServer) {
|
|
5733
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5734
|
+
return {
|
|
5735
|
+
ok: false,
|
|
5736
|
+
error: {
|
|
5737
|
+
name: "UnknownError",
|
|
5738
|
+
message: "Server sign in is not supported."
|
|
5739
|
+
}
|
|
5740
|
+
};
|
|
5741
|
+
}
|
|
5687
5742
|
if (input.type === "MAYA") {
|
|
5688
5743
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
5689
5744
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -5710,14 +5765,13 @@ var SessionManagerCookie = class {
|
|
|
5710
5765
|
})();
|
|
5711
5766
|
if (!r1.ok) return r1;
|
|
5712
5767
|
const now2 = /* @__PURE__ */ new Date();
|
|
5713
|
-
|
|
5768
|
+
localStorage.setItem(
|
|
5714
5769
|
this.storageKey,
|
|
5715
5770
|
JSON.stringify({
|
|
5716
5771
|
...r1.data,
|
|
5717
5772
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5718
5773
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5719
|
-
})
|
|
5720
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5774
|
+
})
|
|
5721
5775
|
);
|
|
5722
5776
|
return {
|
|
5723
5777
|
ok: true,
|
|
@@ -5728,16 +5782,13 @@ var SessionManagerCookie = class {
|
|
|
5728
5782
|
const res2 = await this.authService.createSession(input);
|
|
5729
5783
|
if (res2.ok) {
|
|
5730
5784
|
const now2 = /* @__PURE__ */ new Date();
|
|
5731
|
-
|
|
5785
|
+
localStorage.setItem(
|
|
5732
5786
|
this.storageKey,
|
|
5733
5787
|
JSON.stringify({
|
|
5734
5788
|
...res2.data,
|
|
5735
5789
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5736
5790
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5737
|
-
})
|
|
5738
|
-
{
|
|
5739
|
-
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5740
|
-
}
|
|
5791
|
+
})
|
|
5741
5792
|
);
|
|
5742
5793
|
return {
|
|
5743
5794
|
ok: true,
|
|
@@ -5749,18 +5800,18 @@ var SessionManagerCookie = class {
|
|
|
5749
5800
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
5750
5801
|
const res2 = await this.authService.createSession({
|
|
5751
5802
|
type: "SOCIALS",
|
|
5752
|
-
token: input.token
|
|
5803
|
+
token: input.token,
|
|
5804
|
+
channel: input.channel
|
|
5753
5805
|
});
|
|
5754
5806
|
if (res2.ok) {
|
|
5755
5807
|
const now2 = /* @__PURE__ */ new Date();
|
|
5756
|
-
|
|
5808
|
+
localStorage.setItem(
|
|
5757
5809
|
this.storageKey,
|
|
5758
5810
|
JSON.stringify({
|
|
5759
5811
|
...res2.data,
|
|
5760
5812
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5761
5813
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5762
|
-
})
|
|
5763
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5814
|
+
})
|
|
5764
5815
|
);
|
|
5765
5816
|
return {
|
|
5766
5817
|
ok: true,
|
|
@@ -5774,14 +5825,13 @@ var SessionManagerCookie = class {
|
|
|
5774
5825
|
const res2 = await this.authService.createSession(input);
|
|
5775
5826
|
if (res2.ok) {
|
|
5776
5827
|
const now2 = /* @__PURE__ */ new Date();
|
|
5777
|
-
|
|
5828
|
+
localStorage.setItem(
|
|
5778
5829
|
this.storageKey,
|
|
5779
5830
|
JSON.stringify({
|
|
5780
5831
|
...res2.data,
|
|
5781
5832
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
5782
5833
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
5783
|
-
})
|
|
5784
|
-
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
5834
|
+
})
|
|
5785
5835
|
);
|
|
5786
5836
|
return {
|
|
5787
5837
|
ok: true,
|
|
@@ -5801,14 +5851,13 @@ var SessionManagerCookie = class {
|
|
|
5801
5851
|
};
|
|
5802
5852
|
}
|
|
5803
5853
|
const now = /* @__PURE__ */ new Date();
|
|
5804
|
-
|
|
5854
|
+
localStorage.setItem(
|
|
5805
5855
|
this.storageKey,
|
|
5806
5856
|
JSON.stringify({
|
|
5807
5857
|
...res.data,
|
|
5808
5858
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5809
5859
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5810
|
-
})
|
|
5811
|
-
{}
|
|
5860
|
+
})
|
|
5812
5861
|
);
|
|
5813
5862
|
return {
|
|
5814
5863
|
ok: true,
|
|
@@ -5820,18 +5869,15 @@ var SessionManagerCookie = class {
|
|
|
5820
5869
|
if (res.ok) {
|
|
5821
5870
|
const now = /* @__PURE__ */ new Date();
|
|
5822
5871
|
if (this.isServer) {
|
|
5823
|
-
this.logger.warn("'
|
|
5872
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5824
5873
|
} else {
|
|
5825
|
-
|
|
5874
|
+
localStorage.setItem(
|
|
5826
5875
|
this.storageKey,
|
|
5827
5876
|
JSON.stringify({
|
|
5828
5877
|
...res.data,
|
|
5829
5878
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5830
5879
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5831
|
-
})
|
|
5832
|
-
{
|
|
5833
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5834
|
-
}
|
|
5880
|
+
})
|
|
5835
5881
|
);
|
|
5836
5882
|
}
|
|
5837
5883
|
return { ok: true };
|
|
@@ -5841,7 +5887,7 @@ var SessionManagerCookie = class {
|
|
|
5841
5887
|
}
|
|
5842
5888
|
async get() {
|
|
5843
5889
|
if (this.isServer) {
|
|
5844
|
-
this.logger.warn("'
|
|
5890
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5845
5891
|
return {
|
|
5846
5892
|
ok: true,
|
|
5847
5893
|
data: null
|
|
@@ -5851,7 +5897,7 @@ var SessionManagerCookie = class {
|
|
|
5851
5897
|
await sleep(1e3);
|
|
5852
5898
|
return await this.get();
|
|
5853
5899
|
}
|
|
5854
|
-
const val =
|
|
5900
|
+
const val = localStorage.getItem(this.storageKey);
|
|
5855
5901
|
if (!val) {
|
|
5856
5902
|
return {
|
|
5857
5903
|
ok: true,
|
|
@@ -5865,7 +5911,7 @@ var SessionManagerCookie = class {
|
|
|
5865
5911
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
5866
5912
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
5867
5913
|
this.logger.warn("Session expired. Logging out..");
|
|
5868
|
-
|
|
5914
|
+
localStorage.removeItem(this.storageKey);
|
|
5869
5915
|
return {
|
|
5870
5916
|
ok: false,
|
|
5871
5917
|
error: {
|
|
@@ -5882,7 +5928,7 @@ var SessionManagerCookie = class {
|
|
|
5882
5928
|
if (!res.ok) {
|
|
5883
5929
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5884
5930
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5885
|
-
|
|
5931
|
+
localStorage.removeItem(this.storageKey);
|
|
5886
5932
|
return {
|
|
5887
5933
|
ok: false,
|
|
5888
5934
|
error: res.error
|
|
@@ -5903,9 +5949,7 @@ var SessionManagerCookie = class {
|
|
|
5903
5949
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5904
5950
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5905
5951
|
};
|
|
5906
|
-
|
|
5907
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5908
|
-
});
|
|
5952
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
5909
5953
|
}
|
|
5910
5954
|
return {
|
|
5911
5955
|
ok: true,
|
|
@@ -5923,13 +5967,13 @@ var SessionManagerCookie = class {
|
|
|
5923
5967
|
}
|
|
5924
5968
|
async refresh() {
|
|
5925
5969
|
if (this.isServer) {
|
|
5926
|
-
this.logger.warn("'
|
|
5970
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5927
5971
|
return {
|
|
5928
5972
|
ok: true,
|
|
5929
5973
|
data: null
|
|
5930
5974
|
};
|
|
5931
5975
|
}
|
|
5932
|
-
const val =
|
|
5976
|
+
const val = localStorage.getItem(this.storageKey);
|
|
5933
5977
|
if (!val) {
|
|
5934
5978
|
return {
|
|
5935
5979
|
ok: true,
|
|
@@ -5946,7 +5990,7 @@ var SessionManagerCookie = class {
|
|
|
5946
5990
|
if (!res.ok) {
|
|
5947
5991
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
5948
5992
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
5949
|
-
|
|
5993
|
+
localStorage.removeItem(this.storageKey);
|
|
5950
5994
|
return {
|
|
5951
5995
|
ok: false,
|
|
5952
5996
|
error: res.error
|
|
@@ -5967,9 +6011,7 @@ var SessionManagerCookie = class {
|
|
|
5967
6011
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
5968
6012
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
5969
6013
|
};
|
|
5970
|
-
|
|
5971
|
-
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
5972
|
-
});
|
|
6014
|
+
localStorage.setItem(this.storageKey, JSON.stringify(obj));
|
|
5973
6015
|
return {
|
|
5974
6016
|
ok: true,
|
|
5975
6017
|
data: obj
|
|
@@ -5986,18 +6028,18 @@ var SessionManagerCookie = class {
|
|
|
5986
6028
|
}
|
|
5987
6029
|
async destroy() {
|
|
5988
6030
|
if (this.isServer) {
|
|
5989
|
-
this.logger.warn("'
|
|
6031
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
5990
6032
|
return;
|
|
5991
6033
|
}
|
|
5992
6034
|
const res = await this.get();
|
|
5993
6035
|
if (res.data?.accessToken) {
|
|
5994
6036
|
await this.authService.destroySession(res.data.accessToken);
|
|
5995
6037
|
}
|
|
5996
|
-
|
|
6038
|
+
localStorage.removeItem(this.storageKey);
|
|
5997
6039
|
}
|
|
5998
6040
|
async verify() {
|
|
5999
6041
|
if (this.isServer) {
|
|
6000
|
-
this.logger.warn("'
|
|
6042
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6001
6043
|
return true;
|
|
6002
6044
|
}
|
|
6003
6045
|
const s = await this.get();
|
|
@@ -6007,13 +6049,13 @@ var SessionManagerCookie = class {
|
|
|
6007
6049
|
if (!s.data) return true;
|
|
6008
6050
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
6009
6051
|
if (!v) {
|
|
6010
|
-
|
|
6052
|
+
localStorage.removeItem(this.storageKey);
|
|
6011
6053
|
}
|
|
6012
6054
|
return v;
|
|
6013
6055
|
}
|
|
6014
6056
|
get onMaya() {
|
|
6015
6057
|
if (this.isServer) {
|
|
6016
|
-
this.logger.warn("'
|
|
6058
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
6017
6059
|
return false;
|
|
6018
6060
|
}
|
|
6019
6061
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -6029,9 +6071,7 @@ var SessionManagerCookie = class {
|
|
|
6029
6071
|
return typeof window === "undefined";
|
|
6030
6072
|
}
|
|
6031
6073
|
};
|
|
6032
|
-
|
|
6033
|
-
// src/sdk/session-manager.ts
|
|
6034
|
-
var SessionManager = class {
|
|
6074
|
+
var SessionManagerCookie = class {
|
|
6035
6075
|
logger;
|
|
6036
6076
|
storageKey = "session";
|
|
6037
6077
|
platformStorageKey = "session/platform";
|
|
@@ -6042,10 +6082,6 @@ var SessionManager = class {
|
|
|
6042
6082
|
this.authService = config.authService;
|
|
6043
6083
|
this.walletService = config.walletService;
|
|
6044
6084
|
this.logger = config.logger;
|
|
6045
|
-
if (config.sessionPrefix) {
|
|
6046
|
-
this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
|
|
6047
|
-
this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
|
|
6048
|
-
}
|
|
6049
6085
|
}
|
|
6050
6086
|
get refreshing() {
|
|
6051
6087
|
return this._refreshing;
|
|
@@ -6054,16 +6090,6 @@ var SessionManager = class {
|
|
|
6054
6090
|
this._refreshing = value;
|
|
6055
6091
|
}
|
|
6056
6092
|
async create(input) {
|
|
6057
|
-
if (this.isServer) {
|
|
6058
|
-
this.logger.warn("'localStorage' is not available on the server.");
|
|
6059
|
-
return {
|
|
6060
|
-
ok: false,
|
|
6061
|
-
error: {
|
|
6062
|
-
name: "UnknownError",
|
|
6063
|
-
message: "Server sign in is not supported."
|
|
6064
|
-
}
|
|
6065
|
-
};
|
|
6066
|
-
}
|
|
6067
6093
|
if (input.type === "MAYA") {
|
|
6068
6094
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
6069
6095
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -6090,13 +6116,14 @@ var SessionManager = class {
|
|
|
6090
6116
|
})();
|
|
6091
6117
|
if (!r1.ok) return r1;
|
|
6092
6118
|
const now2 = /* @__PURE__ */ new Date();
|
|
6093
|
-
|
|
6119
|
+
cookies.set(
|
|
6094
6120
|
this.storageKey,
|
|
6095
6121
|
JSON.stringify({
|
|
6096
6122
|
...r1.data,
|
|
6097
6123
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
6098
6124
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6099
|
-
})
|
|
6125
|
+
}),
|
|
6126
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6100
6127
|
);
|
|
6101
6128
|
return {
|
|
6102
6129
|
ok: true,
|
|
@@ -6107,13 +6134,16 @@ var SessionManager = class {
|
|
|
6107
6134
|
const res2 = await this.authService.createSession(input);
|
|
6108
6135
|
if (res2.ok) {
|
|
6109
6136
|
const now2 = /* @__PURE__ */ new Date();
|
|
6110
|
-
|
|
6137
|
+
cookies.set(
|
|
6111
6138
|
this.storageKey,
|
|
6112
6139
|
JSON.stringify({
|
|
6113
6140
|
...res2.data,
|
|
6114
6141
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
6115
6142
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6116
|
-
})
|
|
6143
|
+
}),
|
|
6144
|
+
{
|
|
6145
|
+
expires: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6146
|
+
}
|
|
6117
6147
|
);
|
|
6118
6148
|
return {
|
|
6119
6149
|
ok: true,
|
|
@@ -6125,18 +6155,18 @@ var SessionManager = class {
|
|
|
6125
6155
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
6126
6156
|
const res2 = await this.authService.createSession({
|
|
6127
6157
|
type: "SOCIALS",
|
|
6128
|
-
token: input.token
|
|
6129
|
-
channel: input.channel
|
|
6158
|
+
token: input.token
|
|
6130
6159
|
});
|
|
6131
6160
|
if (res2.ok) {
|
|
6132
6161
|
const now2 = /* @__PURE__ */ new Date();
|
|
6133
|
-
|
|
6162
|
+
cookies.set(
|
|
6134
6163
|
this.storageKey,
|
|
6135
6164
|
JSON.stringify({
|
|
6136
6165
|
...res2.data,
|
|
6137
6166
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
6138
6167
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6139
|
-
})
|
|
6168
|
+
}),
|
|
6169
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6140
6170
|
);
|
|
6141
6171
|
return {
|
|
6142
6172
|
ok: true,
|
|
@@ -6150,13 +6180,14 @@ var SessionManager = class {
|
|
|
6150
6180
|
const res2 = await this.authService.createSession(input);
|
|
6151
6181
|
if (res2.ok) {
|
|
6152
6182
|
const now2 = /* @__PURE__ */ new Date();
|
|
6153
|
-
|
|
6183
|
+
cookies.set(
|
|
6154
6184
|
this.storageKey,
|
|
6155
6185
|
JSON.stringify({
|
|
6156
6186
|
...res2.data,
|
|
6157
6187
|
accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
|
|
6158
6188
|
refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
|
|
6159
|
-
})
|
|
6189
|
+
}),
|
|
6190
|
+
{ expires: subMinutes(addDays(now2, 30), 2).getTime() }
|
|
6160
6191
|
);
|
|
6161
6192
|
return {
|
|
6162
6193
|
ok: true,
|
|
@@ -6176,13 +6207,14 @@ var SessionManager = class {
|
|
|
6176
6207
|
};
|
|
6177
6208
|
}
|
|
6178
6209
|
const now = /* @__PURE__ */ new Date();
|
|
6179
|
-
|
|
6210
|
+
cookies.set(
|
|
6180
6211
|
this.storageKey,
|
|
6181
6212
|
JSON.stringify({
|
|
6182
6213
|
...res.data,
|
|
6183
6214
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6184
6215
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6185
|
-
})
|
|
6216
|
+
}),
|
|
6217
|
+
{}
|
|
6186
6218
|
);
|
|
6187
6219
|
return {
|
|
6188
6220
|
ok: true,
|
|
@@ -6194,15 +6226,18 @@ var SessionManager = class {
|
|
|
6194
6226
|
if (res.ok) {
|
|
6195
6227
|
const now = /* @__PURE__ */ new Date();
|
|
6196
6228
|
if (this.isServer) {
|
|
6197
|
-
this.logger.warn("'
|
|
6229
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6198
6230
|
} else {
|
|
6199
|
-
|
|
6231
|
+
cookies.set(
|
|
6200
6232
|
this.storageKey,
|
|
6201
6233
|
JSON.stringify({
|
|
6202
6234
|
...res.data,
|
|
6203
6235
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6204
6236
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6205
|
-
})
|
|
6237
|
+
}),
|
|
6238
|
+
{
|
|
6239
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6240
|
+
}
|
|
6206
6241
|
);
|
|
6207
6242
|
}
|
|
6208
6243
|
return { ok: true };
|
|
@@ -6212,7 +6247,7 @@ var SessionManager = class {
|
|
|
6212
6247
|
}
|
|
6213
6248
|
async get() {
|
|
6214
6249
|
if (this.isServer) {
|
|
6215
|
-
this.logger.warn("'
|
|
6250
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6216
6251
|
return {
|
|
6217
6252
|
ok: true,
|
|
6218
6253
|
data: null
|
|
@@ -6222,7 +6257,7 @@ var SessionManager = class {
|
|
|
6222
6257
|
await sleep(1e3);
|
|
6223
6258
|
return await this.get();
|
|
6224
6259
|
}
|
|
6225
|
-
const val =
|
|
6260
|
+
const val = cookies.get(this.storageKey);
|
|
6226
6261
|
if (!val) {
|
|
6227
6262
|
return {
|
|
6228
6263
|
ok: true,
|
|
@@ -6236,7 +6271,7 @@ var SessionManager = class {
|
|
|
6236
6271
|
const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
|
|
6237
6272
|
if (isAfter(now, refreshTokenExpiresAt)) {
|
|
6238
6273
|
this.logger.warn("Session expired. Logging out..");
|
|
6239
|
-
|
|
6274
|
+
cookies.remove(this.storageKey);
|
|
6240
6275
|
return {
|
|
6241
6276
|
ok: false,
|
|
6242
6277
|
error: {
|
|
@@ -6253,7 +6288,7 @@ var SessionManager = class {
|
|
|
6253
6288
|
if (!res.ok) {
|
|
6254
6289
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6255
6290
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6256
|
-
|
|
6291
|
+
cookies.remove(this.storageKey);
|
|
6257
6292
|
return {
|
|
6258
6293
|
ok: false,
|
|
6259
6294
|
error: res.error
|
|
@@ -6274,7 +6309,9 @@ var SessionManager = class {
|
|
|
6274
6309
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6275
6310
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6276
6311
|
};
|
|
6277
|
-
|
|
6312
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
6313
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6314
|
+
});
|
|
6278
6315
|
}
|
|
6279
6316
|
return {
|
|
6280
6317
|
ok: true,
|
|
@@ -6292,13 +6329,13 @@ var SessionManager = class {
|
|
|
6292
6329
|
}
|
|
6293
6330
|
async refresh() {
|
|
6294
6331
|
if (this.isServer) {
|
|
6295
|
-
this.logger.warn("'
|
|
6332
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6296
6333
|
return {
|
|
6297
6334
|
ok: true,
|
|
6298
6335
|
data: null
|
|
6299
6336
|
};
|
|
6300
6337
|
}
|
|
6301
|
-
const val =
|
|
6338
|
+
const val = cookies.get(this.storageKey);
|
|
6302
6339
|
if (!val) {
|
|
6303
6340
|
return {
|
|
6304
6341
|
ok: true,
|
|
@@ -6315,7 +6352,7 @@ var SessionManager = class {
|
|
|
6315
6352
|
if (!res.ok) {
|
|
6316
6353
|
this.logger.error(`Failed to refresh session: ${res.error.message}`);
|
|
6317
6354
|
if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
|
|
6318
|
-
|
|
6355
|
+
cookies.remove(this.storageKey);
|
|
6319
6356
|
return {
|
|
6320
6357
|
ok: false,
|
|
6321
6358
|
error: res.error
|
|
@@ -6336,7 +6373,9 @@ var SessionManager = class {
|
|
|
6336
6373
|
accessTokenExpiresAt: addMinutes(now, 8).getTime(),
|
|
6337
6374
|
refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
|
|
6338
6375
|
};
|
|
6339
|
-
|
|
6376
|
+
cookies.set(this.storageKey, JSON.stringify(obj), {
|
|
6377
|
+
expires: subMinutes(addDays(now, 30), 2).getTime()
|
|
6378
|
+
});
|
|
6340
6379
|
return {
|
|
6341
6380
|
ok: true,
|
|
6342
6381
|
data: obj
|
|
@@ -6353,18 +6392,18 @@ var SessionManager = class {
|
|
|
6353
6392
|
}
|
|
6354
6393
|
async destroy() {
|
|
6355
6394
|
if (this.isServer) {
|
|
6356
|
-
this.logger.warn("'
|
|
6395
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6357
6396
|
return;
|
|
6358
6397
|
}
|
|
6359
6398
|
const res = await this.get();
|
|
6360
6399
|
if (res.data?.accessToken) {
|
|
6361
6400
|
await this.authService.destroySession(res.data.accessToken);
|
|
6362
6401
|
}
|
|
6363
|
-
|
|
6402
|
+
cookies.remove(this.storageKey);
|
|
6364
6403
|
}
|
|
6365
6404
|
async verify() {
|
|
6366
6405
|
if (this.isServer) {
|
|
6367
|
-
this.logger.warn("'
|
|
6406
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6368
6407
|
return true;
|
|
6369
6408
|
}
|
|
6370
6409
|
const s = await this.get();
|
|
@@ -6374,13 +6413,13 @@ var SessionManager = class {
|
|
|
6374
6413
|
if (!s.data) return true;
|
|
6375
6414
|
const v = await this.authService.verifySession(s.data.accessToken);
|
|
6376
6415
|
if (!v) {
|
|
6377
|
-
|
|
6416
|
+
cookies.remove(this.storageKey);
|
|
6378
6417
|
}
|
|
6379
6418
|
return v;
|
|
6380
6419
|
}
|
|
6381
6420
|
get onMaya() {
|
|
6382
6421
|
if (this.isServer) {
|
|
6383
|
-
this.logger.warn("'
|
|
6422
|
+
this.logger.warn("'client cookies' is not available on the server.");
|
|
6384
6423
|
return false;
|
|
6385
6424
|
}
|
|
6386
6425
|
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
@@ -7306,6 +7345,7 @@ var Transformer = class {
|
|
|
7306
7345
|
currentActiveDaysCount: data.currentActiveDaysCount,
|
|
7307
7346
|
currentBetsCount: data.currentBetsCount,
|
|
7308
7347
|
currentNewGamesCount: data.currentNewGamesCount,
|
|
7348
|
+
currentAchievements: data.currentAchievements,
|
|
7309
7349
|
currentUniqueGamesCount: data.currentUniqueGamesCount,
|
|
7310
7350
|
dateTimeLastLeveledUp: new Date(data.dateTimeLastLeveledUp),
|
|
7311
7351
|
currentMonthlyAchievementPoints: data.currentMonthlyAchievementPoints,
|
|
@@ -8046,7 +8086,8 @@ var Sdk = class {
|
|
|
8046
8086
|
new GraphQLClient(walletUrl, graphqlClientConfig)
|
|
8047
8087
|
);
|
|
8048
8088
|
const accountService = new AccountService(
|
|
8049
|
-
new GraphQLClient(accountUrl, graphqlClientConfig)
|
|
8089
|
+
new GraphQLClient(accountUrl, graphqlClientConfig),
|
|
8090
|
+
environment
|
|
8050
8091
|
);
|
|
8051
8092
|
const reportService = new ReportService(
|
|
8052
8093
|
new GraphQLClient(reportUrl, graphqlClientConfig)
|