How to use the config.isEnabled function in config

To help you get started, we’ve selected a few config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / server / bundler / sections-loader.js View on Github external
include = include.split( ',' );
		}
		console.log( `[sections-loader] Limiting build to ${ include.join( ', ' ) } sections` );
		const allSections = sections;
		sections = allSections.filter( section => include.includes( section.name ) );
		if ( ! sections.length ) {
			// nothing matched. warn.
			console.warn( `[sections-loader] No sections matched ${ include.join( ',' ) }` );
			console.warn( `[sections-loader] Available sections are:` );
			printSectionsAndPaths( allSections );
		}
	}

	return addModuleImportToSections( {
		sections,
		shouldSplit: config.isEnabled( 'code-splitting' ) && ! forceRequire,
		onlyIsomorphic,
	} );
};
loader.addModuleImportToSections = addModuleImportToSections;
github Automattic / wp-calypso / client / components / domains / register-domain-step / index.jsx View on Github external
recordFiltersReset,
	recordFiltersSubmit,
	recordMapDomainButtonClick,
	recordSearchFormSubmit,
	recordSearchFormView,
	recordSearchResultsReceive,
	recordShowMoreResults,
	recordTransferDomainButtonClick,
	recordUseYourDomainButtonClick,
} from 'components/domains/register-domain-step/analytics';
import Spinner from 'components/spinner';

const debug = debugFactory( 'calypso:domains:register-domain-step' );

// TODO: Enable A/B test handling for M2.1 release
const isPaginationEnabled = config.isEnabled( 'domains/kracken-ui/pagination' );

const domains = wpcom.domains();

// max amount of domain suggestions we should fetch/display
const INITIAL_SUGGESTION_QUANTITY = 2;
const PAGE_SIZE = 10;
const MAX_PAGES = 3;
const SUGGESTION_QUANTITY = isPaginationEnabled ? PAGE_SIZE * MAX_PAGES : PAGE_SIZE;

const FEATURED_SUGGESTIONS_AT_TOP = [ 'group_7', 'group_8' ];
let searchVendor = 'domainsbot';

let searchQueue = [];
let searchStackTimer = null;
let lastSearchTimestamp = null;
let searchCount = 0;
github Automattic / wp-calypso / client / my-sites / importer / site-importer / site-importer-input-pane.jsx View on Github external
componentDidMount() {
		const { importStage } = this.props;
		if ( 'importable' === importStage ) {
			// Clear any leftover state from previous imports
			this.props.clearSiteImporterImport();
		}

		this.validateSite();

		if ( config.isEnabled( 'manage/import/site-importer-endpoints' ) ) {
			this.fetchEndpoints();
		}
	}
github Automattic / wp-calypso / server / pages / index.js View on Github external
const context = Object.assign( {}, request.context, {
		commitSha: process.env.hasOwnProperty( 'COMMIT_SHA' ) ? process.env.COMMIT_SHA : '(unknown)',
		compileDebug: process.env.NODE_ENV === 'development',
		user: false,
		env: calypsoEnv,
		sanitize: sanitize,
		isRTL: config( 'rtl' ),
		requestFrom: request.query.from,
		isWCComConnect,
		badge: false,
		lang,
		entrypoint: getFilesForEntrypoint( target, entrypoint ),
		manifest: getAssets( target ).manifests.manifest,
		faviconURL: config( 'favicon_url' ),
		isFluidWidth: !! config.isEnabled( 'fluid-width' ),
		abTestHelper: !! config.isEnabled( 'dev/test-helper' ),
		preferencesHelper: !! config.isEnabled( 'dev/preferences-helper' ),
		devDocsURL: '/devdocs',
		store: createReduxStore( initialServerState ),
		bodyClasses,
		addEvergreenCheck: target === 'evergreen' && calypsoEnv !== 'development',
		target: target || 'fallback',
	} );

	context.app = {
		// use ipv4 address when is ipv4 mapped address
		clientIp: request.ip ? request.ip.replace( '::ffff:', '' ) : request.ip,
		isDebug,
		staticUrls: staticFilesUrls,
	};
