@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,204 +0,0 @@
1
- export interface PortalConfig {
2
- width?: string;
3
- height?: string;
4
- position?: 'center' | 'top' | 'bottom';
5
- zIndex?: number;
6
- }
7
- export interface PortalThemeConfig {
8
- mode?: 'dark' | 'light' | 'auto';
9
- colors?: {
10
- background?: {
11
- primary?: string;
12
- secondary?: string;
13
- tertiary?: string;
14
- accent?: string;
15
- glass?: string;
16
- };
17
- status?: {
18
- connected?: string;
19
- disconnected?: string;
20
- warning?: string;
21
- pending?: string;
22
- error?: string;
23
- success?: string;
24
- };
25
- text?: {
26
- primary?: string;
27
- secondary?: string;
28
- muted?: string;
29
- inverse?: string;
30
- };
31
- border?: {
32
- primary?: string;
33
- secondary?: string;
34
- hover?: string;
35
- focus?: string;
36
- accent?: string;
37
- };
38
- input?: {
39
- background?: string;
40
- border?: string;
41
- borderFocus?: string;
42
- text?: string;
43
- placeholder?: string;
44
- };
45
- button?: {
46
- primary?: {
47
- background?: string;
48
- text?: string;
49
- hover?: string;
50
- active?: string;
51
- };
52
- secondary?: {
53
- background?: string;
54
- text?: string;
55
- border?: string;
56
- hover?: string;
57
- active?: string;
58
- };
59
- };
60
- };
61
- typography?: {
62
- fontFamily?: {
63
- primary?: string;
64
- secondary?: string;
65
- };
66
- fontSize?: {
67
- xs?: string;
68
- sm?: string;
69
- base?: string;
70
- lg?: string;
71
- xl?: string;
72
- '2xl'?: string;
73
- '3xl'?: string;
74
- '4xl'?: string;
75
- };
76
- fontWeight?: {
77
- normal?: number;
78
- medium?: number;
79
- semibold?: number;
80
- bold?: number;
81
- extrabold?: number;
82
- };
83
- lineHeight?: {
84
- tight?: string;
85
- normal?: string;
86
- relaxed?: string;
87
- };
88
- };
89
- spacing?: {
90
- xs?: string;
91
- sm?: string;
92
- md?: string;
93
- lg?: string;
94
- xl?: string;
95
- '2xl'?: string;
96
- '3xl'?: string;
97
- };
98
- layout?: {
99
- containerMaxWidth?: string;
100
- gridGap?: string;
101
- cardPadding?: string;
102
- borderRadius?: {
103
- sm?: string;
104
- md?: string;
105
- lg?: string;
106
- xl?: string;
107
- '2xl'?: string;
108
- full?: string;
109
- };
110
- };
111
- components?: {
112
- brokerCard?: {
113
- width?: string;
114
- height?: string;
115
- logoSize?: string;
116
- padding?: string;
117
- };
118
- statusIndicator?: {
119
- size?: string;
120
- glowIntensity?: number;
121
- };
122
- modal?: {
123
- background?: string;
124
- backdrop?: string;
125
- };
126
- brokerCardModern?: {
127
- width?: string;
128
- height?: string;
129
- padding?: string;
130
- logoSize?: string;
131
- statusSize?: string;
132
- };
133
- connectButton?: {
134
- width?: string;
135
- height?: string;
136
- };
137
- themeSwitcher?: {
138
- indicatorSize?: string;
139
- };
140
- };
141
- effects?: {
142
- glassmorphism?: {
143
- enabled?: boolean;
144
- blur?: string;
145
- opacity?: number;
146
- border?: string;
147
- };
148
- animations?: {
149
- enabled?: boolean;
150
- duration?: {
151
- fast?: string;
152
- normal?: string;
153
- slow?: string;
154
- };
155
- easing?: {
156
- default?: string;
157
- smooth?: string;
158
- bounce?: string;
159
- };
160
- };
161
- shadows?: {
162
- sm?: string;
163
- md?: string;
164
- lg?: string;
165
- xl?: string;
166
- card?: string;
167
- cardHover?: string;
168
- glow?: string;
169
- focus?: string;
170
- };
171
- };
172
- branding?: {
173
- logo?: string;
174
- companyName?: string;
175
- favicon?: string;
176
- primaryColor?: string;
177
- };
178
- glow?: {
179
- primary?: string;
180
- secondary?: string;
181
- card?: string;
182
- cardHover?: string;
183
- button?: string;
184
- focus?: string;
185
- scrollbar?: string;
186
- };
187
- gradients?: {
188
- start?: string;
189
- end?: string;
190
- hoverStart?: string;
191
- hoverEnd?: string;
192
- };
193
- }
194
- export type PortalThemePreset = 'dark' | 'light' | 'corporateBlue' | 'purple' | 'green' | 'orange';
195
- export interface PortalTheme {
196
- preset?: PortalThemePreset;
197
- custom?: PortalThemeConfig;
198
- }
199
- export interface PortalProps {
200
- config: PortalConfig;
201
- onClose?: () => void;
202
- onReady?: () => void;
203
- onError?: (error: Error) => void;
204
- }
@@ -1,104 +0,0 @@
1
- /**
2
- * Theme-related types
3
- */
4
- export interface Theme {
5
- mode: 'light' | 'dark';
6
- primaryColor: string;
7
- colors: {
8
- primary: string;
9
- secondary: string;
10
- background: {
11
- primary: string;
12
- secondary: string;
13
- tertiary: string;
14
- };
15
- text: {
16
- primary: string;
17
- secondary: string;
18
- disabled: string;
19
- error: string;
20
- success: string;
21
- warning: string;
22
- };
23
- border: {
24
- light: string;
25
- medium: string;
26
- dark: string;
27
- };
28
- status: {
29
- active: string;
30
- inactive: string;
31
- pending: string;
32
- error: string;
33
- success: string;
34
- };
35
- };
36
- typography: {
37
- fontFamily: string;
38
- fontSize: {
39
- xs: string;
40
- sm: string;
41
- base: string;
42
- lg: string;
43
- xl: string;
44
- '2xl': string;
45
- };
46
- fontWeight: {
47
- light: number;
48
- normal: number;
49
- medium: number;
50
- semibold: number;
51
- bold: number;
52
- };
53
- lineHeight: {
54
- none: number;
55
- tight: number;
56
- normal: number;
57
- relaxed: number;
58
- };
59
- };
60
- spacing: {
61
- xs: string;
62
- sm: string;
63
- md: string;
64
- lg: string;
65
- xl: string;
66
- '2xl': string;
67
- };
68
- animation: {
69
- duration: {
70
- fast: string;
71
- normal: string;
72
- slow: string;
73
- };
74
- easing: {
75
- linear: string;
76
- easeIn: string;
77
- easeOut: string;
78
- easeInOut: string;
79
- };
80
- };
81
- components: {
82
- button: {
83
- borderRadius: string;
84
- padding: string;
85
- fontSize: string;
86
- fontWeight: number;
87
- };
88
- input: {
89
- borderRadius: string;
90
- padding: string;
91
- fontSize: string;
92
- };
93
- card: {
94
- borderRadius: string;
95
- padding: string;
96
- shadow: string;
97
- };
98
- modal: {
99
- borderRadius: string;
100
- padding: string;
101
- backdrop: string;
102
- };
103
- };
104
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * Broker filtering utility functions
3
- */
4
- /**
5
- * Convert broker names to broker IDs, filtering out unsupported ones
6
- * @param brokerNames Array of broker names to convert
7
- * @returns Object containing valid broker IDs and any warnings about unsupported names
8
- */
9
- export declare function convertBrokerNamesToIds(brokerNames: string[]): {
10
- brokerIds: string[];
11
- warnings: string[];
12
- };
13
- /**
14
- * Append broker filter parameters to a portal URL
15
- * @param baseUrl The base portal URL (may already have query parameters)
16
- * @param brokerNames Array of broker names to filter by
17
- * @returns The portal URL with broker filter parameters appended
18
- */
19
- export declare function appendBrokerFilterToURL(baseUrl: string, brokerNames?: string[]): string;
20
- /**
21
- * Get list of supported broker names
22
- * @returns Array of supported broker names
23
- */
24
- export declare function getSupportedBrokerNames(): string[];
25
- /**
26
- * Check if a broker name is supported
27
- * @param brokerName The broker name to check
28
- * @returns True if the broker is supported, false otherwise
29
- */
30
- export declare function isBrokerSupported(brokerName: string): boolean;
@@ -1,45 +0,0 @@
1
- export declare class BaseError extends Error {
2
- readonly code: string;
3
- constructor(message: string, code?: string);
4
- }
5
- export declare class ApiError extends BaseError {
6
- readonly status: number;
7
- readonly details?: Record<string, any> | undefined;
8
- constructor(status: number, message: string, details?: Record<string, any> | undefined);
9
- }
10
- export declare class SessionError extends ApiError {
11
- constructor(message: string, details?: Record<string, any>);
12
- }
13
- export declare class AuthenticationError extends ApiError {
14
- constructor(message: string, details?: Record<string, any>);
15
- }
16
- export declare class AuthorizationError extends ApiError {
17
- constructor(message: string, details?: Record<string, any>);
18
- }
19
- export declare class RateLimitError extends ApiError {
20
- constructor(message: string, details?: Record<string, any>);
21
- }
22
- export declare class TokenError extends BaseError {
23
- constructor(message: string);
24
- }
25
- export declare class ValidationError extends BaseError {
26
- constructor(message: string);
27
- }
28
- export declare class NetworkError extends BaseError {
29
- constructor(message: string);
30
- }
31
- export declare class SecurityError extends BaseError {
32
- constructor(message: string);
33
- }
34
- export declare class CompanyAccessError extends ApiError {
35
- constructor(message: string, details?: Record<string, any>);
36
- }
37
- export declare class OrderError extends ApiError {
38
- constructor(message: string, details?: Record<string, any>);
39
- }
40
- export declare class OrderValidationError extends ApiError {
41
- constructor(message: string, details?: Record<string, any>);
42
- }
43
- export declare class TradingNotEnabledError extends ApiError {
44
- constructor(message: string, details?: Record<string, any>);
45
- }
@@ -1,12 +0,0 @@
1
- type EventCallback = (...args: any[]) => void;
2
- export declare class EventEmitter {
3
- private events;
4
- on(event: string, callback: EventCallback): void;
5
- off(event: string, callback: EventCallback): void;
6
- once(event: string, callback: EventCallback): void;
7
- emit(event: string, ...args: any[]): void;
8
- removeAllListeners(event?: string): void;
9
- listenerCount(event: string): number;
10
- listeners(event: string): EventCallback[];
11
- }
12
- export {};
@@ -1,34 +0,0 @@
1
- import { PortalTheme, PortalThemeConfig } from '../types/portal';
2
- /**
3
- * Generate a portal URL with theme parameters
4
- * @param baseUrl The base portal URL
5
- * @param theme The theme configuration
6
- * @returns The portal URL with theme parameters
7
- */
8
- export declare function generatePortalThemeURL(baseUrl: string, theme?: PortalTheme): string;
9
- /**
10
- * Generate a portal URL with theme parameters, appending to existing query params
11
- * @param baseUrl The base portal URL (may already have query parameters)
12
- * @param theme The theme configuration
13
- * @returns The portal URL with theme parameters appended
14
- */
15
- export declare function appendThemeToURL(baseUrl: string, theme?: PortalTheme): string;
16
- /**
17
- * Get a theme configuration by preset name
18
- * @param preset The preset theme name
19
- * @returns The theme configuration or undefined if not found
20
- */
21
- export declare function getThemePreset(preset: string): PortalThemeConfig | undefined;
22
- /**
23
- * Validate a custom theme configuration
24
- * @param theme The theme configuration to validate
25
- * @returns True if valid, false otherwise
26
- */
27
- export declare function validateCustomTheme(theme: PortalThemeConfig): boolean;
28
- /**
29
- * Create a custom theme from a preset with modifications
30
- * @param preset The base preset theme
31
- * @param modifications Partial theme modifications
32
- * @returns The modified theme configuration
33
- */
34
- export declare function createCustomThemeFromPreset(preset: string, modifications: Partial<PortalThemeConfig>): PortalThemeConfig | null;