@finatic/client 0.9.7 → 0.9.9
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/README.md +15 -17
- package/dist/index.d.ts +4534 -1120
- package/dist/index.js +4266 -1339
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4267 -1340
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -39,24 +39,24 @@ The portal allows users to connect their broker accounts. You can either:
|
|
|
39
39
|
**Option A: Open portal in iframe (recommended)**
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
await finatic.openPortal(
|
|
43
|
-
'
|
|
44
|
-
['alpaca', 'tradier'], // Optional: Filter specific brokers
|
|
45
|
-
'user@example.com', // Optional: Pre-fill email
|
|
46
|
-
'
|
|
47
|
-
(userId) => {
|
|
42
|
+
await finatic.openPortal({
|
|
43
|
+
theme: { preset: 'stockAlgos' }, // Theme: 'light' | 'dark' | theme object
|
|
44
|
+
brokers: ['alpaca', 'tradier'], // Optional: Filter specific brokers
|
|
45
|
+
email: 'user@example.com', // Optional: Pre-fill email
|
|
46
|
+
mode: 'dark', // Optional: 'light' | 'dark'
|
|
47
|
+
onSuccess: (userId) => {
|
|
48
48
|
// User successfully authenticated
|
|
49
49
|
console.log('User authenticated:', userId);
|
|
50
50
|
},
|
|
51
|
-
(error) => {
|
|
51
|
+
onError: (error) => {
|
|
52
52
|
// Handle authentication error
|
|
53
53
|
console.error('Portal error:', error);
|
|
54
54
|
},
|
|
55
|
-
() => {
|
|
55
|
+
onClose: () => {
|
|
56
56
|
// Portal was closed
|
|
57
57
|
console.log('Portal closed');
|
|
58
58
|
}
|
|
59
|
-
);
|
|
59
|
+
});
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
**Option B: Get portal URL and redirect**
|
|
@@ -131,12 +131,10 @@ async function setupFinatic() {
|
|
|
131
131
|
const finatic = await FinaticConnect.init(token);
|
|
132
132
|
|
|
133
133
|
// 2. Open portal for authentication
|
|
134
|
-
await finatic.openPortal(
|
|
135
|
-
'
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
'modal',
|
|
139
|
-
async (userId) => {
|
|
134
|
+
await finatic.openPortal({
|
|
135
|
+
theme: { preset: 'stockAlgos' },
|
|
136
|
+
mode: 'dark',
|
|
137
|
+
onSuccess: async (userId) => {
|
|
140
138
|
console.log('User authenticated:', userId);
|
|
141
139
|
|
|
142
140
|
// 3. Fetch data after authentication
|
|
@@ -148,10 +146,10 @@ async function setupFinatic() {
|
|
|
148
146
|
console.log('Positions:', positions);
|
|
149
147
|
console.log('Accounts:', accounts);
|
|
150
148
|
},
|
|
151
|
-
(error) => {
|
|
149
|
+
onError: (error) => {
|
|
152
150
|
console.error('Authentication failed:', error);
|
|
153
151
|
}
|
|
154
|
-
);
|
|
152
|
+
});
|
|
155
153
|
}
|
|
156
154
|
|
|
157
155
|
setupFinatic();
|