Skip to main content
Version: Released

Assembly Application Iframe Messages

As the planner, the assembly application can be embedded in a web site. This section describes Iframe messages that are listened by the assembly editor (input) to react to parent window actions or emitted by the assembly editor (output) to enable parent window to react.

 

For...Inputs MessagesOutputs Messages
AuthenticationAuthentication TokenRefreshedAuthenticationRequired, AuthenticationSucceeded, AuthenticationFailed, TokenExpired
Application–CloseApp
Open SaveLoadAssemblyFromProductIdOpenAssemblyRequired SaveSucceeded

Endpoints​

A website offering access to the assembly editor application must embed it in an Iframe. The application endpoint to use depends on the integration context. You have to use your environment url, specifying assembly component followed by /Editor/ suffix.

Example: https://staging-assembly.xxx.by.me/Editor/

The xxx part depends on the integration context that was provided to you.

Iframe communication​

To have an overview of the subject, we advise you to read window.postMessage documentation on the web.

➡️ Refer to PostMessage documentation 🔗

Every message received by the application or sent by the application through window.postMessage must be an object of this format:

KeyTypeDescription
eventstringThe event name is used as unique identifier for a given event.
content*Content sent with the event. It is optional and can be anything: integer, array, object...
Template​
{
event: "AuthenticationRequired",
content:
{
"token": string,
"distributionID": string
}
}

Authentication​

AuthenticationRequired​

Output emitted when the application requests authentication parameters. Upon this request, the parent window must reply with an Authentication message.

KeyTypeValue/TemplateDescription
eventstringAuthenticationRequired–
content–––

Authentication​

Input received when authentication is requested by the message AuthenticationRequired, the parent window must reply with the following message.

KeyTypeValueDescription
eventstringAuthentication–
contentobjecttoken
distributionID
token: The legal entity token generated by the client website.
distributionID: The specific distribution in the legal entity.
Template​
{
"token": string
"distributionID": string
}

AuthenticationSucceeded​

Output emitted by the application to acknowledge that authentication is successful.

KeyTypeValue/TemplateDescription
eventstringAuthenticationSucceeded–
contentobjectorigin
appID
distributionID
distributionParams
origin: The domain from which the message originated.
appID: The application ID associated with the provided credentials.
distributionID: The distribution ID associated with the provided credentials.
distributionParams: The distribution-specific parameters, if any, of the distribution associated with the provided credentials.
Template​
{
"origin": string,
"appID": string,
"distributionID": string,
"distributionParams": object
}

AuthenticationFailed​

Output emitted by the application to inform that authentication has failed.

KeyTypeValue/TemplateDescription
eventstringAuthenticationFailed–
contentobjecthttpCode
id
message
httpCode: The HTTP error code for the request.
id: The error id.
message: The detailed error message.
Template​
{
"httpCode": HttpErrorCode,
"id": string,
"message": string
}

TokenExpired​

Output emitted and sent to the parent window when a token is expired, subsequent calls to the web-services will fail with a 401 error.

KeyTypeValue/TemplateDescription
eventstringTokenExpired–
content–––

TokenRefreshed​

Input received from the parent window. This message is sent by the parent window on receiving TokenExpired. This message provides a new valid token to the application to authentify subsequent calls to web services.

KeyTypeValueDescription
eventstringTokenRefreshed–
contentobjecttoken
distributionID
token: The legal entity token generated by the client website.
distributionID: The specific distribution in the legal entity.
Template​
{
"token": string,
"distributionID": string
}

Application​

CloseApp​

Output emitted when the user clicks on the cross button to close the application.

KeyTypeValue/TemplateDescription
eventstringCloseApp–
content–––

Open Save​

LoadAssemblyFromProductId​

Input at reception of this message, the assembly application retrieves the product id in the platform and opens the assembly file (BMA) associated to it.

KeyTypeValue/TemplateDescription
eventstringLoadAssemblyFromProductId–
contentobjectidid: Product on which to retrieve and open the assembly file.
Template​
{
"id": integer,
}

OpenAssemblyRequired​

Output emitted when the user clicks on the open component button.

KeyTypeValue/TemplateDescription
eventstringOpenAssemblyRequired–
contentobjectproductIdproductId: The product ID of the component to open.
Template​
{
"productId": string,
}

SaveSucceeded​

Output emitted when the assembly is saved sucessfully.

KeyTypeValue/TemplateDescription
eventstringSaveSucceeded–
content–––