@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.js CHANGED
@@ -188,6 +188,12 @@ var CREATE_GAME_SESSION_MUTATION = gql`
188
188
  ... on GameDoesNotExistError {
189
189
  __typename
190
190
  }
191
+ ... on GameProviderNotEnabledError {
192
+ __typename
193
+ }
194
+ ... on GameTypeNotEnabledError {
195
+ __typename
196
+ }
191
197
  }
192
198
  }
193
199
  `;
@@ -2935,6 +2941,21 @@ var MEMBER_CABINET_SITE_MACHINE_QUERY = gql`
2935
2941
  }
2936
2942
  }
2937
2943
  `;
2944
+ var CABINET_WITHDRAWAL_QUERY = gql`
2945
+ query CabinetWithdrawal($id: ObjectId!) {
2946
+ node(id: $id) {
2947
+ id
2948
+ ... on CabinetWithdrawal {
2949
+ account
2950
+ type
2951
+ reference
2952
+ amount
2953
+ status
2954
+ dateTimeCreated
2955
+ }
2956
+ }
2957
+ }
2958
+ `;
2938
2959
 
2939
2960
  // src/services/utils.ts
2940
2961
  function createOperationError(code) {
@@ -5104,6 +5125,13 @@ var WalletService = class {
5104
5125
  data: res.data.games
5105
5126
  };
5106
5127
  }
5128
+ async cabinetWithdrawal(variables) {
5129
+ const res = await this.client.request(
5130
+ CABINET_WITHDRAWAL_QUERY,
5131
+ variables
5132
+ );
5133
+ return res.ok ? { ok: res.ok, data: res.data.node } : res;
5134
+ }
5107
5135
  };
5108
5136
 
5109
5137
  // src/services/extension.service.ts
@@ -5576,8 +5604,8 @@ function pollable(func, config) {
5576
5604
  };
5577
5605
  }
5578
5606
 
