Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬
Ruby actioncablechat-widgetconversationcustomer-supportdashboarddesigndockerdocker-imageherokuintercomjavascriptlivechatopensourcerailsrubysassvuejswhatsappzendesk
export const getTimelineEntries = panel =>
Array.from(
panel.querySelectorAll('[data-message-id], [id^="campaign-recipient-"]')
);
export const getUnreadScrollTop = (panel, messageId) => {
const unreadMessage = panel.querySelector(`[data-message-id="${messageId}"]`);
if (!unreadMessage) return undefined;
return (
panel.scrollTop +
unreadMessage.getBoundingClientRect().top -
panel.getBoundingClientRect().top -
panel.clientHeight / 2
);
};
export const captureTimelineAnchor = (panel, messageId) => {
const entries = getTimelineEntries(panel);
const panelTop = panel.getBoundingClientRect().top;
const anchor =
entries.find(entry => entry.id === `message${messageId}`) ||
entries.find(entry => entry.getBoundingClientRect().bottom > panelTop);
const offset = anchor?.getBoundingClientRect().top;
return () => {
if (!anchor || !panel.contains(anchor)) return;
panel.scrollTop += anchor.getBoundingClientRect().top - offset;
};
};