@opexa/portal-sdk 0.59.62 → 0.59.64

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
@@ -5096,7 +5096,13 @@ var PortalService = class {
5096
5096
  };
5097
5097
  }
5098
5098
  async topWinsNext() {
5099
- const res = await this.client.request(TOP_WINS_NEXT_QUERY);
5099
+ const res = await this.client.request(
5100
+ TOP_WINS_NEXT_QUERY,
5101
+ void 0,
5102
+ {
5103
+ method: "GET"
5104
+ }
5105
+ );
5100
5106
  if (!res.ok) return res;
5101
5107
  return {
5102
5108
  ok: true,
@@ -5174,7 +5180,9 @@ var ReportService = class {
5174
5180
  return res.ok ? { ok: res.ok, data: res.data.promoByCode } : res;
5175
5181
  }
5176
5182
  async jackpots(variables) {
5177
- const res = await this.client.request(JACKPOTS_QUERY, variables);
5183
+ const res = await this.client.request(JACKPOTS_QUERY, variables, {
5184
+ method: "GET"
5185
+ });
5178
5186
  if (!res.ok) return res;
5179
5187
  return {
5180
5188
  ok: true,
@@ -5182,7 +5190,9 @@ var ReportService = class {
5182
5190
  };
5183
5191
  }
5184
5192
  async _jackpots(variables) {
5185
- const res = await this.client.request(_JACKPOTS_QUERY, variables);
5193
+ const res = await this.client.request(_JACKPOTS_QUERY, variables, {
5194
+ method: "GET"
5195
+ });
5186
5196
  if (!res.ok) return res;
5187
5197
  return {
5188
5198
  ok: true,
@@ -5190,7 +5200,9 @@ var ReportService = class {
5190
5200
  };
5191
5201
  }
5192
5202
  async jackpotsIds(variables) {
5193
- const res = await this.client.request(JACKPOTS_IDS_QUERY, variables);
5203
+ const res = await this.client.request(JACKPOTS_IDS_QUERY, variables, {
5204
+ method: "GET"
5205
+ });
5194
5206
  if (!res.ok) return res;
5195
5207
  return {
5196
5208
  ok: true,
@@ -5206,7 +5218,9 @@ var ReportService = class {
5206
5218
  };
5207
5219
  }
5208
5220
  async tournaments(variables) {
5209
- const res = await this.client.request(TOURNAMENTS_QUERY, variables);
5221
+ const res = await this.client.request(TOURNAMENTS_QUERY, variables, {
5222
+ method: "GET"
5223
+ });
5210
5224
  if (!res.ok) return res;
5211
5225
  return {
5212
5226
  ok: true,
@@ -5214,7 +5228,9 @@ var ReportService = class {
5214
5228
  };
5215
5229
  }
5216
5230
  async tournamentsIds(variables) {
5217
- const res = await this.client.request(TOURNAMENTS_IDS_QUERY, variables);
5231
+ const res = await this.client.request(TOURNAMENTS_IDS_QUERY, variables, {
5232
+ method: "GET"
5233
+ });
5218
5234
  if (!res.ok) return res;
5219
5235
  return {
5220
5236
  ok: true,
@@ -6484,24 +6500,34 @@ var GraphQLClient = class {
6484
6500
  },
6485
6501
  userOptions
6486
6502
  );
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
6503
  const url = new URL(this.url);
6495
6504
  const operationInfo = getOperationInfo(query);
6496
6505
  if (operationInfo) {
6497
6506
  url.searchParams.set(`_${operationInfo.type}`, operationInfo.name);
6498
6507
  }
6508
+ const method = options.method?.toUpperCase() ?? "POST";
6509
+ const headers = new Headers(options.headers);
6510
+ let body;
6511
+ if (method === "GET") {
6512
+ url.searchParams.set("query", minify(query));
6513
+ if (variables) {
6514
+ url.searchParams.set("variables", JSON.stringify(variables));
6515
+ }
6516
+ headers.delete("Content-Type");
6517
+ } else {
6518
+ body = JSON.stringify({
6519
+ query,
6520
+ variables
6521
+ });
6522
+ headers.set("Content-Type", "application/json");
6523
+ }
6524
+ headers.set("Accept", "application/json");
6499
6525
  const req = await this.runMiddlewares(
6500
6526
  new Request(url, {
6501
6527
  ...options,
6502
6528
  body,
6503
6529
  headers,
6504
- method: "POST"
6530
+ method
6505
6531
  }),
6506
6532
  config?.middlewares ?? []
6507
6533
  );
@@ -6628,12 +6654,19 @@ function mergeFetchOptions(i, j) {
6628
6654
  headers: mergeHeaders(i.headers, j.headers)
6629
6655
  };
6630
6656
  }
6657
+ function minify(input) {
6658
+ return input.replace(/\s+/g, " ").trim();
6659
+ }
6631
6660
  function mergeHeaders(i, j) {
6632
6661
  if (!i) return j;
6633
6662
  if (!j) return i;
6634
6663
  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));
6664
+ new Headers(i).forEach((v, k) => {
6665
+ h.append(k, v);
6666
+ });
6667
+ new Headers(j).forEach((v, k) => {
6668
+ h.append(k, v);
6669
+ });
6637
6670
  return h;
6638
6671
  }
6639
6672
 
@@ -10403,15 +10436,18 @@ var Sdk = class {
10403
10436
  }
10404
10437
  });
10405
10438
  }
10406
- async sendVerificationCode__next(input) {
10439
+ async sendVerificationCode__next(input, recaptchaResponse) {
10407
10440
  if (input.type === "SMS") {
10408
- return this.authService.sendVerificationCode({
10409
- channel: "SMS",
10410
- recipient: addAreaCode(input.mobileNumber, await this.locale),
10411
- ...input.strict && {
10412
- verificationType: "MEMBER"
10413
- }
10414
- });
10441
+ return this.authService.sendVerificationCode(
10442
+ {
10443
+ channel: "SMS",
10444
+ recipient: addAreaCode(input.mobileNumber, await this.locale),
10445
+ ...input.strict && {
10446
+ verificationType: "MEMBER"
10447
+ }
10448
+ },
10449
+ recaptchaResponse
10450
+ );
10415
10451
  }
10416
10452
  throw new Error("'Email' verification code is not yet supported");
10417
10453
  }