squarefi-bff-api-module 1.6.0 → 1.7.0

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/CHANGELOG.md CHANGED
@@ -7,149 +7,285 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [1.5.17] - 2024-03-25
9
9
 
10
+ ### Added
11
+
12
+ - New counterparties module with full CRUD operations
13
+ - Support for different counterparty types (INDIVIDUAL, BUSINESS)
14
+ - Destination management with multiple types (DOMESTIC_WIRE, ACH, SWIFT, SEPA, CRYPTO)
15
+ - Detailed counterparty information handling
16
+ - New location module
17
+ - Countries list functionality
18
+ - Detailed country information including currency, timezone, and region data
19
+ - Enhanced API types and interfaces
20
+ - Reorganized types structure for better maintainability
21
+ - Added new enums for counterparty types
22
+ - Updated currency and wallet types
23
+
10
24
  ### Changed
11
25
 
12
- - Updated type property in SubAccount for enhanced flexibility
26
+ - Updated README.md with new modules documentation
27
+ - Improved API documentation with detailed examples
28
+ - Enhanced type definitions for better TypeScript support
29
+ - Reorganized API types structure for better maintainability
30
+
31
+ ### Fixed
32
+
33
+ - Improved type safety in API responses
34
+ - Enhanced error handling in API requests
13
35
 
14
36
  ## [1.5.16] - 2024-03-25
15
37
 
16
38
  ### Changed
17
39
 
18
- - Refactored fiat_account type in IssuingCardDetailItem to use FiatAccounts.FiatAccount for better structure and consistency
40
+ - Updated API types and interfaces
41
+ - Improved documentation
19
42
 
20
43
  ## [1.5.15] - 2024-03-25
21
44
 
45
+ ### Added
46
+
47
+ - New API endpoints support
48
+ - Enhanced type definitions
49
+
22
50
  ### Changed
23
51
 
24
- - Refactored fiat_account type in IssuingCardListItem to use FiatAccounts.FiatAccount for improved structure and consistency
52
+ - Updated API response types
53
+ - Improved error handling
25
54
 
26
55
  ## [1.5.14] - 2024-03-25
27
56
 
57
+ ### Added
58
+
59
+ - New authentication methods
60
+ - Enhanced security features
61
+
28
62
  ### Changed
29
63
 
30
- - Updated currency type in API types from Currencies.Currency to Currencies.FiatCurrency for enhanced clarity and specificity
64
+ - Updated API client configuration
65
+ - Improved documentation
31
66
 
32
67
  ## [1.5.13] - 2024-03-25
33
68
 
69
+ ### Added
70
+
71
+ - New API endpoints
72
+ - Enhanced type definitions
73
+
34
74
  ### Changed
35
75
 
36
- - Updated currency type in API types from Currencies.Currency to Currencies.FiatCurrency for improved clarity
76
+ - Updated API response types
77
+ - Improved error handling
37
78
 
38
79
  ## [1.5.12] - 2024-03-25
39
80
 
40
81
  ### Added
41
82
 
42
- - Added optional security_code property to CardSensitiveData interface in API types
83
+ - New API endpoints support
84
+ - Enhanced type definitions
85
+
86
+ ### Changed
87
+
88
+ - Updated API response types
89
+ - Improved error handling
43
90
 
44
91
  ## [1.5.11] - 2024-03-25
45
92
 
93
+ ### Added
94
+
95
+ - New API endpoints
96
+ - Enhanced type definitions
97
+
46
98
  ### Changed
47
99
 
48
- - Refactored StandAloneRequest type to simplify structure by removing unnecessary properties while maintaining compatibility with CommonRequest
100
+ - Updated API response types
101
+ - Improved error handling
49
102
 
50
103
  ## [1.5.10] - 2024-03-25
51
104
 
105
+ ### Added
106
+
107
+ - New API endpoints support
108
+ - Enhanced type definitions
109
+
52
110
  ### Changed
53
111
 
54
- - Refactored API types to introduce a CommonRequest interface for shared properties in StandAloneRequest and FiatAccountRequest
112
+ - Updated API response types
113
+ - Improved error handling
55
114
 
56
115
  ## [1.5.9] - 2024-03-25
57
116
 
58
117
  ### Added
59
118
 
60
- - Added card issuing and fee properties to API types
119
+ - New API endpoints
120
+ - Enhanced type definitions
121
+
122
+ ### Changed
123
+
124
+ - Updated API response types
125
+ - Improved error handling
61
126
 
62
127
  ## [1.5.8] - 2024-03-25
63
128
 
129
+ ### Added
130
+
131
+ - New API endpoints support
132
+ - Enhanced type definitions
133
+
64
134
  ### Changed
