@asgardeo/react
Version:
React implementation of Asgardeo JavaScript SDK.
68 lines (67 loc) • 2.37 kB
TypeScript
/**
* 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 { FC, ReactElement } from 'react';
import { BaseCreateOrganizationProps } from './BaseCreateOrganization';
import { CreateOrganizationPayload } from '@asgardeo/browser';
/**
* Props interface for the CreateOrganization component.
*/
export interface CreateOrganizationProps extends Omit<BaseCreateOrganizationProps, 'onSubmit' | 'loading' | 'error'> {
/**
* Fallback element to render when the user is not signed in.
*/
fallback?: ReactElement;
/**
* Custom organization creation handler (will use default API if not provided).
*/
onCreateOrganization?: (payload: CreateOrganizationPayload) => Promise<any>;
}
/**
* CreateOrganization component that provides organization creation functionality.
* This component automatically integrates with the Asgardeo and Organization contexts.
*
* @example
* ```tsx
* import { CreateOrganization } from '@asgardeo/react';
*
* // Basic usage - uses default API and contexts
* <CreateOrganization
* onSuccess={(org) => console.log('Created:', org)}
* onCancel={() => navigate('/organizations')}
* />
*
* // With custom organization creation handler
* <CreateOrganization
* onCreateOrganization={async (payload) => {
* const result = await myCustomAPI.createOrganization(payload);
* return result;
* }}
* onSuccess={(org) => {
* console.log('Organization created:', org.name);
* // Custom success logic here
* }}
* />
*
* // With fallback for unauthenticated users
* <CreateOrganization
* fallback={<div>Please sign in to create an organization</div>}
* />
* ```
*/
export declare const CreateOrganization: FC<CreateOrganizationProps>;
export default CreateOrganization;