/** * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you 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 { OrganizationContextProps } from './OrganizationContext'; /** * Hook to access the Organization context. * * This hook provides access to organization data including: * - List of organizations the user belongs to * - Current organization * - Functions to switch organizations and refresh data * - Function to fetch organizations programmatically * - Loading states and error handling * * @returns {OrganizationContextProps} The organization context value containing all organization-related data and functions * @throws {Error} Throws an error if used outside of OrganizationProvider * * @example * ```tsx * import {useOrganization} from '@asgardeo/react'; * * function OrganizationSelector() { * const { * organizations, * currentOrganization, * switchOrganization, * revalidateMyOrganizations, * getOrganizations, * isLoading, * error * } = useOrganization(); * * if (isLoading) { * return
Loading organizations...
; * } * * if (error) { * return
Error: {error}
; * } * * return ( *
*

Current: {currentOrganization?.name}

* * * *
* ); * } * * // Switch to a specific organization * function SwitchOrgButton() { * const {organizations, switchOrganization} = useOrganization(); * * const handleSwitch = (orgId: string) => { * const org = organizations?.find(o => o.id === orgId); * if (org) { * switchOrganization(org); * } * }; * * return ( * * ); * } * ``` */ declare const useOrganization: () => OrganizationContextProps; export default useOrganization; //# sourceMappingURL=useOrganization.d.ts.map