@opexa/portal-sdk 0.59.95 → 0.59.97

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,6 +1,6 @@
1
1
  import { gql, statusCodeToOperationError, callIfFn } from './chunk-WVFSGB7Y.js';
2
- import { Capacitor } from '@capacitor/core';
3
2
  import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
3
+ import { Capacitor } from '@capacitor/core';
4
4
 
5
5
  // src/services/queries.ts
6
6
  var FILE_FRAGMENT = gql`
@@ -4677,15 +4677,22 @@ async function getFingerPrint() {
4677
4677
  return null;
4678
4678
  }
4679
4679
  }
4680
-
4681
- // src/services/auth.service.ts
4682
4680
  function isWebPlatform() {
4683
4681
  try {
4684
4682
  return Capacitor.getPlatform() === "web";
4683
+ } catch {
4684
+ return true;
4685
+ }
4686
+ }
4687
+ function isIOSPlatform() {
4688
+ try {
4689
+ return Capacitor.getPlatform() === "ios";
4685
4690
  } catch {
4686
4691
  return false;
4687
4692
  }
4688
4693
  }
4694
+
4695
+ // src/services/auth.service.ts
4689
4696
  var AuthService = class {
4690
4697
  url;
4691
4698
  options;
@@ -4741,12 +4748,15 @@ var AuthService = class {
4741
4748
  try {
4742
4749
  const isWeb = isWebPlatform();
4743
4750
  const queryParam = isWeb && version === 4 ? "?type=web" : "";
4744
- const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}${queryParam}`, {
4745
- method: "POST",
4746
- headers,
4747
- body: JSON.stringify(input),
4748
- ...version === 4 && { credentials: "include" }
4749
- });
4751
+ const res = await fetch(
4752
+ `${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}${queryParam}`,
4753
+ {
4754
+ method: "POST",
4755
+ headers,
4756
+ body: JSON.stringify(input),
4757
+ ...version === 4 && { credentials: "include" }
4758
+ }
4759
+ );
4750
4760
  const body = await res.json();
4751
4761
  if (res.ok) {
4752
4762
  return {
@@ -4829,7 +4839,7 @@ var AuthService = class {
4829
4839
  }
4830
4840
  async refreshSession(refreshToken, version = 1) {
4831
4841
  const headers = new Headers(this.headers);
4832
- if (version !== 4) {
4842
+ if (version !== 4 || refreshToken) {
4833
4843
  headers.append("Authorization", `Bearer ${refreshToken}`);
4834
4844
  }
4835
4845
  try {
@@ -4943,11 +4953,14 @@ var AuthService = class {
4943
4953
  }
4944
4954
  }
4945
4955
  try {
4946
- const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/otps` : "/otps"}`, {
4947
- method: "POST",
4948
- headers: this.headers,
4949
- body: JSON.stringify(input)
4950
- });
4956
+ const res = await fetch(
4957
+ `${this.url}${version !== 1 ? `/v${version}/otps` : "/otps"}`,
4958
+ {
4959
+ method: "POST",
4960
+ headers: this.headers,
4961
+ body: JSON.stringify(input)
4962
+ }
4963
+ );
4951
4964
  if (res.status === 403) {
4952
4965
  const data = await res.json();
4953
4966
  const code = getErrorCode(data.message);
@@ -6858,6 +6871,6 @@ var ExtensionService = class {
6858
6871
  }
6859
6872
  };
6860
6873
 
6861
- export { AccountService, AuthService, CmsPortalService, ExtensionService, FileService, GameService, PortalService, ReportService, TriggerService, WalletService, getFingerPrint };
6862
- //# sourceMappingURL=chunk-RCMZBLLX.js.map
6863
- //# sourceMappingURL=chunk-RCMZBLLX.js.map
6874
+ export { AccountService, AuthService, CmsPortalService, ExtensionService, FileService, GameService, PortalService, ReportService, TriggerService, WalletService, getFingerPrint, isIOSPlatform };
6875
+ //# sourceMappingURL=chunk-MJLXQ6HC.js.map
6876
+ //# sourceMappingURL=chunk-MJLXQ6HC.js.map