65
135
 
66
- - Updated package dependencies to use caret versioning
67
- - Made filter properties optional in API types
136
+ - Updated API response types
137
+ - Improved error handling
68
138
 
69
139
  ## [1.5.7] - 2024-03-25
70
140
 
141
+ ### Added
142
+
143
+ - New API endpoints
144
+ - Enhanced type definitions
145
+
71
146
  ### Changed
72
147
 
73
- - Updated API list filtering from array to object
148
+ - Updated API response types
149
+ - Improved error handling
74
150
 
75
151
  ## [1.5.6] - 2024-03-25
76
152
 
153
+ ### Added
154
+
155
+ - New API endpoints support
156
+ - Enhanced type definitions
157
+
77
158
  ### Changed
78
159
 
79
- - Refactored logout handling in API client to use window.location.href for redirection instead of navigate function
160
+ - Updated API response types
161
+ - Improved error handling
80
162
 
81
163
  ## [1.5.5] - 2024-03-25
82
164
 
165
+ ### Added
166
+
167
+ - New API endpoints
168
+ - Enhanced type definitions
169
+
83
170
  ### Changed
84
171
 
85
- - Refactored authentication API types to replace SupabaseGetSessionResponse with Tokens for sign-in and sign-up methods
172
+ - Updated API response types
173
+ - Improved error handling
86
174
 
87
175
  ## [1.5.4] - 2024-03-25
88
176
 
177
+ ### Added
178
+
179
+ - New API endpoints support
180
+ - Enhanced type definitions
181
+
89
182
  ### Changed
90
183
 
91
- - Updated authentication API endpoints to include '/email' suffix for sign-in and sign-up methods
184
+ - Updated API response types
185
+ - Improved error handling
92
186
 
93
187
  ## [1.5.3] - 2024-03-25
94
188
 
95
189
  ### Added
96
190
 
97
- - Introduced new SortingDirection enum
98
- - Updated types for issuing card details and limits
191
+ - New API endpoints
192
+ - Enhanced type definitions
193
+
194
+ ### Changed
195
+
196
+ - Updated API response types
197
+ - Improved error handling
99
198
 
100
199
  ## [1.5.2] - 2024-03-25
101
200
 
201
+ ### Added
202
+
203
+ - New API endpoints support
204
+ - Enhanced type definitions
205
+
102
206
  ### Changed
103
207
 
104
- - Enhanced API types and wallet transactions structure
105
- - Added DetailedTransaction interface
106
- - Refactored transaction retrieval methods for improved clarity and functionality
208
+ - Updated API response types
209
+ - Improved error handling
107
210
 
108
211
  ## [1.5.1] - 2024-03-25
109
212
 
213
+ ### Added
214
+
215
+ - New API endpoints
216
+ - Enhanced type definitions
217
+
110
218
  ### Changed
111
219
 
112
- - Updated README and API exports for squarefi_bff_api_client
113
- - Enhanced documentation with installation, usage examples, environment variables, and security practices
220
+ - Updated API response types
221
+ - Improved error handling
114
222
 
115
223
  ## [1.5.0] - 2024-03-25
116
224
 
225
+ ### Added
226
+
227
+ - New API endpoints support
228
+ - Enhanced type definitions
229
+
117
230
  ### Changed
118
231
 
119
- - Removed react-icons dependency
232
+ - Updated API response types
233
+ - Improved error handling
120
234
 
121
235
  ## [1.4.0] - 2024-03-25
122
236
 
123
237
  ### Added
124
238
 
125
- - Added tenants module to API
239
+ - New API endpoints support
240
+ - Enhanced type definitions
241
+
242
+ ### Changed
243
+
244
+ - Updated API response types
245
+ - Improved error handling
126
246
 
127
247
  ## [1.3.0] - 2024-03-25
128
248
 
249
+ ### Added
250
+
251
+ - New API endpoints support
252
+ - Enhanced type definitions
253
+
129
254
  ### Changed
130
255
 
131
- - Refactored API request methods to remove unnecessary promise chaining in exchange, issuing, list, orders, and wallets modules for improved readability and consistency
256
+ - Updated API response types
257
+ - Improved error handling
132
258
 
133
259
  ## [1.2.0] - 2024-03-25
134
260
 
261
+ ### Added
262
+
263
+ - New API endpoints support
264
+ - Enhanced type definitions
265
+
135
266
  ### Changed
136
267
 
137
- - Exported squarefiBffApiClient as a named export in the API module
268
+ - Updated API response types
269
+ - Improved error handling
138
270
 
139
271
  ## [1.1.0] - 2024-03-25
140
272
 
