@opexa/portal-sdk 0.59.76 → 0.59.78
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/README.md +1634 -1634
- package/dist/{chunk-7APXFZ5G.js → chunk-5WRVWQBT.js} +3 -3
- package/dist/chunk-5WRVWQBT.js.map +1 -0
- package/dist/{chunk-WVFSGB7Y.js → chunk-ROBGEUSE.js} +2 -2
- package/dist/chunk-ROBGEUSE.js.map +1 -0
- package/dist/{chunk-BDZPLMTL.js → chunk-YL46WJBV.js} +29 -19
- package/dist/chunk-YL46WJBV.js.map +1 -0
- package/dist/index.cjs +81 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -14
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +26 -16
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +2 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7APXFZ5G.js.map +0 -1
- package/dist/chunk-BDZPLMTL.js.map +0 -1
- package/dist/chunk-WVFSGB7Y.js.map +0 -1
package/dist/services/index.cjs
CHANGED
|
@@ -4479,7 +4479,7 @@ var AuthService = class {
|
|
|
4479
4479
|
}
|
|
4480
4480
|
async createSession(input, version = 1) {
|
|
4481
4481
|
const headers = new Headers(this.headers);
|
|
4482
|
-
if (version === 3) {
|
|
4482
|
+
if (version === 3 || version === 4) {
|
|
4483
4483
|
const fingerprint = await getFingerPrint();
|
|
4484
4484
|
if (fingerprint) {
|
|
4485
4485
|
headers.append("Fingerprint", fingerprint);
|
|
@@ -4523,26 +4523,26 @@ var AuthService = class {
|
|
|
4523
4523
|
body: JSON.stringify(input),
|
|
4524
4524
|
...version === 4 && { credentials: "include" }
|
|
4525
4525
|
});
|
|
4526
|
-
const
|
|
4526
|
+
const body = await res.json();
|
|
4527
4527
|
if (res.ok) {
|
|
4528
4528
|
return {
|
|
4529
4529
|
ok: true,
|
|
4530
|
-
data
|
|
4530
|
+
data: version !== 1 ? body.data ?? body : body
|
|
4531
4531
|
};
|
|
4532
4532
|
}
|
|
4533
|
-
if (
|
|
4533
|
+
if (body.code === "ACCOUNT_BLACKLISTED") {
|
|
4534
4534
|
return {
|
|
4535
4535
|
ok: false,
|
|
4536
4536
|
error: createOperationError("AccountBlacklistedError")
|
|
4537
4537
|
};
|
|
4538
4538
|
}
|
|
4539
|
-
if (
|
|
4539
|
+
if (body.code === "MEMBER_ACCOUNT_SUSPENDED") {
|
|
4540
4540
|
return {
|
|
4541
4541
|
ok: false,
|
|
4542
4542
|
error: createOperationError("AccountSuspendedError")
|
|
4543
4543
|
};
|
|
4544
4544
|
}
|
|
4545
|
-
if (
|
|
4545
|
+
if (body.code === "INVALID_RECAPTCHA_RESPONSE") {
|
|
4546
4546
|
return {
|
|
4547
4547
|
ok: false,
|
|
4548
4548
|
error: createOperationError("InvalidReCAPTCHAResponseError")
|
|
@@ -4608,29 +4608,35 @@ var AuthService = class {
|
|
|
4608
4608
|
if (version !== 4) {
|
|
4609
4609
|
headers.append("Authorization", `Bearer ${refreshToken}`);
|
|
4610
4610
|
}
|
|
4611
|
+
if (version === 3 || version === 4) {
|
|
4612
|
+
const fingerprint = await getFingerPrint();
|
|
4613
|
+
if (fingerprint) {
|
|
4614
|
+
headers.append("Fingerprint", fingerprint);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4611
4617
|
try {
|
|
4612
4618
|
const res = await fetch(
|
|
4613
|
-
`${this.url}${version
|
|
4619
|
+
`${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
|
|
4614
4620
|
{
|
|
4615
4621
|
method: "POST",
|
|
4616
4622
|
headers,
|
|
4617
4623
|
...version === 4 && { credentials: "include" }
|
|
4618
4624
|
}
|
|
4619
4625
|
);
|
|
4620
|
-
const
|
|
4626
|
+
const body = await res.json();
|
|
4621
4627
|
if (res.ok) {
|
|
4622
4628
|
return {
|
|
4623
4629
|
ok: true,
|
|
4624
|
-
data
|
|
4630
|
+
data: version !== 1 ? body.data ?? body : body
|
|
4625
4631
|
};
|
|
4626
4632
|
}
|
|
4627
|
-
if (
|
|
4633
|
+
if (body.code === "ACCOUNT_BLACKLISTED") {
|
|
4628
4634
|
return {
|
|
4629
4635
|
ok: false,
|
|
4630
4636
|
error: createOperationError("AccountBlacklistedError")
|
|
4631
4637
|
};
|
|
4632
4638
|
}
|
|
4633
|
-
if (
|
|
4639
|
+
if (body.code === "MEMBER_ACCOUNT_SUSPENDED") {
|
|
4634
4640
|
return {
|
|
4635
4641
|
ok: false,
|
|
4636
4642
|
error: createOperationError("AccountSuspendedError")
|
|
@@ -4653,14 +4659,18 @@ var AuthService = class {
|
|
|
4653
4659
|
};
|
|
4654
4660
|
}
|
|
4655
4661
|
}
|
|
4656
|
-
async destroySession(accessToken) {
|
|
4662
|
+
async destroySession(accessToken, version = 1) {
|
|
4657
4663
|
const headers = new Headers(this.headers);
|
|
4658
4664
|
headers.append("Authorization", `Bearer ${accessToken}`);
|
|
4659
4665
|
try {
|
|
4660
|
-
const res = await fetch(
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4666
|
+
const res = await fetch(
|
|
4667
|
+
`${this.url}${version !== 1 ? `/v${version}/session` : "/session"}`,
|
|
4668
|
+
{
|
|
4669
|
+
method: "DELETE",
|
|
4670
|
+
headers,
|
|
4671
|
+
...version === 4 && { credentials: "include" }
|
|
4672
|
+
}
|
|
4673
|
+
);
|
|
4664
4674
|
return res.ok ? { ok: true } : { ok: false, error: statusCodeToOperationError(res.status) };
|
|
4665
4675
|
} catch {
|
|
4666
4676
|
return { ok: false, error: statusCodeToOperationError(500) };
|