PluginProbe
Extendify / 3.0.4
Extendify v3.0.4
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / agent.js

agent.js in Extendify 3.0.4, at src/Agent/agent.js

45 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Agent } from '@agent/Agent.jsx';
2 import { render } from '@shared/lib/dom';
3 import { isOnLaunch } from '@shared/lib/utils';
4 import domReady from '@wordpress/dom-ready';
5 import '@agent/agent.css';
6 import '@agent/buttons';
7 import { GuidedTour } from '@agent/components/GuidedTour';
8 import { throwSideConfetti } from './lib/confetti';
9
10 const isInsideIframe = () => !!document.querySelector('body.iframe');
11
12 domReady(() => {
13 // disableForReducedMotion
14 // tours
15 const tourId = 'extendify-agent-tour';
16 if (document.getElementById(tourId)) return;
17 const tour = Object.assign(document.createElement('div'), {
18 className: 'extendify-agent-tour',
19 id: tourId,
20 });
21 render(<GuidedTour />, tour);
22
23 const bg =
24 // admin area
25 document.getElementById('wpwrap') ||
26 // TODO: is this on all block themes?
27 document.querySelector('.wp-site-blocks');
28 if (isOnLaunch() || isInsideIframe() || !bg) return;
29 const id = 'extendify-agent-main';
30 if (document.getElementById(id)) return;
31 const agent = Object.assign(document.createElement('div'), {
32 className: 'extendify-agent',
33 id,
34 });
35 document.body.appendChild(agent);
36 render(<Agent />, agent);
37
38 // Runs when extendify-launch-success is in the url
39 if (window.extAgentData?.startOnboarding) {
40 requestAnimationFrame(() => {
41 throwSideConfetti();
42 });
43 }
44 });
45