@opexa/portal-sdk 0.59.60 → 0.59.61
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-AKP5LBV2.js → chunk-FUFD2LUS.js} +44 -9
- package/dist/chunk-FUFD2LUS.js.map +1 -0
- package/dist/index.cjs +43 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -23
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +42 -6
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +2 -2
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AKP5LBV2.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4358,6 +4358,26 @@ var AccountService = class {
|
|
|
4358
4358
|
};
|
|
4359
4359
|
}
|
|
4360
4360
|
};
|
|
4361
|
+
var thumbmark_instance;
|
|
4362
|
+
async function getFingerPrint() {
|
|
4363
|
+
if (typeof window === "undefined") return null;
|
|
4364
|
+
if (!thumbmark_instance) {
|
|
4365
|
+
thumbmark_instance = new thumbmarkjs.Thumbmark({
|
|
4366
|
+
logging: false,
|
|
4367
|
+
timeout: 3e4,
|
|
4368
|
+
cache_lifetime_in_ms: 1 * 60 * 60 * 1e3
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
try {
|
|
4372
|
+
const cached = sessionStorage.getItem("fingerprint");
|
|
4373
|
+
if (cached) return cached;
|
|
4374
|
+
const result = await thumbmark_instance.get();
|
|
4375
|
+
sessionStorage.setItem("fingerprint", result.thumbmark);
|
|
4376
|
+
return result.thumbmark;
|
|
4377
|
+
} catch {
|
|
4378
|
+
return null;
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4361
4381
|
|
|
4362
4382
|
// src/utils/status-code-to-operation-error.ts
|
|
4363
4383
|
function statusCodeToOperationError(value, message) {
|
|
@@ -4391,8 +4411,14 @@ var AuthService = class {
|
|
|
4391
4411
|
headers.append("Content-Type", "application/json");
|
|
4392
4412
|
return headers;
|
|
4393
4413
|
}
|
|
4394
|
-
async createSession(input) {
|
|
4414
|
+
async createSession(input, version = 1) {
|
|
4395
4415
|
const headers = new Headers(this.headers);
|
|
4416
|
+
if (version === 3) {
|
|
4417
|
+
const fingerprint = await getFingerPrint();
|
|
4418
|
+
if (fingerprint) {
|
|
4419
|
+
headers.append("Fingerprint", fingerprint);
|
|
4420
|
+
}
|
|
4421
|
+
}
|
|
4396
4422
|
if (input.channel) {
|
|
4397
4423
|
headers.append("Channel", input.channel);
|
|
4398
4424
|
}
|
|
@@ -4425,9 +4451,10 @@ var AuthService = class {
|
|
|
4425
4451
|
headers.set("test-pass", input.testPass);
|
|
4426
4452
|
}
|
|
4427
4453
|
try {
|
|
4428
|
-
const res = await fetch(`${this.url}/sessions`, {
|
|
4454
|
+
const res = await fetch(`${this.url}${version === 3 ? "/v3/sessions" : "/sessions"}`, {
|
|
4429
4455
|
method: "POST",
|
|
4430
|
-
headers
|
|
4456
|
+
headers,
|
|
4457
|
+
body: JSON.stringify(input)
|
|
4431
4458
|
});
|
|
4432
4459
|
const data = await res.json();
|
|
4433
4460
|
if (res.ok) {
|
|
@@ -4579,7 +4606,7 @@ var AuthService = class {
|
|
|
4579
4606
|
return true;
|
|
4580
4607
|
}
|
|
4581
4608
|
}
|
|
4582
|
-
async sendVerificationCode(input) {
|
|
4609
|
+
async sendVerificationCode(input, recaptchaResponse) {
|
|
4583
4610
|
if (input.channel === "EMAIL")
|
|
4584
4611
|
throw new Error("Email channel is not yet supported");
|
|
4585
4612
|
function getErrorCode(message) {
|
|
@@ -4597,8 +4624,15 @@ var AuthService = class {
|
|
|
4597
4624
|
try {
|
|
4598
4625
|
const res = await fetch(`${this.url}/otps`, {
|
|
4599
4626
|
method: "POST",
|
|
4600
|
-
headers:
|
|
4601
|
-
|
|
4627
|
+
headers: {
|
|
4628
|
+
...this.headers,
|
|
4629
|
+
...recaptchaResponse && {
|
|
4630
|
+
"google-recaptcha-response": recaptchaResponse
|
|
4631
|
+
}
|
|
4632
|
+
},
|
|
4633
|
+
body: JSON.stringify({
|
|
4634
|
+
...input
|
|
4635
|
+
})
|
|
4602
4636
|
});
|
|
4603
4637
|
if (res.status === 403) {
|
|
4604
4638
|
const data = await res.json();
|
|
@@ -6723,6 +6757,8 @@ function addHours(date, hours) {
|
|
|
6723
6757
|
result.setHours(result.getHours() + hours);
|
|
6724
6758
|
return result;
|
|
6725
6759
|
}
|
|
6760
|
+
|
|
6761
|
+
// src/sdk/utils.ts
|
|
6726
6762
|
function getLocaleByCurrency(currency) {
|
|
6727
6763
|
if (currency === "INR") return "en-IN";
|
|
6728
6764
|
if (currency === "MYR") return "en-MY";
|
|
@@ -6752,26 +6788,6 @@ function parseFbCxd(input) {
|
|
|
6752
6788
|
const fbAdditionalCxd = input.split(cxd)[1].slice(1);
|
|
6753
6789
|
return { cxd, fbAdditionalCxd };
|
|
6754
6790
|
}
|
|
6755
|
-
var thumbmark_instance;
|
|
6756
|
-
async function getFingerprint() {
|
|
6757
|
-
if (typeof window === "undefined") return null;
|
|
6758
|
-
if (!thumbmark_instance) {
|
|
6759
|
-
thumbmark_instance = new thumbmarkjs.Thumbmark({
|
|
6760
|
-
logging: false,
|
|
6761
|
-
timeout: 3e4,
|
|
6762
|
-
cache_lifetime_in_ms: 1 * 60 * 60 * 1e3
|
|
6763
|
-
});
|
|
6764
|
-
}
|
|
6765
|
-
try {
|
|
6766
|
-
const cached = sessionStorage.getItem("fingerprint");
|
|
6767
|
-
if (cached) return cached;
|
|
6768
|
-
const result = await thumbmark_instance.get();
|
|
6769
|
-
sessionStorage.setItem("fingerprint", result.thumbmark);
|
|
6770
|
-
return result.thumbmark;
|
|
6771
|
-
} catch {
|
|
6772
|
-
return null;
|
|
6773
|
-
}
|
|
6774
|
-
}
|
|
6775
6791
|
function getCookie(name) {
|
|
6776
6792
|
if (typeof document === "undefined") return null;
|
|
6777
6793
|
const nameLenPlus = name.length + 1;
|
|
@@ -9742,7 +9758,7 @@ var Sdk = class {
|
|
|
9742
9758
|
};
|
|
9743
9759
|
}
|
|
9744
9760
|
async fingerprint() {
|
|
9745
|
-
return await
|
|
9761
|
+
return await getFingerPrint();
|
|
9746
9762
|
}
|
|
9747
9763
|
get miscMiddleware() {
|
|
9748
9764
|
return async (request) => {
|