squarefi-bff-api-module 1.5.2 → 1.5.4

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.
@@ -15,10 +15,10 @@ export declare const auth: {
15
15
  phone: (data: API.Auth.SignIn.Phone.OTP.Request) => Promise<unknown>;
16
16
  };
17
17
  telegram: (data: API.Auth.Telegram.Signin) => Promise<API.Auth.Tokens>;
18
- password: (email: string, password: string) => Promise<API.Auth.SupabaseGetSessionResponse>;
18
+ password: (email: string, password: string) => Promise<API.Auth.Tokens>;
19
19
  };
20
20
  signup: {
21
- password: (email: string, password: string) => Promise<API.Auth.SupabaseGetSessionResponse>;
21
+ password: (email: string, password: string) => Promise<API.Auth.Tokens>;
22
22
  telegram: (data: API.Auth.Telegram.Signup) => Promise<unknown>;
23
23
  };
24
24
  refresh: {
@@ -87,10 +87,6 @@ export declare namespace API {
87
87
  }
88
88
  }
89
89
  }
90
- interface SupabaseGetSessionResponse {
91
- session?: Tokens;
92
- error?: string;
93
- }
94
90
  namespace VerifyOtp {
95
91
  type Response = {
96
92
  access_token: string;
@@ -73,7 +73,7 @@ const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
73
73
  const isRefreshAvailable = (!isTokenRefreshing && typeof refreshToken === 'string') || (0, sdk_react_1.isTMA)();
74
74
  if (isLogoutNeccesary) {
75
75
  if (typeof window !== 'undefined') {
76
- // navigate('/auth/logout');
76
+ window.location.href = '/logout';
77
77
  (0, tokensFactory_1.deleteTokens)();
78
78
  }
79
79
  requestQueue = [];
@@ -89,7 +89,7 @@ const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
89
89
  })
90
90
  .catch((tokenRefreshError) => {
91
91
  if (typeof window !== 'undefined') {
92
- // navigate('/auth/logout');
92
+ window.location.href = '/logout';
93
93
  (0, tokensFactory_1.deleteTokens)();
94
94
  }
95
95
  requestQueue = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api/auth.ts CHANGED
@@ -32,13 +32,13 @@ export const auth = {
32
32
  email: string,
33
33
  password: string // check on backend V2
34
34
  ) =>
35
- apiClientV2.postRequest<API.Auth.SupabaseGetSessionResponse>('/auth/sign-in/password/email', {
35
+ apiClientV2.postRequest<API.Auth.Tokens>('/auth/sign-in/password/email', {
36
36
  data: { email, password },
37
37
  }),
38
38
  },
39
39
  signup: {
40
40
  password: (email: string, password: string) =>
41
- apiClientV2.postRequest<API.Auth.SupabaseGetSessionResponse>('/auth/sign-up/password/email', {
41
+ apiClientV2.postRequest<API.Auth.Tokens>('/auth/sign-up/password/email', {
42
42
  data: { email, password },
43
43
  }),
44
44
  telegram: (data: API.Auth.Telegram.Signup) => apiClientV2.postRequest(telegramSignUpPath, { data }),
package/src/api/types.ts CHANGED
@@ -109,11 +109,11 @@ export namespace API {
109
109
  }
110
110
  }
111
111
  }
112
- export interface SupabaseGetSessionResponse {
113
- session?: Tokens;
114
- // user?: User;
115
- error?: string;
116
- }
112
+ // export interface SupabaseGetSessionResponse {
113
+ // session?: Tokens;
114
+ // // user?: User;
115
+ // error?: string;
116
+ // }
117
117
 
118
118
  export namespace VerifyOtp {
119
119
  export type Response = { access_token: string; refresh_token: string; error?: string };
@@ -79,7 +79,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
79
79
 
80
80
  if (isLogoutNeccesary) {
81
81
  if (typeof window !== 'undefined') {
82
- // navigate('/auth/logout');
82
+ window.location.href = '/logout';
83
83
  deleteTokens();
84
84
  }
85
85
  requestQueue = [];
@@ -95,7 +95,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
95
95
  })
96
96
  .catch((tokenRefreshError) => {
97
97
  if (typeof window !== 'undefined') {
98
- // navigate('/auth/logout');
98
+ window.location.href = '/logout';
99
99
  deleteTokens();
100
100
  }
101
101
  requestQueue = [];