@opexa/portal-sdk 0.59.79 → 0.59.81

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,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var core = require('@capacitor/core');
3
4
  var thumbmarkjs = require('@thumbmarkjs/thumbmarkjs');
4
5
 
5
6
  // src/utils/gql.ts
@@ -4464,6 +4465,13 @@ var ERROR_MAP = {
4464
4465
  };
4465
4466
 
4466
4467
  // src/services/auth.service.ts
4468
+ function isWebPlatform() {
4469
+ try {
4470
+ return core.Capacitor.getPlatform() === "web";
4471
+ } catch {
4472
+ return false;
4473
+ }
4474
+ }
4467
4475
  var AuthService = class {
4468
4476
  url;
4469
4477
  options;
@@ -4517,7 +4525,9 @@ var AuthService = class {
4517
4525
  headers.set("test-pass", input.testPass);
4518
4526
  }
4519
4527
  try {
4520
- const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}`, {
4528
+ const isWeb = isWebPlatform();
4529
+ const queryParam = isWeb && version === 4 ? "?type=web" : "";
4530
+ const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}${queryParam}`, {
4521
4531
  method: "POST",
4522
4532
  headers,
4523
4533
  body: JSON.stringify(input),
@@ -4615,8 +4625,10 @@ var AuthService = class {
4615
4625
  }
4616
4626
  }
4617
4627
  try {
4628
+ const isWeb = isWebPlatform();
4629
+ const queryParam = isWeb && version === 4 ? "?type=web" : "";
4618
4630
  const res = await fetch(
4619
- `${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
4631
+ `${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}${queryParam}`,
4620
4632
  {
4621
4633
  method: "POST",
4622
4634
  headers,
@@ -4695,7 +4707,7 @@ var AuthService = class {
4695
4707
  return true;
4696
4708
  }
4697
4709
  }
4698
- async sendVerificationCode(input) {
4710
+ async sendVerificationCode(input, version = 1) {
4699
4711
  if (input.channel === "EMAIL")
4700
4712
  throw new Error("Email channel is not yet supported");
4701
4713
  function getErrorCode(message) {
@@ -4711,7 +4723,7 @@ var AuthService = class {
4711
4723
  }
4712
4724
  }
4713
4725
  try {
4714
- const res = await fetch(`${this.url}/otps`, {
4726
+ const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/otps` : "/otps"}`, {
4715
4727
  method: "POST",
4716
4728
  headers: this.headers,
4717
4729
  body: JSON.stringify(input)