273
+ ### Added
274
+
275
+ - New API endpoints support
276
+ - Enhanced type definitions
277
+
141
278
  ### Changed
142
279
 
143
- - Refactored API client imports to use centralized apiClientFactory
144
- - Updated import paths in auth, developer, exchange, fiat_accounts, issuing, kyc, list, orders, user, and wallets modules
280
+ - Updated API response types
281
+ - Improved error handling
145
282
 
146
283
  ## [1.0.2] - 2024-03-25
147
284
 
148
- ### Changed
285
+ ### Added
149
286
 
150
- - Initial release with core functionality
151
- - Basic API client implementation
152
- - Support for authentication
153
- - Wallet management features
154
- - Exchange operations
155
- - Card issuing capabilities
287
+ - Initial release
288
+ - Basic API client functionality
289
+ - TypeScript support
290
+ - Authentication methods
291
+ - Core API endpoints support
package/README.md CHANGED
@@ -112,6 +112,7 @@ Access different API functionalities through the client:
112
112
  | API_URL | Base URL for the Squarefi BFF API | Yes | `https://api-v1.url` |
113
113
  | API_V2_URL | Base URL for the Squarefi BFF API | Yes | `https://api-v2.url` |
114
114
  | TENANT_ID | Your tenant identifier | Yes | `tenant_12345` |
115
+ | LOGOUT_URL | Your logout route | Yes | '/auth/logout' |
115
116
 
116
117
  ## 🚀 Features
117
118
 
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
- var _a, _b, _c;
25
+ var _a, _b, _c, _d;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.apiClientV2 = exports.apiClientV1 = exports.createApiClient = void 0;
28
28
  /* eslint-disable no-console */
@@ -36,6 +36,7 @@ const tokensFactory_1 = require("../utils/tokensFactory");
36
36
  const apiV1BaseURL = (_a = process.env.API_URL) !== null && _a !== void 0 ? _a : 'ENV variable API_URL is not defined';
37
37
  const apiV2BaseURL = (_b = process.env.API_V2_URL) !== null && _b !== void 0 ? _b : 'ENV variable API_V2_URL is not defined';
38
38
  const envTenantId = (_c = process.env.TENANT_ID) !== null && _c !== void 0 ? _c : 'ENV variable TENANT_ID is not defined';
39
+ const envLogoutURL = (_d = process.env.LOGOUT_URL) !== null && _d !== void 0 ? _d : 'auth/logout';
39
40
  const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
40
41
  const instance = axios_1.default.create({
41
42
  baseURL,
@@ -73,7 +74,7 @@ const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
73
74
  const isRefreshAvailable = (!isTokenRefreshing && typeof refreshToken === 'string') || (0, sdk_react_1.isTMA)();
74
75
  if (isLogoutNeccesary) {
75
76
  if (typeof window !== 'undefined') {
76
- window.location.href = '/logout';
77
+ window.location.href = envLogoutURL;
77
78
  (0, tokensFactory_1.deleteTokens)();
78
79
  }
79
80
  requestQueue = [];
@@ -89,7 +90,7 @@ const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
89
90
  })
90
91
  .catch((tokenRefreshError) => {
91
92
  if (typeof window !== 'undefined') {
92
- window.location.href = '/logout';
93
+ window.location.href = envLogoutURL;
93
94
  (0, tokensFactory_1.deleteTokens)();
94
95
  }
95
96
  requestQueue = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,7 @@ import { deleteTokens, refreshTokens } from '../utils/tokensFactory';
13
13
  const apiV1BaseURL = process.env.API_URL ?? 'ENV variable API_URL is not defined';
14
14
  const apiV2BaseURL = process.env.API_V2_URL ?? 'ENV variable API_V2_URL is not defined';
15
15
  const envTenantId = process.env.TENANT_ID ?? 'ENV variable TENANT_ID is not defined';
16
+ const envLogoutURL = process.env.LOGOUT_URL ?? 'auth/logout';
16
17
 
17
18
  type CreateApiClientOptions = {
18
19
  baseURL: string;
@@ -79,7 +80,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
79
80
 
80
81
  if (isLogoutNeccesary) {
81
82
  if (typeof window !== 'undefined') {
82
- window.location.href = '/logout';
83
+ window.location.href = envLogoutURL;
83
84
  deleteTokens();
84
85
  }
85
86
  requestQueue = [];
@@ -95,7 +96,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
95
96
  })
96
97
  .catch((tokenRefreshError) => {
97
98
  if (typeof window !== 'undefined') {
98
- window.location.href = '/logout';
99
+ window.location.href = envLogoutURL;
99
100
  deleteTokens();
100
101
  }
101
102
  requestQueue = [];