@opexa/portal-sdk 0.59.75 → 0.59.77

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.
@@ -1,4 +1,4 @@
1
- import { gql, statusCodeToOperationError, callIfFn } from './chunk-ROBGEUSE.js';
1
+ import { gql, statusCodeToOperationError, callIfFn } from './chunk-WVFSGB7Y.js';
2
2
  import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
3
3
 
4
4
  // src/services/queries.ts
@@ -4450,7 +4450,7 @@ var AuthService = class {
4450
4450
  }
4451
4451
  async createSession(input, version = 1) {
4452
4452
  const headers = new Headers(this.headers);
4453
- if (version === 3) {
4453
+ if (version === 3 || version === 4) {
4454
4454
  const fingerprint = await getFingerPrint();
4455
4455
  if (fingerprint) {
4456
4456
  headers.append("Fingerprint", fingerprint);
@@ -4488,14 +4488,12 @@ var AuthService = class {
4488
4488
  headers.set("test-pass", input.testPass);
4489
4489
  }
4490
4490
  try {
4491
- const res = await fetch(
4492
- `${this.url}${version === 3 ? "/v3/sessions" : "/sessions"}`,
4493
- {
4494
- method: "POST",
4495
- headers,
4496
- body: JSON.stringify(input)
4497
- }
4498
- );
4491
+ const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}`, {
4492
+ method: "POST",
4493
+ headers,
4494
+ body: JSON.stringify(input),
4495
+ ...version === 4 && { credentials: "include" }
4496
+ });
4499
4497
  const data = await res.json();
4500
4498
  if (res.ok) {
4501
4499
  return {
@@ -4576,14 +4574,26 @@ var AuthService = class {
4576
4574
  }
4577
4575
  throw new Error("Invalid input 'type'");
4578
4576
  }
4579
- async refreshSession(refreshToken) {
4577
+ async refreshSession(refreshToken, version = 1) {
4580
4578
  const headers = new Headers(this.headers);
4581
- headers.append("Authorization", `Bearer ${refreshToken}`);
4579
+ if (version !== 4) {
4580
+ headers.append("Authorization", `Bearer ${refreshToken}`);
4581
+ }
4582
+ if (version === 3 || version === 4) {
4583
+ const fingerprint = await getFingerPrint();
4584
+ if (fingerprint) {
4585
+ headers.append("Fingerprint", fingerprint);
4586
+ }
4587
+ }
4582
4588
  try {
4583
- const res = await fetch(`${this.url}/session:refresh`, {
4584
- method: "POST",
4585
- headers
4586
- });
4589
+ const res = await fetch(
4590
+ `${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
4591
+ {
4592
+ method: "POST",
4593
+ headers,
4594
+ ...version === 4 && { credentials: "include" }
4595
+ }
4596
+ );
4587
4597
  const data = await res.json();
4588
4598
  if (res.ok) {
4589
4599
  return {
@@ -4620,14 +4630,20 @@ var AuthService = class {
4620
4630
  };
4621
4631
  }
4622
4632
  }
4623
- async destroySession(accessToken) {
4633
+ async destroySession(accessToken, version = 1) {
4624
4634
  const headers = new Headers(this.headers);
4625
- headers.append("Authorization", `Bearer ${accessToken}`);
4635
+ if (version !== 4) {
4636
+ headers.append("Authorization", `Bearer ${accessToken}`);
4637
+ }
4626
4638
  try {
4627
- const res = await fetch(`${this.url}/session`, {
4628
- method: "DELETE",
4629
- headers
4630
- });
4639
+ const res = await fetch(
4640
+ `${this.url}${version !== 1 ? `/v${version}/session` : "/session"}`,
4641
+ {
4642
+ method: "DELETE",
4643
+ headers,
4644
+ ...version === 4 && { credentials: "include" }
4645
+ }
4646
+ );
4631
4647
  return res.ok ? { ok: true } : { ok: false, error: statusCodeToOperationError(res.status) };
4632
4648
  } catch {
4633
4649
  return { ok: false, error: statusCodeToOperationError(500) };
@@ -6497,5 +6513,5 @@ var ExtensionService = class {
6497
6513
  };
6498
6514
 
6499
6515
  export { AccountService, AuthService, CmsPortalService, ExtensionService, FileService, GameService, PortalService, ReportService, TriggerService, WalletService, getFingerPrint };
6500
- //# sourceMappingURL=chunk-UT6VBXJ4.js.map
6501
- //# sourceMappingURL=chunk-UT6VBXJ4.js.map
6516
+ //# sourceMappingURL=chunk-3WS4U4B7.js.map
6517
+ //# sourceMappingURL=chunk-3WS4U4B7.js.map