@brokerize/elements 1.3.0 → 1.4.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ # 1.4.1 (released 2025-09-08)
4
+
5
+ - `FIXED` In some environments, `crypto.randomUUID()` is not available. This was used for generating IDs in the previous version and is now replaced with `nanoid`
6
+
7
+ # 1.4.0 (released 2025-08-27)
8
+
9
+ - `ADDED` the new component `Overview` which can replace `BrokerList`, `PortfolioTable` and `SessionsTable` in most applications
10
+ - `ADDED` An improved version of the `BrokerizeMain` component, which encapsulates `Overview` , `PortfolioView` and `OrderForm`.
11
+
12
+ # 1.3.0 (released 2025-05-07)
13
+
14
+ - `ADDED` We have added the new function createCustomWebSocketClient to brokerize client, which allows customizing the WebSocke connection URL and token retrieval. The client can be passed to createAuthorizedContext so that the created client is used in all contexts (including brokerize elements components which rely on WebSockets).
15
+
16
+ # 1.2.1 (released 2025-05-01)
17
+
18
+ - `FIXED` an issue where a relative API basePath lead to wrong WebSocket connection URLs.
19
+
3
20
  # 1.2.0 (released 2025-04-24)
4
21
 
5
22
  - `ADDED` the option to pass a `reportingTag` for `createOrderForm`, `createChangeOrderForm` and `createCancelOrderForm`
