/** * WordPress dependencies */ import { CheckboxControl, ExternalLink } from '@safe-wordpress/components'; import { createInterpolateElement, useEffect } from '@safe-wordpress/element'; import { _x, sprintf } from '@safe-wordpress/i18n'; /** * Internal dependencies */ import './style.scss'; import { useAttributes } from '../hooks'; import { DEFAULT_ATTRS } from './config'; import type { FieldSettingProps } from '../types'; const INCOMPATIBLE_SETTINGS = [ 'match_all_segments', 'preload_query_args' ]; const PARTICIPATION_SETTINGS = [ 'exclude_bots', 'percentage_of_tested_visitors', ]; export const AlternativeLoadingSetting = ( { name: settingName, disabled, }: FieldSettingProps ): JSX.Element => { const [ attributes, setAttributes ] = useAttributes( settingName, DEFAULT_ATTRS ); useEffect( () => { INCOMPATIBLE_SETTINGS.forEach( attributes.mode === 'cookie' ? lock : unlock ); PARTICIPATION_SETTINGS.forEach( attributes.mode === 'cookie' && attributes.lockParticipationSettings ? lock : unlock ); }, [ attributes ] ); return (
nabAlternative'
),
_x( 'Read moreā¦', 'user', 'nelio-ab-testing' )
),
{
code: ,
link: (
// @ts-expect-error Link text will be added later.