@opexa/portal-sdk 0.59.63 → 0.59.65

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.
@@ -35,7 +35,7 @@ type Modifiable = {
35
35
  interface ModifiedRequest extends Readonly<Omit<Request, ModifiableKey>>, Modifiable {
36
36
  }
37
37
  type GraphQLClientMiddleware = (request: ModifiedRequest) => ModifiedRequest | Promise<ModifiedRequest>;
38
- interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body' | 'method'> {
38
+ interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body'> {
39
39
  }
40
40
  interface GraphQLClientConfig {
41
41
  fetch?: typeof globalThis.fetch | null;
@@ -35,7 +35,7 @@ type Modifiable = {
35
35
  interface ModifiedRequest extends Readonly<Omit<Request, ModifiableKey>>, Modifiable {
36
36
  }
37
37
  type GraphQLClientMiddleware = (request: ModifiedRequest) => ModifiedRequest | Promise<ModifiedRequest>;
38
- interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body' | 'method'> {
38
+ interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body'> {
39
39
  }
40
40
  interface GraphQLClientConfig {
41
41
  fetch?: typeof globalThis.fetch | null;
package/dist/index.cjs CHANGED
@@ -3090,6 +3090,26 @@ var TOP_WINS_NEXT_QUERY = gql`
3090
3090
  }
3091
3091
  }
3092
3092
  `;
3093
+ var TOP_WINS_QUERY__NEXT = gql`
3094
+ query TopWins {
3095
+ topWins: _topWins {
3096
+ id
3097
+ game {
3098
+ id
3099
+ name
3100
+ type
3101
+ provider
3102
+ reference
3103
+ }
3104
+ member {
3105
+ id
3106
+ name
3107
+ }
3108
+ multiplier
3109
+ payout
3110
+ }
3111
+ }
3112
+ `;
3093
3113
  var JACKPOTS_QUERY = gql`
3094
3114
  query Jackpots(
3095
3115
  $first: Int
@@ -5096,13 +5116,33 @@ var PortalService = class {
5096
5116
  };
5097
5117
  }
5098
5118
  async topWinsNext() {
5099
- const res = await this.client.request(TOP_WINS_NEXT_QUERY);
5119
+ const res = await this.client.request(
5120
+ TOP_WINS_NEXT_QUERY,
5121
+ void 0,
5122
+ {
5123
+ method: "GET"
5124
+ }
5125
+ );
5100
5126
  if (!res.ok) return res;
5101
5127
  return {
5102
5128
  ok: true,
5103
5129
  data: res.data._topWins
5104
5130
  };
5105
5131
  }
5132
+ async topWins__next() {
5133
+ const res = await this.client.request(
5134
+ TOP_WINS_QUERY__NEXT,
5135
+ void 0,
5136
+ {
5137
+ method: "GET"
5138
+ }
5139
+ );
5140
+ if (!res.ok) return res;
5141
+ return {
5142
+ ok: true,
5143
+ data: res.data.topWins
5144
+ };
5145
+ }
5106
5146
  };
5107
5147
 
5108
5148
  // src/services/report.service.ts
@@ -5174,7 +5214,9 @@ var ReportService = class {
5174
5214
  return res.ok ? { ok: res.ok, data: res.data.promoByCode } : res;
5175
5215
  }
5176
5216
  async jackpots(variables) {
5177
- const res = await this.client.request(JACKPOTS_QUERY, variables);
5217
+ const res = await this.client.request(JACKPOTS_QUERY, variables, {
5218
+ method: "GET"
5219
+ });
5178
5220
  if (!res.ok) return res;
5179
5221
  return {
5180
5222
  ok: true,
@@ -5182,7 +5224,9 @@ var ReportService = class {
5182
5224
  };
5183
5225
  }
5184
5226
  async _jackpots(variables) {
5185
- const res = await this.client.request(_JACKPOTS_QUERY, variables);
5227
+ const res = await this.client.request(_JACKPOTS_QUERY, variables, {
5228
+ method: "GET"
5229
+ });
5186
5230
  if (!res.ok) return res;
5187
5231
  return {
5188
5232
  ok: true,
@@ -5190,7 +5234,9 @@ var ReportService = class {
5190
5234
  };
5191
5235
  }
5192
5236
  async jackpotsIds(variables) {
5193
- const res = await this.client.request(JACKPOTS_IDS_QUERY, variables);
5237
+ const res = await this.client.request(JACKPOTS_IDS_QUERY, variables, {
5238
+ method: "GET"
5239
+ });
5194
5240
  if (!res.ok) return res;
5195
5241
  return {
5196
5242
  ok: true,
@@ -5206,7 +5252,9 @@ var ReportService = class {
5206
5252
  };
5207
5253
  }
5208
5254
  async tournaments(variables) {
5209
- const res = await this.client.request(TOURNAMENTS_QUERY, variables);
5255
+ const res = await this.client.request(TOURNAMENTS_QUERY, variables, {
5256
+ method: "GET"
5257
+ });
5210
5258
  if (!res.ok) return res;
5211
5259
  return {
5212
5260
  ok: true,
@@ -5214,7 +5262,9 @@ var ReportService = class {
5214
5262
  };
5215
5263
  }
5216
5264
  async tournamentsIds(variables) {
5217
- const res = await this.client.request(TOURNAMENTS_IDS_QUERY, variables);
5265
+ const res = await this.client.request(TOURNAMENTS_IDS_QUERY, variables, {
5266
+ method: "GET"
5267
+ });
5218
5268
  if (!res.ok) return res;
5219
5269
  return {
5220
5270
  ok: true,
@@ -5425,16 +5475,24 @@ var WalletService = class {
5425
5475
  this.client = client;
5426
5476
  }
5427
5477
  async promos() {
5428
- const res = await this.client.request(PROMOS_QUERY);
5478
+ const res = await this.client.request(PROMOS_QUERY, void 0, {
5479
+ method: "GET"
5480
+ });
5429
5481
  return res.ok ? { ok: res.ok, data: res.data.promos } : res;
5430
5482
  }
5431
5483
  async cashbacks() {
5432
- const res = await this.client.request(CASHBACKS_QUERY);
5484
+ const res = await this.client.request(CASHBACKS_QUERY, void 0, {
5485
+ method: "GET"
5486
+ });
5433
5487
  return res.ok ? { ok: res.ok, data: res.data.cashbacks } : res;
5434
5488
  }
5435
5489
  async promosAndCashbacks() {
5436
5490
  const res = await this.client.request(
5437
- PROMOS_AND_CASHBACKS_QUERY
5491
+ PROMOS_AND_CASHBACKS_QUERY,
5492
+ void 0,
5493
+ {
5494
+ method: "GET"
5495
+ }
5438
5496
  );
5439
5497
  return res.ok ? {
5440
5498
  ok: res.ok,
@@ -6484,24 +6542,34 @@ var GraphQLClient = class {
6484
6542
  },
6485
6543
  userOptions
6486
6544
  );
6487
- const body = JSON.stringify({
6488
- query,
6489
- variables
6490
- });
6491
- const headers = new Headers(options.headers);
6492
- headers.set("Content-Type", "application/json");
6493
- headers.set("Accept", "application/json");
6494
6545
  const url = new URL(this.url);
6495
6546
  const operationInfo = getOperationInfo(query);
6496
6547
  if (operationInfo) {
6497
6548
  url.searchParams.set(`_${operationInfo.type}`, operationInfo.name);
6498
6549
  }
6550
+ const method = options.method?.toUpperCase() ?? "POST";
6551
+ const headers = new Headers(options.headers);
6552
+ let body;
6553
+ if (method === "GET") {
6554
+ url.searchParams.set("query", minify(query));
6555
+ if (variables) {
6556
+ url.searchParams.set("variables", JSON.stringify(variables));
6557
+ }
6558
+ headers.delete("Content-Type");
6559
+ } else {
6560
+ body = JSON.stringify({
6561
+ query,
6562
+ variables
6563
+ });
6564
+ headers.set("Content-Type", "application/json");
6565
+ }
6566
+ headers.set("Accept", "application/json");
6499
6567
  const req = await this.runMiddlewares(
6500
6568
  new Request(url, {
6501
6569
  ...options,
6502
6570
  body,
6503
6571
  headers,
6504
- method: "POST"
6572
+ method
6505
6573
  }),
6506
6574
  config?.middlewares ?? []
6507
6575
  );
@@ -6628,12 +6696,19 @@ function mergeFetchOptions(i, j) {
6628
6696
  headers: mergeHeaders(i.headers, j.headers)
6629
6697
  };
6630
6698
  }
6699
+ function minify(input) {
6700
+ return input.replace(/\s+/g, " ").trim();
6701
+ }
6631
6702
  function mergeHeaders(i, j) {
6632
6703
  if (!i) return j;
6633
6704
  if (!j) return i;
6634
6705
  const h = new Headers();
6635
- new Headers(i).forEach((v, k) => h.append(k, v));
6636
- new Headers(j).forEach((v, k) => h.append(k, v));
6706
+ new Headers(i).forEach((v, k) => {
6707
+ h.append(k, v);
6708
+ });
6709
+ new Headers(j).forEach((v, k) => {
6710
+ h.append(k, v);
6711
+ });
6637
6712
  return h;
6638
6713
  }
6639
6714
 
@@ -7734,6 +7809,7 @@ var Transformer = class {
7734
7809
  promoByCode: this.promoByCode.bind(this),
7735
7810
  quest: this.quest.bind(this),
7736
7811
  topWin: this.topWin.bind(this),
7812
+ topWin__next: this.topWin__next.bind(this),
7737
7813
  jackpots: this.jackpots.bind(this),
7738
7814
  jackpotPayouts: this.jackpotPayouts.bind(this),
7739
7815
  tournaments: this.tournaments.bind(this),
@@ -9250,6 +9326,19 @@ var Transformer = class {
9250
9326
  payout: parseDecimal(data.payout, 0)
9251
9327
  };
9252
9328
  }
9329
+ topWin__next(data) {
9330
+ const image = `${ENDPOINTS.production.static}/images/${data.game.provider.toLowerCase()}/thumbnail-${data.game.id}.webp?cache_id=${IMAGE_CACHE_ID}`;
9331
+ return {
9332
+ id: data.id,
9333
+ game: {
9334
+ ...data.game,
9335
+ images: [image]
9336
+ },
9337
+ member: data.member,
9338
+ multiplier: parseDecimal(data.multiplier, 0),
9339
+ payout: parseDecimal(data.payout, 0)
9340
+ };
9341
+ }
9253
9342
  jackpots(data) {
9254
9343
  return {
9255
9344
  id: data.id,
@@ -11771,6 +11860,14 @@ var Sdk = class {
11771
11860
  })
11772
11861
  };
11773
11862
  }
11863
+ async topWins__next() {
11864
+ const res = await this.portalService.topWins__next();
11865
+ if (!res.ok) return res;
11866
+ return {
11867
+ ok: true,
11868
+ data: res.data.map(this.transformer.transform.topWin__next)
11869
+ };
11870
+ }
11774
11871
  /*
11775
11872
  *=============================================
11776
11873
  * JACKPOT