@brokerize/elements 1.2.1 → 1.4.0

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 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,9 @@ 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
+ onNavigate?: (linkTarget: LinkTarget) => void;
505
590
  } & BrokerizeBaseConfig;
506
591
 
507
592
  export declare type OrderTableConfig = {
@@ -512,6 +597,11 @@ export declare type OrderTableConfig = {
512
597
  onShowReceipt: ({ orderId }: { orderId: string }) => void;
513
598
  } & BrokerizeBaseConfig;
514
599
 
600
+ export declare type OverviewConfig = BrokerizeBaseConfig & {
601
+ onNavigate: (portfolio: Models.Portfolio) => void;
602
+ onLogin: (data: { brokerName: string }) => void;
603
+ };
604
+
515
605
  export declare type PortfolioTableConfig = {
516
606
  hideInactivePortfolios?: boolean;
517
607
  onNavigate: (portfolio: Models.Portfolio) => void;
@@ -519,7 +609,16 @@ export declare type PortfolioTableConfig = {
519
609
 
520
610
  export declare type PortfolioViewConfig = {
521
611
  portfolioId: string;
522
- onBuy: (opts: { security: Models.Security; isin: string }) => void;
612
+ /**
613
+ * Set this to `true` to allow users select a different portfolio inside the widget.
614
+ */
615
+ allowChangePortfolio?: boolean;
616
+ /**
617
+ * Called if the user wants to add a new broker login. This should navigate to the overview.
618
+ * Only available if allowChangePortfolio is true.
619
+ */
620
+ onAddBrokerLogin?: () => void;
621
+ onBuy: (opts: { security: Models.Security; isin: string; availableSize?: number }) => void;
523
622
  onSell: (opts: { security: Models.Security; isin: string; availableSize: number }) => void;
524
623
  onCancelOrder: (opts: { orderId: string }) => void;
525
624
  onChangeOrder: (opts: { orderId: string }) => void;
@@ -584,9 +683,7 @@ export declare type SecurityQuotesProviderOpts = {
584
683
 
585
684
  export declare type SecurityQuoteSubscription = { unsubscribe: () => void };
586
685
 
587
- export declare type SessionsTableConfig = {
588
- onEnableSessionTan: (opts: { sessionId: string }) => void;
589
- } & BrokerizeBaseConfig;
686
+ export declare type SessionsTableConfig = BrokerizeBaseConfig;
590
687
 
591
688
  export declare type SessionTanFormConfig = {
592
689
  sessionId: string;
@@ -602,7 +699,8 @@ export declare type ShowToast = (opts: ToastOptions) => void;
602
699
 
603
700
  export declare type StylingUIExampleConfig = {
604
701
  theme: Theme;
605
- } & BrokerizeBaseConfig;
702
+ renderTo: HTMLElement;
703
+ };
606
704
 
607
705
  export declare type SupportLink = {
608
706
  emailSubject: string;
@@ -656,6 +754,8 @@ export declare type ThemeTokens = {
656
754
  'zl-box-shadow-md'?: string;
657
755
  'zl-box-shadow-sm'?: string;
658
756
  'zl-box-shadow-xl'?: string;
757
+ 'zl-broker-select-background-color'?: string;
758
+ 'zl-broker-select-border-color'?: string;
659
759
  'zl-btn-active-background-color'?: string;
660
760
  'zl-btn-active-background-image'?: string;
661
761
  'zl-btn-background-color'?: string;
@@ -665,6 +765,15 @@ export declare type ThemeTokens = {
665
765
  'zl-btn-border-style'?: string;
666
766
  'zl-btn-border-width'?: string;
667
767
  'zl-btn-default-color'?: string;
768
+ 'zl-btn-error-active-background-color'?: string;
769
+ 'zl-btn-error-background-color'?: string;
770
+ 'zl-btn-error-border-color'?: string;
771
+ 'zl-btn-error-color'?: string;
772
+ 'zl-btn-error-focus-color'?: string;
773
+ 'zl-btn-error-hover-background-color'?: string;
774
+ 'zl-btn-error-hover-color'?: string;
775
+ 'zl-btn-error-muted-color'?: string;
776
+ 'zl-btn-error-outlined-color'?: string;
668
777
  'zl-btn-focus-background-image'?: string;
669
778
  'zl-btn-focus-color'?: string;
670
779
  'zl-btn-hover-background-color'?: string;
@@ -682,6 +791,24 @@ export declare type ThemeTokens = {
682
791
  'zl-btn-sm-font-size'?: string;
683
792
  'zl-btn-sm-padding-x'?: string;
684
793
  'zl-btn-sm-padding-y'?: string;
794
+ 'zl-btn-success-active-background-color'?: string;
795
+ 'zl-btn-success-background-color'?: string;
796
+ 'zl-btn-success-border-color'?: string;
797
+ 'zl-btn-success-color'?: string;
798
+ 'zl-btn-success-focus-color'?: string;
799
+ 'zl-btn-success-hover-background-color'?: string;
800
+ 'zl-btn-success-hover-color'?: string;
801
+ 'zl-btn-success-muted-color'?: string;
802
+ 'zl-btn-success-outlined-color'?: string;
803
+ 'zl-btn-warning-active-background-color'?: string;
804
+ 'zl-btn-warning-background-color'?: string;
805
+ 'zl-btn-warning-border-color'?: string;
806
+ 'zl-btn-warning-color'?: string;
807
+ 'zl-btn-warning-focus-color'?: string;
808
+ 'zl-btn-warning-hover-background-color'?: string;
809
+ 'zl-btn-warning-hover-color'?: string;
810
+ 'zl-btn-warning-muted-color'?: string;
811
+ 'zl-btn-warning-outlined-color'?: string;
685
812
  'zl-card-background-color'?: string;
686
813
  'zl-card-border-color'?: string;
687
814
  'zl-card-border-radius'?: string;
@@ -747,6 +874,7 @@ export declare type ThemeTokens = {
747
874
  'zl-default-border-width'?: string;
748
875
  'zl-default-box-shadow'?: string;
749
876
  'zl-default-font-size'?: string;
877
+ 'zl-default-line-height'?: string;
750
878
  'zl-default-link-color'?: string;
751
879
  'zl-default-link-decoration'?: string;
752
880
  'zl-default-padding-x'?: string;
@@ -819,6 +947,9 @@ export declare type ThemeTokens = {
819
947
  'zl-input-with-dropdown-border-bottom-right-radius'?: string;
820
948
  'zl-input-with-dropdown-border-top-left-radius'?: string;
821
949
  'zl-input-with-dropdown-border-top-right-radius'?: string;
950
+ 'zl-kebab-menu-box-shadow'?: string;
951
+ 'zl-kebab-menu-max-width'?: string;
952
+ 'zl-kebab-menu-padding'?: string;
822
953
  'zl-keyfigures-font-size'?: string;
823
954
  'zl-keyfigures-gap-x'?: string;
824
955
  'zl-keyfigures-gap-y'?: string;
@@ -830,6 +961,11 @@ export declare type ThemeTokens = {
830
961
  'zl-label-color'?: string;
831
962
  'zl-label-font-size'?: string;
832
963
  'zl-label-font-weight'?: string;
964
+ 'zl-line-height-base'?: string;
965
+ 'zl-line-height-lg'?: string;
966
+ 'zl-line-height-md'?: string;
967
+ 'zl-line-height-sm'?: string;
968
+ 'zl-line-height-xs'?: string;
833
969
  'zl-link-underline-offset'?: string;
834
970
  'zl-listbox-background-color'?: string;
835
971
  'zl-listbox-border-color'?: string;
@@ -842,7 +978,6 @@ export declare type ThemeTokens = {
842
978
  'zl-loader-contrast-color'?: string;
843
979
  'zl-logo-margin'?: string;
844
980
  'zl-logo-max-width'?: string;
845
- 'zl-overlay-backdrop-opacity'?: string;
846
981
  'zl-modal-background-color'?: string;
847
982
  'zl-modal-background-image'?: string;
848
983
  'zl-modal-close-offset'?: string;
@@ -902,6 +1037,23 @@ export declare type ThemeTokens = {
902
1037
  'zl-order-toggle-sell-selected-background-color'?: string;
903
1038
  'zl-order-toggle-sell-selected-color'?: string;
904
1039
  'zl-order-toggle-text-align'?: string;
1040
+ 'zl-overlay-backdrop-opacity'?: string;
1041
+ 'zl-panel-background-color'?: string;
1042
+ 'zl-panel-border-color'?: string;
1043
+ 'zl-panel-color'?: string;
1044
+ 'zl-panel-disbled-color'?: string;
1045
+ 'zl-panel-error-background-color'?: string;
1046
+ 'zl-panel-error-border-color'?: string;
1047
+ 'zl-panel-error-color'?: string;
1048
+ 'zl-panel-info-background-color'?: string;
1049
+ 'zl-panel-info-border-color'?: string;
1050
+ 'zl-panel-info-color'?: string;
1051
+ 'zl-panel-success-background-color'?: string;
1052
+ 'zl-panel-success-border-color'?: string;
1053
+ 'zl-panel-success-color'?: string;
1054
+ 'zl-panel-warning-background-color'?: string;
1055
+ 'zl-panel-warning-border-color'?: string;
1056
+ 'zl-panel-warning-color'?: string;
905
1057
  'zl-popup-background-color'?: string;
906
1058
  'zl-popup-color'?: string;
907
1059
  'zl-popup-font-weight'?: string;