/** * WordPress dependencies */ import { dispatch } from '@wordpress/data'; /** * Internal dependencies */ import { initChecker } from './components'; import { addListeners } from './listeners'; import { initLocalStorageSyncher } from './local-storage'; import { store as NAB_CHECKER } from './store'; import { isReachable } from './utils'; import type { Settings } from '../public/types'; initLocalStorageSyncher(); initChecker(); void dispatch( NAB_CHECKER ).addNewPage( document.location.href ); void dispatch( NAB_CHECKER ).setSettings( // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access ( ( window as any ).nabSettings || {} ) as Partial< Settings > ); addListeners(); isReachable( 'https://api.nelioabtesting.com/v1/ping' ) .then( ( b ) => dispatch( NAB_CHECKER ).setCloudConnection( b ) ) .catch( () => dispatch( NAB_CHECKER ).setCloudConnection( false ) );