@myhealth-belgium/webcomponent-integration
v2.0.0
Published
Interfaces to use when creating a custom component for My Health
Downloads
27
Readme
MyHealth Belgium web component integration library
This is a mandatory API, each web-component that needs to be integrated in myhealth.belgium.be should declare following:
Properties
Language
The language always holds the current language as a value, which means it can change over time if the user changes his/her preferred language. The web component must change it’s displayed translations whenever the value changes. The values of the language property are defined in the Language enum. It's values can be:
- en
- de
- fr
- nl
Environment
The environment property holds the environment where the application is currently running. Possible values of this property are defined by the Environment enum. Currently, the possible values are:
- prod
- acc
- int
- dev
For production, acceptation, integration and development respectively.
Access token holder
The AccessTokenHolder is used to have a callback mechanism to always retrieve the current valid access-token.
When you perform an api from the webcomponent that needs authentication, you can retrieve the Bearer-token by calling the getAccessToken()
method from the AccessTokenHolder
.
The interface
interface AccessTokenHolder {
getAccessToken(): String
}
Example usage of webcomponent on a page
<my-component
environment="prod"
language="nl"
access-token-holder={this.accessTokenHolder}
</my-component>
The AccessTokenHolder will be implemented by the user of the web component, in our case myhealth.belgium.be.
Component specific API (data exchange)
A component can require additional data to be exchanged between the container and itself. This should happen according to the Web Component Specification standard meaning:
Data should be provided to the web component by setting a property value. E.g.
<my-component
personalInfo={this.personalInfo}>
</my-component>
Data from the web component to the container should be implemented by an event. E.g.
<my-component
onProfileSelected={event => this.selectProfile(event)}>
</my-component>
Intent and concerns of this library
The intent of this library is to provide a standard in communication between the webcomponent and the integrating platform.
The provided access token by the AccessTokenHolder
needs to be discussed with both client and provider of the web component.
This is out of scope for this library.
How to install
npm i @myhealth-belgium/webcomponent-integration