Ch 13-(2020-04-03) Updated the code example for postMessage

Changes made on 2020-04-03 are delineated below.

Additions are underlined in Green. Deletions are underlined in Red. Modifications are underlined in Blue.

Change occurred on https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/1109360647

Code Block -

window.addEventListener("message", (event) => {
// This domain changes with every environment. This origin value will be the CentinelAPI domain
// event message sample
//{MessageType: "profile.completed", SessionId: "0_57f063fd-659a-4779-b45b-9e456fdb7935", Status: true}
if (event.origin === "https://centinelapistag.cardinalcommerce.com/") {
let data = JSON.parse(event.data);
console.warn('Merchant received a message:', data)
if (data !== undefined && data.Status) {
console.warn('Songbird ran DF successfully')
//Use in cmpi_lookup if DFReferenceId not provided in JWT
$('#DFReferenceId').val(data.payload.SessionId)
}
}
}, false);