// chat-client.js // Copyright (C) 2024 DTP Technologies, LLC // All Rights Reserved 'use strict'; const DTP_COMPONENT_NAME = 'DtpChatApp'; import DtpApp from 'dtp/dtp-app.js'; export class ChatApp extends DtpApp { constructor (user) { super(DTP_COMPONENT_NAME, user, { withAdvertising: false }); this.log.info('DTP app client online'); } async confirmNavigation (event) { const target = event.currentTarget || event.target; event.preventDefault(); event.stopPropagation(); const href = target.getAttribute('href'); const hrefTarget = target.getAttribute('target'); const text = target.textContent; const whitelist = [ 'digitaltelepresence.com', 'www.digitaltelepresence.com', 'chat.digitaltelepresence.com', 'sites.digitaltelepresence.com', ]; try { const url = new URL(href); if (!whitelist.includes(url.hostname)) { await UIkit.modal.confirm(`
You are navigating to ${href}
, a link or button that was displayed as:
${text}