Skip to content

Commit c7cb35c

Browse files
committed
fix: prevent overlap between Vapi widget and Fern Ask AI panel
1 parent f36d019 commit c7cb35c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fern/custom.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ function injectVapiWidget() {
1313
return;
1414
}
1515

16+
// Add --ask-ai-panel-width CSS variable for widget positioning if it doesn't exist already
17+
if (!getComputedStyle(document.documentElement).getPropertyValue('--ask-ai-panel-width').trim()) {
18+
document.documentElement.style.setProperty('--ask-ai-panel-width', '0px');
19+
}
20+
1621
const script = document.createElement('script');
1722
script.src = WIDGET_SCRIPT_URL;
1823
script.async = true;
@@ -22,10 +27,14 @@ function injectVapiWidget() {
2227
const widget = document.createElement(WIDGET_TAG);
2328
const apiKey = '6d46661c-2dce-4032-b62d-64c151a14e0d';
2429
widget.setAttribute('apiKey', apiKey);
30+
2531
widget.style.position = 'fixed';
2632
widget.style.bottom = '0';
27-
widget.style.right = '0';
33+
widget.style.right = `var(--ask-ai-panel-width)`;
2834
widget.style.zIndex = '9999';
35+
36+
widget.style.transition = 'right 0.5s ease-out';
37+
2938
document.body.appendChild(widget);
3039
console.log('[custom.js] Widget element appended to DOM');
3140
};

0 commit comments

Comments
 (0)