package/README.md CHANGED
@@ -101,6 +101,47 @@ const apiCtx = await this.client.createAuthorizedContext(authCtxCfg);
101
101
  and a theme can be provided in the same manner as in the [theming section](#theming).
102
102
  The above code is valid for Angular (and it's way of binding properties). Most frameworks allow to integrate custom elements similarly.
103
103
 
104
+ ## Overview
105
+
106
+ A view for viewing the list of active brokerage sessions and portfolios and for managing session state (for example: enable/disable Session TAN). It also presents the list of available brokers for adding logins, so that it can be used as a starting point for logging in to brokers as well as a view for selecting the portfolio for trading.
107
+
108
+ ```typescript
109
+ Brokerize.Elements.createOverview({
110
+ theme,
111
+ renderTo: resetRenderTo(),
112
+ authorizedApiContext: globalApiCtx,
113
+ onNavigate(portfolio) {
114
+ /* navigate to the selected portfolio view, e.g. by calling `createPortfolioView(...)` */
115
+ // showPortfolioView(portfolio.id);
116
+ },
117
+ onLogin({ brokerName }) {
118
+ /* open the broker login for the given brokerName. */
119
+ // Brokerize.Elements.createBrokerLoginForm(...)
120
+ }
121
+ });
122
+ ```
123
+
124
+ ### web component
125
+
126
+ ```html
127
+ <brokerize-overview ... />
128
+ ```
129
+
130
+ | Property | Description | optional |
131
+ | :------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | :------: |
132
+ | authorizedApiContext | Instance of `AuthorizedApiContext` from `@brokerize/client` | &#10060; |
133
+ | theme | You can use the <a href="https://app.brokerize.com/theming">brokerize theme designer</a> to build a theme JSON | &#9989; |
134
+ | addFrame | Add a "powered by brokerize" frame to the component | &#9989; |
135
+ | supportLink | Add a support link to the brokerize frame config, e.g. `{ emailSubject: 'Help needed for trading in XYZ app'}` | &#9989; |
136
+ | confirmationStorage | An implementation of a `ConfirmationStorage` which stores whether users have accepted legal terms. By default, this will try to use the `LocalStorage` | &#9989; |
137
+
138
+ ### events
139
+
140
+ | event | Description |
141
+ | :------- | ----------------------------------------------------------------------------------- |
142
+ | login | is fired when the user has accepted the terms and conditions and clicked on `Login` |
143
+ | navigage | is fired when the user navigates to a portfolio |
144
+
104
145
  ## BrokerList
105
146
 
106
147
  A view that lets the user pick a broker for logging in. Selection of the broker as well as showing / accepting the terms and conditions of the given broker is handled inside the component.
package/dist/bundle.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { AuthorizedApiContext } from '@brokerize/client';
3
3
  import type { Brokerize } from '@brokerize/client';
4
4
  import type { BrokerizeError } from '@brokerize/client';
5
5
  import * as Client from '@brokerize/client';
6
- import type { Models } from '@brokerize/client';
6
+ import { Models } from '@brokerize/client';
7
7
 
8
8
  export declare type BrokerizeBaseConfig = {
9
9
  /**
@@ -53,6 +53,7 @@ export declare type BrokerizeElement = {
53
53
 
54
54
  export declare type BrokerizeElements = {
55
55
  createBrokerizeMain: (cfg: BrokerizeMainConfig) => BrokerizeMainElement;
56
+ createOverview: (cfg: OverviewConfig) => BrokerizeElement;
56
57
  createBrokerList: (cfg: BrokerListConfig) => BrokerizeElement;
57
58
  createBrokerLoginForm: (cfg: BrokerLoginFormConfig) => BrokerizeElement;
58
59
  createOrderForm: (cfg: OrderFormConfig) => BrokerizeElement;
@@ -67,6 +68,7 @@ export declare type BrokerizeElements = {
67
68
  createPortfolioView: (cfg: PortfolioViewConfig) => BrokerizeElement;
68
69
  createModalHost: (cfg: ModalHostConfig) => BrokerizeElement;
69
70
  createStylingUIExample: (cfg: StylingUIExampleConfig) => BrokerizeElement;
71
+ createLoader: (cfg: LoaderConfig) => BrokerizeElement;
70
72
  modalService: ModalService;
71
73
  /**
72
74
  * Configure global settings for Brokerize Elements. The global configuration is shared across all instances of Brokerize Elements.
@@ -76,6 +78,11 @@ export declare type BrokerizeElements = {
76
78
  * @returns
77
79
  */
78
80
  configure: (config: Partial<BrokerizeElementsGlobalConfiguration>) => void;
81
+ /**
82
+ * The default theming token values. This can be used for building theme designers or inspecting themes
83
+ * together with `createStylingUIExample`.
84
+ */
85
+ themingTokenDefaults: ThemeTokens;
79
86
  };
80
87
 
81
88
  export declare type BrokerizeElementsGlobalConfiguration = {
@@ -90,6 +97,8 @@ export declare type BrokerizeElementsGlobalConfiguration = {
90
97
  assetsPath?: string;
91
98
  };
92
99
 
100
+ export declare type BrokerizeLoaderVariant = 'brokerize' | 'spinner' | 'order' | 'loading';
101
+
93
102
  export declare type BrokerizeMainConfig = BrokerizeBaseConfig & {
94
103
  onNavigationStateChange?: (state: any) => void;
95
104
  useNavigation?: boolean;
@@ -104,11 +113,43 @@ export declare type BrokerizeMainElement = BrokerizeElement & {
104
113
  };
105
114
 
106
115
  export declare type BrokerizeNavigation = {
116
+ /**
117
+ * @deprecated will be removed in a later version. Please us `navigateToPortfolio` instead.
118
+ */
107
119
  NavigateToPortfolio: (portfolioId: string) => void;
120
+ navigateToPortfolio: (portfolioId: string) => void;
121
+ /**
122
+ * @deprecated will be removed in a later version. Please us `startOrderFlow` instead.
123
+ */
108
124
  NavigateToOrderForm: (_isin: string, _initialOrderCreateValues: OrderFormInitialOrder) => void;
125
+ /**
126
+ * Initiates the desired order flow. This may trigger a login redirect or directly show an order form, depending on
127
+ * which state the session is currently in.
128
+ *
129
+ * If the user is logged in to a broker, that one will be used and the brokerName parameter is ignored.
130
+ * If the user is logged in to a broker, but the desired portfolioId is not part of the list, a different portfolio may be used etc.
131
+ *
132
+ * @param orderFlowParams
133
+ * @returns
134
+ */
135
+ startOrderFlow: (orderFlowParams: OrderFlowParameters) => void;
136
+ /**
137
+ * @deprecated use NavigateToOverview instead
138
+ */
109
139
  NavigateToChangeBroker: () => void;
140
+ /**
141
+ * @deprecated use NavigateToOverview instead
142
+ */
110
143
  NavigateToDepot: () => void;
144
+ /**
145
+ * @deprecated use NavigateToOverview instead
146
+ */
111
147
  NavigateToSessions: () => void;
148
+ /**
149
+ * Shows the overview over current portfolios and sessions of the user. From there, they can navigate into one
150
+ * portfolio or add new broker logins.
151
+ */
152
+ navigateToOverview: () => void;
112
153
  };
113
154
 
114
155
  /**
@@ -124,6 +165,10 @@ export declare type BrokerizeSummaryData = { title: string } & any;
124
165
  export declare type BrokerListConfig = {
125
166
  onLogin: (data: { brokerName: string }) => void;
126
167
  confirmationStorage?: ConfirmationStorage;
168
+ /** brokerize-internal */
169
+ disclaimerPrefixHtml?: string;
170
+ /** brokerize-internal */
171
+ infoPreamble?: string;
127
172
  } & BrokerizeBaseConfig;
128
173
 
129
174
  export declare type BrokerLoginFormConfig = {
@@ -379,9 +424,18 @@ export declare type InputConfig = {
379
424
 
380
425
  export declare type LinkTarget = {
381
426
  type: 'portfolio';
427
+ portfolio?: Models.Portfolio;
382
428
  portfolioId: string;
383
429
  };
384
430
 
431
+ export declare type LoaderConfig = {
432
+ variant?: BrokerizeLoaderVariant;
433
+ alignment?: string;
434
+ overlay?: boolean;
435
+ repeat?: boolean;
436
+ size?: number;
437
+ } & BrokerizeBaseConfig;
438
+
385
439
  export declare type LoginFormConfig = {
386
440
  onGuestLogin: () => void;
387
441
  client: Brokerize;
@@ -425,6 +479,25 @@ export declare type openExternalLinkCallback = (url: string, target?: string, wi
425
479
 
426
480
  export declare type OrderDirection = 'asc' | 'desc';
427
481
 
482
+ export declare type OrderFlowParameters = {
483
+ /**
484
+ * The security to open the order form for.
485
+ */
486
+ security?: Models.Security;
487
+ /**
488
+ * The broker to prefer, if it is available.
489
+ */
490
+ brokerName?: string;
491
+ /**
492
+ * The portfolioId to prefer, if it is available.
493
+ */
494
+ portfolioId?: string;
495
+ /**
496
+ * The initial order values to show.
497
+ */
498
+ initialOrderCreateValues?: OrderFormInitialOrder;
499
+ };
500
+
428
501
  export declare type OrderFormConfig = {
429
502
  portfolioId: string;
430
503
  /**
@@ -475,10 +548,21 @@ export declare type OrderFormConfig = {
475
548
  * If custom quotes should be shown in the order form, provide an implementation of `SecurityQuotesProvider`.
476
549
  */
477
550
  quotesProvider?: SecurityQuotesProvider;
551
+ onNavigate?: (linkTarget: LinkTarget) => void;
552
+ onChangedPreparedTrade?: (preparedTrade: Models.PreparedTrade) => void;
478
553
  /**
479
554
  * Optional `reportingTag` to send with order creates. ReportingTags appear in order reports.
480
555
  */
481
556
  reportingTag?: string;
557
+ /**
558
+ * Set this to `true` to allow users select a different portfolio inside the widget.
559
+ */
560
+ allowChangePortfolio?: boolean;
561
+ /**
562
+ * Called if the user wants to add a new broker login. This should navigate to the overview.
563
+ * Only available if allowChangePortfolio is true.
564
+ */
565
+ onAddBrokerLogin?: () => void;
482
566
  } & BrokerizeBaseConfig;
483
567
 
484
568
  export declare type OrderFormInitialOrder = Partial<
@@ -500,8 +584,13 @@ export declare type OrderFormInitialOrder = Partial<
500
584
  >;
501
585
 
502
586
  export declare type OrderReceiptConfig = {
503
- orderId: string;
504
- onNavigate: (linkTarget: LinkTarget) => void;
587
+ orderId?: string;
588
+ orderData?: ReceiptData;
589
+ /**
590
+ * `true` if the receipt is shown in response to an order creation.
591
+ */
592
+ isOrderConfirmation?: boolean;
593
+ onNavigate?: (linkTarget: LinkTarget) => void;
505
594
  } & BrokerizeBaseConfig;
506
595
 
507
596
  export declare type OrderTableConfig = {
@@ -512,6 +601,11 @@ export declare type OrderTableConfig = {
512
601
  onShowReceipt: ({ orderId }: { orderId: string }) => void;
513
602
  } & BrokerizeBaseConfig;
514
603
 
604
+ export declare type OverviewConfig = BrokerizeBaseConfig & {
605
+ onNavigate: (portfolio: Models.Portfolio) => void;
606
+ onLogin: (data: { brokerName: string }) => void;
607
+ };
608
+
515
609
  export declare type PortfolioTableConfig = {
516
610
  hideInactivePortfolios?: boolean;
517
611
  onNavigate: (portfolio: Models.Portfolio) => void;
@@ -519,7 +613,16 @@ export declare type PortfolioTableConfig = {
519
613
 
520
614
  export declare type PortfolioViewConfig = {
521
615
  portfolioId: string;
522
- onBuy: (opts: { security: Models.Security; isin: string }) => void;
616
+ /**
617
+ * Set this to `true` to allow users select a different portfolio inside the widget.
618
+ */
619
+ allowChangePortfolio?: boolean;
620
+ /**
621
+ * Called if the user wants to add a new broker login. This should navigate to the overview.
622
+ * Only available if allowChangePortfolio is true.
623
+ */
624
+ onAddBrokerLogin?: () => void;
625
+ onBuy: (opts: { security: Models.Security; isin: string; availableSize?: number }) => void;
523
626
  onSell: (opts: { security: Models.Security; isin: string; availableSize: number }) => void;
524
627
  onCancelOrder: (opts: { orderId: string }) => void;
525
628
  onChangeOrder: (opts: { orderId: string }) => void;
@@ -584,9 +687,7 @@ export declare type SecurityQuotesProviderOpts = {
584
687
 
585
688
  export declare type SecurityQuoteSubscription = { unsubscribe: () => void };
586
689
 
587
- export declare type SessionsTableConfig = {
588
- onEnableSessionTan: (opts: { sessionId: string }) => void;
589
- } & BrokerizeBaseConfig;
690
+ export declare type SessionsTableConfig = BrokerizeBaseConfig;
590
691
 
591
692
  export declare type SessionTanFormConfig = {
592
693
  sessionId: string;
@@ -602,7 +703,8 @@ export declare type ShowToast = (opts: ToastOptions) => void;
602
703
 
603
704
  export declare type StylingUIExampleConfig = {
604
705
  theme: Theme;
605
- } & BrokerizeBaseConfig;
706
+ renderTo: HTMLElement;
707
+ };
606
708
 
607
709
  export declare type SupportLink = {
608
710
  emailSubject: string;
@@ -656,6 +758,8 @@ export declare type ThemeTokens = {
656
758
  'zl-box-shadow-md'?: string;
657
759
  'zl-box-shadow-sm'?: string;
658
760
  'zl-box-shadow-xl'?: string;
761
+ 'zl-broker-select-background-color'?: string;
762
+ 'zl-broker-select-border-color'?: string;
659
763
  'zl-btn-active-background-color'?: string;
660
764
  'zl-btn-active-background-image'?: string;
661
765
  'zl-btn-background-color'?: string;
@@ -665,6 +769,15 @@ export declare type ThemeTokens = {
665
769
  'zl-btn-border-style'?: string;
666
770
  'zl-btn-border-width'?: string;
667
771
  'zl-btn-default-color'?: string;
772
+ 'zl-btn-error-active-background-color'?: string;
773
+ 'zl-btn-error-background-color'?: string;
774
+ 'zl-btn-error-border-color'?: string;
775
+ 'zl-btn-error-color'?: string;
776
+ 'zl-btn-error-focus-color'?: string;
777
+ 'zl-btn-error-hover-background-color'?: string;
778
+ 'zl-btn-error-hover-color'?: string;
779
+ 'zl-btn-error-muted-color'?: string;
780
+ 'zl-btn-error-outlined-color'?: string;
668
781
  'zl-btn-focus-background-image'?: string;
669
782
  'zl-btn-focus-color'?: string;
670
783
  'zl-btn-hover-background-color'?: string;
@@ -682,6 +795,24 @@ export declare type ThemeTokens = {
682
795
  'zl-btn-sm-font-size'?: string;
683
796
  'zl-btn-sm-padding-x'?: string;
684
797
  'zl-btn-sm-padding-y'?: string;
798
+ 'zl-btn-success-active-background-color'?: string;
799
+ 'zl-btn-success-background-color'?: string;
800
+ 'zl-btn-success-border-color'?: string;
801
+ 'zl-btn-success-color'?: string;
802
+ 'zl-btn-success-focus-color'?: string;
803
+ 'zl-btn-success-hover-background-color'?: string;
804
+ 'zl-btn-success-hover-color'?: string;
805
+ 'zl-btn-success-muted-color'?: string;
806
+ 'zl-btn-success-outlined-color'?: string;
807
+ 'zl-btn-warning-active-background-color'?: string;
808
+ 'zl-btn-warning-background-color'?: string;
809
+ 'zl-btn-warning-border-color'?: string;
810
+ 'zl-btn-warning-color'?: string;
811
+ 'zl-btn-warning-focus-color'?: string;
812
+ 'zl-btn-warning-hover-background-color'?: string;
813
+ 'zl-btn-warning-hover-color'?: string;
814
+ 'zl-btn-warning-muted-color'?: string;
815
+ 'zl-btn-warning-outlined-color'?: string;
685
816
  'zl-card-background-color'?: string;
686
817
  'zl-card-border-color'?: string;
687
818
  'zl-card-border-radius'?: string;
@@ -747,6 +878,7 @@ export declare type ThemeTokens = {
747
878
  'zl-default-border-width'?: string;
748
879
  'zl-default-box-shadow'?: string;
749
880
  'zl-default-font-size'?: string;
881
+ 'zl-default-line-height'?: string;
750
882
  'zl-default-link-color'?: string;
751
883
  'zl-default-link-decoration'?: string;
752
884
  'zl-default-padding-x'?: string;
@@ -819,6 +951,9 @@ export declare type ThemeTokens = {
819
951
  'zl-input-with-dropdown-border-bottom-right-radius'?: string;
820
952
  'zl-input-with-dropdown-border-top-left-radius'?: string;
821
953
  'zl-input-with-dropdown-border-top-right-radius'?: string;
954
+ 'zl-kebab-menu-box-shadow'?: string;
955
+ 'zl-kebab-menu-max-width'?: string;
956
+ 'zl-kebab-menu-padding'?: string;
822
957
  'zl-keyfigures-font-size'?: string;
823
958
  'zl-keyfigures-gap-x'?: string;
824
959
  'zl-keyfigures-gap-y'?: string;
@@ -830,6 +965,11 @@ export declare type ThemeTokens = {
830
965
  'zl-label-color'?: string;
831
966
  'zl-label-font-size'?: string;
832
967
  'zl-label-font-weight'?: string;
968
+ 'zl-line-height-base'?: string;
969
+ 'zl-line-height-lg'?: string;
970
+ 'zl-line-height-md'?: string;
971
+ 'zl-line-height-sm'?: string;
972
+ 'zl-line-height-xs'?: string;
833
973
  'zl-link-underline-offset'?: string;
834
974
  'zl-listbox-background-color'?: string;
835
975
  'zl-listbox-border-color'?: string;
@@ -842,7 +982,6 @@ export declare type ThemeTokens = {
842
982
  'zl-loader-contrast-color'?: string;
843
983
  'zl-logo-margin'?: string;
844
984
  'zl-logo-max-width'?: string;
845
- 'zl-overlay-backdrop-opacity'?: string;
846
985
  'zl-modal-background-color'?: string;
847
986
  'zl-modal-background-image'?: string;
848
987
  'zl-modal-close-offset'?: string;
@@ -902,6 +1041,23 @@ export declare type ThemeTokens = {
902
1041
  'zl-order-toggle-sell-selected-background-color'?: string;
903
1042
  'zl-order-toggle-sell-selected-color'?: string;
904
1043
  'zl-order-toggle-text-align'?: string;
1044
+ 'zl-overlay-backdrop-opacity'?: string;
1045
+ 'zl-panel-background-color'?: string;
1046
+ 'zl-panel-border-color'?: string;
1047
+ 'zl-panel-color'?: string;
1048
+ 'zl-panel-disbled-color'?: string;
1049
+ 'zl-panel-error-background-color'?: string;
1050
+ 'zl-panel-error-border-color'?: string;
1051
+ 'zl-panel-error-color'?: string;
1052
+ 'zl-panel-info-background-color'?: string;
1053
+ 'zl-panel-info-border-color'?: string;
1054
+ 'zl-panel-info-color'?: string;
1055
+ 'zl-panel-success-background-color'?: string;
1056
+ 'zl-panel-success-border-color'?: string;
1057
+ 'zl-panel-success-color'?: string;
1058
+ 'zl-panel-warning-background-color'?: string;
1059
+ 'zl-panel-warning-border-color'?: string;
1060
+ 'zl-panel-warning-color'?: string;
905
1061
  'zl-popup-background-color'?: string;
906
1062
  'zl-popup-color'?: string;
907
1063
  'zl-popup-font-weight'?: string;