react-code-dataset / wp-calypso /client /lib /jetpack /wpcom-atomic-transfer.tsx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import { isEnabled } from '@automattic/calypso-config';
import BusinessATSwitch from 'calypso/components/jetpack/business-at-switch';
import { AtomicContentSwitch } from 'calypso/components/jetpack/wpcom-business-at';
import { isJetpackSite } from 'calypso/state/sites/selectors';
import { getSelectedSiteId } from 'calypso/state/ui/selectors';
import type { Context } from './types';
import type { ComponentType } from 'react';
export default function wpcomAtomicTransfer(
UpsellComponent: ComponentType,
content?: AtomicContentSwitch
): ( context: Context, next: () => void ) => void {
return ( context, next ) => {
const getState = context.store.getState;
const siteId = getSelectedSiteId( getState() );
const isJetpack = isJetpackSite( getState(), siteId );
if ( ! isJetpack && ! isEnabled( 'jetpack-cloud' ) && context.primary ) {
context.primary = (
<BusinessATSwitch UpsellComponent={ UpsellComponent } content={ content } />
);
}
next();
};
}