| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { Agent } from '@agent/Agent.jsx'; |
| 2 | 2 | import { render } from '@shared/lib/dom'; |
| 3 | +import { isEmbedded } from '@shared/lib/embedded-guard'; | |
| 3 | 4 | import { isOnLaunch } from '@shared/lib/utils'; |
| 4 | 5 | import domReady from '@wordpress/dom-ready'; |
| 5 | 6 | import '@agent/agent.css'; |
| 6 | 7 | import '@agent/buttons'; |
| @@ -6,11 +7,13 @@ | ||
| 6 | 7 | import '@agent/buttons'; |
| 7 | 8 | import { GuidedTour } from '@agent/components/GuidedTour'; |
| 8 | 9 | import { throwSideConfetti } from './lib/confetti'; |
| 9 | 10 | |
| 10 | -const isInsideIframe = () => !!document.querySelector('body.iframe'); | |
| 11 | +domReady(() => { | |
| 12 | + // Never activate framed — the Customizer preview, page-builder previews, | |
| 13 | + // and the block-editor canvas are all someone else's iframe. | |
| 14 | + if (isEmbedded()) return; | |
| 11 | 15 | |
| 12 | -domReady(() => { | |
| 13 | 16 | // disableForReducedMotion |
| 14 | 17 | // tours |
| 15 | 18 | const tourId = 'extendify-agent-tour'; |
| 16 | 19 | if (document.getElementById(tourId)) return; |
| @@ -24,9 +27,9 @@ | ||
| 24 | 27 | // admin area |
| 25 | 28 | document.getElementById('wpwrap') || |
| 26 | 29 | // TODO: is this on all block themes? |
| 27 | 30 | document.querySelector('.wp-site-blocks'); |
| 28 | - if (isOnLaunch() || isInsideIframe() || !bg) return; | |
| 31 | + if (isOnLaunch() || !bg) return; | |
| 29 | 32 | const id = 'extendify-agent-main'; |
| 30 | 33 | if (document.getElementById(id)) return; |
| 31 | 34 | const agent = Object.assign(document.createElement('div'), { |
| 32 | 35 | className: 'extendify-agent', |