PluginProbe
Extendify / 3.1.4
Extendify v3.1.4
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 0.7.0 All 126 releases
extendify / src / Agent / agent.js

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

48 lines 1.4 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 { isEmbedded } from '@shared/lib/embedded-guard';
4 import { isOnLaunch } from '@shared/lib/utils';
5 import domReady from '@wordpress/dom-ready';
6 import '@agent/agent.css';
7 import '@agent/buttons';
8 import { GuidedTour } from '@agent/components/GuidedTour';
9 import { throwSideConfetti } from './lib/confetti';
10
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;
15
16 // disableForReducedMotion
17 // tours
18 const tourId = 'extendify-agent-tour';
19 if (document.getElementById(tourId)) return;
20 const tour = Object.assign(document.createElement('div'), {
21 className: 'extendify-agent-tour',
22 id: tourId,
23 });
24 render(<GuidedTour />, tour);
25
26 const bg =
27 // admin area
28 document.getElementById('wpwrap') ||
29 // TODO: is this on all block themes?
30 document.querySelector('.wp-site-blocks');
31 if (isOnLaunch() || !bg) return;
32 const id = 'extendify-agent-main';
33 if (document.getElementById(id)) return;
34 const agent = Object.assign(document.createElement('div'), {
35 className: 'extendify-agent',
36 id,
37 });
38 document.body.appendChild(agent);
39 render(<Agent />, agent);
40
41 // Runs when extendify-launch-success is in the url
42 if (window.extAgentData?.startOnboarding) {
43 requestAnimationFrame(() => {
44 throwSideConfetti();
45 });
46 }
47 });
48