@opexa/portal-sdk 0.52.8 → 0.53.1

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 CHANGED
@@ -193,6 +193,12 @@ var CREATE_GAME_SESSION_MUTATION = gql`
193
193
  ... on GameDoesNotExistError {
194
194
  __typename
195
195
  }
196
+ ... on GameProviderNotEnabledError {
197
+ __typename
198
+ }
199
+ ... on GameTypeNotEnabledError {
200
+ __typename
201
+ }
196
202
  }
197
203
  }
198
204
  `;
@@ -2940,6 +2946,21 @@ var MEMBER_CABINET_SITE_MACHINE_QUERY = gql`
2940
2946
  }
2941
2947
  }
2942
2948
  `;
2949
+ var CABINET_WITHDRAWAL_QUERY = gql`
2950
+ query CabinetWithdrawal($id: ObjectId!) {
2951
+ node(id: $id) {
2952
+ id
2953
+ ... on CabinetWithdrawal {
2954
+ account
2955
+ type
2956
+ reference
2957
+ amount
2958
+ status
2959
+ dateTimeCreated
2960
+ }
2961
+ }
2962
+ }
2963
+ `;
2943
2964
 
2944
2965
  // src/services/utils.ts
2945
2966
  function createOperationError(code) {
@@ -5109,6 +5130,13 @@ var WalletService = class {
5109
5130
  data: res.data.games
5110
5131
  };
5111
5132
  }
5133
+ async cabinetWithdrawal(variables) {
5134
+ const res = await this.client.request(
5135
+ CABINET_WITHDRAWAL_QUERY,
5136
+ variables
5137
+ );
5138
+ return res.ok ? { ok: res.ok, data: res.data.node } : res;
5139
+ }
5112
5140
  };
5113
5141
 
5114
5142
  // src/services/extension.service.ts
@@ -5581,8 +5609,8 @@ function pollable(func, config) {
5581
5609
  };
5582
5610
  }
5583
5611
 
