squarefi-bff-api-module 1.34.3 → 1.34.5
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/api/auth.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { API } from './types/types';
|
|
2
2
|
export declare const telegramSignInPath = "/auth/sign-in/telegram";
|
|
3
3
|
export declare const telegramSignUpPath = "/auth/sign-up/telegram";
|
|
4
|
+
export declare const telegramLinkPath = "/auth/telegram/link";
|
|
4
5
|
export declare const refreshTokenPath = "/auth/refresh/refresh-token";
|
|
5
6
|
export declare const auth: {
|
|
6
7
|
otp: {
|
|
@@ -23,6 +24,9 @@ export declare const auth: {
|
|
|
23
24
|
password: (email: string, password: string, captcha: string) => Promise<API.Auth.Tokens>;
|
|
24
25
|
telegram: (data: API.Auth.Telegram.Signup.Request) => Promise<API.Auth.Telegram.Signup.Response>;
|
|
25
26
|
};
|
|
27
|
+
telegram: {
|
|
28
|
+
link: (data: API.Auth.Telegram.Link.Request) => Promise<void>;
|
|
29
|
+
};
|
|
26
30
|
refresh: {
|
|
27
31
|
refresh_token: (data: API.Auth.RefreshToken.Request) => Promise<API.Auth.RefreshToken.Response>;
|
|
28
32
|
};
|
package/dist/api/auth.js
CHANGED
|
@@ -3,6 +3,7 @@ import { convertPhoneToSupabaseFormat } from '../utils/converters';
|
|
|
3
3
|
export const telegramSignInPath = '/auth/sign-in/telegram'; // V2 path
|
|
4
4
|
// export const telegramSignInPath = '/auth/signin/telegram'; // V1 path
|
|
5
5
|
export const telegramSignUpPath = '/auth/sign-up/telegram';
|
|
6
|
+
export const telegramLinkPath = '/auth/telegram/link';
|
|
6
7
|
export const refreshTokenPath = '/auth/refresh/refresh-token';
|
|
7
8
|
export const auth = {
|
|
8
9
|
otp: {
|
|
@@ -61,6 +62,9 @@ export const auth = {
|
|
|
61
62
|
}),
|
|
62
63
|
telegram: (data) => apiClientV2.postRequest(telegramSignUpPath, { data }),
|
|
63
64
|
},
|
|
65
|
+
telegram: {
|
|
66
|
+
link: (data) => apiClientV2.postRequest(telegramLinkPath, { data }),
|
|
67
|
+
},
|
|
64
68
|
refresh: {
|
|
65
69
|
refresh_token: (data) => apiClientV2.postRequest(refreshTokenPath, { data }),
|
|
66
70
|
},
|
|
@@ -139,6 +139,23 @@ export interface paths {
|
|
|
139
139
|
patch?: never;
|
|
140
140
|
trace?: never;
|
|
141
141
|
};
|
|
142
|
+
"/auth/telegram/link": {
|
|
143
|
+
parameters: {
|
|
144
|
+
query?: never;
|
|
145
|
+
header?: never;
|
|
146
|
+
path?: never;
|
|
147
|
+
cookie?: never;
|
|
148
|
+
};
|
|
149
|
+
get?: never;
|
|
150
|
+
put?: never;
|
|
151
|
+
/** Link Telegram account to existing user via OTP-verified phone */
|
|
152
|
+
post: operations["AuthTelegramController_linkTelegramAccount"];
|
|
153
|
+
delete?: never;
|
|
154
|
+
options?: never;
|
|
155
|
+
head?: never;
|
|
156
|
+
patch?: never;
|
|
157
|
+
trace?: never;
|
|
158
|
+
};
|
|
142
159
|
"/auth/sign-in/telegram": {
|
|
143
160
|
parameters: {
|
|
144
161
|
query?: never;
|
|
@@ -1273,12 +1290,8 @@ export interface components {
|
|
|
1273
1290
|
};
|
|
1274
1291
|
TelegramSignUpByPhoneDto: {
|
|
1275
1292
|
phone: string;
|
|
1276
|
-
tg_id: string;
|
|
1277
|
-
first_name: string;
|
|
1278
|
-
last_name: string;
|
|
1279
1293
|
hash: string;
|
|
1280
1294
|
init_data_raw: string;
|
|
1281
|
-
username: string;
|
|
1282
1295
|
invite_code?: string;
|
|
1283
1296
|
referrer?: string;
|
|
1284
1297
|
};
|
|
@@ -1291,8 +1304,11 @@ export interface components {
|
|
|
1291
1304
|
token_type: string;
|
|
1292
1305
|
refresh_token?: string | null;
|
|
1293
1306
|
};
|
|
1307
|
+
TelegramLinkDto: {
|
|
1308
|
+
init_data_raw: string;
|
|
1309
|
+
hash: string;
|
|
1310
|
+
};
|
|
1294
1311
|
TelegramSignInByTgIdDto: {
|
|
1295
|
-
tg_id: string;
|
|
1296
1312
|
hash: string;
|
|
1297
1313
|
init_data_raw: string;
|
|
1298
1314
|
};
|
|
@@ -1335,6 +1351,7 @@ export interface components {
|
|
|
1335
1351
|
UserDataEntity: {
|
|
1336
1352
|
can_invite: boolean;
|
|
1337
1353
|
created_at: string;
|
|
1354
|
+
/** @deprecated */
|
|
1338
1355
|
id: number;
|
|
1339
1356
|
kyc_date: string | null;
|
|
1340
1357
|
/**
|
|
@@ -1355,6 +1372,7 @@ export interface components {
|
|
|
1355
1372
|
logo_url?: string | null;
|
|
1356
1373
|
/** @description ISO 3166-1 alpha-2 country code */
|
|
1357
1374
|
nationality?: string | null;
|
|
1375
|
+
readonly uuid: string;
|
|
1358
1376
|
readonly email: string | null;
|
|
1359
1377
|
readonly phone: string | null;
|
|
1360
1378
|
};
|
|
@@ -2363,6 +2381,7 @@ export interface components {
|
|
|
2363
2381
|
readonly has_more: boolean;
|
|
2364
2382
|
};
|
|
2365
2383
|
WalletUserInfoDto: {
|
|
2384
|
+
/** @deprecated */
|
|
2366
2385
|
id: number;
|
|
2367
2386
|
first_name?: string | null;
|
|
2368
2387
|
last_name?: string | null;
|
|
@@ -2648,6 +2667,28 @@ export interface operations {
|
|
|
2648
2667
|
};
|
|
2649
2668
|
};
|
|
2650
2669
|
};
|
|
2670
|
+
AuthTelegramController_linkTelegramAccount: {
|
|
2671
|
+
parameters: {
|
|
2672
|
+
query?: never;
|
|
2673
|
+
header?: never;
|
|
2674
|
+
path?: never;
|
|
2675
|
+
cookie?: never;
|
|
2676
|
+
};
|
|
2677
|
+
requestBody: {
|
|
2678
|
+
content: {
|
|
2679
|
+
"application/json": components["schemas"]["TelegramLinkDto"];
|
|
2680
|
+
};
|
|
2681
|
+
};
|
|
2682
|
+
responses: {
|
|
2683
|
+
/** @description Unauthorized */
|
|
2684
|
+
401: {
|
|
2685
|
+
headers: {
|
|
2686
|
+
[name: string]: unknown;
|
|
2687
|
+
};
|
|
2688
|
+
content?: never;
|
|
2689
|
+
};
|
|
2690
|
+
};
|
|
2691
|
+
};
|
|
2651
2692
|
AuthTelegramController_signIn: {
|
|
2652
2693
|
parameters: {
|
|
2653
2694
|
query?: never;
|
|
@@ -15,6 +15,9 @@ export declare namespace API {
|
|
|
15
15
|
type Request = operations['AuthTelegramController_signUp']['requestBody']['content']['application/json'];
|
|
16
16
|
type Response = operations['AuthTelegramController_signUp']['responses']['200']['content']['application/json'];
|
|
17
17
|
}
|
|
18
|
+
namespace Link {
|
|
19
|
+
type Request = operations['AuthTelegramController_linkTelegramAccount']['requestBody']['content']['application/json'];
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
interface Tokens {
|
|
20
23
|
access_token: string;
|
|
@@ -18,14 +18,12 @@ export async function refreshTokens() {
|
|
|
18
18
|
}
|
|
19
19
|
if (isTMA()) {
|
|
20
20
|
initData.restore();
|
|
21
|
-
const tg_id = initData.user()?.id;
|
|
22
21
|
const hash = initData.hash();
|
|
23
22
|
const init_data_raw = initData.raw();
|
|
24
|
-
if (!
|
|
23
|
+
if (!hash || !init_data_raw) {
|
|
25
24
|
return Promise.reject(new Error('No TG ID, hash or init data raw found in tokensFactory'));
|
|
26
25
|
}
|
|
27
26
|
const telegramSignInResponse = await auth.signin.telegram({
|
|
28
|
-
tg_id: tg_id.toString(),
|
|
29
27
|
hash,
|
|
30
28
|
init_data_raw,
|
|
31
29
|
});
|