@finatic/client 0.0.142 → 0.9.1

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +39 -0
  3. package/README.md +54 -425
  4. package/dist/index.d.ts +7329 -1579
  5. package/dist/index.js +8110 -6114
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +8047 -6085
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +77 -33
  10. package/dist/types/core/client/ApiClient.d.ts +0 -270
  11. package/dist/types/core/client/FinaticConnect.d.ts +0 -332
  12. package/dist/types/core/portal/PortalUI.d.ts +0 -37
  13. package/dist/types/index.d.ts +0 -12
  14. package/dist/types/lib/logger/index.d.ts +0 -2
  15. package/dist/types/lib/logger/logger.d.ts +0 -4
  16. package/dist/types/lib/logger/logger.types.d.ts +0 -28
  17. package/dist/types/mocks/MockApiClient.d.ts +0 -171
  18. package/dist/types/mocks/MockDataProvider.d.ts +0 -139
  19. package/dist/types/mocks/MockFactory.d.ts +0 -53
  20. package/dist/types/mocks/utils.d.ts +0 -24
  21. package/dist/types/themes/portalPresets.d.ts +0 -9
  22. package/dist/types/types/api/auth.d.ts +0 -93
  23. package/dist/types/types/api/broker.d.ts +0 -421
  24. package/dist/types/types/api/core.d.ts +0 -46
  25. package/dist/types/types/api/errors.d.ts +0 -31
  26. package/dist/types/types/api/orders.d.ts +0 -39
  27. package/dist/types/types/api/portfolio.d.ts +0 -55
  28. package/dist/types/types/common/pagination.d.ts +0 -33
  29. package/dist/types/types/connect.d.ts +0 -58
  30. package/dist/types/types/index.d.ts +0 -13
  31. package/dist/types/types/portal.d.ts +0 -204
  32. package/dist/types/types/ui/theme.d.ts +0 -104
  33. package/dist/types/utils/brokerUtils.d.ts +0 -30
  34. package/dist/types/utils/errors.d.ts +0 -45
  35. package/dist/types/utils/events.d.ts +0 -12
  36. package/dist/types/utils/themeUtils.d.ts +0 -34
  37. package/src/core/client/ApiClient.ts +0 -2004
  38. package/src/core/client/FinaticConnect.ts +0 -1606
  39. package/src/core/portal/PortalUI.ts +0 -335
  40. package/src/index.d.ts +0 -23
  41. package/src/index.ts +0 -100
  42. package/src/lib/logger/index.ts +0 -3
  43. package/src/lib/logger/logger.ts +0 -332
  44. package/src/lib/logger/logger.types.ts +0 -34
  45. package/src/mocks/MockApiClient.ts +0 -1058
  46. package/src/mocks/MockDataProvider.ts +0 -986
  47. package/src/mocks/MockFactory.ts +0 -97
  48. package/src/mocks/utils.ts +0 -133
  49. package/src/themes/portalPresets.ts +0 -1307
  50. package/src/types/api/auth.ts +0 -112
  51. package/src/types/api/broker.ts +0 -461
  52. package/src/types/api/core.ts +0 -53
  53. package/src/types/api/errors.ts +0 -35
  54. package/src/types/api/orders.ts +0 -45
  55. package/src/types/api/portfolio.ts +0 -59
  56. package/src/types/common/pagination.ts +0 -164
  57. package/src/types/connect.ts +0 -56
  58. package/src/types/index.ts +0 -25
  59. package/src/types/portal.ts +0 -214
  60. package/src/types/ui/theme.ts +0 -105
  61. package/src/utils/brokerUtils.ts +0 -104
  62. package/src/utils/errors.ts +0 -104
  63. package/src/utils/events.ts +0 -66
  64. package/src/utils/themeUtils.ts +0 -165
