@opexa/portal-sdk 0.59.61 → 0.59.63
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/index.cjs +80 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +80 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6927,7 +6927,7 @@ var SessionManager = class {
|
|
|
6927
6927
|
set refreshing(value) {
|
|
6928
6928
|
this._refreshing = value;
|
|
6929
6929
|
}
|
|
6930
|
-
async create(input) {
|
|
6930
|
+
async create(input, version = 1) {
|
|
6931
6931
|
if (this.isServer) {
|
|
6932
6932
|
this.logger.warn("'localStorage' is not available on the server.");
|
|
6933
6933
|
return {
|
|
@@ -6956,7 +6956,7 @@ var SessionManager = class {
|
|
|
6956
6956
|
}
|
|
6957
6957
|
};
|
|
6958
6958
|
}
|
|
6959
|
-
const f1 = () => this.authService.createSession(input);
|
|
6959
|
+
const f1 = () => this.authService.createSession(input, version);
|
|
6960
6960
|
const r1 = await pollable(f1, {
|
|
6961
6961
|
until: (r) => r.ok,
|
|
6962
6962
|
interval: 1e3,
|
|
@@ -6978,7 +6978,7 @@ var SessionManager = class {
|
|
|
6978
6978
|
};
|
|
6979
6979
|
}
|
|
6980
6980
|
if (input.type === "MOBILE_NUMBER") {
|
|
6981
|
-
const res2 = await this.authService.createSession(input);
|
|
6981
|
+
const res2 = await this.authService.createSession(input, version);
|
|
6982
6982
|
if (res2.ok) {
|
|
6983
6983
|
const now2 = /* @__PURE__ */ new Date();
|
|
6984
6984
|
localStorage.setItem(
|
|
@@ -6997,11 +6997,14 @@ var SessionManager = class {
|
|
|
6997
6997
|
return res2;
|
|
6998
6998
|
}
|
|
6999
6999
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
7000
|
-
const res2 = await this.authService.createSession(
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7000
|
+
const res2 = await this.authService.createSession(
|
|
7001
|
+
{
|
|
7002
|
+
type: "SOCIALS",
|
|
7003
|
+
token: input.token,
|
|
7004
|
+
channel: input.channel
|
|
7005
|
+
},
|
|
7006
|
+
version
|
|
7007
|
+
);
|
|
7005
7008
|
if (res2.ok) {
|
|
7006
7009
|
const now2 = /* @__PURE__ */ new Date();
|
|
7007
7010
|
localStorage.setItem(
|
|
@@ -7021,7 +7024,7 @@ var SessionManager = class {
|
|
|
7021
7024
|
}
|
|
7022
7025
|
if (input.type === "CABINET") {
|
|
7023
7026
|
localStorage.setItem(this.platformStorageKey, "CABINET");
|
|
7024
|
-
const res2 = await this.authService.createSession(input);
|
|
7027
|
+
const res2 = await this.authService.createSession(input, version);
|
|
7025
7028
|
if (res2.ok) {
|
|
7026
7029
|
const now2 = /* @__PURE__ */ new Date();
|
|
7027
7030
|
localStorage.setItem(
|
|
@@ -7039,7 +7042,7 @@ var SessionManager = class {
|
|
|
7039
7042
|
}
|
|
7040
7043
|
return res2;
|
|
7041
7044
|
}
|
|
7042
|
-
const res = await this.authService.createSession(input);
|
|
7045
|
+
const res = await this.authService.createSession(input, version);
|
|
7043
7046
|
if (!res.ok) return res;
|
|
7044
7047
|
if (res.data.authenticator) {
|
|
7045
7048
|
return {
|
|
@@ -7288,7 +7291,7 @@ var SessionManagerCookie = class {
|
|
|
7288
7291
|
set refreshing(value) {
|
|
7289
7292
|
this._refreshing = value;
|
|
7290
7293
|
}
|
|
7291
|
-
async create(input) {
|
|
7294
|
+
async create(input, version = 1) {
|
|
7292
7295
|
if (input.type === "MAYA") {
|
|
7293
7296
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
7294
7297
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -7307,7 +7310,7 @@ var SessionManagerCookie = class {
|
|
|
7307
7310
|
}
|
|
7308
7311
|
};
|
|
7309
7312
|
}
|
|
7310
|
-
const f1 = () => this.authService.createSession(input);
|
|
7313
|
+
const f1 = () => this.authService.createSession(input, version);
|
|
7311
7314
|
const r1 = await pollable(f1, {
|
|
7312
7315
|
until: (r) => r.ok,
|
|
7313
7316
|
interval: 1e3,
|
|
@@ -7330,7 +7333,7 @@ var SessionManagerCookie = class {
|
|
|
7330
7333
|
};
|
|
7331
7334
|
}
|
|
7332
7335
|
if (input.type === "MOBILE_NUMBER") {
|
|
7333
|
-
const res2 = await this.authService.createSession(input);
|
|
7336
|
+
const res2 = await this.authService.createSession(input, version);
|
|
7334
7337
|
if (res2.ok) {
|
|
7335
7338
|
const now2 = /* @__PURE__ */ new Date();
|
|
7336
7339
|
cookies__default.default.set(
|
|
@@ -7352,10 +7355,13 @@ var SessionManagerCookie = class {
|
|
|
7352
7355
|
return res2;
|
|
7353
7356
|
}
|
|
7354
7357
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
7355
|
-
const res2 = await this.authService.createSession(
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7358
|
+
const res2 = await this.authService.createSession(
|
|
7359
|
+
{
|
|
7360
|
+
type: "SOCIALS",
|
|
7361
|
+
token: input.token
|
|
7362
|
+
},
|
|
7363
|
+
version
|
|
7364
|
+
);
|
|
7359
7365
|
if (res2.ok) {
|
|
7360
7366
|
const now2 = /* @__PURE__ */ new Date();
|
|
7361
7367
|
cookies__default.default.set(
|
|
@@ -7376,7 +7382,7 @@ var SessionManagerCookie = class {
|
|
|
7376
7382
|
}
|
|
7377
7383
|
if (input.type === "CABINET") {
|
|
7378
7384
|
localStorage.setItem(this.platformStorageKey, "CABINET");
|
|
7379
|
-
const res2 = await this.authService.createSession(input);
|
|
7385
|
+
const res2 = await this.authService.createSession(input, version);
|
|
7380
7386
|
if (res2.ok) {
|
|
7381
7387
|
const now2 = /* @__PURE__ */ new Date();
|
|
7382
7388
|
cookies__default.default.set(
|
|
@@ -7395,7 +7401,7 @@ var SessionManagerCookie = class {
|
|
|
7395
7401
|
}
|
|
7396
7402
|
return res2;
|
|
7397
7403
|
}
|
|
7398
|
-
const res = await this.authService.createSession(input);
|
|
7404
|
+
const res = await this.authService.createSession(input, version);
|
|
7399
7405
|
if (!res.ok) return res;
|
|
7400
7406
|
if (res.data.authenticator) {
|
|
7401
7407
|
return {
|
|
@@ -9784,7 +9790,7 @@ var Sdk = class {
|
|
|
9784
9790
|
this.fbp = fbp;
|
|
9785
9791
|
}
|
|
9786
9792
|
}
|
|
9787
|
-
async signIn(input) {
|
|
9793
|
+
async signIn(input, version = 1) {
|
|
9788
9794
|
if (input.type === "TOKEN") {
|
|
9789
9795
|
console.warn(
|
|
9790
9796
|
"'TOKEN (signIn)' is deprecated. Please use 'SOCIALS' instead."
|
|
@@ -9792,10 +9798,13 @@ var Sdk = class {
|
|
|
9792
9798
|
}
|
|
9793
9799
|
switch (input.type) {
|
|
9794
9800
|
case "NAME_AND_PASSWORD": {
|
|
9795
|
-
const res = await this.sessionManager.create(
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9801
|
+
const res = await this.sessionManager.create(
|
|
9802
|
+
{
|
|
9803
|
+
...input,
|
|
9804
|
+
password: await sha256(input.password)
|
|
9805
|
+
},
|
|
9806
|
+
version
|
|
9807
|
+
);
|
|
9799
9808
|
if (!res.ok) return res;
|
|
9800
9809
|
if (res.data) {
|
|
9801
9810
|
return {
|
|
@@ -9815,42 +9824,54 @@ var Sdk = class {
|
|
|
9815
9824
|
}
|
|
9816
9825
|
case "SOCIALS":
|
|
9817
9826
|
case "TOKEN": {
|
|
9818
|
-
const res = await this.sessionManager.create(
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9827
|
+
const res = await this.sessionManager.create(
|
|
9828
|
+
{
|
|
9829
|
+
type: "SOCIALS",
|
|
9830
|
+
token: input.token,
|
|
9831
|
+
channel: input.channel
|
|
9832
|
+
},
|
|
9833
|
+
version
|
|
9834
|
+
);
|
|
9823
9835
|
return res.ok ? { ok: true } : res;
|
|
9824
9836
|
}
|
|
9825
9837
|
case "CABINET": {
|
|
9826
|
-
const res = await this.sessionManager.create(
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9838
|
+
const res = await this.sessionManager.create(
|
|
9839
|
+
{
|
|
9840
|
+
type: "CABINET",
|
|
9841
|
+
token: input.token,
|
|
9842
|
+
channel: input.channel
|
|
9843
|
+
},
|
|
9844
|
+
version
|
|
9845
|
+
);
|
|
9831
9846
|
return res.ok ? { ok: true } : res;
|
|
9832
9847
|
}
|
|
9833
9848
|
case "MOBILE_NUMBER": {
|
|
9834
|
-
const res = await this.sessionManager.create(
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9849
|
+
const res = await this.sessionManager.create(
|
|
9850
|
+
{
|
|
9851
|
+
type: "MOBILE_NUMBER",
|
|
9852
|
+
mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
|
|
9853
|
+
verificationCode: input.verificationCode,
|
|
9854
|
+
reCAPTCHAResponse: input.reCAPTCHAResponse,
|
|
9855
|
+
testPass: input.testPass,
|
|
9856
|
+
channel: input.channel
|
|
9857
|
+
},
|
|
9858
|
+
version
|
|
9859
|
+
);
|
|
9842
9860
|
return res.ok ? { ok: true } : res;
|
|
9843
9861
|
}
|
|
9844
9862
|
case "SINGLE_USE_TOKEN": {
|
|
9845
|
-
const res = await this.sessionManager.create(
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9863
|
+
const res = await this.sessionManager.create(
|
|
9864
|
+
{
|
|
9865
|
+
type: "SINGLE_USE_TOKEN",
|
|
9866
|
+
token: input.token,
|
|
9867
|
+
channel: input.channel
|
|
9868
|
+
},
|
|
9869
|
+
version
|
|
9870
|
+
);
|
|
9850
9871
|
return res.ok ? { ok: true } : res;
|
|
9851
9872
|
}
|
|
9852
9873
|
default: {
|
|
9853
|
-
const res = await this.sessionManager.create(input);
|
|
9874
|
+
const res = await this.sessionManager.create(input, version);
|
|
9854
9875
|
return res.ok ? { ok: true } : res;
|
|
9855
9876
|
}
|
|
9856
9877
|
}
|
|
@@ -10382,15 +10403,18 @@ var Sdk = class {
|
|
|
10382
10403
|
}
|
|
10383
10404
|
});
|
|
10384
10405
|
}
|
|
10385
|
-
async sendVerificationCode__next(input) {
|
|
10406
|
+
async sendVerificationCode__next(input, recaptchaResponse) {
|
|
10386
10407
|
if (input.type === "SMS") {
|
|
10387
|
-
return this.authService.sendVerificationCode(
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10408
|
+
return this.authService.sendVerificationCode(
|
|
10409
|
+
{
|
|
10410
|
+
channel: "SMS",
|
|
10411
|
+
recipient: addAreaCode(input.mobileNumber, await this.locale),
|
|
10412
|
+
...input.strict && {
|
|
10413
|
+
verificationType: "MEMBER"
|
|
10414
|
+
}
|
|
10415
|
+
},
|
|
10416
|
+
recaptchaResponse
|
|
10417
|
+
);
|
|
10394
10418
|
}
|
|
10395
10419
|
throw new Error("'Email' verification code is not yet supported");
|
|
10396
10420
|
}
|