/**
 * Copyright © 2021 Johnson & Johnson
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ import React , { useContext , ComponentType } from 'react' ; import { AuthContextProps , SignOutRedirectArgs , SigninRedirectArgs } from './types' ; private see AuthContextProps export const AuthContext = React . createContext < AuthContextProps | undefined > ( undefined ) ; see AuthContextProps export const useBodilessOidc = ( ) => useContext ( AuthContext ) ! ; param args see SigninRedirectArgs export const withSignInOnClick = ( args ? ) => ( Component ) => ( props ) => { const { signIn } = useBodilessOidc ( ) ; return < Component { ... props } onClick = { ( ) => signIn ( args ) } />; } ; see AuthContextProps export const withSignOutOnClick = ( Component ) => ( props ) => { const { signOut } = useBodilessOidc ( ) ; return < Component { ... props } onClick = { signOut } / > ; } ; see AuthContextProps export const withSignInPopupOnClick = ( Component ) => ( props ) => { const { signInPopup } = useBodilessOidc ( ) ; return < Component { ... props } onClick = { signInPopup } / > ; } ; param args see SignOutRedirectArgs export const withSignOutRedirectOnClick = ( args ? ) => ( Component ) => ( props ) => { const { signOutRedirect } = useBodilessOidc ( ) ; return < Component { ... props } onClick = { ( ) => signOutRedirect ( args ) } />; } ;