@opexa/portal-sdk 0.55.0 → 0.55.2

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
@@ -3102,10 +3102,21 @@ var TOURNAMENTS_QUERY = gql`
3102
3102
  }
3103
3103
  }
3104
3104
  `;
3105
- var TOURNAMENTS_TOTAL_COUNT_QUERY = gql`
3106
- query TournamentsTotalCount($filter: TournamentFilterInput) {
3107
- tournaments(first: 1, filter: $filter) {
3105
+ var TOURNAMENTS_IDS = gql`
3106
+ query TournamentsIds($first: Int, $after: Cursor, $filter: TournamentFilterInput) {
3107
+ tournaments(first: $first, after: $after, filter: $filter) {
3108
3108
  totalCount
3109
+ pageInfo {
3110
+ hasNextPage
3111
+ endCursor
3112
+ }
3113
+ edges {
3114
+ node {
3115
+ ... on MultiplierTournament {
3116
+ id
3117
+ }
3118
+ }
3119
+ }
3109
3120
  }
3110
3121
  }
3111
3122
  `;
@@ -3633,7 +3644,14 @@ var AccountService = class {
3633
3644
  };
3634
3645
  }
3635
3646
  async registerAgentAccount(variables) {
3636
- const res = await this.client.request(REGISTER_AGENT_ACCOUNT_MUTATION, variables);
3647
+ const { code, ...others } = variables;
3648
+ const res = await this.client.request(REGISTER_AGENT_ACCOUNT_MUTATION, others, {
3649
+ headers: {
3650
+ ...code && {
3651
+ "Agent-Code": code
3652
+ }
3653
+ }
3654
+ });
3637
3655
  if (!res.ok) return res;
3638
3656
  if (res.data?.registerAgentAccount) {
3639
3657
  return {
@@ -4449,12 +4467,12 @@ var ReportService = class {
4449
4467
  data: res.data.tournaments
4450
4468
  };
4451
4469
  }
4452
- async tournamentsTotalCount(variables) {
4453
- const res = await this.client.request(TOURNAMENTS_TOTAL_COUNT_QUERY, variables);
4470
+ async tournamentsIds(variables) {
4471
+ const res = await this.client.request(TOURNAMENTS_IDS, variables);
4454
4472
  if (!res.ok) return res;
4455
4473
  return {
4456
4474
  ok: true,
4457
- data: res.data.tournaments?.totalCount ?? 0
4475
+ data: res.data.tournaments ?? 0
4458
4476
  };
4459
4477
  }
4460
4478
  async memberAchievements() {
@@ -5978,8 +5996,8 @@ function pollable(func, config) {
5978
5996
  };
5979
5997
  }
5980
5998
 
5981
- // src/sdk/session-manager-cookie.ts
5982
- var SessionManagerCookie = class {
5999
+ // src/sdk/session-manager.ts
6000
+ var SessionManager = class {
5983
6001
  logger;
5984
6002
  storageKey = "session";
5985
6003
  platformStorageKey = "session/platform";
@@ -5990,6 +6008,10 @@ var SessionManagerCookie = class {
5990
6008
  this.authService = config.authService;
5991
6009
  this.walletService = config.walletService;
5992
6010
  this.logger = config.logger;
6011
+ if (config.sessionPrefix) {
6012
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6013
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6014
+ }
5993
6015
  }
5994
6016
  get refreshing() {
5995
6017
  return this._refreshing;
@@ -5998,6 +6020,16 @@ var SessionManagerCookie = class {
5998
6020
  this._refreshing = value;
5999
6021
  }
6000
6022
  async create(input) {
6023
+ if (this.isServer) {
6024
+ this.logger.warn("'localStorage' is not available on the server.");
6025
+ return {
6026
+ ok: false,
6027
+ error: {
6028
+ name: "UnknownError",
6029
+ message: "Server sign in is not supported."
6030
+ }
6031
+ };
6032
+ }
6001
6033
  if (input.type === "MAYA") {
6002
6034
  localStorage.setItem(this.platformStorageKey, "MAYA");
6003
6035
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6024,14 +6056,13 @@ var SessionManagerCookie = class {
6024
6056
  })();
6025
6057
  if (!r1.ok) return r1;
6026
6058
  const now2 = /* @__PURE__ */ new Date();
6027
- cookies__default.default.set(
6059
+ localStorage.setItem(
6028
6060
  this.storageKey,
6029
6061
  JSON.stringify({
6030
6062
  ...r1.data,
6031
6063
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6032
6064
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6033
- }),
6034
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6065
+ })
6035
6066
  );
6036
6067
  return {
6037
6068
  ok: true,
@@ -6042,16 +6073,13 @@ var SessionManagerCookie = class {
6042
6073
  const res2 = await this.authService.createSession(input);
6043
6074
  if (res2.ok) {
6044
6075
  const now2 = /* @__PURE__ */ new Date();
6045
- cookies__default.default.set(
6076
+ localStorage.setItem(
6046
6077
  this.storageKey,
6047
6078
  JSON.stringify({
6048
6079
  ...res2.data,
6049
6080
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6050
6081
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6051
- }),
6052
- {
6053
- expires: subMinutes(addDays(now2, 30), 2).getTime()
6054
- }
6082
+ })
6055
6083
  );
6056
6084
  return {
6057
6085
  ok: true,
@@ -6063,18 +6091,18 @@ var SessionManagerCookie = class {
6063
6091
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6064
6092
  const res2 = await this.authService.createSession({
6065
6093
  type: "SOCIALS",
6066
- token: input.token
6094
+ token: input.token,
6095
+ channel: input.channel
6067
6096
  });
6068
6097
  if (res2.ok) {
6069
6098
  const now2 = /* @__PURE__ */ new Date();
6070
- cookies__default.default.set(
6099
+ localStorage.setItem(
6071
6100
  this.storageKey,
6072
6101
  JSON.stringify({
6073
6102
  ...res2.data,
6074
6103
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6075
6104
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6076
- }),
6077
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6105
+ })
6078
6106
  );
6079
6107
  return {
6080
6108
  ok: true,
@@ -6088,14 +6116,13 @@ var SessionManagerCookie = class {
6088
6116
  const res2 = await this.authService.createSession(input);
6089
6117
  if (res2.ok) {
6090
6118
  const now2 = /* @__PURE__ */ new Date();
6091
- cookies__default.default.set(
6119
+ localStorage.setItem(
6092
6120
  this.storageKey,
6093
6121
  JSON.stringify({
6094
6122
  ...res2.data,
6095
6123
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6096
6124
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6097
- }),
6098
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6125
+ })
6099
6126
  );
6100
6127
  return {
6101
6128
  ok: true,
@@ -6115,14 +6142,13 @@ var SessionManagerCookie = class {
6115
6142
  };
6116
6143
  }
6117
6144
  const now = /* @__PURE__ */ new Date();
6118
- cookies__default.default.set(
6145
+ localStorage.setItem(
6119
6146
  this.storageKey,
6120
6147
  JSON.stringify({
6121
6148
  ...res.data,
6122
6149
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6123
6150
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6124
- }),
6125
- {}
6151
+ })
6126
6152
  );
6127
6153
  return {
6128
6154
  ok: true,
@@ -6134,18 +6160,15 @@ var SessionManagerCookie = class {
6134
6160
  if (res.ok) {
6135
6161
  const now = /* @__PURE__ */ new Date();
6136
6162
  if (this.isServer) {
6137
- this.logger.warn("'client cookies' is not available on the server.");
6163
+ this.logger.warn("'localStorage' is not available on the server.");
6138
6164
  } else {
6139
- cookies__default.default.set(
6165
+ localStorage.setItem(
6140
6166
  this.storageKey,
6141
6167
  JSON.stringify({
6142
6168
  ...res.data,
6143
6169
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6144
6170
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6145
- }),
6146
- {
6147
- expires: subMinutes(addDays(now, 30), 2).getTime()
6148
- }
6171
+ })
6149
6172
  );
6150
6173
  }
6151
6174
  return { ok: true };
@@ -6155,7 +6178,7 @@ var SessionManagerCookie = class {
6155
6178
  }
6156
6179
  async get() {
6157
6180
  if (this.isServer) {
6158
- this.logger.warn("'client cookies' is not available on the server.");
6181
+ this.logger.warn("'localStorage' is not available on the server.");
6159
6182
  return {
6160
6183
  ok: true,
6161
6184
  data: null
@@ -6165,7 +6188,7 @@ var SessionManagerCookie = class {
6165
6188
  await sleep(1e3);
6166
6189
  return await this.get();
6167
6190
  }
6168
- const val = cookies__default.default.get(this.storageKey);
6191
+ const val = localStorage.getItem(this.storageKey);
6169
6192
  if (!val) {
6170
6193
  return {
6171
6194
  ok: true,
@@ -6179,7 +6202,7 @@ var SessionManagerCookie = class {
6179
6202
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6180
6203
  if (isAfter(now, refreshTokenExpiresAt)) {
6181
6204
  this.logger.warn("Session expired. Logging out..");
6182
- cookies__default.default.remove(this.storageKey);
6205
+ localStorage.removeItem(this.storageKey);
6183
6206
  return {
6184
6207
  ok: false,
6185
6208
  error: {
@@ -6196,7 +6219,7 @@ var SessionManagerCookie = class {
6196
6219
  if (!res.ok) {
6197
6220
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6198
6221
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6199
- cookies__default.default.remove(this.storageKey);
6222
+ localStorage.removeItem(this.storageKey);
6200
6223
  return {
6201
6224
  ok: false,
6202
6225
  error: res.error
@@ -6217,9 +6240,7 @@ var SessionManagerCookie = class {
6217
6240
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6218
6241
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6219
6242
  };
6220
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6221
- expires: subMinutes(addDays(now, 30), 2).getTime()
6222
- });
6243
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6223
6244
  }
6224
6245
  return {
6225
6246
  ok: true,
@@ -6237,13 +6258,13 @@ var SessionManagerCookie = class {
6237
6258
  }
6238
6259
  async refresh() {
6239
6260
  if (this.isServer) {
6240
- this.logger.warn("'client cookies' is not available on the server.");
6261
+ this.logger.warn("'localStorage' is not available on the server.");
6241
6262
  return {
6242
6263
  ok: true,
6243
6264
  data: null
6244
6265
  };
6245
6266
  }
6246
- const val = cookies__default.default.get(this.storageKey);
6267
+ const val = localStorage.getItem(this.storageKey);
6247
6268
  if (!val) {
6248
6269
  return {
6249
6270
  ok: true,
@@ -6260,7 +6281,7 @@ var SessionManagerCookie = class {
6260
6281
  if (!res.ok) {
6261
6282
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6262
6283
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6263
- cookies__default.default.remove(this.storageKey);
6284
+ localStorage.removeItem(this.storageKey);
6264
6285
  return {
6265
6286
  ok: false,
6266
6287
  error: res.error
@@ -6281,9 +6302,7 @@ var SessionManagerCookie = class {
6281
6302
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6282
6303
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6283
6304
  };
6284
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6285
- expires: subMinutes(addDays(now, 30), 2).getTime()
6286
- });
6305
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6287
6306
  return {
6288
6307
  ok: true,
6289
6308
  data: obj
@@ -6300,18 +6319,18 @@ var SessionManagerCookie = class {
6300
6319
  }
6301
6320
  async destroy() {
6302
6321
  if (this.isServer) {
6303
- this.logger.warn("'client cookies' is not available on the server.");
6322
+ this.logger.warn("'localStorage' is not available on the server.");
6304
6323
  return;
6305
6324
  }
6306
6325
  const res = await this.get();
6307
6326
  if (res.data?.accessToken) {
6308
6327
  await this.authService.destroySession(res.data.accessToken);
6309
6328
  }
6310
- cookies__default.default.remove(this.storageKey);
6329
+ localStorage.removeItem(this.storageKey);
6311
6330
  }
6312
6331
  async verify() {
6313
6332
  if (this.isServer) {
6314
- this.logger.warn("'client cookies' is not available on the server.");
6333
+ this.logger.warn("'localStorage' is not available on the server.");
6315
6334
  return true;
6316
6335
  }
6317
6336
  const s = await this.get();
@@ -6321,13 +6340,13 @@ var SessionManagerCookie = class {
6321
6340
  if (!s.data) return true;
6322
6341
  const v = await this.authService.verifySession(s.data.accessToken);
6323
6342
  if (!v) {
6324
- cookies__default.default.remove(this.storageKey);
6343
+ localStorage.removeItem(this.storageKey);
6325
6344
  }
6326
6345
  return v;
6327
6346
  }
6328
6347
  get onMaya() {
6329
6348
  if (this.isServer) {
6330
- this.logger.warn("'client cookies' is not available on the server.");
6349
+ this.logger.warn("'localStorage' is not available on the server.");
6331
6350
  return false;
6332
6351
  }
6333
6352
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6343,9 +6362,7 @@ var SessionManagerCookie = class {
6343
6362
  return typeof window === "undefined";
6344
6363
  }
6345
6364
  };
6346
-
6347
- // src/sdk/session-manager.ts
6348
- var SessionManager = class {
6365
+ var SessionManagerCookie = class {
6349
6366
  logger;
6350
6367
  storageKey = "session";
6351
6368
  platformStorageKey = "session/platform";
@@ -6356,10 +6373,6 @@ var SessionManager = class {
6356
6373
  this.authService = config.authService;
6357
6374
  this.walletService = config.walletService;
6358
6375
  this.logger = config.logger;
6359
- if (config.sessionPrefix) {
6360
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6361
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6362
- }
6363
6376
  }
6364
6377
  get refreshing() {
6365
6378
  return this._refreshing;
@@ -6368,16 +6381,6 @@ var SessionManager = class {
6368
6381
  this._refreshing = value;
6369
6382
  }
6370
6383
  async create(input) {
6371
- if (this.isServer) {
6372
- this.logger.warn("'localStorage' is not available on the server.");
6373
- return {
6374
- ok: false,
6375
- error: {
6376
- name: "UnknownError",
6377
- message: "Server sign in is not supported."
6378
- }
6379
- };
6380
- }
6381
6384
  if (input.type === "MAYA") {
6382
6385
  localStorage.setItem(this.platformStorageKey, "MAYA");
6383
6386
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6404,13 +6407,14 @@ var SessionManager = class {
6404
6407
  })();
6405
6408
  if (!r1.ok) return r1;
6406
6409
  const now2 = /* @__PURE__ */ new Date();
6407
- localStorage.setItem(
6410
+ cookies__default.default.set(
6408
6411
  this.storageKey,
6409
6412
  JSON.stringify({
6410
6413
  ...r1.data,
6411
6414
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6412
6415
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6413
- })
6416
+ }),
6417
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6414
6418
  );
6415
6419
  return {
6416
6420
  ok: true,
@@ -6421,13 +6425,16 @@ var SessionManager = class {
6421
6425
  const res2 = await this.authService.createSession(input);
6422
6426
  if (res2.ok) {
6423
6427
  const now2 = /* @__PURE__ */ new Date();
6424
- localStorage.setItem(
6428
+ cookies__default.default.set(
6425
6429
  this.storageKey,
6426
6430
  JSON.stringify({
6427
6431
  ...res2.data,
6428
6432
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6429
6433
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6430
- })
6434
+ }),
6435
+ {
6436
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
6437
+ }
6431
6438
  );
6432
6439
  return {
6433
6440
  ok: true,
@@ -6439,18 +6446,18 @@ var SessionManager = class {
6439
6446
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6440
6447
  const res2 = await this.authService.createSession({
6441
6448
  type: "SOCIALS",
6442
- token: input.token,
6443
- channel: input.channel
6449
+ token: input.token
6444
6450
  });
6445
6451
  if (res2.ok) {
6446
6452
  const now2 = /* @__PURE__ */ new Date();
6447
- localStorage.setItem(
6453
+ cookies__default.default.set(
6448
6454
  this.storageKey,
6449
6455
  JSON.stringify({
6450
6456
  ...res2.data,
6451
6457
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6452
6458
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6453
- })
6459
+ }),
6460
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6454
6461
  );
6455
6462
  return {
6456
6463
  ok: true,
@@ -6464,13 +6471,14 @@ var SessionManager = class {
6464
6471
  const res2 = await this.authService.createSession(input);
6465
6472
  if (res2.ok) {
6466
6473
  const now2 = /* @__PURE__ */ new Date();
6467
- localStorage.setItem(
6474
+ cookies__default.default.set(
6468
6475
  this.storageKey,
6469
6476
  JSON.stringify({
6470
6477
  ...res2.data,
6471
6478
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6472
6479
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6473
- })
6480
+ }),
6481
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6474
6482
  );
6475
6483
  return {
6476
6484
  ok: true,
@@ -6490,13 +6498,14 @@ var SessionManager = class {
6490
6498
  };
6491
6499
  }
6492
6500
  const now = /* @__PURE__ */ new Date();
6493
- localStorage.setItem(
6501
+ cookies__default.default.set(
6494
6502
  this.storageKey,
6495
6503
  JSON.stringify({
6496
6504
  ...res.data,
6497
6505
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6498
6506
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6499
- })
6507
+ }),
6508
+ {}
6500
6509
  );
6501
6510
  return {
6502
6511
  ok: true,
@@ -6508,15 +6517,18 @@ var SessionManager = class {
6508
6517
  if (res.ok) {
6509
6518
  const now = /* @__PURE__ */ new Date();
6510
6519
  if (this.isServer) {
6511
- this.logger.warn("'localStorage' is not available on the server.");
6520
+ this.logger.warn("'client cookies' is not available on the server.");
6512
6521
  } else {
6513
- localStorage.setItem(
6522
+ cookies__default.default.set(
6514
6523
  this.storageKey,
6515
6524
  JSON.stringify({
6516
6525
  ...res.data,
6517
6526
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6518
6527
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6519
- })
6528
+ }),
6529
+ {
6530
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6531
+ }
6520
6532
  );
6521
6533
  }
6522
6534
  return { ok: true };
@@ -6526,7 +6538,7 @@ var SessionManager = class {
6526
6538
  }
6527
6539
  async get() {
6528
6540
  if (this.isServer) {
6529
- this.logger.warn("'localStorage' is not available on the server.");
6541
+ this.logger.warn("'client cookies' is not available on the server.");
6530
6542
  return {
6531
6543
  ok: true,
6532
6544
  data: null
@@ -6536,7 +6548,7 @@ var SessionManager = class {
6536
6548
  await sleep(1e3);
6537
6549
  return await this.get();
6538
6550
  }
6539
- const val = localStorage.getItem(this.storageKey);
6551
+ const val = cookies__default.default.get(this.storageKey);
6540
6552
  if (!val) {
6541
6553
  return {
6542
6554
  ok: true,
@@ -6550,7 +6562,7 @@ var SessionManager = class {
6550
6562
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6551
6563
  if (isAfter(now, refreshTokenExpiresAt)) {
6552
6564
  this.logger.warn("Session expired. Logging out..");
6553
- localStorage.removeItem(this.storageKey);
6565
+ cookies__default.default.remove(this.storageKey);
6554
6566
  return {
6555
6567
  ok: false,
6556
6568
  error: {
@@ -6567,7 +6579,7 @@ var SessionManager = class {
6567
6579
  if (!res.ok) {
6568
6580
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6569
6581
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6570
- localStorage.removeItem(this.storageKey);
6582
+ cookies__default.default.remove(this.storageKey);
6571
6583
  return {
6572
6584
  ok: false,
6573
6585
  error: res.error
@@ -6588,7 +6600,9 @@ var SessionManager = class {
6588
6600
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6589
6601
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6590
6602
  };
6591
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6603
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6604
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6605
+ });
6592
6606
  }
6593
6607
  return {
6594
6608
  ok: true,
@@ -6606,13 +6620,13 @@ var SessionManager = class {
6606
6620
  }
6607
6621
  async refresh() {
6608
6622
  if (this.isServer) {
6609
- this.logger.warn("'localStorage' is not available on the server.");
6623
+ this.logger.warn("'client cookies' is not available on the server.");
6610
6624
  return {
6611
6625
  ok: true,
6612
6626
  data: null
6613
6627
  };
6614
6628
  }
6615
- const val = localStorage.getItem(this.storageKey);
6629
+ const val = cookies__default.default.get(this.storageKey);
6616
6630
  if (!val) {
6617
6631
  return {
6618
6632
  ok: true,
@@ -6629,7 +6643,7 @@ var SessionManager = class {
6629
6643
  if (!res.ok) {
6630
6644
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6631
6645
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6632
- localStorage.removeItem(this.storageKey);
6646
+ cookies__default.default.remove(this.storageKey);
6633
6647
  return {
6634
6648
  ok: false,
6635
6649
  error: res.error
@@ -6650,7 +6664,9 @@ var SessionManager = class {
6650
6664
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6651
6665
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6652
6666
  };
6653
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6667
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6668
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6669
+ });
6654
6670
  return {
6655
6671
  ok: true,
6656
6672
  data: obj
@@ -6667,18 +6683,18 @@ var SessionManager = class {
6667
6683
  }
6668
6684
  async destroy() {
6669
6685
  if (this.isServer) {
6670
- this.logger.warn("'localStorage' is not available on the server.");
6686
+ this.logger.warn("'client cookies' is not available on the server.");
6671
6687
  return;
6672
6688
  }
6673
6689
  const res = await this.get();
6674
6690
  if (res.data?.accessToken) {
6675
6691
  await this.authService.destroySession(res.data.accessToken);
6676
6692
  }
6677
- localStorage.removeItem(this.storageKey);
6693
+ cookies__default.default.remove(this.storageKey);
6678
6694
  }
6679
6695
  async verify() {
6680
6696
  if (this.isServer) {
6681
- this.logger.warn("'localStorage' is not available on the server.");
6697
+ this.logger.warn("'client cookies' is not available on the server.");
6682
6698
  return true;
6683
6699
  }
6684
6700
  const s = await this.get();
@@ -6688,13 +6704,13 @@ var SessionManager = class {
6688
6704
  if (!s.data) return true;
6689
6705
  const v = await this.authService.verifySession(s.data.accessToken);
6690
6706
  if (!v) {
6691
- localStorage.removeItem(this.storageKey);
6707
+ cookies__default.default.remove(this.storageKey);
6692
6708
  }
6693
6709
  return v;
6694
6710
  }
6695
6711
  get onMaya() {
6696
6712
  if (this.isServer) {
6697
- this.logger.warn("'localStorage' is not available on the server.");
6713
+ this.logger.warn("'client cookies' is not available on the server.");
6698
6714
  return false;
6699
6715
  }
6700
6716
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -8931,7 +8947,7 @@ var Sdk = class {
8931
8947
  }
8932
8948
  });
8933
8949
  }
8934
- async registerAgentAccount(input) {
8950
+ async registerAgentAccount(input, code) {
8935
8951
  return await this.accountService.registerAgentAccount({
8936
8952
  input: {
8937
8953
  name: input.name,
@@ -8941,6 +8957,7 @@ var Sdk = class {
8941
8957
  emailAddress: input.emailAddress,
8942
8958
  customProperties: input.customProperties
8943
8959
  },
8960
+ ...code && { code },
8944
8961
  ...this.webDomain && {
8945
8962
  domain: this.webDomain
8946
8963
  }
@@ -10398,12 +10415,17 @@ var Sdk = class {
10398
10415
  }
10399
10416
  };
10400
10417
  }
10401
- async tournamentsTotalCount(input) {
10402
- const res = await this.reportService.tournamentsTotalCount(input);
10418
+ async tournamentsIds(input) {
10419
+ const res = await this.reportService.tournamentsIds(input);
10403
10420
  if (!res.ok) return res;
10404
10421
  return {
10405
10422
  ok: true,
10406
- data: res.data
10423
+ data: {
10424
+ tournaments: res.data.edges.map(({ node }) => node.id),
10425
+ hasNextPage: res.data.pageInfo.hasNextPage,
10426
+ totalCount: res.data.totalCount,
10427
+ endCursor: res.data.pageInfo.endCursor ?? void 0
10428
+ }
10407
10429
  };
10408
10430
  }
10409
10431
  /*