@finatic/client 0.0.137 → 0.0.139

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.
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from '../../utils/events';
2
2
  import { PaginatedResult } from '../../types/common/pagination';
3
- import { OrderResponse } from '../../types/api/orders';
3
+ import { OrderResponse, TradingContext } from '../../types/api/orders';
4
4
  import { BrokerBalance, BrokerInfo, BrokerConnection, OrdersFilter, PositionsFilter, AccountsFilter, BalancesFilter, BrokerDataOrder, BrokerDataPosition, BrokerDataAccount, DisconnectCompanyResponse } from '../../types/api/broker';
5
5
  import { FinaticConnectOptions, PortalOptions } from '../../types/connect';
6
6
  interface DeviceInfo {
@@ -152,6 +152,25 @@ export declare class FinaticConnect extends EventEmitter {
152
152
  side?: 'Buy' | 'Sell';
153
153
  order_id?: string;
154
154
  }>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', connection_id?: string): Promise<OrderResponse>;
155
+ /**
156
+ * Set the broker context for trading
157
+ * @param broker - The broker to use for trading
158
+ */
159
+ setTradingContextBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader' | 'interactive_brokers' | 'tradestation'): void;
160
+ /**
161
+ * Set the account context for trading
162
+ * @param accountNumber - The account number to use for trading
163
+ * @param accountId - Optional account ID
164
+ */
165
+ setTradingContextAccount(accountNumber: string, accountId?: string): void;
166
+ /**
167
+ * Get the current trading context
168
+ */
169
+ getTradingContext(): TradingContext;
170
+ /**
171
+ * Clear the trading context
172
+ */
173
+ clearTradingContext(): void;
155
174
  /**
156
175
  * Place a stock market order (convenience method)
157
176
  */
@@ -1,4 +1,3 @@
1
- import { UserToken } from '../../types';
2
1
  export declare class PortalUI {
3
2
  private iframe;
4
3
  private container;
@@ -6,7 +5,6 @@ export declare class PortalUI {
6
5
  private sessionId;
7
6
  private portalOrigin;
8
7
  private options?;
9
- private userToken;
10
8
  private originalBodyStyle;
11
9
  constructor(portalUrl: string);
12
10
  private createContainer;
@@ -34,5 +32,4 @@ export declare class PortalUI {
34
32
  private handleError;
35
33
  private handleClose;
36
34
  private handleResize;
37
- getTokens(): UserToken | null;
38
35
  }
@@ -5,4 +5,5 @@ export declare const corporateBlueTheme: PortalThemeConfig;
5
5
  export declare const purpleTheme: PortalThemeConfig;
6
6
  export declare const greenTheme: PortalThemeConfig;
7
7
  export declare const orangeTheme: PortalThemeConfig;
8
+ export declare const stockAlgosTheme: PortalThemeConfig;
8
9
  export declare const portalThemePresets: Record<string, PortalThemeConfig>;
@@ -39,7 +39,10 @@ export interface PortalMessage {
39
39
  }
40
40
  export interface PortalOptions {
41
41
  /** Callback when user successfully connects */
42
- onSuccess?: (userId: string) => void;
42
+ onSuccess?: (userId: string, tokens?: {
43
+ access_token?: string;
44
+ refresh_token?: string;
45
+ }) => void;
43
46
  /** Callback when an error occurs */
44
47
  onError?: (error: Error) => void;
45
48
  /** Callback when the portal is closed */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finatic/client",
3
- "version": "0.0.137",
3
+ "version": "0.0.139",
4
4
  "description": "Finatic Client SDK for browser integration",
5
5
  "type": "module",
6
6
  "publishConfig": {