one-click-accessibility/modules/settings/assets/js/components/onboarding-modal/index.js
VasylD 9c9536cbeb
[APP-2130] add elementor one (#433)
* [APP-0000] add elementor one

* [APP-0000] add elementor one

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-0000] Add slug to the connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* Hide sidebar footer if Elementor One is connected

* fix: import errors on opening the scanner

* [APP-0000] Update connect config

* Update modules/settings/module.php

Co-authored-by: Rami Yushuvaev <92088692+rami-elementor@users.noreply.github.com>

* [APP-2270] Top bar implementation (#458)

* [APP-2270] Top bar implementation

* Update top bar title

* Update packages

* fix: env for top bar

* update: ally menu location

* Fix pointer

* Update

* Update

* Update

* Update

* Update

* Fix design saving

* Add missing pro icon to sidebar menu

* Sidebar icons sizes

* Fix link to "Manage subscription"

* fix: header name

* Update logo icon in the sidebar

* Remove logos from modal/dialog headers

* Update button colors

* Make the "Get started" modal dismissible

* Update crown icon

* Update

* Role attribute

* Update logo icon

* Update list item padding

* [APP-0000] Update connect config

* [ACD-7909] Enable Pro features on One

* Update menu order

* [ACD-7909] Enable Pro features on One

* [ACD-7909] Enable Pro features on One

* Hide pointers from Elementor One users

* [ACD-7909] Enable Pro features on One

* fix: don't show notices in some cases (#466)

* [ACD-7794] Fix subitem color and spacing, info and pro icon size (#464)

* fix: subitem color and spacing, info and pro icon size

* chore: update elementor-one-assets package to 0.4.16

* fix: PLG margin and button style issue (#463)

---------

Co-authored-by: Nirbhay Singh <nirbhayr@elementor.com>
Co-authored-by: vasyldinets <vasyld@elementor.red>
Co-authored-by: Nirbhay Singh <121793120+nirbhayel@users.noreply.github.com>

---------

Co-authored-by: Rami Yushuvaev <ramiy@elementor.com>
Co-authored-by: Nirbhay Singh <nirbhayr@elementor.com>
Co-authored-by: Rami Yushuvaev <92088692+rami-elementor@users.noreply.github.com>
Co-authored-by: Nirbhay Singh <121793120+nirbhayel@users.noreply.github.com>
2026-01-12 12:26:38 +01:00

109 lines
3.4 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Button from '@elementor/ui/Button';
import Dialog from '@elementor/ui/Dialog';
import DialogActions from '@elementor/ui/DialogActions';
import DialogContent from '@elementor/ui/DialogContent';
import DialogContentText from '@elementor/ui/DialogContentText';
import DialogHeader from '@elementor/ui/DialogHeader';
import DialogTitle from '@elementor/ui/DialogTitle';
import { useModal, useStorage } from '@ea11y/hooks';
import { mixpanelEvents, mixpanelService } from '@ea11y-apps/global/services';
import { useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { usePluginSettingsContext } from '../../contexts/plugin-settings';
const OnboardingModal = () => {
const { isOpen, close } = useModal();
const { save } = useStorage();
const { homeUrl, isConnected, closePostConnectModal, closeOnboardingModal } =
usePluginSettingsContext();
const [shouldShowModal, setShouldShowModal] = useState(false);
// Check if URL has source=admin_banner parameter
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
const source = urlParams.get('source');
setShouldShowModal(source === 'admin_banner');
}, []);
// Check if modal should be displayed based on all conditions
const shouldDisplayModal =
isOpen &&
shouldShowModal &&
isConnected &&
closePostConnectModal &&
!closeOnboardingModal;
useEffect(() => {
if (shouldDisplayModal) {
mixpanelService.sendEvent(mixpanelEvents.introductionBannerShowed, {
source: 'page_view',
});
}
}, [shouldDisplayModal]);
const onClose = async () => {
await save({
ea11y_close_onboarding_modal: true,
});
await mixpanelService.sendEvent(mixpanelEvents.introductionBannerClosed);
close();
};
return (
<Dialog
open={shouldDisplayModal}
onClose={onClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogHeader logo={false} onClose={onClose}>
<DialogTitle>
{__('Ally Accessibility', 'pojo-accessibility')}
</DialogTitle>
</DialogHeader>
<DialogContent dividers>
<iframe
width="550"
height="300"
src="https://www.youtube.com/embed/4Ct_6HAsBr8?si=NZsWyvjBxvSs45lL&amp;controls=0"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerPolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>
<DialogContentText variant="h5" color="text.primary" marginTop={2}>
{__('See Allys new assistant in action', 'pojo-accessibility')}
</DialogContentText>
<DialogContentText>
{__(
'Watch a quick demo to see how it works. Then launch your first scan to uncover issues and start improving your site.',
'pojo-accessibility',
)}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={onClose} color="secondary">
{__('Got it', 'pojo-accessibility')}
</Button>
<Button
href={`${homeUrl}?open-ea11y-assistant=1&open-ea11y-assistant-src=Ally_dashboard`}
target="_blank"
variant="contained"
color="primary"
onClick={() => {
mixpanelService.sendEvent(mixpanelEvents.scanHomePageButtonClicked);
onClose();
}}
>
{__('Scan my home page', 'pojo-accessibility')}
</Button>
</DialogActions>
</Dialog>
);
};
export default OnboardingModal;