Chatwoot/app/javascript/widget/helpers/utils.js
Pranav Raj S 8af200ad20
Fix missing translations, enable dutch language (#878)
* Fix missing translations, enable dutch language
2020-05-19 19:05:10 +05:30

19 lines
462 B
JavaScript
Executable file

export const isEmptyObject = obj =>
Object.keys(obj).length === 0 && obj.constructor === Object;
export const arrayToHashById = array =>
array.reduce((map, obj) => {
const newMap = map;
newMap[obj.id] = obj;
return newMap;
}, {});
export const IFrameHelper = {
isIFrame: () => window.self !== window.top,
sendMessage: msg => {
window.parent.postMessage(
`chatwoot-widget:${JSON.stringify({ ...msg })}`,
'*'
);
},
};