@@ -1,421 +0,0 @@
1
- /**
2
- * Broker-related types
3
- */
4
- export interface BrokerAccount {
5
- id: string;
6
- user_broker_connection_id: string;
7
- broker_provided_account_id: string;
8
- account_name: string;
9
- account_type: string;
10
- currency: string;
11
- cash_balance: number;
12
- buying_power: number;
13
- status: string;
14
- /** ISO 8601 timestamp with timezone information */
15
- created_at: string;
16
- /** ISO 8601 timestamp with timezone information */
17
- updated_at: string;
18
- /** ISO 8601 timestamp with timezone information */
19
- last_synced_at: string;
20
- /** ISO 8601 timestamp with timezone information - when positions were last synced */
21
- positions_synced_at: string | null;
22
- /** ISO 8601 timestamp with timezone information - when orders were last synced */
23
- orders_synced_at: string | null;
24
- /** ISO 8601 timestamp with timezone information - when balances were last synced */
25
- balances_synced_at: string | null;
26
- /** ISO 8601 timestamp with timezone information - when the account was created */
27
- account_created_at: string | null;
28
- /** ISO 8601 timestamp with timezone information - when the account was last updated */
29
- account_updated_at: string | null;
30
- /** ISO 8601 timestamp with timezone information - when the first trade occurred */
31
- account_first_trade_at: string | null;
32
- }
33
- export interface BrokerOrder {
34
- id: string;
35
- user_broker_connection_id: string;
36
- broker_provided_account_id: string;
37
- order_id: string;
38
- symbol: string;
39
- order_type: string;
40
- side: 'buy' | 'sell';
41
- quantity: number;
42
- price: number;
43
- status: string;
44
- /** ISO 8601 timestamp with timezone information */
45
- created_at: string;
46
- /** ISO 8601 timestamp with timezone information */
47
- updated_at: string;
48
- /** ISO 8601 timestamp with timezone information, null if not filled */
49
- filled_at: string | null;
50
- filled_quantity: number;
51
- filled_avg_price: number;
52
- }
53
- export interface BrokerPosition {
54
- id: string;
55
- user_broker_connection_id: string;
56
- broker_provided_account_id: string;
57
- symbol: string;
58
- asset_type: string;
59
- quantity: number;
60
- average_price: number;
61
- market_value: number;
62
- cost_basis: number;
63
- unrealized_gain_loss: number;
64
- unrealized_gain_loss_percent: number;
65
- current_price: number;
66
- last_price: number;
67
- /** ISO 8601 timestamp with timezone information */
68
- last_price_updated_at: string;
69
- /** ISO 8601 timestamp with timezone information */
70
- created_at: string;
71
- /** ISO 8601 timestamp with timezone information */
72
- updated_at: string;
73
- }
74
- export interface BrokerBalance {
75
- id: string;
76
- account_id: string;
77
- total_cash_value: number | null;
78
- net_liquidation_value: number | null;
79
- initial_margin: number | null;
80
- maintenance_margin: number | null;
81
- available_to_withdraw: number | null;
82
- total_realized_pnl: number | null;
83
- balance_created_at: string | null;
84
- balance_updated_at: string | null;
85
- is_end_of_day_snapshot: boolean | null;
86
- raw_payload: any | null;
87
- /** ISO 8601 timestamp with timezone information */
88
- created_at: string;
89
- /** ISO 8601 timestamp with timezone information */
90
- updated_at: string;
91
- }
92
- export interface BrokerDataOptions {
93
- broker_name?: string;
94
- account_id?: string;
95
- symbol?: string;
96
- }
97
- export interface BrokerInfo {
98
- id: string;
99
- name: string;
100
- display_name: string;
101
- description: string;
102
- website: string;
103
- features: string[];
104
- auth_type: 'oauth' | 'api_key';
105
- logo_path: string;
106
- is_active: boolean;
107
- }
108
- export interface BrokerOrderParams {
109
- broker: 'robinhood' | 'tasty_trade' | 'ninja_trader';
110
- order_id?: string;
111
- orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
112
- assetType: 'equity' | 'equity_option' | 'crypto' | 'forex' | 'future' | 'future_option';
113
- action: 'Buy' | 'Sell';
114
- timeInForce: 'day' | 'gtc' | 'gtd' | 'ioc' | 'fok';
115
- accountNumber: string | number;
116
- symbol: string;
117
- orderQty: number;
118
- price?: number;
119
- stopPrice?: number;
120
- }
121
- export interface BrokerExtras {
122
- robinhood?: {
123
- extendedHours?: boolean;
124
- marketHours?: 'regular_hours' | 'extended_hours';
125
- trailType?: 'percentage' | 'amount';
126
- };
127
- ninjaTrader?: {
128
- accountSpec?: string;
129
- isAutomated?: boolean;
130
- activationTime?: string;
131
- text?: string;
132
- pegDifference?: number;
133
- expireTime?: string;
134
- };
135
- tastyTrade?: {
136
- automatedSource?: boolean;
137
- priceEffect?: 'Debit' | 'Credit';
138
- externalIdentifier?: string;
139
- partitionKey?: string;
140
- preflightId?: string;
141
- source?: string;
142
- valueEffect?: 'Debit' | 'Credit';
143
- };
144
- }
145
- export interface BrokerConnection {
146
- id: string;
147
- broker_id: string;
148
- user_id: string;
149
- company_id: string;
150
- status: 'connected' | 'disconnected' | 'error';
151
- connected_at: string;
152
- last_synced_at: string | null;
153
- permissions: {
154
- read: boolean;
155
- write: boolean;
156
- };
157
- metadata: {
158
- nickname?: string;
159
- [key: string]: any;
160
- };
161
- needs_reauth: boolean;
162
- }
163
- export interface BrokerDataOrder {
164
- id: string;
165
- broker_id: string;
166
- connection_id: string;
167
- account_id: string;
168
- order_id: string;
169
- symbol: string;
170
- order_type: string;
171
- side: 'buy' | 'sell';
172
- quantity: number;
173
- price: number;
174
- status: 'filled' | 'pending' | 'cancelled' | 'rejected' | 'partially_filled';
175
- asset_type: 'stock' | 'option' | 'crypto' | 'future';
176
- created_at: string;
177
- updated_at: string;
178
- filled_at?: string;
179
- filled_quantity: number;
180
- filled_avg_price: number;
181
- metadata?: Record<string, any>;
182
- }
183
- export interface BrokerDataPosition {
184
- id: string;
185
- broker_id: string;
186
- connection_id: string;
187
- account_id: string;
188
- symbol: string;
189
- asset_type: 'stock' | 'option' | 'crypto' | 'future';
190
- side: 'long' | 'short';
191
- quantity: number;
192
- average_price: number;
193
- market_value: number;
194
- cost_basis: number;
195
- unrealized_gain_loss: number;
196
- unrealized_gain_loss_percent: number;
197
- current_price: number;
198
- last_price: number;
199
- last_price_updated_at: string;
200
- position_status: 'open' | 'closed';
201
- created_at: string;
202
- updated_at: string;
203
- metadata?: Record<string, any>;
204
- }
205
- export interface BrokerDataAccount {
206
- id: string;
207
- broker_id: string;
208
- connection_id: string;
209
- account_id: string;
210
- account_name: string;
211
- account_type: 'margin' | 'cash' | 'crypto_wallet' | 'live' | 'sim';
212
- status: 'active' | 'inactive';
213
- currency: string;
214
- cash_balance: number;
215
- buying_power: number;
216
- equity: number;
217
- created_at: string;
218
- updated_at: string;
219
- last_synced_at: string;
220
- metadata?: Record<string, any>;
221
- }
222
- export interface OrdersFilter {
223
- broker_id?: string;
224
- connection_id?: string;
225
- account_id?: string;
226
- symbol?: string;
227
- status?: 'filled' | 'pending' | 'cancelled' | 'rejected' | 'partially_filled';
228
- side?: 'buy' | 'sell';
229
- asset_type?: 'stock' | 'option' | 'crypto' | 'future';
230
- limit?: number;
231
- offset?: number;
232
- created_after?: string;
233
- created_before?: string;
234
- with_metadata?: boolean;
235
- }
236
- export interface PositionsFilter {
237
- broker_id?: string;
238
- connection_id?: string;
239
- account_id?: string;
240
- symbol?: string;
241
- side?: 'long' | 'short';
242
- asset_type?: 'stock' | 'option' | 'crypto' | 'future';
243
- position_status?: 'open' | 'closed';
244
- limit?: number;
245
- offset?: number;
246
- updated_after?: string;
247
- updated_before?: string;
248
- with_metadata?: boolean;
249
- }
250
- export interface AccountsFilter {
251
- broker_id?: string;
252
- connection_id?: string;
253
- account_type?: 'margin' | 'cash' | 'crypto_wallet' | 'live' | 'sim';
254
- status?: 'active' | 'inactive';
255
- currency?: string;
256
- limit?: number;
257
- offset?: number;
258
- with_metadata?: boolean;
259
- }
260
- export interface BalancesFilter {
261
- broker_id?: string;
262
- connection_id?: string;
263
- account_id?: string;
264
- is_end_of_day_snapshot?: boolean;
265
- limit?: number;
266
- offset?: number;
267
- balance_created_after?: string;
268
- balance_created_before?: string;
269
- with_metadata?: boolean;
270
- }
271
- export interface FilteredOrdersResponse {
272
- orders: BrokerDataOrder[];
273
- total: number;
274
- limit: number;
275
- offset: number;
276
- }
277
- export interface FilteredPositionsResponse {
278
- positions: BrokerDataPosition[];
279
- total: number;
280
- limit: number;
281
- offset: number;
282
- }
283
- export interface FilteredAccountsResponse {
284
- accounts: BrokerDataAccount[];
285
- total: number;
286
- limit: number;
287
- offset: number;
288
- }
289
- export interface FilteredBalancesResponse {
290
- balances: BrokerBalance[];
291
- total: number;
292
- limit: number;
293
- offset: number;
294
- }
295
- export interface DisconnectCompanyResponse {
296
- success: boolean;
297
- response_data: {
298
- connection_id: string;
299
- action: 'company_access_removed' | 'connection_deleted';
300
- remaining_companies?: number;
301
- message: string;
302
- };
303
- message: string;
304
- status_code: number;
305
- }
306
- export interface OrderFill {
307
- id: string;
308
- order_id: string;
309
- leg_id: string | null;
310
- price: number;
311
- quantity: number;
312
- executed_at: string;
313
- execution_id: string | null;
314
- trade_id: string | null;
315
- venue: string | null;
316
- commission_fee: number | null;
317
- created_at: string;
318
- updated_at: string;
319
- }
320
- export interface OrderEvent {
321
- id: string;
322
- order_id: string;
323
- order_group_id: string | null;
324
- event_type: string | null;
325
- event_time: string;
326
- event_id: string | null;
327
- order_status: string | null;
328
- inferred: boolean;
329
- confidence: number | null;
330
- reason_code: string | null;
331
- recorded_at: string | null;
332
- }
333
- export interface OrderLeg {
334
- id: string;
335
- order_id: string;
336
- leg_index: number;
337
- asset_type: string;
338
- broker_provided_symbol: string | null;
339
- quantity: number;
340
- filled_quantity: number | null;
341
- avg_fill_price: number | null;
342
- created_at: string | null;
343
- updated_at: string | null;
344
- }
345
- export interface OrderGroupOrder extends BrokerDataOrder {
346
- legs: OrderLeg[];
347
- }
348
- export interface OrderGroup {
349
- id: string;
350
- user_broker_connection_id: string | null;
351
- created_at: string;
352
- updated_at: string;
353
- orders: OrderGroupOrder[];
354
- }
355
- export interface PositionLot {
356
- id: string;
357
- position_id: string | null;
358
- user_broker_connection_id: string;
359
- broker_provided_account_id: string;
360
- instrument_key: string;
361
- asset_type: string | null;
362
- side: 'long' | 'short' | null;
363
- open_quantity: number;
364
- closed_quantity: number;
365
- remaining_quantity: number;
366
- open_price: number;
367
- close_price_avg: number | null;
368
- cost_basis: number;
369
- cost_basis_w_commission: number;
370
- realized_pl: number;
371
- realized_pl_w_commission: number;
372
- lot_opened_at: string;
373
- lot_closed_at: string | null;
374
- position_group_id: string | null;
375
- created_at: string;
376
- updated_at: string;
377
- position_lot_fills?: PositionLotFill[];
378
- }
379
- export interface PositionLotFill {
380
- id: string;
381
- lot_id: string;
382
- order_fill_id: string;
383
- fill_price: number;
384
- fill_quantity: number;
385
- executed_at: string;
386
- commission_share: number | null;
387
- created_at: string;
388
- updated_at: string;
389
- }
390
- export interface OrderFillsFilter {
391
- connection_id?: string;
392
- limit?: number;
393
- offset?: number;
394
- }
395
- export interface OrderEventsFilter {
396
- connection_id?: string;
397
- limit?: number;
398
- offset?: number;
399
- }
400
- export interface OrderGroupsFilter {
401
- broker_id?: string;
402
- connection_id?: string;
403
- limit?: number;
404
- offset?: number;
405
- created_after?: string;
406
- created_before?: string;
407
- }
408
- export interface PositionLotsFilter {
409
- broker_id?: string;
410
- connection_id?: string;
411
- account_id?: string;
412
- symbol?: string;
413
- position_id?: string;
414
- limit?: number;
415
- offset?: number;
416
- }
417
- export interface PositionLotFillsFilter {
418
- connection_id?: string;
419
- limit?: number;
420
- offset?: number;
421
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Core API types
3
- */
4
- import { ApiPaginationInfo } from '../common/pagination';
5
- export interface ApiConfig {
6
- baseUrl: string;
7
- apiKey?: string;
8
- sandbox?: boolean;
9
- }
10
- export interface ApiResponse<T> {
11
- success: boolean;
12
- response_data: T;
13
- message: string;
14
- status_code: number;
15
- pagination?: ApiPaginationInfo;
16
- }
17
- export interface ApiError {
18
- code: string;
19
- message: string;
20
- details?: Record<string, any>;
21
- }
22
- export interface RequestHeaders {
23
- 'Content-Type': string;
24
- 'X-API-Key'?: string;
25
- Authorization?: string;
26
- 'X-CSRF-Token'?: string;
27
- token?: string;
28
- 'User-Agent'?: string;
29
- 'X-Device-Info'?: string;
30
- 'X-Request-ID'?: string;
31
- 'X-Request-Timestamp'?: string;
32
- 'X-Request-Signature'?: string;
33
- [key: string]: string | undefined;
34
- }
35
- export interface PortalResponse {
36
- portalUrl: string;
37
- token: string;
38
- expiresIn: number;
39
- }
40
- export interface PortalUrlResponse {
41
- success: boolean;
42
- message: string;
43
- data: {
44
- portal_url: string;
45
- };
46
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Error response types matching API documentation
3
- */
4
- export interface TradeAccessDeniedError {
5
- success: false;
6
- response_data: null;
7
- message: string;
8
- status_code: 403;
9
- category: 'TRADE_ACCESS_DENIED';
10
- }
11
- export interface OrderNotFoundError {
12
- success: false;
13
- response_data: null;
14
- message: string;
15
- status_code: 404;
16
- category: 'ORDER_NOT_FOUND';
17
- }
18
- export interface ValidationError {
19
- success: false;
20
- response_data: null;
21
- message: string;
22
- status_code: 400;
23
- }
24
- export interface TradingNotEnabledError {
25
- success: false;
26
- response_data: null;
27
- message: string;
28
- status_code: 403;
29
- code: 'TRADING_NOT_ENABLED';
30
- requires_action: null;
31
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * Order-related types
3
- */
4
- export interface Order {
5
- symbol: string;
6
- side: 'buy' | 'sell';
7
- quantity: number;
8
- type_: 'market' | 'limit' | 'stop' | 'stop_limit';
9
- price?: number;
10
- stopPrice?: number;
11
- timeInForce: 'day' | 'gtc' | 'opg' | 'cls' | 'ioc' | 'fok';
12
- }
13
- export interface OptionsOrder extends Order {
14
- optionType: 'call' | 'put';
15
- strikePrice: number;
16
- expirationDate: string;
17
- }
18
- export interface CryptoOrderOptions {
19
- quantity?: number;
20
- notional?: number;
21
- }
22
- export interface OptionsOrderOptions {
23
- strikePrice: number;
24
- expirationDate: string;
25
- optionType: 'call' | 'put';
26
- contractSize?: number;
27
- }
28
- export interface OrderResponse {
29
- success: boolean;
30
- response_data: any;
31
- message: string;
32
- status_code: number;
33
- category?: string;
34
- }
35
- export interface TradingContext {
36
- broker?: string;
37
- accountNumber?: string;
38
- accountId?: string;
39
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Portfolio-related types
3
- */
4
- export interface PortfolioSnapshot {
5
- timestamp: string;
6
- totalValue: number;
7
- cash: number;
8
- equity: number;
9
- positions: {
10
- symbol: string;
11
- quantity: number;
12
- averagePrice: number;
13
- currentPrice: number;
14
- marketValue: number;
15
- unrealizedPnL: number;
16
- }[];
17
- }
18
- export interface PerformanceMetrics {
19
- totalReturn: number;
20
- dailyReturn: number;
21
- weeklyReturn: number;
22
- monthlyReturn: number;
23
- yearlyReturn: number;
24
- maxDrawdown: number;
25
- sharpeRatio: number;
26
- beta: number;
27
- alpha: number;
28
- }
29
- export interface Holding {
30
- symbol: string;
31
- quantity: number;
32
- averagePrice: number;
33
- currentPrice: number;
34
- marketValue: number;
35
- unrealizedPnL: number;
36
- realizedPnL: number;
37
- costBasis: number;
38
- currency: string;
39
- }
40
- export interface Portfolio {
41
- id: string;
42
- name: string;
43
- type: string;
44
- status: string;
45
- cash: number;
46
- buyingPower: number;
47
- equity: number;
48
- longMarketValue: number;
49
- shortMarketValue: number;
50
- initialMargin: number;
51
- maintenanceMargin: number;
52
- lastEquity: number;
53
- positions: Holding[];
54
- performance: PerformanceMetrics;
55
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Pagination-related types and classes
3
- */
4
- export interface ApiPaginationInfo {
5
- has_more: boolean;
6
- next_offset: number;
7
- current_offset: number;
8
- limit: number;
9
- }
10
- export interface PaginationMetadata {
11
- hasMore: boolean;
12
- nextOffset: number;
13
- currentOffset: number;
14
- limit: number;
15
- currentPage: number;
16
- hasNext: boolean;
17
- hasPrevious: boolean;
18
- }
19
- export declare class PaginatedResult<T> {
20
- readonly data: T;
21
- readonly metadata: PaginationMetadata;
22
- private navigationCallback?;
23
- constructor(data: T, paginationInfo: ApiPaginationInfo, navigationCallback?: (offset: number, limit: number) => Promise<PaginatedResult<T>>);
24
- get hasNext(): boolean;
25
- get hasPrevious(): boolean;
26
- get currentPage(): number;
27
- nextPage(): Promise<PaginatedResult<T> | null>;
28
- previousPage(): Promise<PaginatedResult<T> | null>;
29
- goToPage(pageNumber: number): Promise<PaginatedResult<T> | null>;
30
- firstPage(): Promise<PaginatedResult<T> | null>;
31
- lastPage(): Promise<PaginatedResult<T> | null>;
32
- getPaginationInfo(): string;
33
- }
@@ -1,58 +0,0 @@
1
- import { Theme } from './ui/theme';
2
- import { UserToken } from './api/auth';
3
- import { PortalTheme } from './portal';
4
- export interface FinaticConnectOptions {
5
- /** The portal token from your backend */
6
- token: string;
7
- /** Optional base URL for API requests */
8
- baseUrl?: string;
9
- /** Optional origin for the portal */
10
- origin?: string;
11
- /** Callback when user successfully connects */
12
- onSuccess?: (tokens: UserToken) => void;
13
- /** Callback when an error occurs */
14
- onError?: (error: Error) => void;
15
- /** Callback when the portal is closed */
16
- onClose?: () => void;
17
- /** Optional theme configuration */
18
- theme?: Theme;
19
- /** Callback when tokens are received */
20
- onTokensReceived?: (tokens: {
21
- access_token?: string;
22
- refresh_token?: string;
23
- }) => void;
24
- }
25
- export interface FinaticUserToken {
26
- accessToken: string;
27
- refreshToken: string;
28
- userId: string;
29
- companyId: string;
30
- expiresAt: Date;
31
- }
32
- export interface PortalMessage {
33
- type: 'success' | 'error' | 'close' | 'resize';
34
- userId?: string;
35
- error?: string;
36
- height?: number;
37
- access_token?: string;
38
- refresh_token?: string;
39
- }
40
- export interface PortalOptions {
41
- /** Callback when user successfully connects */
42
- onSuccess?: (userId: string, tokens?: {
43
- access_token?: string;
44
- refresh_token?: string;
45
- }) => void;
46
- /** Callback when an error occurs */
47
- onError?: (error: Error) => void;
48
- /** Callback when the portal is closed */
49
- onClose?: () => void;
50
- /** Callback when portal events occur */
51
- onEvent?: (type: string, data: any) => void;
52
- /** Optional theme configuration for the portal */
53
- theme?: PortalTheme;
54
- /** Optional list of broker names to filter by (only these brokers will be shown) */
55
- brokers?: string[];
56
- /** Optional email address to prefill in the portal */
57
- email?: string;
58
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Main types barrel export
3
- */
4
- export * from './api/core';
5
- export * from './api/auth';
6
- export * from './api/broker';
7
- export * from './api/orders';
8
- export * from './api/portfolio';
9
- export * from './ui/theme';
10
- export * from './common/pagination';
11
- export * from './connect';
12
- export type { DeviceInfo } from './api/auth';
13
- export type { SessionResponse } from './api/auth';