@govflanders/vl-widget-global-header-types 1.0.20 → 1.0.22
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 +65 -18
- package/dist/citizen-profile.d.ts +1 -1
- package/dist/client.d.ts +97 -2
- package/dist/idp.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,37 +100,84 @@ client.setMainLinks([
|
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
## API
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
The `window.globalHeaderClient` object offers several methods for interacting with the widget. Each method is typed and returns promises, making asynchronous operations easier to handle. Below is a detailed breakdown of each method, its parameters, and the expected return values.
|
|
104
105
|
|
|
105
106
|
### getConfig(): Promise\<Config\>
|
|
106
107
|
Retrieve the current widget configuration.
|
|
107
108
|
|
|
108
|
-
###
|
|
109
|
-
|
|
109
|
+
### branding
|
|
110
|
+
|
|
111
|
+
The `branding` object contains methods for interacting with branding configurations.
|
|
112
|
+
|
|
113
|
+
- **getLevel(): Promise\<number\>**
|
|
114
|
+
Fetch the current branding level of the widget.
|
|
115
|
+
|
|
116
|
+
- **setLevel(level: number): Promise\<boolean\>**
|
|
117
|
+
Set the branding level of the widget.
|
|
118
|
+
|
|
119
|
+
- **getColor(colorKey: string): Promise\<string\>**
|
|
120
|
+
Fetch a specific branding color based on the provided color key.
|
|
121
|
+
|
|
122
|
+
- **setColor(colorConfig: { key: string, value: string }): Promise\<boolean\>**
|
|
123
|
+
Set a specific branding color for the widget.
|
|
124
|
+
|
|
125
|
+
- **getColors(): Promise\<BrandingConfigColors\>**
|
|
126
|
+
Fetch the entire set of branding colors.
|
|
127
|
+
|
|
128
|
+
- **setColors(colors: BrandingConfigColors): Promise\<boolean\>**
|
|
129
|
+
Set multiple branding colors for the widget.
|
|
130
|
+
|
|
131
|
+
- **getHost(): Promise\<Partial\<BrandingConfigHost\>\>**
|
|
132
|
+
Retrieve the host configuration for branding.
|
|
133
|
+
|
|
134
|
+
- **setHost(host: BrandingConfigHost): Promise\<boolean\>**
|
|
135
|
+
Set the host branding configuration.
|
|
110
136
|
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
- **getUmbrella(): Promise\<Partial\<BrandingConfigUmbrella\>\>**
|
|
138
|
+
Retrieve the umbrella configuration for branding.
|
|
113
139
|
|
|
114
|
-
|
|
115
|
-
|
|
140
|
+
- **setUmbrella(umbrella: BrandingConfigUmbrella): Promise\<boolean\>**
|
|
141
|
+
Set the umbrella branding configuration.
|
|
116
142
|
|
|
117
|
-
|
|
118
|
-
|
|
143
|
+
- **getVariables(): Promise\<Record\<string, string\>\>**
|
|
144
|
+
Fetch branding-related variables as a dictionary.
|
|
119
145
|
|
|
120
|
-
###
|
|
121
|
-
Sets the main navigation links that are displayed within the widget. These links will only be visible for widgets that support sessions, and they are displayed only when the user is logged in.
|
|
146
|
+
### contact
|
|
122
147
|
|
|
123
|
-
|
|
124
|
-
Add a single link to the application menu.
|
|
148
|
+
The `contact` object contains methods related to managing service points.
|
|
125
149
|
|
|
126
|
-
|
|
127
|
-
|
|
150
|
+
- **setServicePoints(servicePoints: Translatable\<ServicePoints\>): Promise\<Translatable\<ServicePoints\>\>**
|
|
151
|
+
Update the service points displayed in the widget.
|
|
128
152
|
|
|
129
|
-
|
|
130
|
-
|
|
153
|
+
- **getServicePoints(): Promise\<EnrichedServicePoints\>**
|
|
154
|
+
Fetch the current service points from the widget.
|
|
155
|
+
|
|
156
|
+
- **resetServicePoints(): Promise\<boolean\>**
|
|
157
|
+
Reset the service points to the initial values defined in the widget’s configuration.
|
|
158
|
+
|
|
159
|
+
### accessMenu
|
|
160
|
+
|
|
161
|
+
The `accessMenu` object contains methods for managing the access menu's links and profile.
|
|
162
|
+
|
|
163
|
+
- **setProfile(profileConfig: Partial\<ProfileConfig\>): Promise\<boolean\>**
|
|
164
|
+
Set or update the profile configuration for the widget.
|
|
165
|
+
|
|
166
|
+
- **setMainLinks(mainLinks: MainLink[]): Promise\<boolean\>**
|
|
167
|
+
Sets the main navigation links that are displayed within the widget. These links will only be visible for widgets that support sessions, and they are displayed only when the user is logged in.
|
|
168
|
+
|
|
169
|
+
- **addApplicationMenuLink(link: ApplicationMenuLink): Promise\<ApplicationMenuLink[]\>**
|
|
170
|
+
Add a single link to the application menu.
|
|
171
|
+
|
|
172
|
+
- **addApplicationMenuLinks(links: ApplicationMenuLink[]): Promise\<ApplicationMenuLink[]\>**
|
|
173
|
+
Add multiple links to the application menu.
|
|
174
|
+
|
|
175
|
+
- **setApplicationMenuLinks(links: ApplicationMenuLink[]): Promise\<ApplicationMenuLink[]\>**
|
|
176
|
+
Replace all application menu links.
|
|
131
177
|
|
|
132
178
|
### setNavigationEnabled(enabled: boolean): Promise\<boolean\>
|
|
133
|
-
|
|
179
|
+
|
|
180
|
+
Enable or disable the host and branding navigation.
|
|
134
181
|
|
|
135
182
|
### mount(element?: HTMLElement): Promise\<boolean\>
|
|
136
183
|
|
|
@@ -23,7 +23,7 @@ export interface CitizenProfileConfig {
|
|
|
23
23
|
pluginTypeId: 'citizen_profile';
|
|
24
24
|
session: Session;
|
|
25
25
|
application: Application;
|
|
26
|
-
applicationMenu?:
|
|
26
|
+
applicationMenu?: ApplicationLink[];
|
|
27
27
|
mainLinks?: MainLink[];
|
|
28
28
|
}
|
|
29
29
|
export interface MainLink {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Translatable } from './i18n';
|
|
2
2
|
import { MainLink, ProfileConfig } from './citizen-profile';
|
|
3
3
|
import { EnrichedServicePoints, ServicePoints } from './contact';
|
|
4
|
-
import { Config } from './config';
|
|
4
|
+
import { BrandingConfigColors, BrandingConfigHost, BrandingConfigUmbrella, Config } from './config';
|
|
5
5
|
import { ApplicationMenuLink } from './citizen-profile';
|
|
6
6
|
export type Handlers = {
|
|
7
7
|
/**
|
|
@@ -67,6 +67,71 @@ export type Handlers = {
|
|
|
67
67
|
* @returns A promise that resolves to true if the navigation enabled state was set, false otherwise
|
|
68
68
|
*/
|
|
69
69
|
setNavigationEnabled: Handler<boolean, boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* Get the level of branding
|
|
72
|
+
* @returns A promise that resolves to the branding level
|
|
73
|
+
*/
|
|
74
|
+
getBrandingLevel: Handler<undefined, number>;
|
|
75
|
+
/**
|
|
76
|
+
* Set the branding level
|
|
77
|
+
* @param level The level of branding to set
|
|
78
|
+
* @returns A promise that resolves to true if the branding level was set
|
|
79
|
+
*/
|
|
80
|
+
setBrandingLevel: Handler<number, boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Get the branding colors
|
|
83
|
+
* @returns A promise that resolves to the branding colors
|
|
84
|
+
*/
|
|
85
|
+
getBrandingColors: Handler<undefined, BrandingConfigColors>;
|
|
86
|
+
/**
|
|
87
|
+
* Get a specific branding color by type
|
|
88
|
+
* @param type The type of branding color to get
|
|
89
|
+
* @returns A promise that resolves to the branding color
|
|
90
|
+
*/
|
|
91
|
+
getBrandingColor: Handler<keyof BrandingConfigColors, string>;
|
|
92
|
+
/**
|
|
93
|
+
* Set the branding colors
|
|
94
|
+
* @param colors The colors to set
|
|
95
|
+
* @returns A promise that resolves to true if the branding colors were set
|
|
96
|
+
*/
|
|
97
|
+
setBrandingColors: Handler<BrandingConfigColors, boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* Set a specific branding color by type
|
|
100
|
+
* @param type The type of branding color to set
|
|
101
|
+
* @param value The color value to set
|
|
102
|
+
* @returns A promise that resolves to true if the branding color was set
|
|
103
|
+
*/
|
|
104
|
+
setBrandingColor: Handler<{
|
|
105
|
+
type: keyof BrandingConfigColors;
|
|
106
|
+
value: string;
|
|
107
|
+
}, boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Get the host context
|
|
110
|
+
* @returns A promise that resolves to the branding host settings
|
|
111
|
+
*/
|
|
112
|
+
getBrandingHost: Handler<undefined, Partial<BrandingConfigHost>>;
|
|
113
|
+
/**
|
|
114
|
+
* Set the host context
|
|
115
|
+
* @param host The branding host settings to set
|
|
116
|
+
* @returns A promise that resolves to true if the branding host was set
|
|
117
|
+
*/
|
|
118
|
+
setBrandingHost: Handler<Partial<BrandingConfigHost>, boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Get the umbrella context
|
|
121
|
+
* @returns A promise that resolves to the branding umbrella settings
|
|
122
|
+
*/
|
|
123
|
+
getBrandingUmbrella: Handler<undefined, Partial<BrandingConfigUmbrella>>;
|
|
124
|
+
/**
|
|
125
|
+
* Set the umbrella context
|
|
126
|
+
* @param umbrella The branding umbrella settings to set
|
|
127
|
+
* @returns A promise that resolves to true if the branding umbrella was set
|
|
128
|
+
*/
|
|
129
|
+
setBrandingUmbrella: Handler<Partial<BrandingConfigUmbrella>, boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Get the branding CSS variables
|
|
132
|
+
* @returns A promise that resolves to the branding CSS variables
|
|
133
|
+
*/
|
|
134
|
+
getBrandingVariables: Handler<undefined, Record<string, string>>;
|
|
70
135
|
/**
|
|
71
136
|
* Mount an element
|
|
72
137
|
* @param element The element to mount
|
|
@@ -83,7 +148,7 @@ type ArgumentTypes = {
|
|
|
83
148
|
type ReturnTypes = {
|
|
84
149
|
[HandlersKey in keyof Handlers]: Handlers[HandlersKey] extends Handler<any, infer Return> ? Return : never;
|
|
85
150
|
};
|
|
86
|
-
export type
|
|
151
|
+
export type ClientMethods = {
|
|
87
152
|
[K in keyof Handlers]: ArgumentTypes[K] extends undefined ? () => Promise<ReturnTypes[K]> : (args: ArgumentTypes[K]) => Promise<ReturnTypes[K]>;
|
|
88
153
|
};
|
|
89
154
|
export type QueueItem<Key extends keyof Handlers> = {
|
|
@@ -98,6 +163,36 @@ export interface GlobalHeaderLinker {
|
|
|
98
163
|
queue: QueueItem<keyof Handlers>[];
|
|
99
164
|
update: () => void;
|
|
100
165
|
}
|
|
166
|
+
export interface GlobalHeaderClient {
|
|
167
|
+
contact: {
|
|
168
|
+
getServicePoints: ClientMethods['getServicePoints'];
|
|
169
|
+
setServicePoints: ClientMethods['setServicePoints'];
|
|
170
|
+
resetServicePoints: ClientMethods['resetServicePoints'];
|
|
171
|
+
};
|
|
172
|
+
accessMenu: {
|
|
173
|
+
setMainLinks: ClientMethods['setMainLinks'];
|
|
174
|
+
addApplicationMenuLink: ClientMethods['addApplicationMenuLink'];
|
|
175
|
+
addApplicationMenuLinks: ClientMethods['addApplicationMenuLinks'];
|
|
176
|
+
setApplicationMenuLinks: ClientMethods['setApplicationMenuLinks'];
|
|
177
|
+
setProfile: ClientMethods['setProfile'];
|
|
178
|
+
};
|
|
179
|
+
branding: {
|
|
180
|
+
getLevel: ClientMethods['getBrandingLevel'];
|
|
181
|
+
setLevel: ClientMethods['setBrandingLevel'];
|
|
182
|
+
getColors: ClientMethods['getBrandingColors'];
|
|
183
|
+
getColor: ClientMethods['getBrandingColor'];
|
|
184
|
+
setColor: ClientMethods['setBrandingColor'];
|
|
185
|
+
setColors: ClientMethods['setBrandingColors'];
|
|
186
|
+
getHost: ClientMethods['getBrandingHost'];
|
|
187
|
+
setHost: ClientMethods['setBrandingHost'];
|
|
188
|
+
getUmbrella: ClientMethods['getBrandingUmbrella'];
|
|
189
|
+
setUmbrella: ClientMethods['setBrandingUmbrella'];
|
|
190
|
+
getVariables: ClientMethods['getBrandingVariables'];
|
|
191
|
+
};
|
|
192
|
+
setNavigationEnabled: ClientMethods['setNavigationEnabled'];
|
|
193
|
+
getConfig: ClientMethods['getConfig'];
|
|
194
|
+
mount: ClientMethods['mount'];
|
|
195
|
+
}
|
|
101
196
|
declare global {
|
|
102
197
|
interface Window {
|
|
103
198
|
globalHeaderClient: GlobalHeaderClient;
|
package/dist/idp.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@govflanders/vl-widget-global-header-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "TypeScript definitions for GlobalHeaderClient",
|
|
6
6
|
"main": "",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
"release": "rm -rf dist && yarn build && yarn version --patch --no-git-tag-version && git add . && git commit -m \"Release global-header-types $(node -p \"require('./package.json').version\")\" && git tag \"global-header-types-$(node -p \"require('./package.json').version\")\" && git push && git push --tags && npm_config_registry=https://registry.npmjs.org/ npm publish --access public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@govflanders/vl-widget-shared": "^1.0.
|
|
30
|
+
"@govflanders/vl-widget-shared": "^1.0.6"
|
|
31
31
|
}
|
|
32
32
|
}
|