| 1 |
import { render } from '@wordpress/element' |
| 2 |
import { AssistLandingPage } from '@assist/AssistLandingPage' |
| 3 |
import { AdminNotice } from '@assist/components/AdminNotice' |
| 4 |
|
| 5 |
// Disable Assist while Launch is running |
| 6 |
const q = new URLSearchParams(window.location.search) |
| 7 |
const launchActive = ['onboarding'].includes(q.get('extendify')) |
| 8 |
const launchCompleted = window.extAssistData.launchCompleted |
| 9 |
const devbuild = window.extAssistData.devbuild |
| 10 |
|
| 11 |
const assistPage = document.getElementById('extendify-assist-landing-page') |
| 12 |
const dashboard = document.getElementById('dashboard-widgets-wrap') |
| 13 |
|
| 14 |
// Assist landing page |
| 15 |
if (!launchActive && assistPage) { |
| 16 |
render(<AssistLandingPage />, assistPage) |
| 17 |
} |
| 18 |
|
| 19 |
// Launch admin notice - show on devmode too |
| 20 |
if (dashboard && (!launchCompleted || devbuild)) { |
| 21 |
const launchAdminNotice = Object.assign(document.createElement('div'), { |
| 22 |
className: 'extendify-assist', |
| 23 |
}) |
| 24 |
// Hide the welcome notice if we are going to display ours |
| 25 |
document.getElementById('welcome-panel')?.remove() |
| 26 |
dashboard.before(launchAdminNotice) |
| 27 |
render(<AdminNotice />, launchAdminNotice) |
| 28 |
} |
| 29 |
|