github Automattic / wp-calypso / client / extensions / woocommerce / state / sites / shipping-zone-methods / actions.js View on Github external
.then( data => {
			// Only need to check the feature flag. If WCS isn't enabled, no "wc_services_*" methods will be returned in the first place
			const wcsMethods = config.isEnabled( 'woocommerce/extension-wcservices' )
				? data.filter( ( { method_id } ) => startsWith( method_id, 'wc_services' ) )
				: [];
			wcsMethods.forEach( ( { id, method_id } ) =>
				dispatch( fetchShippingZoneMethodSettings( siteId, method_id, id ) )
			);
		} )
		.catch( err => {
github Automattic / wp-calypso / client / login / index.web.js View on Github external
export default router => {
	if ( config.isEnabled( 'login/magic-login' ) ) {
		router(
			`/log-in/link/use/${ lang }`,
			setUpLocale,
			setSection( LOGIN_SECTION_DEFINITION ),
			redirectLoggedIn,
			magicLoginUse,
			makeLoggedOutLayout
		);

		router(
			[ `/log-in/link/${ lang }`, `/log-in/jetpack/link/${ lang }` ],
			setUpLocale,
			setSection( LOGIN_SECTION_DEFINITION ),
			redirectLoggedIn,
			magicLogin,
			makeLoggedOutLayout
github Automattic / wp-calypso / client / components / domains / register-domain-step / index.jsx View on Github external
renderSearchFilters() {
		const isKrackenUi =
			config.isEnabled( 'domains/kracken-ui/dashes-filter' ) ||
			config.isEnabled( 'domains/kracken-ui/exact-match-filter' ) ||
			config.isEnabled( 'domains/kracken-ui/max-characters-filter' );
		const isRenderingInitialSuggestions =
			! Array.isArray( this.state.searchResults ) &&
			! this.state.loadingResults &&
			! this.props.showExampleSuggestions;
		const showFilters = isKrackenUi && ! isRenderingInitialSuggestions;
		return (
			showFilters && (
github Automattic / wp-calypso / client / blocks / inline-help / inline-help-query-support-types.jsx View on Github external
hasDataToDetermineVariation = () => {
		const ticketReadyOrError =
			this.props.ticketSupportConfigurationReady || this.props.ticketSupportRequestError !== null;
		const happychatReadyOrDisabled =
			! config.isEnabled( 'happychat' ) || this.props.isHappychatUserEligible !== null;

		return ticketReadyOrError && happychatReadyOrDisabled;
	};
github Automattic / wp-calypso / client / components / domains / search-filters / dropdown-filters.jsx View on Github external
renderPopover() {
		const {
			filters: { includeDashes, maxCharacters, exactSldMatchesOnly },
			popoverId,
			translate,
		} = this.props;

		const isDashesFilterEnabled = config.isEnabled( 'domains/kracken-ui/dashes-filter' );
		const isExactMatchFilterEnabled = config.isEnabled( 'domains/kracken-ui/exact-match-filter' );
		const isLengthFilterEnabled = config.isEnabled( 'domains/kracken-ui/max-characters-filter' );

		return (
			
				{ isLengthFilterEnabled && (
github Automattic / wp-calypso / client / my-sites / importer / jetpack-importer.jsx View on Github external
render() {
		if ( ! isEnabled( 'manage/import-to-jetpack' ) ) {
			return this.renderUnsupportedCard();
		}

		return (
			
				<h2>
					A8C NOTICE: Jetpack Importing is currently in development -- please use wp-admin / wp-cli
					tooling in the meantime
				</h2>
				<hr>
				{ ' would go here' }
				<hr>
				<div>@TODO URL Importer here</div>
				<hr>
				<div>@TODO Info / Icons for supported services here</div>