const getIntegrationId = () => {
return window.location.href.split('=')[1]
}
// yêu cầu SmaxAi trả dữ liệu customer
if (window.parent) {
window.parent.postMessage({
name: '__SM_FORM_CUSTOMER',
data: {
integration_id: getIntegrationId(),
}
}, '*')
} else {
console.error('window.parent is undefined')
}
// yêu cầu SmaxAi bật popup
if (window.parent) {
window.parent.postMessage({
name: '__SM_FORM_POPUP',
action: 'SHOW', // 'HIDE'
data: {
integration_id: getIntegrationId(),
url: 'https://crm.com/orders?id=xxx',
title: 'Title Demo',
height: '80vh'
}
}, '*')
} else {
console.error('window.parent is undefined')
}