import { InitAuth0 , SignInWithAuth0 } from './instance' ; import { GetAccessToken , GetSession } from './session' ; import { WithApiAuthRequired } from './helpers' ; import { HandleAuth , HandleCallback , HandleLogin , HandleLogout , HandleProfile } from './handlers' ; export { UserProvider , UserProviderProps , UserProfile , UserContext , useUser , withPageAuthRequired , WithPageAuthRequired } from './frontend' ; const serverSideOnly = ( method ) : string => `The ${ method } method can only be used from the server side` ; const instance = { getSession ( ) { throw new Error ( serverSideOnly ( 'getSession' ) ) ; } , getAccessToken ( ) { throw new Error ( serverSideOnly ( 'getAccessToken' ) ) ; } , withApiAuthRequired ( ) { throw new Error ( serverSideOnly ( 'withApiAuthRequired' ) ) ; } , handleLogin ( ) { throw new Error ( serverSideOnly ( 'handleLogin' ) ) ; } , handleLogout ( ) { throw new Error ( serverSideOnly ( 'handleLogout' ) ) ; } , handleCallback ( ) { throw new Error ( serverSideOnly ( 'handleCallback' ) ) ; } , handleProfile ( ) { throw new Error ( serverSideOnly ( 'handleProfile' ) ) ; } , handleAuth ( ) { throw new Error ( serverSideOnly ( 'handleAuth' ) ) ; } , withPageAuthRequired ( ) { throw new Error ( serverSideOnly ( 'withPageAuthRequired' ) ) ; } } ; export const initAuth0 = ( ) => instance ; export const getSession = ( ... args ) => instance . getSession ( ... args ) ; export const getAccessToken = ( ... args ) => instance . getAccessToken ( ... args ) ; export const withApiAuthRequired = ( ... args ) => instance . withApiAuthRequired ( ... args ) ; export const handleLogin = ( ... args ) => instance . handleLogin ( ... args ) ; export const handleLogout = ( ... args ) => instance . handleLogout ( ... args ) ; export const handleCallback = ( ... args ) => instance . handleCallback ( ... args ) ; export const handleProfile = ( ... args ) => instance . handleProfile ( ... args ) ; export const handleAuth = ( ... args ) => instance . handleAuth ( ... args ) ;