@brokerize/elements 1.1.0 → 1.1.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.
- package/CHANGELOG.md +17 -5
- package/README.md +30 -80
- package/dist/bundle.d.ts +46 -3
- package/dist/bundle.es.js +17233 -22944
- package/dist/bundle.umd.js +62 -133
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# 1.1.1 (released 2025-03-31)
|
|
4
|
+
|
|
5
|
+
- `FIXED` cost label in OrderForm was wrong in some cases
|
|
6
|
+
- `FIXED` issues with number parsing in some environments
|
|
7
|
+
- `FIXED` formatting of staking positions information in portfolio tables
|
|
8
|
+
- `FIXED` validity date changes in ChangeOrder
|
|
9
|
+
- `CHANGED` support for strict content security policies by removing usages of `eval`
|
|
10
|
+
- `CHANGED` better looking countdown for quote trading
|
|
11
|
+
- `CHANGED` buying power in OrderForm now selects the cash account based on selected exchange
|
|
12
|
+
- `ADDED` order fees in order receipts
|
|
13
|
+
|
|
3
14
|
# 1.1.0 (released 2024-12-06)
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
- `
|
|
7
|
-
-
|
|
8
|
-
-
|
|
15
|
+
|
|
16
|
+
- `CHANGED` opening a sessionTanForm now automatically requests the TAN from the API if there is exactly one method available with `flow=DECOUPLED`.
|
|
17
|
+
- `ADDED` support for switching between the brokerize and DonauCapital order endpoints via the `tradingViaCryptoService` flag. If your client supports crypto trading, you have to add a `basePathCryptoService` option next to `basePath` in the `BrokerizeConfig`. The URLs will be provided to you. The elements will then automatically direct createTrade, changeOrder and cancelOrder requests to that service and display the corresponding provider logo in the UI.
|
|
18
|
+
- `FIXED` hide cash account select when there is actually nothing to choose for the user.
|
|
19
|
+
- `FIXED` number input behavior if the input is restricted to have 0 decimal places.
|
|
20
|
+
- `CHANGED` `getQuote` is now called with the selected `sellPositionId`, if applicable.
|
|
9
21
|
|
|
10
22
|
# 1.0.4 (released 2024-10-28)
|
|
11
23
|
|
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# brokerize elements
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@brokerize/elements` is the official UI library for the brokerize API. Together with `@brokerize/client` it provides drop-in brokerage UI elements for various trading use cases.
|
|
4
4
|
|
|
5
5
|
# how to install
|
|
6
6
|
|
|
7
|
-
The brokerize client libraries are publicly available, so you can
|
|
8
|
-
|
|
9
|
-
Once you have the token, this is how you add it to a project:
|
|
7
|
+
The brokerize client libraries are publicly available, so you can install them like any other npm package:
|
|
10
8
|
|
|
11
9
|
```
|
|
12
10
|
$ npm init -y
|
|
@@ -24,26 +22,36 @@ const brokerizeClient = new Brokerize({
|
|
|
24
22
|
// API configuration
|
|
25
23
|
basePath: BROKERIZE_API_URL /* https://api-preview.brokerize.com for our preview environment */,
|
|
26
24
|
clientId: '<YOUR-API-CLIENT-ID>',
|
|
27
|
-
cognito: {
|
|
28
|
-
Endpoint: '<PROVIDED-COGNITO-ENDPOINT>',
|
|
29
|
-
ClientId: '<PROVIDED-COGNITO-CLIENT-ID>',
|
|
30
|
-
UserPoolId: '<PROVIDED-COGNITO-USERPOOL-ID>'
|
|
31
|
-
},
|
|
32
25
|
// provide global dependencies
|
|
33
|
-
fetch: globalThis.fetch.bind(globalThis),
|
|
34
|
-
createAbortController: () => new AbortController(),
|
|
35
|
-
createWebSocket: (url, protocol) => new WebSocket(url, protocol)
|
|
26
|
+
fetch: globalThis.fetch.bind(globalThis), // optionally, a custom fetch implementation can be used
|
|
27
|
+
createAbortController: () => new AbortController(), // optionally, a custom AbortController can be used
|
|
28
|
+
createWebSocket: (url, protocol) => new WebSocket(url, protocol) // optionally, a custom WebSocket implementation can be used
|
|
36
29
|
});
|
|
37
30
|
```
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
Applications create temporary brokerize guest users for accessing the API. This code creates a guest user with the API and a corresponding `AuthorizedApiContext`:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const user = await brokerizeClient.createGuestUser();
|
|
36
|
+
const apiCtx = brokerizeClient.createAuthorizedContext(user);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`apiCtx` can now be used to interact with the API in the scope if the newly created user (you can also use that instance directly in your application code). The `user` object can be stored as JSON in order to authenticate as the same user again. Note that the created credentials' lifetime depends on the client configuration. By default, those temporary users are deleted at night.
|
|
40
|
+
|
|
41
|
+
Now that you have a brokerize client instance as well as an `AuthorizedApiContext`, you can show the list of available brokers (or any other view) like this:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
createBrokerList({
|
|
45
|
+
authorizedApiContext,
|
|
46
|
+
theme,
|
|
47
|
+
addFrame,
|
|
48
|
+
renderTo,
|
|
49
|
+
onLogin({ brokerName }) {
|
|
50
|
+
// show the login process for broker `brokerName` here
|
|
51
|
+
},
|
|
52
|
+
openExternalLink
|
|
53
|
+
});
|
|
54
|
+
```
|
|
47
55
|
|
|
48
56
|
## theming
|
|
49
57
|
|
|
@@ -138,6 +146,8 @@ createBrokerList({
|
|
|
138
146
|
|
|
139
147
|
## BrokerLoginForm
|
|
140
148
|
|
|
149
|
+
**NOTE**: `createBrokerLoginForm` does not actually present a login form directly in most cases but rather triggers an OAuth redirect. This depends on the client configuration and specific demands of brokers and/or partners. By default, all brokers use an OAuth-style login flow.
|
|
150
|
+
|
|
141
151
|
```typescript
|
|
142
152
|
createBrokerLoginForm({
|
|
143
153
|
authorizedApiContext,
|
|
@@ -190,66 +200,6 @@ createBrokerLoginForm({
|
|
|
190
200
|
| login | is fired when the user has successfully logged in |
|
|
191
201
|
| redirect | is fired when a redirect to the broker login page should take place |
|
|
192
202
|
|
|
193
|
-
## Brokerize Login
|
|
194
|
-
|
|
195
|
-
As described in the OpenAPI specification, users can either log in with their brokerize account or create a guest user. This will create a guest user with the API and a corresponding `AuthorizedApiContext`:
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
const user = await brokerizeClient.createGuestUser();
|
|
199
|
-
const apiCtx = brokerizeClient.createAuthorizedContext(user);
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
`apiCtx` can now be used to interact with the API (you can also use that instance directly in your application code).
|
|
203
|
-
|
|
204
|
-
If you want to support users to choose between logging in with their brokerize credentials or using a guest account, use `LoginForm` to retrieve either `AuthorizedApiContext` like this:
|
|
205
|
-
|
|
206
|
-
```javascript
|
|
207
|
-
Brokerize.Elements.createLoginForm({
|
|
208
|
-
renderTo: $el,
|
|
209
|
-
theme,
|
|
210
|
-
addFrame,
|
|
211
|
-
client: brokerizeClient,
|
|
212
|
-
onGuestLogin() {
|
|
213
|
-
client.createGuestUser().then(
|
|
214
|
-
(authCtxCfg) => {
|
|
215
|
-
setLogin(authCtxCfg);
|
|
216
|
-
},
|
|
217
|
-
(err) => showError(err)
|
|
218
|
-
);
|
|
219
|
-
},
|
|
220
|
-
onLogin(authCtxCfg) {
|
|
221
|
-
setLogin(authCtxCfg);
|
|
222
|
-
},
|
|
223
|
-
openExternalLink
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
function setLogin(authCtxCfg) {
|
|
227
|
-
apiCtx = client.createAuthorizedContext(cfg);
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
<img src="example-screenshots/brokerize-login.png" width="500"/>
|
|
232
|
-
|
|
233
|
-
### web component
|
|
234
|
-
|
|
235
|
-
```html
|
|
236
|
-
<brokerize-login ... />
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### properties
|
|
240
|
-
|
|
241
|
-
| Property | Description | optional |
|
|
242
|
-
| :------- | -------------------------------------------------------------------------------------------------------------- | :------: |
|
|
243
|
-
| client | Instance of the `@brokerize/client` | ❌ |
|
|
244
|
-
| theme | You can use the <a href="https://app.brokerize.com/theming">brokerize theme designer</a> to build a theme JSON | ✅ |
|
|
245
|
-
|
|
246
|
-
### events
|
|
247
|
-
|
|
248
|
-
| event | Description |
|
|
249
|
-
| :---- | ------------------------------------------------- |
|
|
250
|
-
| guest | is fired when the user clicks the guest login |
|
|
251
|
-
| login | is fired when the user has successfully logged in |
|
|
252
|
-
|
|
253
203
|
## Brokerize Main
|
|
254
204
|
|
|
255
205
|
The main component is the default goto component for the simplest and quickest brokerize experience, as all the default behavior is already interconnected and ready to use. You just need to integrate this one component and can use all of brokerize's features.
|
package/dist/bundle.d.ts
CHANGED
|
@@ -54,7 +54,6 @@ export declare type BrokerizeElement = {
|
|
|
54
54
|
export declare type BrokerizeElements = {
|
|
55
55
|
createBrokerizeMain: (cfg: BrokerizeMainConfig) => BrokerizeMainElement;
|
|
56
56
|
createBrokerList: (cfg: BrokerListConfig) => BrokerizeElement;
|
|
57
|
-
createLoginForm: (cfg: LoginFormConfig) => BrokerizeElement;
|
|
58
57
|
createBrokerLoginForm: (cfg: BrokerLoginFormConfig) => BrokerizeElement;
|
|
59
58
|
createOrderForm: (cfg: OrderFormConfig) => BrokerizeElement;
|
|
60
59
|
createPortfolioTable: (cfg: PortfolioTableConfig) => BrokerizeElement;
|
|
@@ -306,6 +305,31 @@ export declare type DataCellValueString = {
|
|
|
306
305
|
cssConfig?: any;
|
|
307
306
|
};
|
|
308
307
|
|
|
308
|
+
/**
|
|
309
|
+
* For generic application dialogs: a configuration for the dialog, including a
|
|
310
|
+
* headline title, a content text and a list of input boxes where users may enter data.
|
|
311
|
+
*/
|
|
312
|
+
export declare type DialogConfig = {
|
|
313
|
+
title?: string;
|
|
314
|
+
content?: string;
|
|
315
|
+
inputConfigs: InputConfig[];
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Result of a `ModalService.showDialog(...)` operation.
|
|
320
|
+
*/
|
|
321
|
+
export declare type DialogResult = DialogResultCancel | DialogResultOk;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* For generic dialogs: the result when the user has canceled the dialog.
|
|
325
|
+
*/
|
|
326
|
+
export declare type DialogResultCancel = { response: 'cancel' };
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* For generic dialogs: the result when user has entered data and confirmed the dialog.
|
|
330
|
+
*/
|
|
331
|
+
export declare type DialogResultOk = { response: 'ok'; inputs: InputConfig[] };
|
|
332
|
+
|
|
309
333
|
export declare type DownloadedFile = {
|
|
310
334
|
blob: Blob;
|
|
311
335
|
filename: string;
|
|
@@ -335,6 +359,15 @@ declare type Image_2 = {
|
|
|
335
359
|
};
|
|
336
360
|
export { Image_2 as Image }
|
|
337
361
|
|
|
362
|
+
export declare type InputConfig = {
|
|
363
|
+
id?: string;
|
|
364
|
+
defaultValue?: string;
|
|
365
|
+
inputLabel: string;
|
|
366
|
+
placeholder?: string;
|
|
367
|
+
required?: boolean;
|
|
368
|
+
value?: string;
|
|
369
|
+
};
|
|
370
|
+
|
|
338
371
|
export declare type LinkTarget = {
|
|
339
372
|
type: 'portfolio';
|
|
340
373
|
portfolioId: string;
|
|
@@ -350,20 +383,32 @@ export declare type ModalHostConfig = { showToast?: ShowToast } & BrokerizeBaseC
|
|
|
350
383
|
|
|
351
384
|
export declare interface ModalService {
|
|
352
385
|
showSecurityInformation(title: string, content: string): void;
|
|
386
|
+
|
|
353
387
|
showConfirm(msg: string): Promise<boolean>;
|
|
388
|
+
|
|
389
|
+
showDialog(dialogConfig: DialogConfig): Promise<DialogResult>;
|
|
390
|
+
|
|
354
391
|
showSessionTanModal(sessionId: string): void;
|
|
392
|
+
|
|
355
393
|
activate(): void;
|
|
394
|
+
|
|
356
395
|
deactivate(): void;
|
|
396
|
+
|
|
357
397
|
override(overrides: Partial<ModalService>): void;
|
|
398
|
+
|
|
358
399
|
showReceipt(data: ReceiptData, showActions: boolean, handleOrderTableAction: (e: any) => void): void;
|
|
400
|
+
|
|
359
401
|
showDetailedTable(table: Models.GenericTable): void;
|
|
402
|
+
|
|
360
403
|
showPositionDetail(
|
|
361
404
|
position: Models.Position,
|
|
362
405
|
row?: TableRow,
|
|
363
406
|
header?: Header,
|
|
364
407
|
handleTableAction?: (actionId: string, rowId: string) => void
|
|
365
408
|
): void;
|
|
409
|
+
|
|
366
410
|
showLoginForm(brokerName: any, returnToUrl: string, redirect: (redirecTo: string) => void): void;
|
|
411
|
+
|
|
367
412
|
showToast(opts: ToastOptions): void;
|
|
368
413
|
}
|
|
369
414
|
|
|
@@ -602,7 +647,6 @@ export declare type ThemeTokens = {
|
|
|
602
647
|
'zl-btn-border-radius'?: string;
|
|
603
648
|
'zl-btn-border-style'?: string;
|
|
604
649
|
'zl-btn-border-width'?: string;
|
|
605
|
-
'zl-btn-countdown-bar-color'?: string;
|
|
606
650
|
'zl-btn-default-color'?: string;
|
|
607
651
|
'zl-btn-focus-background-image'?: string;
|
|
608
652
|
'zl-btn-focus-color'?: string;
|
|
@@ -618,7 +662,6 @@ export declare type ThemeTokens = {
|
|
|
618
662
|
'zl-btn-md-padding-y'?: string;
|
|
619
663
|
'zl-btn-muted-color'?: string;
|
|
620
664
|
'zl-btn-outlined-color'?: string;
|
|
621
|
-
'zl-btn-progessbar-height'?: string;
|
|
622
665
|
'zl-btn-sm-font-size'?: string;
|
|
623
666
|
'zl-btn-sm-padding-x'?: string;
|
|
624
667
|
'zl-btn-sm-padding-y'?: string;
|