5579
- // src/sdk/session-manager-cookie.ts
5580
- var SessionManagerCookie = class {
5607
+ // src/sdk/session-manager.ts
5608
+ var SessionManager = class {
5581
5609
  logger;
5582
5610
  storageKey = "session";
5583
5611
  platformStorageKey = "session/platform";
@@ -5588,6 +5616,10 @@ var SessionManagerCookie = class {
5588
5616
  this.authService = config.authService;
5589
5617
  this.walletService = config.walletService;
5590
5618
  this.logger = config.logger;
5619
+ if (config.sessionPrefix) {
5620
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5621
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5622
+ }
5591
5623
  }
5592
5624
  get refreshing() {
5593
5625
  return this._refreshing;
@@ -5596,6 +5628,16 @@ var SessionManagerCookie = class {
5596
5628
  this._refreshing = value;
5597
5629
  }
5598
5630
  async create(input) {
5631
+ if (this.isServer) {
5632
+ this.logger.warn("'localStorage' is not available on the server.");
5633
+ return {
5634
+ ok: false,
5635
+ error: {
5636
+ name: "UnknownError",
5637
+ message: "Server sign in is not supported."
5638
+ }
5639
+ };
5640
+ }
5599
5641
  if (input.type === "MAYA") {
5600
5642
  localStorage.setItem(this.platformStorageKey, "MAYA");
5601
5643
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -5622,14 +5664,13 @@ var SessionManagerCookie = class {
5622
5664
  })();
5623
5665
  if (!r1.ok) return r1;
5624
5666
  const now2 = /* @__PURE__ */ new Date();
5625
- cookies.set(
5667
+ localStorage.setItem(
5626
5668
  this.storageKey,
5627
5669
  JSON.stringify({
5628
5670
  ...r1.data,
5629
5671
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5630
5672
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5631
- }),
5632
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5673
+ })
5633
5674
  );
5634
5675
  return {
5635
5676
  ok: true,
@@ -5640,16 +5681,13 @@ var SessionManagerCookie = class {
5640
5681
  const res2 = await this.authService.createSession(input);
5641
5682
  if (res2.ok) {
5642
5683
  const now2 = /* @__PURE__ */ new Date();
5643
- cookies.set(
5684
+ localStorage.setItem(
5644
5685
  this.storageKey,
5645
5686
  JSON.stringify({
5646
5687
  ...res2.data,
5647
5688
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5648
5689
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5649
- }),
5650
- {
5651
- expires: subMinutes(addDays(now2, 30), 2).getTime()
5652
- }
5690
+ })
5653
5691
  );
5654
5692
  return {
5655
5693
  ok: true,
@@ -5661,18 +5699,18 @@ var SessionManagerCookie = class {
5661
5699
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
5662
5700
  const res2 = await this.authService.createSession({
5663
5701
  type: "SOCIALS",
5664
- token: input.token
5702
+ token: input.token,
5703
+ channel: input.channel
5665
5704
  });
5666
5705
  if (res2.ok) {
5667
5706
  const now2 = /* @__PURE__ */ new Date();
5668
- cookies.set(
5707
+ localStorage.setItem(
5669
5708
  this.storageKey,
5670
5709
  JSON.stringify({
5671
5710
  ...res2.data,
5672
5711
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5673
5712
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5674
- }),
5675
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5713
+ })
5676
5714
  );
5677
5715
  return {
5678
5716
  ok: true,
@@ -5686,14 +5724,13 @@ var SessionManagerCookie = class {
5686
5724
  const res2 = await this.authService.createSession(input);
5687
5725
  if (res2.ok) {
5688
5726
  const now2 = /* @__PURE__ */ new Date();
5689
- cookies.set(
5727
+ localStorage.setItem(
5690
5728
  this.storageKey,
5691
5729
  JSON.stringify({
5692
5730
  ...res2.data,
5693
5731
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5694
5732
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5695
- }),
5696
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5733
+ })
5697
5734
  );
5698
5735
  return {
5699
5736
  ok: true,
@@ -5713,14 +5750,13 @@ var SessionManagerCookie = class {
5713
5750
  };
5714
5751
  }
5715
5752
  const now = /* @__PURE__ */ new Date();
5716
- cookies.set(
5753
+ localStorage.setItem(
5717
5754
  this.storageKey,
5718
5755
  JSON.stringify({
5719
5756
  ...res.data,
5720
5757
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5721
5758
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5722
- }),
5723
- {}
5759
+ })
5724
5760
  );
5725
5761
  return {
5726
5762
  ok: true,
@@ -5732,18 +5768,15 @@ var SessionManagerCookie = class {
5732
5768
  if (res.ok) {
5733
5769
  const now = /* @__PURE__ */ new Date();
5734
5770
  if (this.isServer) {
5735
- this.logger.warn("'client cookies' is not available on the server.");
5771
+ this.logger.warn("'localStorage' is not available on the server.");
5736
5772
  } else {
5737
- cookies.set(
5773
+ localStorage.setItem(
5738
5774
  this.storageKey,
5739
5775
  JSON.stringify({
5740
5776
  ...res.data,
5741
5777
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5742
5778
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5743
- }),
5744
- {
5745
- expires: subMinutes(addDays(now, 30), 2).getTime()
5746
- }
5779
+ })
5747
5780
  );
5748
5781
  }
5749
5782
  return { ok: true };
@@ -5753,7 +5786,7 @@ var SessionManagerCookie = class {
5753
5786
  }
5754
5787
  async get() {
5755
5788
  if (this.isServer) {
5756
- this.logger.warn("'client cookies' is not available on the server.");
5789
+ this.logger.warn("'localStorage' is not available on the server.");
5757
5790
  return {
5758
5791
  ok: true,
5759
5792
  data: null
@@ -5763,7 +5796,7 @@ var SessionManagerCookie = class {
5763
5796
  await sleep(1e3);
5764
5797
  return await this.get();
5765
5798
  }
5766
- const val = cookies.get(this.storageKey);
5799
+ const val = localStorage.getItem(this.storageKey);
5767
5800
  if (!val) {
5768
5801
  return {
5769
5802
  ok: true,
@@ -5777,7 +5810,7 @@ var SessionManagerCookie = class {
5777
5810
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
5778
5811
  if (isAfter(now, refreshTokenExpiresAt)) {
5779
5812
  this.logger.warn("Session expired. Logging out..");
5780
- cookies.remove(this.storageKey);
5813
+ localStorage.removeItem(this.storageKey);
5781
5814
  return {
5782
5815
  ok: false,
5783
5816
  error: {
@@ -5794,7 +5827,7 @@ var SessionManagerCookie = class {
5794
5827
  if (!res.ok) {
5795
5828
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5796
5829
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5797
- cookies.remove(this.storageKey);
5830
+ localStorage.removeItem(this.storageKey);
5798
5831
  return {
5799
5832
  ok: false,
5800
5833
  error: res.error
@@ -5815,9 +5848,7 @@ var SessionManagerCookie = class {
5815
5848
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5816
5849
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5817
5850
  };
5818
- cookies.set(this.storageKey, JSON.stringify(obj), {
5819
- expires: subMinutes(addDays(now, 30), 2).getTime()
5820
- });
5851
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5821
5852
  }
5822
5853
  return {
5823
5854
  ok: true,
@@ -5835,13 +5866,13 @@ var SessionManagerCookie = class {
5835
5866
  }
5836
5867
  async refresh() {
5837
5868
  if (this.isServer) {
5838
- this.logger.warn("'client cookies' is not available on the server.");
5869
+ this.logger.warn("'localStorage' is not available on the server.");
5839
5870
  return {
5840
5871
  ok: true,
5841
5872
  data: null
5842
5873
  };
5843
5874
  }
5844
- const val = cookies.get(this.storageKey);
5875
+ const val = localStorage.getItem(this.storageKey);
5845
5876
  if (!val) {
5846
5877
  return {
5847
5878
  ok: true,
@@ -5858,7 +5889,7 @@ var SessionManagerCookie = class {
5858
5889
  if (!res.ok) {
5859
5890
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5860
5891
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5861
- cookies.remove(this.storageKey);
5892
+ localStorage.removeItem(this.storageKey);
5862
5893
  return {
5863
5894
  ok: false,
5864
5895
  error: res.error
@@ -5879,9 +5910,7 @@ var SessionManagerCookie = class {
5879
5910
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5880
5911
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5881
5912
  };
5882
- cookies.set(this.storageKey, JSON.stringify(obj), {
5883
- expires: subMinutes(addDays(now, 30), 2).getTime()
5884
- });
5913
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5885
5914
  return {
5886
5915
  ok: true,
5887
5916
  data: obj
@@ -5898,18 +5927,18 @@ var SessionManagerCookie = class {
5898
5927
  }
5899
5928
  async destroy() {
5900
5929
  if (this.isServer) {
5901
- this.logger.warn("'client cookies' is not available on the server.");
5930
+ this.logger.warn("'localStorage' is not available on the server.");
5902
5931
  return;
5903
5932
  }
5904
5933
  const res = await this.get();
5905
5934
  if (res.data?.accessToken) {
5906
5935
  await this.authService.destroySession(res.data.accessToken);
5907
5936
  }
5908
- cookies.remove(this.storageKey);
5937
+ localStorage.removeItem(this.storageKey);
5909
5938
  }
5910
5939
  async verify() {
5911
5940
  if (this.isServer) {
5912
- this.logger.warn("'client cookies' is not available on the server.");
5941
+ this.logger.warn("'localStorage' is not available on the server.");
5913
5942
  return true;
5914
5943
  }
5915
5944
  const s = await this.get();
@@ -5919,13 +5948,13 @@ var SessionManagerCookie = class {
5919
5948
  if (!s.data) return true;
5920
5949
  const v = await this.authService.verifySession(s.data.accessToken);
5921
5950
  if (!v) {
5922
- cookies.remove(this.storageKey);
5951
+ localStorage.removeItem(this.storageKey);
5923
5952
  }
5924
5953
  return v;
5925
5954
  }
5926
5955
  get onMaya() {
5927
5956
  if (this.isServer) {
5928
- this.logger.warn("'client cookies' is not available on the server.");
5957
+ this.logger.warn("'localStorage' is not available on the server.");
5929
5958
  return false;
5930
5959
  }
5931
5960
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -5941,9 +5970,7 @@ var SessionManagerCookie = class {
5941
5970
  return typeof window === "undefined";
5942
5971
  }
5943
5972
  };
5944
-
5945
- // src/sdk/session-manager.ts
5946
- var SessionManager = class {
5973
+ var SessionManagerCookie = class {
5947
5974
  logger;
5948
5975
  storageKey = "session";
5949
5976
  platformStorageKey = "session/platform";
@@ -5954,10 +5981,6 @@ var SessionManager = class {
5954
5981
  this.authService = config.authService;
5955
5982
  this.walletService = config.walletService;
5956
5983
  this.logger = config.logger;
5957
- if (config.sessionPrefix) {
5958
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5959
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5960
- }
5961
5984
  }
5962
5985
  get refreshing() {
5963
5986
  return this._refreshing;
@@ -5966,16 +5989,6 @@ var SessionManager = class {
5966
5989
  this._refreshing = value;
5967
5990
  }
5968
5991
  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
- }
5979
5992
  if (input.type === "MAYA") {
5980
5993
  localStorage.setItem(this.platformStorageKey, "MAYA");
5981
5994
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6002,13 +6015,14 @@ var SessionManager = class {
6002
6015
  })();
6003
6016
  if (!r1.ok) return r1;
6004
6017
  const now2 = /* @__PURE__ */ new Date();
6005
- localStorage.setItem(
6018
+ cookies.set(
6006
6019
  this.storageKey,
6007
6020
  JSON.stringify({
6008
6021
  ...r1.data,
6009
6022
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6010
6023
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6011
- })
6024
+ }),
6025
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6012
6026
  );
6013
6027
  return {
6014
6028
  ok: true,
@@ -6019,13 +6033,16 @@ var SessionManager = class {
6019
6033
  const res2 = await this.authService.createSession(input);
6020
6034
  if (res2.ok) {
6021
6035
  const now2 = /* @__PURE__ */ new Date();
6022
- localStorage.setItem(
6036
+ cookies.set(
6023
6037
  this.storageKey,
6024
6038
  JSON.stringify({
6025
6039
  ...res2.data,
6026
6040
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6027
6041
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6028
- })
6042
+ }),
6043
+ {
6044
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
6045
+ }
6029
6046
  );
6030
6047
  return {
6031
6048
  ok: true,
@@ -6037,18 +6054,18 @@ var SessionManager = class {
6037
6054
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6038
6055
  const res2 = await this.authService.createSession({
6039
6056
  type: "SOCIALS",
6040
- token: input.token,
6041
- channel: input.channel
6057
+ token: input.token
6042
6058
  });
6043
6059
  if (res2.ok) {
6044
6060
  const now2 = /* @__PURE__ */ new Date();
6045
- localStorage.setItem(
6061
+ cookies.set(
6046
6062
  this.storageKey,
6047
6063
  JSON.stringify({
6048
6064
  ...res2.data,
6049
6065
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6050
6066
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6051
- })
6067
+ }),
6068
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6052
6069
  );
6053
6070
  return {
6054
6071
  ok: true,
@@ -6062,13 +6079,14 @@ var SessionManager = class {
6062
6079
  const res2 = await this.authService.createSession(input);
6063
6080
  if (res2.ok) {
6064
6081
  const now2 = /* @__PURE__ */ new Date();
6065
- localStorage.setItem(
6082
+ cookies.set(
6066
6083
  this.storageKey,
6067
6084
  JSON.stringify({
6068
6085
  ...res2.data,
6069
6086
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6070
6087
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6071
- })
6088
+ }),
6089
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6072
6090
  );
6073
6091
  return {
6074
6092
  ok: true,
@@ -6088,13 +6106,14 @@ var SessionManager = class {
6088
6106
  };
6089
6107
  }
6090
6108
  const now = /* @__PURE__ */ new Date();
6091
- localStorage.setItem(
6109
+ cookies.set(
6092
6110
  this.storageKey,
6093
6111
  JSON.stringify({
6094
6112
  ...res.data,
6095
6113
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6096
6114
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6097
- })
6115
+ }),
6116
+ {}
6098
6117
  );
6099
6118
  return {
6100
6119
  ok: true,
@@ -6106,15 +6125,18 @@ var SessionManager = class {
6106
6125
  if (res.ok) {
6107
6126
  const now = /* @__PURE__ */ new Date();
6108
6127
  if (this.isServer) {
6109
- this.logger.warn("'localStorage' is not available on the server.");
6128
+ this.logger.warn("'client cookies' is not available on the server.");
6110
6129
  } else {
6111
- localStorage.setItem(
6130
+ cookies.set(
6112
6131
  this.storageKey,
6113
6132
  JSON.stringify({
6114
6133
  ...res.data,
6115
6134
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6116
6135
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6117
- })
6136
+ }),
6137
+ {
6138
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6139
+ }
6118
6140
  );
6119
6141
  }
6120
6142
  return { ok: true };
@@ -6124,7 +6146,7 @@ var SessionManager = class {
6124
6146
  }
6125
6147
  async get() {
6126
6148
  if (this.isServer) {
6127
- this.logger.warn("'localStorage' is not available on the server.");
6149
+ this.logger.warn("'client cookies' is not available on the server.");
6128
6150
  return {
6129
6151
  ok: true,
6130
6152
  data: null
@@ -6134,7 +6156,7 @@ var SessionManager = class {
6134
6156
  await sleep(1e3);
6135
6157
  return await this.get();
6136
6158
  }
6137
- const val = localStorage.getItem(this.storageKey);
6159
+ const val = cookies.get(this.storageKey);
6138
6160
  if (!val) {
6139
6161
  return {
6140
6162
  ok: true,
@@ -6148,7 +6170,7 @@ var SessionManager = class {
6148
6170
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6149
6171
  if (isAfter(now, refreshTokenExpiresAt)) {
6150
6172
  this.logger.warn("Session expired. Logging out..");
6151
- localStorage.removeItem(this.storageKey);
6173
+ cookies.remove(this.storageKey);
6152
6174
  return {
6153
6175
  ok: false,
6154
6176
  error: {
@@ -6165,7 +6187,7 @@ var SessionManager = class {
6165
6187
  if (!res.ok) {
6166
6188
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6167
6189
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6168
- localStorage.removeItem(this.storageKey);
6190
+ cookies.remove(this.storageKey);
6169
6191
  return {
6170
6192
  ok: false,
6171
6193
  error: res.error
@@ -6186,7 +6208,9 @@ var SessionManager = class {
6186
6208
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6187
6209
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6188
6210
  };
6189
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6211
+ cookies.set(this.storageKey, JSON.stringify(obj), {
6212
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6213
+ });
6190
6214
  }
6191
6215
  return {
6192
6216
  ok: true,
@@ -6204,13 +6228,13 @@ var SessionManager = class {
6204
6228
  }
6205
6229
  async refresh() {
6206
6230
  if (this.isServer) {
6207
- this.logger.warn("'localStorage' is not available on the server.");
6231
+ this.logger.warn("'client cookies' is not available on the server.");
6208
6232
  return {
6209
6233
  ok: true,
6210
6234
  data: null
6211
6235
  };
6212
6236
  }
6213
- const val = localStorage.getItem(this.storageKey);
6237
+ const val = cookies.get(this.storageKey);
6214
6238
  if (!val) {
6215
6239
  return {
6216
6240
  ok: true,
@@ -6227,7 +6251,7 @@ var SessionManager = class {
6227
6251
  if (!res.ok) {
6228
6252
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6229
6253
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6230
- localStorage.removeItem(this.storageKey);
6254
+ cookies.remove(this.storageKey);
6231
6255
  return {
6232
6256
  ok: false,
6233
6257
  error: res.error
@@ -6248,7 +6272,9 @@ var SessionManager = class {
6248
6272
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6249
6273
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6250
6274
  };
6251
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6275
+ cookies.set(this.storageKey, JSON.stringify(obj), {
6276
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6277
+ });
6252
6278
  return {
6253
6279
  ok: true,
6254
6280
  data: obj
@@ -6265,18 +6291,18 @@ var SessionManager = class {
6265
6291
  }
6266
6292
  async destroy() {
6267
6293
  if (this.isServer) {
6268
- this.logger.warn("'localStorage' is not available on the server.");
6294
+ this.logger.warn("'client cookies' is not available on the server.");
6269
6295
  return;
6270
6296
  }
6271
6297
  const res = await this.get();
6272
6298
  if (res.data?.accessToken) {
6273
6299
  await this.authService.destroySession(res.data.accessToken);
6274
6300
  }
6275
- localStorage.removeItem(this.storageKey);
6301
+ cookies.remove(this.storageKey);
6276
6302
  }
6277
6303
  async verify() {
6278
6304
  if (this.isServer) {
6279
- this.logger.warn("'localStorage' is not available on the server.");
6305
+ this.logger.warn("'client cookies' is not available on the server.");
6280
6306
  return true;
6281
6307
  }
6282
6308
  const s = await this.get();
@@ -6286,13 +6312,13 @@ var SessionManager = class {
6286
6312
  if (!s.data) return true;
6287
6313
  const v = await this.authService.verifySession(s.data.accessToken);
6288
6314
  if (!v) {
6289
- localStorage.removeItem(this.storageKey);
6315
+ cookies.remove(this.storageKey);
6290
6316
  }
6291
6317
  return v;
6292
6318
  }
6293
6319
  get onMaya() {
6294
6320
  if (this.isServer) {
6295
- this.logger.warn("'localStorage' is not available on the server.");
6321
+ this.logger.warn("'client cookies' is not available on the server.");
6296
6322
  return false;
6297
6323
  }
6298
6324
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6398,6 +6424,7 @@ var Transformer = class {
6398
6424
  announcement: this.announcement.bind(this),
6399
6425
  withdrawalRecord: this.withdrawalRecord.bind(this),
6400
6426
  deposit: this.deposit.bind(this),
6427
+ cabinetWithdrawal: this.cabinetWithdrawal.bind(this),
6401
6428
  depositRecord: this.depositRecord.bind(this),
6402
6429
  betRecord: this.betRecord.bind(this),
6403
6430
  latestBetRecord: this.latestBetRecord.bind(this),
@@ -7864,6 +7891,19 @@ var Transformer = class {
7864
7891
  }
7865
7892
  };
7866
7893
  }
7894
+ cabinetWithdrawal(data) {
7895
+ const o = {
7896
+ id: data.id,
7897
+ type: data.type,
7898
+ status: data.status,
7899
+ amount: data.amount,
7900
+ reference: data.reference,
7901
+ accountName: data.accountName,
7902
+ dateTimeCreated: data.dateTimeCreated,
7903
+ error: data.error ?? void 0
7904
+ };
7905
+ return compact(o);
7906
+ }
7867
7907
  };
7868
7908
 
7869
7909
  // src/sdk/sdk.ts
@@ -8313,7 +8353,7 @@ var Sdk = class {
8313
8353
  }
8314
8354
  /*
8315
8355
  *=============================================
8316
- * MACHINE EXTENSION
8356
+ * EXTENSION
8317
8357
  *=============================================
8318
8358
  */
8319
8359
  async memberCabinetSiteMachine() {
@@ -8324,6 +8364,14 @@ var Sdk = class {
8324
8364
  data: res.data ? this.transformer.transform.memberCabinetSiteMachine(res.data) : null
8325
8365
  };
8326
8366
  }
8367
+ async cabinetWithdrawalRecord(id) {
8368
+ const res = await this.walletService.cabinetWithdrawal({ id });
8369
+ if (!res.ok) return res;
8370
+ return {
8371
+ ok: true,
8372
+ data: res.data ? this.transformer.transform.cabinetWithdrawal(res.data) : null
8373
+ };
8374
+ }
8327
8375
  /*
8328
8376
  *=============================================
8329
8377
  * PLATFORM
@@ -9401,8 +9449,8 @@ var Sdk = class {
9401
9449
  return {
9402
9450
  ok: false,
9403
9451
  error: {
9404
- name: "GameDoesNotExistError",
9405
- message: "Game does not exist"
9452
+ name: res0.error?.name ?? "GameDoesNotExistError",
9453
+ message: res0.error?.message ?? "Game does not exist"
9406
9454
  }
9407
9455
  };
9408
9456
  }