@opexa/portal-sdk 0.59.61 → 0.59.62
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 +69 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +69 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -84,13 +84,13 @@ declare class Sdk {
|
|
|
84
84
|
fingerprint(): Promise<string | null>;
|
|
85
85
|
private get miscMiddleware();
|
|
86
86
|
collectMetaDetails(): void;
|
|
87
|
-
signIn(input: NameAndPasswordSignInInput): Promise<NameAndPasswordSignInReturn>;
|
|
88
|
-
signIn(input: MobileNumberSignInInput): Promise<MobileNumberSignInReturn>;
|
|
89
|
-
signIn(input: MayaSignInInput): Promise<MayaSignInReturn>;
|
|
90
|
-
signIn(input: TokenSignInInput): Promise<TokenSignInReturn>;
|
|
91
|
-
signIn(input: SocialsSignInInput): Promise<SocialsSignInReturn>;
|
|
92
|
-
signIn(input: CabinetSignInInput): Promise<CabinetSignInReturn>;
|
|
93
|
-
signIn(input: SingleUseTokenSignInInput): Promise<SingleUseTokenSignInReturn>;
|
|
87
|
+
signIn(input: NameAndPasswordSignInInput, version?: 1 | 3): Promise<NameAndPasswordSignInReturn>;
|
|
88
|
+
signIn(input: MobileNumberSignInInput, version?: 1 | 3): Promise<MobileNumberSignInReturn>;
|
|
89
|
+
signIn(input: MayaSignInInput, version?: 1 | 3): Promise<MayaSignInReturn>;
|
|
90
|
+
signIn(input: TokenSignInInput, version?: 1 | 3): Promise<TokenSignInReturn>;
|
|
91
|
+
signIn(input: SocialsSignInInput, version?: 1 | 3): Promise<SocialsSignInReturn>;
|
|
92
|
+
signIn(input: CabinetSignInInput, version?: 1 | 3): Promise<CabinetSignInReturn>;
|
|
93
|
+
signIn(input: SingleUseTokenSignInInput, version?: 1 | 3): Promise<SingleUseTokenSignInReturn>;
|
|
94
94
|
authenticate(input: AuthenticateInput): Promise<AuthenticateReturn>;
|
|
95
95
|
signOut(): Promise<void>;
|
|
96
96
|
watchSession(input: WatchSessionInput): () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -84,13 +84,13 @@ declare class Sdk {
|
|
|
84
84
|
fingerprint(): Promise<string | null>;
|
|
85
85
|
private get miscMiddleware();
|
|
86
86
|
collectMetaDetails(): void;
|
|
87
|
-
signIn(input: NameAndPasswordSignInInput): Promise<NameAndPasswordSignInReturn>;
|
|
88
|
-
signIn(input: MobileNumberSignInInput): Promise<MobileNumberSignInReturn>;
|
|
89
|
-
signIn(input: MayaSignInInput): Promise<MayaSignInReturn>;
|
|
90
|
-
signIn(input: TokenSignInInput): Promise<TokenSignInReturn>;
|
|
91
|
-
signIn(input: SocialsSignInInput): Promise<SocialsSignInReturn>;
|
|
92
|
-
signIn(input: CabinetSignInInput): Promise<CabinetSignInReturn>;
|
|
93
|
-
signIn(input: SingleUseTokenSignInInput): Promise<SingleUseTokenSignInReturn>;
|
|
87
|
+
signIn(input: NameAndPasswordSignInInput, version?: 1 | 3): Promise<NameAndPasswordSignInReturn>;
|
|
88
|
+
signIn(input: MobileNumberSignInInput, version?: 1 | 3): Promise<MobileNumberSignInReturn>;
|
|
89
|
+
signIn(input: MayaSignInInput, version?: 1 | 3): Promise<MayaSignInReturn>;
|
|
90
|
+
signIn(input: TokenSignInInput, version?: 1 | 3): Promise<TokenSignInReturn>;
|
|
91
|
+
signIn(input: SocialsSignInInput, version?: 1 | 3): Promise<SocialsSignInReturn>;
|
|
92
|
+
signIn(input: CabinetSignInInput, version?: 1 | 3): Promise<CabinetSignInReturn>;
|
|
93
|
+
signIn(input: SingleUseTokenSignInInput, version?: 1 | 3): Promise<SingleUseTokenSignInReturn>;
|
|
94
94
|
authenticate(input: AuthenticateInput): Promise<AuthenticateReturn>;
|
|
95
95
|
signOut(): Promise<void>;
|
|
96
96
|
watchSession(input: WatchSessionInput): () => void;
|
package/dist/index.js
CHANGED
|
@@ -358,7 +358,7 @@ var SessionManager = class {
|
|
|
358
358
|
set refreshing(value) {
|
|
359
359
|
this._refreshing = value;
|
|
360
360
|
}
|
|
361
|
-
async create(input) {
|
|
361
|
+
async create(input, version = 1) {
|
|
362
362
|
if (this.isServer) {
|
|
363
363
|
this.logger.warn("'localStorage' is not available on the server.");
|
|
364
364
|
return {
|
|
@@ -387,7 +387,7 @@ var SessionManager = class {
|
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
|
-
const f1 = () => this.authService.createSession(input);
|
|
390
|
+
const f1 = () => this.authService.createSession(input, version);
|
|
391
391
|
const r1 = await pollable(f1, {
|
|
392
392
|
until: (r) => r.ok,
|
|
393
393
|
interval: 1e3,
|
|
@@ -409,7 +409,7 @@ var SessionManager = class {
|
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
411
|
if (input.type === "MOBILE_NUMBER") {
|
|
412
|
-
const res2 = await this.authService.createSession(input);
|
|
412
|
+
const res2 = await this.authService.createSession(input, version);
|
|
413
413
|
if (res2.ok) {
|
|
414
414
|
const now2 = /* @__PURE__ */ new Date();
|
|
415
415
|
localStorage.setItem(
|
|
@@ -428,11 +428,14 @@ var SessionManager = class {
|
|
|
428
428
|
return res2;
|
|
429
429
|
}
|
|
430
430
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
431
|
-
const res2 = await this.authService.createSession(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
431
|
+
const res2 = await this.authService.createSession(
|
|
432
|
+
{
|
|
433
|
+
type: "SOCIALS",
|
|
434
|
+
token: input.token,
|
|
435
|
+
channel: input.channel
|
|
436
|
+
},
|
|
437
|
+
version
|
|
438
|
+
);
|
|
436
439
|
if (res2.ok) {
|
|
437
440
|
const now2 = /* @__PURE__ */ new Date();
|
|
438
441
|
localStorage.setItem(
|
|
@@ -452,7 +455,7 @@ var SessionManager = class {
|
|
|
452
455
|
}
|
|
453
456
|
if (input.type === "CABINET") {
|
|
454
457
|
localStorage.setItem(this.platformStorageKey, "CABINET");
|
|
455
|
-
const res2 = await this.authService.createSession(input);
|
|
458
|
+
const res2 = await this.authService.createSession(input, version);
|
|
456
459
|
if (res2.ok) {
|
|
457
460
|
const now2 = /* @__PURE__ */ new Date();
|
|
458
461
|
localStorage.setItem(
|
|
@@ -470,7 +473,7 @@ var SessionManager = class {
|
|
|
470
473
|
}
|
|
471
474
|
return res2;
|
|
472
475
|
}
|
|
473
|
-
const res = await this.authService.createSession(input);
|
|
476
|
+
const res = await this.authService.createSession(input, version);
|
|
474
477
|
if (!res.ok) return res;
|
|
475
478
|
if (res.data.authenticator) {
|
|
476
479
|
return {
|
|
@@ -719,7 +722,7 @@ var SessionManagerCookie = class {
|
|
|
719
722
|
set refreshing(value) {
|
|
720
723
|
this._refreshing = value;
|
|
721
724
|
}
|
|
722
|
-
async create(input) {
|
|
725
|
+
async create(input, version = 1) {
|
|
723
726
|
if (input.type === "MAYA") {
|
|
724
727
|
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
725
728
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
@@ -738,7 +741,7 @@ var SessionManagerCookie = class {
|
|
|
738
741
|
}
|
|
739
742
|
};
|
|
740
743
|
}
|
|
741
|
-
const f1 = () => this.authService.createSession(input);
|
|
744
|
+
const f1 = () => this.authService.createSession(input, version);
|
|
742
745
|
const r1 = await pollable(f1, {
|
|
743
746
|
until: (r) => r.ok,
|
|
744
747
|
interval: 1e3,
|
|
@@ -761,7 +764,7 @@ var SessionManagerCookie = class {
|
|
|
761
764
|
};
|
|
762
765
|
}
|
|
763
766
|
if (input.type === "MOBILE_NUMBER") {
|
|
764
|
-
const res2 = await this.authService.createSession(input);
|
|
767
|
+
const res2 = await this.authService.createSession(input, version);
|
|
765
768
|
if (res2.ok) {
|
|
766
769
|
const now2 = /* @__PURE__ */ new Date();
|
|
767
770
|
cookies.set(
|
|
@@ -783,10 +786,13 @@ var SessionManagerCookie = class {
|
|
|
783
786
|
return res2;
|
|
784
787
|
}
|
|
785
788
|
if (input.type === "SOCIALS" || input.type === "TOKEN") {
|
|
786
|
-
const res2 = await this.authService.createSession(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
789
|
+
const res2 = await this.authService.createSession(
|
|
790
|
+
{
|
|
791
|
+
type: "SOCIALS",
|
|
792
|
+
token: input.token
|
|
793
|
+
},
|
|
794
|
+
version
|
|
795
|
+
);
|
|
790
796
|
if (res2.ok) {
|
|
791
797
|
const now2 = /* @__PURE__ */ new Date();
|
|
792
798
|
cookies.set(
|
|
@@ -807,7 +813,7 @@ var SessionManagerCookie = class {
|
|
|
807
813
|
}
|
|
808
814
|
if (input.type === "CABINET") {
|
|
809
815
|
localStorage.setItem(this.platformStorageKey, "CABINET");
|
|
810
|
-
const res2 = await this.authService.createSession(input);
|
|
816
|
+
const res2 = await this.authService.createSession(input, version);
|
|
811
817
|
if (res2.ok) {
|
|
812
818
|
const now2 = /* @__PURE__ */ new Date();
|
|
813
819
|
cookies.set(
|
|
@@ -826,7 +832,7 @@ var SessionManagerCookie = class {
|
|
|
826
832
|
}
|
|
827
833
|
return res2;
|
|
828
834
|
}
|
|
829
|
-
const res = await this.authService.createSession(input);
|
|
835
|
+
const res = await this.authService.createSession(input, version);
|
|
830
836
|
if (!res.ok) return res;
|
|
831
837
|
if (res.data.authenticator) {
|
|
832
838
|
return {
|
|
@@ -3215,7 +3221,7 @@ var Sdk = class {
|
|
|
3215
3221
|
this.fbp = fbp;
|
|
3216
3222
|
}
|
|
3217
3223
|
}
|
|
3218
|
-
async signIn(input) {
|
|
3224
|
+
async signIn(input, version = 1) {
|
|
3219
3225
|
if (input.type === "TOKEN") {
|
|
3220
3226
|
console.warn(
|
|
3221
3227
|
"'TOKEN (signIn)' is deprecated. Please use 'SOCIALS' instead."
|
|
@@ -3223,10 +3229,13 @@ var Sdk = class {
|
|
|
3223
3229
|
}
|
|
3224
3230
|
switch (input.type) {
|
|
3225
3231
|
case "NAME_AND_PASSWORD": {
|
|
3226
|
-
const res = await this.sessionManager.create(
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3232
|
+
const res = await this.sessionManager.create(
|
|
3233
|
+
{
|
|
3234
|
+
...input,
|
|
3235
|
+
password: await sha256(input.password)
|
|
3236
|
+
},
|
|
3237
|
+
version
|
|
3238
|
+
);
|
|
3230
3239
|
if (!res.ok) return res;
|
|
3231
3240
|
if (res.data) {
|
|
3232
3241
|
return {
|
|
@@ -3246,42 +3255,54 @@ var Sdk = class {
|
|
|
3246
3255
|
}
|
|
3247
3256
|
case "SOCIALS":
|
|
3248
3257
|
case "TOKEN": {
|
|
3249
|
-
const res = await this.sessionManager.create(
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3258
|
+
const res = await this.sessionManager.create(
|
|
3259
|
+
{
|
|
3260
|
+
type: "SOCIALS",
|
|
3261
|
+
token: input.token,
|
|
3262
|
+
channel: input.channel
|
|
3263
|
+
},
|
|
3264
|
+
version
|
|
3265
|
+
);
|
|
3254
3266
|
return res.ok ? { ok: true } : res;
|
|
3255
3267
|
}
|
|
3256
3268
|
case "CABINET": {
|
|
3257
|
-
const res = await this.sessionManager.create(
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3269
|
+
const res = await this.sessionManager.create(
|
|
3270
|
+
{
|
|
3271
|
+
type: "CABINET",
|
|
3272
|
+
token: input.token,
|
|
3273
|
+
channel: input.channel
|
|
3274
|
+
},
|
|
3275
|
+
version
|
|
3276
|
+
);
|
|
3262
3277
|
return res.ok ? { ok: true } : res;
|
|
3263
3278
|
}
|
|
3264
3279
|
case "MOBILE_NUMBER": {
|
|
3265
|
-
const res = await this.sessionManager.create(
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3280
|
+
const res = await this.sessionManager.create(
|
|
3281
|
+
{
|
|
3282
|
+
type: "MOBILE_NUMBER",
|
|
3283
|
+
mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
|
|
3284
|
+
verificationCode: input.verificationCode,
|
|
3285
|
+
reCAPTCHAResponse: input.reCAPTCHAResponse,
|
|
3286
|
+
testPass: input.testPass,
|
|
3287
|
+
channel: input.channel
|
|
3288
|
+
},
|
|
3289
|
+
version
|
|
3290
|
+
);
|
|
3273
3291
|
return res.ok ? { ok: true } : res;
|
|
3274
3292
|
}
|
|
3275
3293
|
case "SINGLE_USE_TOKEN": {
|
|
3276
|
-
const res = await this.sessionManager.create(
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3294
|
+
const res = await this.sessionManager.create(
|
|
3295
|
+
{
|
|
3296
|
+
type: "SINGLE_USE_TOKEN",
|
|
3297
|
+
token: input.token,
|
|
3298
|
+
channel: input.channel
|
|
3299
|
+
},
|
|
3300
|
+
version
|
|
3301
|
+
);
|
|
3281
3302
|
return res.ok ? { ok: true } : res;
|
|
3282
3303
|
}
|
|
3283
3304
|
default: {
|
|
3284
|
-
const res = await this.sessionManager.create(input);
|
|
3305
|
+
const res = await this.sessionManager.create(input, version);
|
|
3285
3306
|
return res.ok ? { ok: true } : res;
|
|
3286
3307
|
}
|
|
3287
3308
|
}
|