feat(hubspot): add dark mode support and light color scheme for chat widget
- Removed production check to ensure HubSpot script loads in all environments. - Implemented dark mode CSS injection when the dark theme is active. - Added a style block to enforce a light color scheme for the HubSpot chat widget, improving visibility and user experience.
This commit is contained in:
@@ -15,7 +15,7 @@ class HubSpotManager {
|
||||
* Load HubSpot script with dark mode support
|
||||
*/
|
||||
init() {
|
||||
if (!this.isProduction) return;
|
||||
// if (!this.isProduction) return;
|
||||
|
||||
const loadHubSpot = () => {
|
||||
const script = document.createElement('script');
|
||||
@@ -52,6 +52,7 @@ class HubSpotManager {
|
||||
existingStyle.remove();
|
||||
}
|
||||
|
||||
// Apply dark mode CSS if dark theme is active
|
||||
if (isDark) {
|
||||
this.injectDarkModeCSS();
|
||||
}
|
||||
@@ -121,4 +122,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Make available globally for potential cleanup
|
||||
window.HubSpotManager = hubspot;
|
||||
});
|
||||
});
|
||||
|
||||
// Add this style to ensure the chat widget uses the light color scheme
|
||||
(function() {
|
||||
var style = document.createElement('style');
|
||||
style.innerHTML = '#hubspot-messages-iframe-container { color-scheme: light !important; }';
|
||||
document.head.appendChild(style);
|
||||
})();
|
||||
Reference in New Issue
Block a user