@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.
- package/dist/{chunk-RCMZBLLX.js → chunk-MJLXQ6HC.js} +31 -18
- package/dist/chunk-MJLXQ6HC.js.map +1 -0
- package/dist/index.cjs +254 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +223 -72
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +26 -20
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.js +1 -1
- package/package.json +9 -2
- package/dist/chunk-RCMZBLLX.js.map +0 -1
package/dist/services/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var core = require('@capacitor/core');
|
|
4
3
|
var thumbmarkjs = require('@thumbmarkjs/thumbmarkjs');
|
|
4
|
+
var core = require('@capacitor/core');
|
|
5
5
|
|
|
6
6
|
// src/utils/gql.ts
|
|
7
7
|
function gql(strings, ...values) {
|
|
@@ -4688,6 +4688,13 @@ async function getFingerPrint() {
|
|
|
4688
4688
|
return null;
|
|
4689
4689
|
}
|
|
4690
4690
|
}
|
|
4691
|
+
function isWebPlatform() {
|
|
4692
|
+
try {
|
|
4693
|
+
return core.Capacitor.getPlatform() === "web";
|
|
4694
|
+
} catch {
|
|
4695
|
+
return true;
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4691
4698
|
|
|
4692
4699
|
// src/utils/status-code-to-operation-error.ts
|
|
4693
4700
|
function statusCodeToOperationError(value, message) {
|
|
@@ -4708,13 +4715,6 @@ var ERROR_MAP = {
|
|
|
4708
4715
|
};
|
|
4709
4716
|
|
|
4710
4717
|
// src/services/auth.service.ts
|
|
4711
|
-
function isWebPlatform() {
|
|
4712
|
-
try {
|
|
4713
|
-
return core.Capacitor.getPlatform() === "web";
|
|
4714
|
-
} catch {
|
|
4715
|
-
return false;
|
|
4716
|
-
}
|
|
4717
|
-
}
|
|
4718
4718
|
var AuthService = class {
|
|
4719
4719
|
url;
|
|
4720
4720
|
options;
|
|
@@ -4770,12 +4770,15 @@ var AuthService = class {
|
|
|
4770
4770
|
try {
|
|
4771
4771
|
const isWeb = isWebPlatform();
|
|
4772
4772
|
const queryParam = isWeb && version === 4 ? "?type=web" : "";
|
|
4773
|
-
const res = await fetch(
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4773
|
+
const res = await fetch(
|
|
4774
|
+
`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}${queryParam}`,
|
|
4775
|
+
{
|
|
4776
|
+
method: "POST",
|
|
4777
|
+
headers,
|
|
4778
|
+
body: JSON.stringify(input),
|
|
4779
|
+
...version === 4 && { credentials: "include" }
|
|
4780
|
+
}
|
|
4781
|
+
);
|
|
4779
4782
|
const body = await res.json();
|
|
4780
4783
|
if (res.ok) {
|
|
4781
4784
|
return {
|
|
@@ -4858,7 +4861,7 @@ var AuthService = class {
|
|
|
4858
4861
|
}
|
|
4859
4862
|
async refreshSession(refreshToken, version = 1) {
|
|
4860
4863
|
const headers = new Headers(this.headers);
|
|
4861
|
-
if (version !== 4) {
|
|
4864
|
+
if (version !== 4 || refreshToken) {
|
|
4862
4865
|
headers.append("Authorization", `Bearer ${refreshToken}`);
|
|
4863
4866
|
}
|
|
4864
4867
|
try {
|
|
@@ -4972,11 +4975,14 @@ var AuthService = class {
|
|
|
4972
4975
|
}
|
|
4973
4976
|
}
|
|
4974
4977
|
try {
|
|
4975
|
-
const res = await fetch(
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4978
|
+
const res = await fetch(
|
|
4979
|
+
`${this.url}${version !== 1 ? `/v${version}/otps` : "/otps"}`,
|
|
4980
|
+
{
|
|
4981
|
+
method: "POST",
|
|
4982
|
+
headers: this.headers,
|
|
4983
|
+
body: JSON.stringify(input)
|
|
4984
|
+
}
|
|
4985
|
+
);
|
|
4980
4986
|
if (res.status === 403) {
|
|
4981
4987
|
const data = await res.json();
|
|
4982
4988
|
const code = getErrorCode(data.message);
|