@govflanders/vl-widget-global-header-types 1.0.32 → 1.0.34
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 +4 -138
- package/dist/client.d.ts +170 -181
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +120 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1493 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +118 -0
- package/docs/interfaces/AccessMenuConfig.html +6 -0
- package/docs/interfaces/AlertConfig.html +4 -0
- package/docs/interfaces/Application.html +4 -0
- package/docs/interfaces/ApplicationLink.html +5 -0
- package/docs/interfaces/BaseConfig.html +3 -0
- package/docs/interfaces/BrandingConfig.html +7 -0
- package/docs/interfaces/BrandingConfigColors.html +4 -0
- package/docs/interfaces/BrandingConfigHost.html +5 -0
- package/docs/interfaces/BrandingConfigUmbrella.html +5 -0
- package/docs/interfaces/Channel.html +11 -0
- package/docs/interfaces/CobrowseConfig.html +5 -0
- package/docs/interfaces/CobrowseConsentConfig.html +3 -0
- package/docs/interfaces/Config.html +5 -0
- package/docs/interfaces/ContactConfig.html +5 -0
- package/docs/interfaces/ContactOption.html +14 -0
- package/docs/interfaces/ContactOptionRef.html +4 -0
- package/docs/interfaces/EnrichedServicePoints.html +5 -0
- package/docs/interfaces/GlobalHeaderClient.html +104 -0
- package/docs/interfaces/I18n.html +3 -0
- package/docs/interfaces/IDPData.html +3 -0
- package/docs/interfaces/Image.html +4 -0
- package/docs/interfaces/Link.html +3 -0
- package/docs/interfaces/LinkWithTarget.html +4 -0
- package/docs/interfaces/MainLink.html +5 -0
- package/docs/interfaces/ProfileConfig.html +7 -0
- package/docs/interfaces/RecursiveRecord.html +1 -0
- package/docs/interfaces/ResolveOptions.html +3 -0
- package/docs/interfaces/ServicePoints.html +5 -0
- package/docs/interfaces/Session.html +2 -0
- package/docs/interfaces/Translations.html +3 -0
- package/docs/modules.html +46 -0
- package/docs/types/AlertModifier.html +1 -0
- package/docs/types/ApplicationMenuLink.html +1 -0
- package/docs/types/BrandingConfigLevel.html +2 -0
- package/docs/types/CapacityCode.html +1 -0
- package/docs/types/ChannelIcon.html +1 -0
- package/docs/types/ChannelType.html +1 -0
- package/docs/types/CobrowseChannel.html +1 -0
- package/docs/types/ContactOptionSocialPlatform.html +1 -0
- package/docs/types/ContactServiceEndpoints.html +1 -0
- package/docs/types/EnrichedServicePoint.html +1 -0
- package/docs/types/Language.html +1 -0
- package/docs/types/PluginTypeId.html +1 -0
- package/docs/types/ServicePoint.html +1 -0
- package/docs/types/Translatable.html +1 -0
- package/docs/variables/languages.html +1 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Global Header Widget types
|
|
2
|
-
|
|
3
1
|
The **`@govflanders/vl-widget-global-header-types`** package provides TypeScript types and interfaces for interacting with the **Global Header Widget**. This widget is embedded in customer web pages and exposes a client object (`window.globalHeaderClient`) that allows for dynamic configuration and interaction with the global header.
|
|
4
2
|
|
|
5
3
|
By using the types defined in this package, developers can ensure type-safe interactions with the widget while improving their development experience (DX) by utilizing autocompletion and built-in documentation.
|
|
@@ -103,141 +101,7 @@ client.setMainLinks([
|
|
|
103
101
|
|
|
104
102
|
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.
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
Retrieve the current widget configuration.
|
|
108
|
-
|
|
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.
|
|
136
|
-
|
|
137
|
-
- **getUmbrella(): Promise\<Partial\<BrandingConfigUmbrella\>\>**
|
|
138
|
-
Retrieve the umbrella configuration for branding.
|
|
139
|
-
|
|
140
|
-
- **setUmbrella(umbrella: BrandingConfigUmbrella): Promise\<boolean\>**
|
|
141
|
-
Set the umbrella branding configuration.
|
|
142
|
-
|
|
143
|
-
- **getVariables(): Promise\<Record\<string, string\>\>**
|
|
144
|
-
Fetch branding-related variables as a dictionary.
|
|
145
|
-
|
|
146
|
-
### contact
|
|
147
|
-
|
|
148
|
-
The `contact` object contains methods related to managing service points.
|
|
149
|
-
|
|
150
|
-
- **setServicePoints(servicePoints: Translatable\<ServicePoints\>): Promise\<Translatable\<ServicePoints\>\>**
|
|
151
|
-
Update the service points displayed in the widget.
|
|
152
|
-
|
|
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
|
-
- **open(): Promise\<boolean\>**
|
|
160
|
-
Opens the contact interface.
|
|
161
|
-
|
|
162
|
-
- **close(): Promise\<boolean\>**
|
|
163
|
-
Closes the contact interface.
|
|
164
|
-
|
|
165
|
-
- **toggle(): Promise\<boolean\>**
|
|
166
|
-
Toggles the visibility of the contact interface.
|
|
167
|
-
|
|
168
|
-
- **isOpen(): Promise\<boolean\>**
|
|
169
|
-
Checks whether the contact interface is currently open.
|
|
170
|
-
|
|
171
|
-
### accessMenu
|
|
172
|
-
|
|
173
|
-
The `accessMenu` object contains methods for managing the access menu's links and profile.
|
|
174
|
-
|
|
175
|
-
- **setProfile(profileConfig: Partial\<ProfileConfig\>): Promise\<boolean\>**
|
|
176
|
-
Set or update the profile configuration for the widget.
|
|
177
|
-
|
|
178
|
-
- **getProfile(): Promise\<Partial\<ProfileConfig\>\>**
|
|
179
|
-
Retrieve the current profile configuration for the widget.
|
|
180
|
-
|
|
181
|
-
- **setMainLinks(mainLinks: MainLink[]): Promise\<boolean\>**
|
|
182
|
-
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.
|
|
183
|
-
|
|
184
|
-
- **addApplicationMenuLink(link: ApplicationMenuLink): Promise\<ApplicationMenuLink[]\>**
|
|
185
|
-
Add a single link to the application menu.
|
|
186
|
-
|
|
187
|
-
- **addApplicationMenuLinks(links: ApplicationMenuLink[]): Promise\<ApplicationMenuLink[]\>**
|
|
188
|
-
Add multiple links to the application menu.
|
|
189
|
-
|
|
190
|
-
- **setApplicationMenuLinks(links: ApplicationMenuLink[]): Promise\<ApplicationMenuLink[]\>**
|
|
191
|
-
Replace all application menu links.
|
|
192
|
-
|
|
193
|
-
### setNavigationEnabled(enabled: boolean): Promise\<boolean\>
|
|
194
|
-
|
|
195
|
-
Enable or disable the host and branding navigation.
|
|
196
|
-
|
|
197
|
-
### mount(element?: HTMLElement): Promise\<boolean\>
|
|
198
|
-
|
|
199
|
-
The `mount` method allows you to control where the **Global Header Widget** is rendered on the page. There are two main ways to integrate the widget, depending on whether you want to manually control its placement or let it render automatically:
|
|
200
|
-
|
|
201
|
-
1. **Using the 'entry' script**:
|
|
202
|
-
When you include the widget via the following script:
|
|
203
|
-
|
|
204
|
-
```html
|
|
205
|
-
<script src="https://prod.widgets.burgerprofiel.vlaanderen.be/api/v2/widget/__global_header_id__/entry"></script>
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
The widget is **not automatically rendered** on the page. Instead, you must call the `mount` method from the `window.globalHeaderClient` object to display it. This gives you control over where and when the widget is added. You can either:
|
|
209
|
-
|
|
210
|
-
- **Mount to a specific element**:
|
|
211
|
-
Pass an HTML element to the `mount` method to render the widget inside that element.
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
const element = document.getElementById('customHeader');
|
|
215
|
-
window.globalHeaderClient.mount(element);
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
- **Mount without specifying an element**:
|
|
219
|
-
If no element is provided, the widget will automatically render at the top of the page.
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
window.globalHeaderClient.mount();
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
2. **Using the 'embed' script**:
|
|
226
|
-
If you use this script instead:
|
|
227
|
-
|
|
228
|
-
```html
|
|
229
|
-
<script src="https://prod.widgets.burgerprofiel.vlaanderen.be/api/v2/widget/__global_header_id__/embed"></script>
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
The widget will **automatically render** as a `<div>` at the location where the script is placed in the HTML. No additional action is needed to mount the widget in this case. For accessibility reasons, the header is marked with `role="banner"`. If you prefer not to include this role (e.g., to avoid multiple banner roles on a page), use the mount method described above with a `<div>` element.
|
|
233
|
-
|
|
234
|
-
#### Return Value
|
|
235
|
-
|
|
236
|
-
The `mount` method returns a promise that resolves to `true` if the widget was successfully mounted, or `false` otherwise.
|
|
237
|
-
|
|
238
|
-
### unmount(): Promise\<boolean\>
|
|
239
|
-
|
|
240
|
-
The `unmount` method unmounts the widget from the element it's mounted at.
|
|
104
|
+
Checkout the [GlobalHeaderClient](./interfaces/GlobalHeaderClient.html) here to see how to use it.
|
|
241
105
|
|
|
242
106
|
## Migration guide: Upgrading from v4 to v5
|
|
243
107
|
|
|
@@ -247,7 +111,7 @@ If you’re currently using version 4 of the Global Header Widget, please follow
|
|
|
247
111
|
|
|
248
112
|
No more client library or polyfill scripts: In version 5, you no longer need to include any additional client library or polyfill script links in your HTML. Access to the `window.globalHeaderClient` object is automatically provided when you include either the entry script or the embed script.
|
|
249
113
|
Action Required:
|
|
250
|
-
- Remove any `<script>` tags that reference client libraries or
|
|
114
|
+
- Remove any `<script>` tags that reference client libraries or polyfill libraries for the widget.
|
|
251
115
|
- Ensure that either the entry script or the embed script is included in your HTML.
|
|
252
116
|
|
|
253
117
|
### 2. Eliminate installable packages
|
|
@@ -274,6 +138,7 @@ Action Required:
|
|
|
274
138
|
Example:
|
|
275
139
|
|
|
276
140
|
```diff
|
|
141
|
+
// Using widgets V4
|
|
277
142
|
- vl.widget.client.capture(
|
|
278
143
|
- // Verplichte capture functie.
|
|
279
144
|
- function(widget) {
|
|
@@ -282,6 +147,7 @@ Example:
|
|
|
282
147
|
- }
|
|
283
148
|
- },
|
|
284
149
|
- );
|
|
150
|
+
// Using widgets V5
|
|
285
151
|
+ globalHeaderClient.contact.resetServicePoints();
|
|
286
152
|
```
|
|
287
153
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,216 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { ApplicationMenuLink } from './access-menu';
|
|
6
|
-
export type Handlers = {
|
|
7
|
-
/**
|
|
8
|
-
* Get the current configuration
|
|
9
|
-
* @returns A promise that resolves to the current configuration
|
|
10
|
-
*/
|
|
11
|
-
getConfig: Handler<undefined, Config>;
|
|
12
|
-
/**
|
|
13
|
-
* Set the service points
|
|
14
|
-
* @param servicePoints The service points to set
|
|
15
|
-
* @returns A promise that resolves to the set service points
|
|
16
|
-
*/
|
|
17
|
-
setServicePoints: Handler<Translatable<ServicePoints>, Translatable<ServicePoints>>;
|
|
18
|
-
/**
|
|
19
|
-
* Get the current service points
|
|
20
|
-
* @returns A promise that resolves to the current service points
|
|
21
|
-
*/
|
|
22
|
-
getServicePoints: Handler<undefined, EnrichedServicePoints>;
|
|
23
|
-
/**
|
|
24
|
-
* Reset the service points to the initial values from the configuration.
|
|
25
|
-
*
|
|
26
|
-
* This method reverts the service points back to their original state
|
|
27
|
-
* as defined in the initial configuration, effectively overriding any
|
|
28
|
-
* previously set service points.
|
|
29
|
-
*
|
|
30
|
-
* @return {Promise<this>}
|
|
31
|
-
* A promise that resolves when the service points have been reset.
|
|
32
|
-
*/
|
|
33
|
-
resetServicePoints: Handler<undefined, boolean>;
|
|
34
|
-
/**
|
|
35
|
-
* Set the profile configuration
|
|
36
|
-
* @param profileConfig The profile configuration to set
|
|
37
|
-
* @returns A promise that resolves to true if the profile configuration was set, false otherwise
|
|
38
|
-
*/
|
|
39
|
-
setProfile: Handler<Partial<ProfileConfig>, boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Get the profile configuration
|
|
42
|
-
* @returns A promise that resolves to the current profile configuration
|
|
43
|
-
*/
|
|
44
|
-
getProfile: Handler<undefined, Partial<ProfileConfig>>;
|
|
45
|
-
/**
|
|
46
|
-
* Set the main links
|
|
47
|
-
* @param mainLinks The main links to set
|
|
48
|
-
* @returns A promise that resolves to true if the main links were set, false otherwise
|
|
49
|
-
*/
|
|
50
|
-
setMainLinks: Handler<Translatable<MainLink>[], boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Add an application menu link
|
|
53
|
-
* @param link The link to add
|
|
54
|
-
* @returns A promise that resolves to the updated application menu
|
|
55
|
-
*/
|
|
56
|
-
addApplicationMenuLink: Handler<ApplicationMenuLink, ApplicationMenuLink[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Add multiple application menu links
|
|
59
|
-
* @param links The links to add
|
|
60
|
-
* @returns A promise that resolves to the updated application menu
|
|
61
|
-
*/
|
|
62
|
-
addApplicationMenuLinks: Handler<ApplicationMenuLink[], ApplicationMenuLink[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Set the application menu links
|
|
65
|
-
* @param links The links to set
|
|
66
|
-
* @returns A promise that resolves to the updated application menu
|
|
67
|
-
*/
|
|
68
|
-
setApplicationMenuLinks: Handler<ApplicationMenuLink[], ApplicationMenuLink[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Set the navigation enabled state
|
|
71
|
-
* @param enabled The navigation enabled state
|
|
72
|
-
* @returns A promise that resolves to true if the navigation enabled state was set, false otherwise
|
|
73
|
-
*/
|
|
74
|
-
setNavigationEnabled: Handler<boolean, boolean>;
|
|
75
|
-
/**
|
|
76
|
-
* Get the level of branding
|
|
77
|
-
* @returns A promise that resolves to the branding level
|
|
78
|
-
*/
|
|
79
|
-
getBrandingLevel: Handler<undefined, number>;
|
|
80
|
-
/**
|
|
81
|
-
* Set the branding level
|
|
82
|
-
* @param level The level of branding to set
|
|
83
|
-
* @returns A promise that resolves to true if the branding level was set
|
|
84
|
-
*/
|
|
85
|
-
setBrandingLevel: Handler<number, boolean>;
|
|
86
|
-
/**
|
|
87
|
-
* Get the branding colors
|
|
88
|
-
* @returns A promise that resolves to the branding colors
|
|
89
|
-
*/
|
|
90
|
-
getBrandingColors: Handler<undefined, BrandingConfigColors>;
|
|
91
|
-
/**
|
|
92
|
-
* Get a specific branding color by type
|
|
93
|
-
* @param type The type of branding color to get
|
|
94
|
-
* @returns A promise that resolves to the branding color
|
|
95
|
-
*/
|
|
96
|
-
getBrandingColor: Handler<keyof BrandingConfigColors, string>;
|
|
97
|
-
/**
|
|
98
|
-
* Set the branding colors
|
|
99
|
-
* @param colors The colors to set
|
|
100
|
-
* @returns A promise that resolves to true if the branding colors were set
|
|
101
|
-
*/
|
|
102
|
-
setBrandingColors: Handler<BrandingConfigColors, boolean>;
|
|
103
|
-
/**
|
|
104
|
-
* Set a specific branding color by type
|
|
105
|
-
* @param type The type of branding color to set
|
|
106
|
-
* @param value The color value to set
|
|
107
|
-
* @returns A promise that resolves to true if the branding color was set
|
|
108
|
-
*/
|
|
109
|
-
setBrandingColor: Handler<{
|
|
110
|
-
type: keyof BrandingConfigColors;
|
|
111
|
-
value: string;
|
|
112
|
-
}, boolean>;
|
|
113
|
-
/**
|
|
114
|
-
* Get the host context
|
|
115
|
-
* @returns A promise that resolves to the branding host settings
|
|
116
|
-
*/
|
|
117
|
-
getBrandingHost: Handler<undefined, Partial<BrandingConfigHost>>;
|
|
118
|
-
/**
|
|
119
|
-
* Set the host context
|
|
120
|
-
* @param host The branding host settings to set
|
|
121
|
-
* @returns A promise that resolves to true if the branding host was set
|
|
122
|
-
*/
|
|
123
|
-
setBrandingHost: Handler<Partial<BrandingConfigHost>, boolean>;
|
|
124
|
-
/**
|
|
125
|
-
* Get the umbrella context
|
|
126
|
-
* @returns A promise that resolves to the branding umbrella settings
|
|
127
|
-
*/
|
|
128
|
-
getBrandingUmbrella: Handler<undefined, Partial<BrandingConfigUmbrella>>;
|
|
129
|
-
/**
|
|
130
|
-
* Set the umbrella context
|
|
131
|
-
* @param umbrella The branding umbrella settings to set
|
|
132
|
-
* @returns A promise that resolves to true if the branding umbrella was set
|
|
133
|
-
*/
|
|
134
|
-
setBrandingUmbrella: Handler<Partial<BrandingConfigUmbrella>, boolean>;
|
|
135
|
-
/**
|
|
136
|
-
* Get the branding CSS variables
|
|
137
|
-
* @returns A promise that resolves to the branding CSS variables
|
|
138
|
-
*/
|
|
139
|
-
getBrandingVariables: Handler<undefined, Record<string, string>>;
|
|
140
|
-
/**
|
|
141
|
-
* Mount an element
|
|
142
|
-
* @param element The element to mount
|
|
143
|
-
* @returns A promise that resolves to true if the element was mounted, false otherwise
|
|
144
|
-
*/
|
|
145
|
-
mount: Handler<HTMLElement | void, boolean>;
|
|
146
|
-
/**
|
|
147
|
-
* Unmount an element
|
|
148
|
-
* @returns A promise that resolves to true if the element was unmounted, false otherwise
|
|
149
|
-
*/
|
|
150
|
-
unmount: Handler<undefined, boolean>;
|
|
151
|
-
openContact: Handler<undefined, boolean>;
|
|
152
|
-
closeContact: Handler<undefined, boolean>;
|
|
153
|
-
toggleContact: Handler<undefined, boolean>;
|
|
154
|
-
isContactOpen: Handler<undefined, boolean>;
|
|
155
|
-
};
|
|
156
|
-
type PromiseResolver<T> = (value: T | PromiseLike<T>) => void;
|
|
157
|
-
type PromiseRejecter = (reason?: any) => void;
|
|
158
|
-
export type Handler<Args, Return> = (args: Args, resolve: PromiseResolver<Return>, reject: PromiseRejecter) => void;
|
|
159
|
-
type ArgumentTypes = {
|
|
160
|
-
[HandlersKey in keyof Handlers]: Handlers[HandlersKey] extends Handler<infer Args, any> ? Args : never;
|
|
161
|
-
};
|
|
162
|
-
type ReturnTypes = {
|
|
163
|
-
[HandlersKey in keyof Handlers]: Handlers[HandlersKey] extends Handler<any, infer Return> ? Return : never;
|
|
164
|
-
};
|
|
165
|
-
export type ClientMethods = {
|
|
166
|
-
[K in keyof Handlers]: ArgumentTypes[K] extends undefined ? () => Promise<ReturnTypes[K]> : (args: ArgumentTypes[K]) => Promise<ReturnTypes[K]>;
|
|
167
|
-
};
|
|
168
|
-
export type QueueItem<Key extends keyof Handlers> = {
|
|
169
|
-
[K in keyof Handlers]: {
|
|
170
|
-
key: K;
|
|
171
|
-
args: ArgumentTypes[K];
|
|
172
|
-
resolve: PromiseResolver<ReturnTypes[K]>;
|
|
173
|
-
reject: PromiseRejecter;
|
|
174
|
-
};
|
|
175
|
-
}[Key];
|
|
176
|
-
export interface GlobalHeaderLinker {
|
|
177
|
-
queue: QueueItem<keyof Handlers>[];
|
|
178
|
-
update: () => void;
|
|
179
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The `window.globalHeaderClient` object offers several methods for interacting with the widget.
|
|
3
|
+
* Each method is typed and returns promises, making asynchronous operations easier to handle.
|
|
4
|
+
*/
|
|
180
5
|
export interface GlobalHeaderClient {
|
|
181
6
|
contact: {
|
|
7
|
+
/**
|
|
8
|
+
* Get the current service points
|
|
9
|
+
* @returns A promise that resolves to the current service points
|
|
10
|
+
*/
|
|
182
11
|
getServicePoints: ClientMethods['getServicePoints'];
|
|
12
|
+
/**
|
|
13
|
+
* Set the service points
|
|
14
|
+
* @param servicePoints The service points to set
|
|
15
|
+
* @returns A promise that resolves to the set service points
|
|
16
|
+
*/
|
|
183
17
|
setServicePoints: ClientMethods['setServicePoints'];
|
|
18
|
+
/**
|
|
19
|
+
* Reset the service points to the initial values from the configuration.
|
|
20
|
+
*
|
|
21
|
+
* This method reverts the service points back to their original state
|
|
22
|
+
* as defined in the initial configuration, effectively overriding any
|
|
23
|
+
* previously set service points.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise that resolves when the service points have been reset.
|
|
26
|
+
*/
|
|
184
27
|
resetServicePoints: ClientMethods['resetServicePoints'];
|
|
28
|
+
/**
|
|
29
|
+
* Open the contact panel.
|
|
30
|
+
* @returns A promise that resolves to true if the contact panel was opened.
|
|
31
|
+
*/
|
|
185
32
|
open: ClientMethods['openContact'];
|
|
33
|
+
/**
|
|
34
|
+
* Close the contact panel.
|
|
35
|
+
* @returns A promise that resolves to true if the contact panel was closed.
|
|
36
|
+
*/
|
|
186
37
|
close: ClientMethods['closeContact'];
|
|
38
|
+
/**
|
|
39
|
+
* Toggle the contact panel.
|
|
40
|
+
* @returns A promise that resolves to true if the contact panel is now open.
|
|
41
|
+
*/
|
|
187
42
|
toggle: ClientMethods['toggleContact'];
|
|
43
|
+
/**
|
|
44
|
+
* Check if the contact panel is open.
|
|
45
|
+
* @returns A promise that resolves to true if the contact panel is open.
|
|
46
|
+
*/
|
|
188
47
|
isOpen: ClientMethods['isContactOpen'];
|
|
189
48
|
};
|
|
190
49
|
accessMenu: {
|
|
50
|
+
/**
|
|
51
|
+
* Set the main links
|
|
52
|
+
* @param mainLinks The main links to set
|
|
53
|
+
* @returns A promise that resolves to true if the main links were set, false otherwise
|
|
54
|
+
*/
|
|
191
55
|
setMainLinks: ClientMethods['setMainLinks'];
|
|
56
|
+
/**
|
|
57
|
+
* Add an application menu link
|
|
58
|
+
* @param link The link to add
|
|
59
|
+
* @returns A promise that resolves to the updated application menu
|
|
60
|
+
*/
|
|
192
61
|
addApplicationMenuLink: ClientMethods['addApplicationMenuLink'];
|
|
62
|
+
/**
|
|
63
|
+
* Add multiple application menu links
|
|
64
|
+
* @param links The links to add
|
|
65
|
+
* @returns A promise that resolves to the updated application menu
|
|
66
|
+
*/
|
|
193
67
|
addApplicationMenuLinks: ClientMethods['addApplicationMenuLinks'];
|
|
68
|
+
/**
|
|
69
|
+
* Set the application menu links
|
|
70
|
+
* @param links The links to set
|
|
71
|
+
* @returns A promise that resolves to the updated application menu
|
|
72
|
+
*/
|
|
194
73
|
setApplicationMenuLinks: ClientMethods['setApplicationMenuLinks'];
|
|
74
|
+
/**
|
|
75
|
+
* Set the profile configuration
|
|
76
|
+
* @param profileConfig The profile configuration to set
|
|
77
|
+
* @returns A promise that resolves to true if the profile configuration was set, false otherwise
|
|
78
|
+
*/
|
|
195
79
|
setProfile: ClientMethods['setProfile'];
|
|
80
|
+
/**
|
|
81
|
+
* Get the profile configuration
|
|
82
|
+
* @returns A promise that resolves to the current profile configuration
|
|
83
|
+
*/
|
|
196
84
|
getProfile: ClientMethods['getProfile'];
|
|
197
85
|
};
|
|
198
86
|
branding: {
|
|
87
|
+
/**
|
|
88
|
+
* Get the level of branding
|
|
89
|
+
* @returns A promise that resolves to the branding level
|
|
90
|
+
*/
|
|
199
91
|
getLevel: ClientMethods['getBrandingLevel'];
|
|
92
|
+
/**
|
|
93
|
+
* Set the branding level
|
|
94
|
+
* @param level The level of branding to set
|
|
95
|
+
* @returns A promise that resolves to true if the branding level was set
|
|
96
|
+
*/
|
|
200
97
|
setLevel: ClientMethods['setBrandingLevel'];
|
|
98
|
+
/**
|
|
99
|
+
* Get the branding colors
|
|
100
|
+
* @returns A promise that resolves to the branding colors
|
|
101
|
+
*/
|
|
201
102
|
getColors: ClientMethods['getBrandingColors'];
|
|
103
|
+
/**
|
|
104
|
+
* Get a specific branding color by type
|
|
105
|
+
* @param type The type of branding color to get
|
|
106
|
+
* @returns A promise that resolves to the branding color
|
|
107
|
+
*/
|
|
202
108
|
getColor: ClientMethods['getBrandingColor'];
|
|
203
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Set the branding colors
|
|
111
|
+
* @param colors The colors to set
|
|
112
|
+
* @returns A promise that resolves to true if the branding colors were set
|
|
113
|
+
*/
|
|
204
114
|
setColors: ClientMethods['setBrandingColors'];
|
|
115
|
+
/**
|
|
116
|
+
* Set a specific branding color by type
|
|
117
|
+
* @param args The type of branding color and value to set
|
|
118
|
+
* @returns A promise that resolves to true if the branding color was set
|
|
119
|
+
*/
|
|
120
|
+
setColor: ClientMethods['setBrandingColor'];
|
|
121
|
+
/**
|
|
122
|
+
* Get the host context
|
|
123
|
+
* @returns A promise that resolves to the branding host settings
|
|
124
|
+
*/
|
|
205
125
|
getHost: ClientMethods['getBrandingHost'];
|
|
126
|
+
/**
|
|
127
|
+
* Set the host context
|
|
128
|
+
* @param host The branding host settings to set
|
|
129
|
+
* @returns A promise that resolves to true if the branding host was set
|
|
130
|
+
*/
|
|
206
131
|
setHost: ClientMethods['setBrandingHost'];
|
|
132
|
+
/**
|
|
133
|
+
* Get the umbrella context
|
|
134
|
+
* @returns A promise that resolves to the branding umbrella settings
|
|
135
|
+
*/
|
|
207
136
|
getUmbrella: ClientMethods['getBrandingUmbrella'];
|
|
137
|
+
/**
|
|
138
|
+
* Set the umbrella context
|
|
139
|
+
* @param umbrella The branding umbrella settings to set
|
|
140
|
+
* @returns A promise that resolves to true if the branding umbrella was set
|
|
141
|
+
*/
|
|
208
142
|
setUmbrella: ClientMethods['setBrandingUmbrella'];
|
|
143
|
+
/**
|
|
144
|
+
* Get the branding CSS variables
|
|
145
|
+
* @returns A promise that resolves to the branding CSS variables
|
|
146
|
+
*/
|
|
209
147
|
getVariables: ClientMethods['getBrandingVariables'];
|
|
210
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Set the navigation enabled state
|
|
151
|
+
* @param enabled The navigation enabled state
|
|
152
|
+
* @returns A promise that resolves to true if the navigation enabled state was set, false otherwise
|
|
153
|
+
*/
|
|
211
154
|
setNavigationEnabled: ClientMethods['setNavigationEnabled'];
|
|
155
|
+
/**
|
|
156
|
+
* Get the current configuration
|
|
157
|
+
* @returns A promise that resolves to the current configuration
|
|
158
|
+
*/
|
|
212
159
|
getConfig: ClientMethods['getConfig'];
|
|
160
|
+
/**
|
|
161
|
+
* The `mount` method allows you to control where the **Global Header Widget** is rendered on the page. There are two main ways to integrate the widget, depending on whether you want to manually control its placement or let it render automatically:
|
|
162
|
+
*
|
|
163
|
+
* 1. **Using the 'entry' script**:
|
|
164
|
+
* When you include the widget via the following script:
|
|
165
|
+
*
|
|
166
|
+
* ```html
|
|
167
|
+
* <script src="https://prod.widgets.burgerprofiel.vlaanderen.be/api/v2/widget/__global_header_id__/entry"></script>
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* The widget is **not automatically rendered** on the page. Instead, you must call the `mount` method from the `window.globalHeaderClient` object to display it. This gives you control over where and when the widget is added. You can either:
|
|
171
|
+
*
|
|
172
|
+
* - **Mount to a specific element**:
|
|
173
|
+
* Pass an HTML element to the `mount` method to render the widget inside that element.
|
|
174
|
+
*
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const element = document.getElementById('customHeader');
|
|
177
|
+
* window.globalHeaderClient.mount(element);
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* - **Mount without specifying an element**:
|
|
181
|
+
* If no element is provided, the widget will automatically render at the top of the page.
|
|
182
|
+
*
|
|
183
|
+
* ```typescript
|
|
184
|
+
* window.globalHeaderClient.mount();
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* 2. **Using the 'embed' script**:
|
|
188
|
+
* If you use this script instead:
|
|
189
|
+
*
|
|
190
|
+
* ```html
|
|
191
|
+
* <script src="https://prod.widgets.burgerprofiel.vlaanderen.be/api/v2/widget/__global_header_id__/embed"></script>
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* The widget will **automatically render** as a `<div>` at the location where the script is placed in the HTML. No additional action is needed to mount the widget in this case. For accessibility reasons, the header is marked with `role="banner"`. If you prefer not to include this role (e.g., to avoid multiple banner roles on a page), use the mount method described above with a `<div>` element.
|
|
195
|
+
*
|
|
196
|
+
* @param element The element to mount
|
|
197
|
+
* @returns A promise that resolves to `true` if the element was mounted, `false` otherwise
|
|
198
|
+
*/
|
|
213
199
|
mount: ClientMethods['mount'];
|
|
200
|
+
/**
|
|
201
|
+
* Unmount an element
|
|
202
|
+
* @returns A promise that resolves to true if the element was unmounted, false otherwise
|
|
203
|
+
*/
|
|
214
204
|
unmount: ClientMethods['unmount'];
|
|
215
205
|
}
|
|
216
206
|
declare global {
|
|
@@ -219,4 +209,3 @@ declare global {
|
|
|
219
209
|
globalHeaderLinker: GlobalHeaderLinker;
|
|
220
210
|
}
|
|
221
211
|
}
|
|
222
|
-
export {};
|
package/docs/.nojekyll
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--light-hl-0: #800000;
|
|
3
|
+
--dark-hl-0: #808080;
|
|
4
|
+
--light-hl-1: #800000;
|
|
5
|
+
--dark-hl-1: #569CD6;
|
|
6
|
+
--light-hl-2: #000000;
|
|
7
|
+
--dark-hl-2: #D4D4D4;
|
|
8
|
+
--light-hl-3: #E50000;
|
|
9
|
+
--dark-hl-3: #9CDCFE;
|
|
10
|
+
--light-hl-4: #0000FF;
|
|
11
|
+
--dark-hl-4: #CE9178;
|
|
12
|
+
--light-hl-5: #000000FF;
|
|
13
|
+
--dark-hl-5: #D4D4D4;
|
|
14
|
+
--light-hl-6: #001080;
|
|
15
|
+
--dark-hl-6: #9CDCFE;
|
|
16
|
+
--light-hl-7: #795E26;
|
|
17
|
+
--dark-hl-7: #DCDCAA;
|
|
18
|
+
--light-hl-8: #008000;
|
|
19
|
+
--dark-hl-8: #6A9955;
|
|
20
|
+
--light-hl-9: #A31515;
|
|
21
|
+
--dark-hl-9: #CE9178;
|
|
22
|
+
--light-hl-10: #0000FF;
|
|
23
|
+
--dark-hl-10: #569CD6;
|
|
24
|
+
--light-hl-11: #AF00DB;
|
|
25
|
+
--dark-hl-11: #C586C0;
|
|
26
|
+
--light-hl-12: #0070C1;
|
|
27
|
+
--dark-hl-12: #4FC1FF;
|
|
28
|
+
--light-hl-13: #267F99;
|
|
29
|
+
--dark-hl-13: #4EC9B0;
|
|
30
|
+
--light-code-background: #FFFFFF;
|
|
31
|
+
--dark-code-background: #1E1E1E;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (prefers-color-scheme: light) { :root {
|
|
35
|
+
--hl-0: var(--light-hl-0);
|
|
36
|
+
--hl-1: var(--light-hl-1);
|
|
37
|
+
--hl-2: var(--light-hl-2);
|
|
38
|
+
--hl-3: var(--light-hl-3);
|
|
39
|
+
--hl-4: var(--light-hl-4);
|
|
40
|
+
--hl-5: var(--light-hl-5);
|
|
41
|
+
--hl-6: var(--light-hl-6);
|
|
42
|
+
--hl-7: var(--light-hl-7);
|
|
43
|
+
--hl-8: var(--light-hl-8);
|
|
44
|
+
--hl-9: var(--light-hl-9);
|
|
45
|
+
--hl-10: var(--light-hl-10);
|
|
46
|
+
--hl-11: var(--light-hl-11);
|
|
47
|
+
--hl-12: var(--light-hl-12);
|
|
48
|
+
--hl-13: var(--light-hl-13);
|
|
49
|
+
--code-background: var(--light-code-background);
|
|
50
|
+
} }
|
|
51
|
+
|
|
52
|
+
@media (prefers-color-scheme: dark) { :root {
|
|
53
|
+
--hl-0: var(--dark-hl-0);
|
|
54
|
+
--hl-1: var(--dark-hl-1);
|
|
55
|
+
--hl-2: var(--dark-hl-2);
|
|
56
|
+
--hl-3: var(--dark-hl-3);
|
|
57
|
+
--hl-4: var(--dark-hl-4);
|
|
58
|
+
--hl-5: var(--dark-hl-5);
|
|
59
|
+
--hl-6: var(--dark-hl-6);
|
|
60
|
+
--hl-7: var(--dark-hl-7);
|
|
61
|
+
--hl-8: var(--dark-hl-8);
|
|
62
|
+
--hl-9: var(--dark-hl-9);
|
|
63
|
+
--hl-10: var(--dark-hl-10);
|
|
64
|
+
--hl-11: var(--dark-hl-11);
|
|
65
|
+
--hl-12: var(--dark-hl-12);
|
|
66
|
+
--hl-13: var(--dark-hl-13);
|
|
67
|
+
--code-background: var(--dark-code-background);
|
|
68
|
+
} }
|
|
69
|
+
|
|
70
|
+
:root[data-theme='light'] {
|
|
71
|
+
--hl-0: var(--light-hl-0);
|
|
72
|
+
--hl-1: var(--light-hl-1);
|
|
73
|
+
--hl-2: var(--light-hl-2);
|
|
74
|
+
--hl-3: var(--light-hl-3);
|
|
75
|
+
--hl-4: var(--light-hl-4);
|
|
76
|
+
--hl-5: var(--light-hl-5);
|
|
77
|
+
--hl-6: var(--light-hl-6);
|
|
78
|
+
--hl-7: var(--light-hl-7);
|
|
79
|
+
--hl-8: var(--light-hl-8);
|
|
80
|
+
--hl-9: var(--light-hl-9);
|
|
81
|
+
--hl-10: var(--light-hl-10);
|
|
82
|
+
--hl-11: var(--light-hl-11);
|
|
83
|
+
--hl-12: var(--light-hl-12);
|
|
84
|
+
--hl-13: var(--light-hl-13);
|
|
85
|
+
--code-background: var(--light-code-background);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:root[data-theme='dark'] {
|
|
89
|
+
--hl-0: var(--dark-hl-0);
|
|
90
|
+
--hl-1: var(--dark-hl-1);
|
|
91
|
+
--hl-2: var(--dark-hl-2);
|
|
92
|
+
--hl-3: var(--dark-hl-3);
|
|
93
|
+
--hl-4: var(--dark-hl-4);
|
|
94
|
+
--hl-5: var(--dark-hl-5);
|
|
95
|
+
--hl-6: var(--dark-hl-6);
|
|
96
|
+
--hl-7: var(--dark-hl-7);
|
|
97
|
+
--hl-8: var(--dark-hl-8);
|
|
98
|
+
--hl-9: var(--dark-hl-9);
|
|
99
|
+
--hl-10: var(--dark-hl-10);
|
|
100
|
+
--hl-11: var(--dark-hl-11);
|
|
101
|
+
--hl-12: var(--dark-hl-12);
|
|
102
|
+
--hl-13: var(--dark-hl-13);
|
|
103
|
+
--code-background: var(--dark-code-background);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.hl-0 { color: var(--hl-0); }
|
|
107
|
+
.hl-1 { color: var(--hl-1); }
|
|
108
|
+
.hl-2 { color: var(--hl-2); }
|
|
109
|
+
.hl-3 { color: var(--hl-3); }
|
|
110
|
+
.hl-4 { color: var(--hl-4); }
|
|
111
|
+
.hl-5 { color: var(--hl-5); }
|
|
112
|
+
.hl-6 { color: var(--hl-6); }
|
|
113
|
+
.hl-7 { color: var(--hl-7); }
|
|
114
|
+
.hl-8 { color: var(--hl-8); }
|
|
115
|
+
.hl-9 { color: var(--hl-9); }
|
|
116
|
+
.hl-10 { color: var(--hl-10); }
|
|
117
|
+
.hl-11 { color: var(--hl-11); }
|
|
118
|
+
.hl-12 { color: var(--hl-12); }
|
|
119
|
+
.hl-13 { color: var(--hl-13); }
|
|
120
|
+
pre, code { background: var(--code-background); }
|