5584
- // src/sdk/session-manager-cookie.ts
5585
- var SessionManagerCookie = class {
5612
+ // src/sdk/session-manager.ts
5613
+ var SessionManager = class {
5586
5614
  logger;
5587
5615
  storageKey = "session";
5588
5616
  platformStorageKey = "session/platform";
@@ -5593,6 +5621,10 @@ var SessionManagerCookie = class {
5593
5621
  this.authService = config.authService;
5594
5622
  this.walletService = config.walletService;
5595
5623
  this.logger = config.logger;
5624
+ if (config.sessionPrefix) {
5625
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5626
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5627
+ }
5596
5628
  }
5597
5629
  get refreshing() {
5598
5630
  return this._refreshing;
@@ -5601,6 +5633,16 @@ var SessionManagerCookie = class {
5601
5633
  this._refreshing = value;
5602
5634
  }
5603
5635
  async create(input) {
5636
+ if (this.isServer) {
5637
+ this.logger.warn("'localStorage' is not available on the server.");
5638
+ return {
5639
+ ok: false,
5640
+ error: {
5641
+ name: "UnknownError",
5642
+ message: "Server sign in is not supported."
5643
+ }
5644
+ };
5645
+ }
5604
5646
  if (input.type === "MAYA") {
5605
5647
  localStorage.setItem(this.platformStorageKey, "MAYA");
5606
5648
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -5627,14 +5669,13 @@ var SessionManagerCookie = class {
5627
5669
  })();
5628
5670
  if (!r1.ok) return r1;
5629
5671
  const now2 = /* @__PURE__ */ new Date();
5630
- cookies__default.default.set(
5672
+ localStorage.setItem(
5631
5673
  this.storageKey,
5632
5674
  JSON.stringify({
5633
5675
  ...r1.data,
5634
5676
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5635
5677
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5636
- }),
5637
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5678
+ })
5638
5679
  );
5639
5680
  return {
5640
5681
  ok: true,
@@ -5645,16 +5686,13 @@ var SessionManagerCookie = class {
5645
5686
  const res2 = await this.authService.createSession(input);
5646
5687
  if (res2.ok) {
5647
5688
  const now2 = /* @__PURE__ */ new Date();
5648
- cookies__default.default.set(
5689
+ localStorage.setItem(
5649
5690
  this.storageKey,
5650
5691
  JSON.stringify({
5651
5692
  ...res2.data,
5652
5693
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5653
5694
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5654
- }),
5655
- {
5656
- expires: subMinutes(addDays(now2, 30), 2).getTime()
5657
- }
5695
+ })
5658
5696
  );
5659
5697
  return {
5660
5698
  ok: true,
@@ -5666,18 +5704,18 @@ var SessionManagerCookie = class {
5666
5704
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
5667
5705
  const res2 = await this.authService.createSession({
5668
5706
  type: "SOCIALS",
5669
- token: input.token
5707
+ token: input.token,
5708
+ channel: input.channel
5670
5709
  });
5671
5710
  if (res2.ok) {
5672
5711
  const now2 = /* @__PURE__ */ new Date();
5673
- cookies__default.default.set(
5712
+ localStorage.setItem(
5674
5713
  this.storageKey,
5675
5714
  JSON.stringify({
5676
5715
  ...res2.data,
5677
5716
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5678
5717
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5679
- }),
5680
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5718
+ })
5681
5719
  );
5682
5720
  return {
5683
5721
  ok: true,
@@ -5691,14 +5729,13 @@ var SessionManagerCookie = class {
5691
5729
  const res2 = await this.authService.createSession(input);
5692
5730
  if (res2.ok) {
5693
5731
  const now2 = /* @__PURE__ */ new Date();
5694
- cookies__default.default.set(
5732
+ localStorage.setItem(
5695
5733
  this.storageKey,
5696
5734
  JSON.stringify({
5697
5735
  ...res2.data,
5698
5736
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5699
5737
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5700
- }),
5701
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5738
+ })
5702
5739
  );
5703
5740
  return {
5704
5741
  ok: true,
@@ -5718,14 +5755,13 @@ var SessionManagerCookie = class {
5718
5755
  };
5719
5756
  }
5720
5757
  const now = /* @__PURE__ */ new Date();
5721
- cookies__default.default.set(
5758
+ localStorage.setItem(
5722
5759
  this.storageKey,
5723
5760
  JSON.stringify({
5724
5761
  ...res.data,
5725
5762
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5726
5763
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5727
- }),
5728
- {}
5764
+ })
5729
5765
  );
5730
5766
  return {
5731
5767
  ok: true,
@@ -5737,18 +5773,15 @@ var SessionManagerCookie = class {
5737
5773
  if (res.ok) {
5738
5774
  const now = /* @__PURE__ */ new Date();
5739
5775
  if (this.isServer) {
5740
- this.logger.warn("'client cookies' is not available on the server.");
5776
+ this.logger.warn("'localStorage' is not available on the server.");
5741
5777
  } else {
5742
- cookies__default.default.set(
5778
+ localStorage.setItem(
5743
5779
  this.storageKey,
5744
5780
  JSON.stringify({
5745
5781
  ...res.data,
5746
5782
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5747
5783
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5748
- }),
5749
- {
5750
- expires: subMinutes(addDays(now, 30), 2).getTime()
5751
- }
5784
+ })
5752
5785
  );
5753
5786
  }
5754
5787
  return { ok: true };
@@ -5758,7 +5791,7 @@ var SessionManagerCookie = class {
5758
5791
  }
5759
5792
  async get() {
5760
5793
  if (this.isServer) {
5761
- this.logger.warn("'client cookies' is not available on the server.");
5794
+ this.logger.warn("'localStorage' is not available on the server.");
5762
5795
  return {
5763
5796
  ok: true,
5764
5797
  data: null
@@ -5768,7 +5801,7 @@ var SessionManagerCookie = class {
5768
5801
  await sleep(1e3);
5769
5802
  return await this.get();
5770
5803
  }
5771
- const val = cookies__default.default.get(this.storageKey);
5804
+ const val = localStorage.getItem(this.storageKey);
5772
5805
  if (!val) {
5773
5806
  return {
5774
5807
  ok: true,
@@ -5782,7 +5815,7 @@ var SessionManagerCookie = class {
5782
5815
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
5783
5816
  if (isAfter(now, refreshTokenExpiresAt)) {
5784
5817
  this.logger.warn("Session expired. Logging out..");
5785
- cookies__default.default.remove(this.storageKey);
5818
+ localStorage.removeItem(this.storageKey);
5786
5819
  return {
5787
5820
  ok: false,
5788
5821
  error: {
@@ -5799,7 +5832,7 @@ var SessionManagerCookie = class {
5799
5832
  if (!res.ok) {
5800
5833
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5801
5834
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5802
- cookies__default.default.remove(this.storageKey);
5835
+ localStorage.removeItem(this.storageKey);
5803
5836
  return {
5804
5837
  ok: false,
5805
5838
  error: res.error
@@ -5820,9 +5853,7 @@ var SessionManagerCookie = class {
5820
5853
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5821
5854
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5822
5855
  };
5823
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5824
- expires: subMinutes(addDays(now, 30), 2).getTime()
5825
- });
5856
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5826
5857
  }
5827
5858
  return {
5828
5859
  ok: true,
@@ -5840,13 +5871,13 @@ var SessionManagerCookie = class {
5840
5871
  }
5841
5872
  async refresh() {
5842
5873
  if (this.isServer) {
5843
- this.logger.warn("'client cookies' is not available on the server.");
5874
+ this.logger.warn("'localStorage' is not available on the server.");
5844
5875
  return {
5845
5876
  ok: true,
5846
5877
  data: null
5847
5878
  };
5848
5879
  }
5849
- const val = cookies__default.default.get(this.storageKey);
5880
+ const val = localStorage.getItem(this.storageKey);
5850
5881
  if (!val) {
5851
5882
  return {
5852
5883
  ok: true,
@@ -5863,7 +5894,7 @@ var SessionManagerCookie = class {
5863
5894
  if (!res.ok) {
5864
5895
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5865
5896
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5866
- cookies__default.default.remove(this.storageKey);
5897
+ localStorage.removeItem(this.storageKey);
5867
5898
  return {
5868
5899
  ok: false,
5869
5900
  error: res.error
@@ -5884,9 +5915,7 @@ var SessionManagerCookie = class {
5884
5915
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5885
5916
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5886
5917
  };
5887
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5888
- expires: subMinutes(addDays(now, 30), 2).getTime()
5889
- });
5918
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5890
5919
  return {
5891
5920
  ok: true,
5892
5921
  data: obj
@@ -5903,18 +5932,18 @@ var SessionManagerCookie = class {
5903
5932
  }
5904
5933
  async destroy() {
5905
5934
  if (this.isServer) {
5906
- this.logger.warn("'client cookies' is not available on the server.");
5935
+ this.logger.warn("'localStorage' is not available on the server.");
5907
5936
  return;
5908
5937
  }
5909
5938
  const res = await this.get();
5910
5939
  if (res.data?.accessToken) {
5911
5940
  await this.authService.destroySession(res.data.accessToken);
5912
5941
  }
5913
- cookies__default.default.remove(this.storageKey);
5942
+ localStorage.removeItem(this.storageKey);
5914
5943
  }
5915
5944
  async verify() {
5916
5945
  if (this.isServer) {
5917
- this.logger.warn("'client cookies' is not available on the server.");
5946
+ this.logger.warn("'localStorage' is not available on the server.");
5918
5947
  return true;
5919
5948
  }
5920
5949
  const s = await this.get();
@@ -5924,13 +5953,13 @@ var SessionManagerCookie = class {
5924
5953
  if (!s.data) return true;
5925
5954
  const v = await this.authService.verifySession(s.data.accessToken);
5926
5955
  if (!v) {
5927
- cookies__default.default.remove(this.storageKey);
5956
+ localStorage.removeItem(this.storageKey);
5928
5957
  }
5929
5958
  return v;
5930
5959
  }
5931
5960
  get onMaya() {
5932
5961
  if (this.isServer) {
5933
- this.logger.warn("'client cookies' is not available on the server.");
5962
+ this.logger.warn("'localStorage' is not available on the server.");
5934
5963
  return false;
5935
5964
  }
5936
5965
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -5946,9 +5975,7 @@ var SessionManagerCookie = class {
5946
5975
  return typeof window === "undefined";
5947
5976
  }
5948
5977
  };
5949
-
5950
- // src/sdk/session-manager.ts
5951
- var SessionManager = class {
5978
+ var SessionManagerCookie = class {
5952
5979
  logger;
5953
5980
  storageKey = "session";
5954
5981
  platformStorageKey = "session/platform";
@@ -5959,10 +5986,6 @@ var SessionManager = class {
5959
5986
  this.authService = config.authService;
5960
5987
  this.walletService = config.walletService;
5961
5988
  this.logger = config.logger;
5962
- if (config.sessionPrefix) {
5963
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5964
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5965
- }
5966
5989
  }
5967
5990
  get refreshing() {
5968
5991
  return this._refreshing;
@@ -5971,16 +5994,6 @@ var SessionManager = class {
5971
5994
  this._refreshing = value;
5972
5995
  }
5973
5996
  async create(input) {
5974
- if (this.isServer) {
5975
- this.logger.warn("'localStorage' is not available on the server.");
5976
- return {
5977
- ok: false,
5978
- error: {
5979
- name: "UnknownError",
5980
- message: "Server sign in is not supported."
5981
- }
5982
- };
5983
- }
5984
5997
  if (input.type === "MAYA") {
5985
5998
  localStorage.setItem(this.platformStorageKey, "MAYA");
5986
5999
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6007,13 +6020,14 @@ var SessionManager = class {
6007
6020
  })();
6008
6021
  if (!r1.ok) return r1;
6009
6022
  const now2 = /* @__PURE__ */ new Date();
6010
- localStorage.setItem(
6023
+ cookies__default.default.set(
6011
6024
  this.storageKey,
6012
6025
  JSON.stringify({
6013
6026
  ...r1.data,
6014
6027
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6015
6028
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6016
- })
6029
+ }),
6030
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6017
6031
  );
6018
6032
  return {
6019
6033
  ok: true,
@@ -6024,13 +6038,16 @@ var SessionManager = class {
6024
6038
  const res2 = await this.authService.createSession(input);
6025
6039
  if (res2.ok) {
6026
6040
  const now2 = /* @__PURE__ */ new Date();
6027
- localStorage.setItem(
6041
+ cookies__default.default.set(
6028
6042
  this.storageKey,
6029
6043
  JSON.stringify({
6030
6044
  ...res2.data,
6031
6045
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6032
6046
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6033
- })
6047
+ }),
6048
+ {
6049
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
6050
+ }
6034
6051
  );
6035
6052
  return {
6036
6053
  ok: true,
@@ -6042,18 +6059,18 @@ var SessionManager = class {
6042
6059
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6043
6060
  const res2 = await this.authService.createSession({
6044
6061
  type: "SOCIALS",
6045
- token: input.token,
6046
- channel: input.channel
6062
+ token: input.token
6047
6063
  });
6048
6064
  if (res2.ok) {
6049
6065
  const now2 = /* @__PURE__ */ new Date();
6050
- localStorage.setItem(
6066
+ cookies__default.default.set(
6051
6067
  this.storageKey,
6052
6068
  JSON.stringify({
6053
6069
  ...res2.data,
6054
6070
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6055
6071
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6056
- })
6072
+ }),
6073
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6057
6074
  );
6058
6075
  return {
6059
6076
  ok: true,
@@ -6067,13 +6084,14 @@ var SessionManager = class {
6067
6084
  const res2 = await this.authService.createSession(input);
6068
6085
  if (res2.ok) {
6069
6086
  const now2 = /* @__PURE__ */ new Date();
6070
- localStorage.setItem(
6087
+ cookies__default.default.set(
6071
6088
  this.storageKey,
6072
6089
  JSON.stringify({
6073
6090
  ...res2.data,
6074
6091
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6075
6092
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6076
- })
6093
+ }),
6094
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6077
6095
  );
6078
6096
  return {
6079
6097
  ok: true,
@@ -6093,13 +6111,14 @@ var SessionManager = class {
6093
6111
  };
6094
6112
  }
6095
6113
  const now = /* @__PURE__ */ new Date();
6096
- localStorage.setItem(
6114
+ cookies__default.default.set(
6097
6115
  this.storageKey,
6098
6116
  JSON.stringify({
6099
6117
  ...res.data,
6100
6118
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6101
6119
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6102
- })
6120
+ }),
6121
+ {}
6103
6122
  );
6104
6123
  return {
6105
6124
  ok: true,
@@ -6111,15 +6130,18 @@ var SessionManager = class {
6111
6130
  if (res.ok) {
6112
6131
  const now = /* @__PURE__ */ new Date();
6113
6132
  if (this.isServer) {
6114
- this.logger.warn("'localStorage' is not available on the server.");
6133
+ this.logger.warn("'client cookies' is not available on the server.");
6115
6134
  } else {
6116
- localStorage.setItem(
6135
+ cookies__default.default.set(
6117
6136
  this.storageKey,
6118
6137
  JSON.stringify({
6119
6138
  ...res.data,
6120
6139
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6121
6140
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6122
- })
6141
+ }),
6142
+ {
6143
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6144
+ }
6123
6145
  );
6124
6146
  }
6125
6147
  return { ok: true };
@@ -6129,7 +6151,7 @@ var SessionManager = class {
6129
6151
  }
6130
6152
  async get() {
6131
6153
  if (this.isServer) {
6132
- this.logger.warn("'localStorage' is not available on the server.");
6154
+ this.logger.warn("'client cookies' is not available on the server.");
6133
6155
  return {
6134
6156
  ok: true,
6135
6157
  data: null
@@ -6139,7 +6161,7 @@ var SessionManager = class {
6139
6161
  await sleep(1e3);
6140
6162
  return await this.get();
6141
6163
  }
6142
- const val = localStorage.getItem(this.storageKey);
6164
+ const val = cookies__default.default.get(this.storageKey);
6143
6165
  if (!val) {
6144
6166
  return {
6145
6167
  ok: true,
@@ -6153,7 +6175,7 @@ var SessionManager = class {
6153
6175
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6154
6176
  if (isAfter(now, refreshTokenExpiresAt)) {
6155
6177
  this.logger.warn("Session expired. Logging out..");
6156
- localStorage.removeItem(this.storageKey);
6178
+ cookies__default.default.remove(this.storageKey);
6157
6179
  return {
6158
6180
  ok: false,
6159
6181
  error: {
@@ -6170,7 +6192,7 @@ var SessionManager = class {
6170
6192
  if (!res.ok) {
6171
6193
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6172
6194
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6173
- localStorage.removeItem(this.storageKey);
6195
+ cookies__default.default.remove(this.storageKey);
6174
6196
  return {
6175
6197
  ok: false,
6176
6198
  error: res.error
@@ -6191,7 +6213,9 @@ var SessionManager = class {
6191
6213
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6192
6214
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6193
6215
  };
6194
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6216
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6217
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6218
+ });
6195
6219
  }
6196
6220
  return {
6197
6221
  ok: true,
@@ -6209,13 +6233,13 @@ var SessionManager = class {
6209
6233
  }
6210
6234
  async refresh() {
6211
6235
  if (this.isServer) {
6212
- this.logger.warn("'localStorage' is not available on the server.");
6236
+ this.logger.warn("'client cookies' is not available on the server.");
6213
6237
  return {
6214
6238
  ok: true,
6215
6239
  data: null
6216
6240
  };
6217
6241
  }
6218
- const val = localStorage.getItem(this.storageKey);
6242
+ const val = cookies__default.default.get(this.storageKey);
6219
6243
  if (!val) {
6220
6244
  return {
6221
6245
  ok: true,
@@ -6232,7 +6256,7 @@ var SessionManager = class {
6232
6256
  if (!res.ok) {
6233
6257
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6234
6258
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6235
- localStorage.removeItem(this.storageKey);
6259
+ cookies__default.default.remove(this.storageKey);
6236
6260
  return {
6237
6261
  ok: false,
6238
6262
  error: res.error
@@ -6253,7 +6277,9 @@ var SessionManager = class {
6253
6277
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6254
6278
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6255
6279
  };
6256
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6280
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6281
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6282
+ });
6257
6283
  return {
6258
6284
  ok: true,
6259
6285
  data: obj
@@ -6270,18 +6296,18 @@ var SessionManager = class {
6270
6296
  }
6271
6297
  async destroy() {
6272
6298
  if (this.isServer) {
6273
- this.logger.warn("'localStorage' is not available on the server.");
6299
+ this.logger.warn("'client cookies' is not available on the server.");
6274
6300
  return;
6275
6301
  }
6276
6302
  const res = await this.get();
6277
6303
  if (res.data?.accessToken) {
6278
6304
  await this.authService.destroySession(res.data.accessToken);
6279
6305
  }
6280
- localStorage.removeItem(this.storageKey);
6306
+ cookies__default.default.remove(this.storageKey);
6281
6307
  }
6282
6308
  async verify() {
6283
6309
  if (this.isServer) {
6284
- this.logger.warn("'localStorage' is not available on the server.");
6310
+ this.logger.warn("'client cookies' is not available on the server.");
6285
6311
  return true;
6286
6312
  }
6287
6313
  const s = await this.get();
@@ -6291,13 +6317,13 @@ var SessionManager = class {
6291
6317
  if (!s.data) return true;
6292
6318
  const v = await this.authService.verifySession(s.data.accessToken);
6293
6319
  if (!v) {
6294
- localStorage.removeItem(this.storageKey);
6320
+ cookies__default.default.remove(this.storageKey);
6295
6321
  }
6296
6322
  return v;
6297
6323
  }
6298
6324
  get onMaya() {
6299
6325
  if (this.isServer) {
6300
- this.logger.warn("'localStorage' is not available on the server.");
6326
+ this.logger.warn("'client cookies' is not available on the server.");
6301
6327
  return false;
6302
6328
  }
6303
6329
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6403,6 +6429,7 @@ var Transformer = class {
6403
6429
  announcement: this.announcement.bind(this),
6404
6430
  withdrawalRecord: this.withdrawalRecord.bind(this),
6405
6431
  deposit: this.deposit.bind(this),
6432
+ cabinetWithdrawal: this.cabinetWithdrawal.bind(this),
6406
6433
  depositRecord: this.depositRecord.bind(this),
6407
6434
  betRecord: this.betRecord.bind(this),
6408
6435
  latestBetRecord: this.latestBetRecord.bind(this),
@@ -7869,6 +7896,19 @@ var Transformer = class {
7869
7896
  }
7870
7897
  };
7871
7898
  }
7899
+ cabinetWithdrawal(data) {
7900
+ const o = {
7901
+ id: data.id,
7902
+ type: data.type,
7903
+ status: data.status,
7904
+ amount: data.amount,
7905
+ reference: data.reference,
7906
+ accountName: data.accountName,
7907
+ dateTimeCreated: data.dateTimeCreated,
7908
+ error: data.error ?? void 0
7909
+ };
7910
+ return compact(o);
7911
+ }
7872
7912
  };
7873
7913
 
7874
7914
  // src/sdk/sdk.ts
@@ -8318,7 +8358,7 @@ var Sdk = class {
8318
8358
  }
8319
8359
  /*
8320
8360
  *=============================================
8321
- * MACHINE EXTENSION
8361
+ * EXTENSION
8322
8362
  *=============================================
8323
8363
  */
8324
8364
  async memberCabinetSiteMachine() {
@@ -8329,6 +8369,14 @@ var Sdk = class {
8329
8369
  data: res.data ? this.transformer.transform.memberCabinetSiteMachine(res.data) : null
8330
8370
  };
8331
8371
  }
8372
+ async cabinetWithdrawalRecord(id) {
8373
+ const res = await this.walletService.cabinetWithdrawal({ id });
8374
+ if (!res.ok) return res;
8375
+ return {
8376
+ ok: true,
8377
+ data: res.data ? this.transformer.transform.cabinetWithdrawal(res.data) : null
8378
+ };
8379
+ }
8332
8380
  /*
8333
8381
  *=============================================
8334
8382
  * PLATFORM
@@ -9406,8 +9454,8 @@ var Sdk = class {
9406
9454
  return {
9407
9455
  ok: false,
9408
9456
  error: {
9409
- name: "GameDoesNotExistError",
9410
- message: "Game does not exist"
9457
+ name: res0.error?.name ?? "GameDoesNotExistError",
9458
+ message: res0.error?.message ?? "Game does not exist"
9411
9459
  }
9412
9460
  };
9413
9461
  }