mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-21 12:16:59 +08:00
* [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>
127 lines
3.6 KiB
JavaScript
127 lines
3.6 KiB
JavaScript
import InfoCircleIcon from '@elementor/icons/InfoCircleIcon';
|
||
import Box from '@elementor/ui/Box';
|
||
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 FormControlLabel from '@elementor/ui/FormControlLabel';
|
||
import Infotip from '@elementor/ui/Infotip';
|
||
import Switch from '@elementor/ui/Switch';
|
||
import Typography from '@elementor/ui/Typography';
|
||
import { mixpanelEvents, mixpanelService } from '@ea11y-apps/global/services';
|
||
import { __ } from '@wordpress/i18n';
|
||
import { useAnalyticsContext } from '../../contexts/analytics-context';
|
||
|
||
export const AnalyticsToggle = () => {
|
||
const {
|
||
isAnalyticsEnabled,
|
||
handleAnalyticsToggle,
|
||
updateIsAnalyticsEnabled,
|
||
showConfirmPopup,
|
||
setShowConfirmPopup,
|
||
} = useAnalyticsContext();
|
||
|
||
const handleToggleClick = () => {
|
||
handleAnalyticsToggle();
|
||
};
|
||
|
||
const handleClose = () => {
|
||
setShowConfirmPopup(false);
|
||
|
||
mixpanelService.sendEvent(mixpanelEvents.popupButtonClicked, {
|
||
data: {
|
||
popupType: 'analytics_confirm',
|
||
buttonName: 'Not now',
|
||
},
|
||
});
|
||
};
|
||
|
||
const handleConfirm = () => {
|
||
updateIsAnalyticsEnabled();
|
||
setShowConfirmPopup(false);
|
||
|
||
mixpanelService.sendEvent(mixpanelEvents.popupButtonClicked, {
|
||
data: {
|
||
popupType: 'analytics_confirm',
|
||
buttonName: 'Confirm',
|
||
},
|
||
});
|
||
};
|
||
|
||
return (
|
||
<>
|
||
<FormControlLabel
|
||
control={
|
||
<Switch
|
||
color="info"
|
||
checked={isAnalyticsEnabled}
|
||
onChange={handleToggleClick}
|
||
sx={{ ml: 2 }}
|
||
/>
|
||
}
|
||
label={
|
||
<Box display="flex" alignItems="center" gap={1}>
|
||
<Typography variant="body1">
|
||
{__('Track widget data', 'pojo-accessibility')}
|
||
</Typography>
|
||
|
||
<Infotip
|
||
content={
|
||
<Typography variant="body1" sx={{ p: 2, maxWidth: '300px' }}>
|
||
{__(
|
||
"Enable to track widget data, feature usage, user insights and more to improve your website's accessibility.",
|
||
'pojo-accessibility',
|
||
)}
|
||
</Typography>
|
||
}
|
||
>
|
||
<InfoCircleIcon fontSize="small" />
|
||
</Infotip>
|
||
</Box>
|
||
}
|
||
labelPlacement="start"
|
||
sx={{ ml: 0 }}
|
||
/>
|
||
<Dialog
|
||
open={showConfirmPopup}
|
||
onClose={handleClose}
|
||
aria-labelledby="confirm-enable-analytics-title"
|
||
aria-describedby="confirm-enable-analytics-description"
|
||
>
|
||
<DialogHeader logo={false}>
|
||
<DialogTitle>
|
||
{__('Enable widget tracking?', 'pojo-accessibility')}
|
||
</DialogTitle>
|
||
</DialogHeader>
|
||
<DialogContent
|
||
sx={{ gap: 2, display: 'flex', flexDirection: 'column' }}
|
||
>
|
||
<DialogContentText id="confirm-enable-analytics-description">
|
||
{__(
|
||
'This allows Ally to record how visitors open and use your accessibility widget, unlocking real‑time analytics.',
|
||
'pojo-accessibility',
|
||
)}
|
||
</DialogContentText>
|
||
<DialogContentText id="confirm-enable-analytics-description">
|
||
{__(
|
||
'This may slightly affect performance on high‑traffic sites.',
|
||
'pojo-accessibility',
|
||
)}
|
||
</DialogContentText>
|
||
</DialogContent>
|
||
|
||
<DialogActions>
|
||
<Button onClick={handleClose} color="secondary">
|
||
{__('Not now', 'pojo-accessibility')}
|
||
</Button>
|
||
<Button onClick={handleConfirm} variant="contained" color="primary">
|
||
{__('Confirm & enable', 'pojo-accessibility')}
|
||
</Button>
|
||
</DialogActions>
|
||
</Dialog>
|
||
</>
|
||
);
|
||
};
|