@asgardeo/react 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/AsgardeoReactClient.d.ts +13 -5
  2. package/dist/__temp__/api.d.ts +11 -5
  3. package/dist/__temp__/models.d.ts +3 -3
  4. package/dist/api/createOrganization.d.ts +81 -0
  5. package/dist/api/getAllOrganizations.d.ts +73 -0
  6. package/dist/api/getMeOrganizations.d.ts +77 -0
  7. package/dist/api/getOrganization.d.ts +69 -0
  8. package/dist/api/getSchemas.d.ts +67 -0
  9. package/dist/api/getScim2Me.d.ts +67 -0
  10. package/dist/api/updateMeProfile.d.ts +55 -0
  11. package/dist/api/updateOrganization.d.ts +76 -0
  12. package/dist/cjs/index.js +9685 -17275
  13. package/dist/cjs/index.js.map +4 -4
  14. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +5 -5
  15. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +5 -5
  16. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +5 -5
  17. package/dist/components/control/AsgardeoLoading.d.ts +47 -0
  18. package/dist/components/control/SignedIn.d.ts +2 -0
  19. package/dist/components/control/SignedOut.d.ts +2 -0
  20. package/dist/components/factories/FieldFactory.d.ts +6 -11
  21. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
  22. package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
  23. package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
  24. package/dist/components/presentation/Organization/Organization.d.ts +66 -0
  25. package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
  26. package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
  27. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
  28. package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
  29. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
  30. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
  31. package/dist/components/presentation/SignIn/BaseSignIn.d.ts +31 -38
  32. package/dist/components/presentation/SignIn/SignIn.d.ts +3 -14
  33. package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +4 -4
  34. package/dist/components/presentation/SignIn/types.d.ts +6 -6
  35. package/dist/components/presentation/SignUp/BaseSignUp.d.ts +126 -0
  36. package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
  37. package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
  38. package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
  39. package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
  40. package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
  41. package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
  42. package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
  43. package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
  44. package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
  45. package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
  46. package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
  47. package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
  48. package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
  49. package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
  50. package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
  51. package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
  52. package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
  53. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
  54. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
  55. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +17 -15
  56. package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
  57. package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
  58. package/dist/components/primitives/Card/Card.d.ts +8 -9
  59. package/dist/components/primitives/Divider/Divider.d.ts +8 -8
  60. package/dist/components/primitives/Icons/Building.d.ts +40 -0
  61. package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
  62. package/dist/components/primitives/Icons/Check.d.ts +40 -0
  63. package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
  64. package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
  65. package/dist/components/primitives/Icons/Plus.d.ts +23 -0
  66. package/dist/components/primitives/Icons/Settings.d.ts +0 -0
  67. package/dist/components/primitives/Icons/User.d.ts +23 -0
  68. package/dist/components/primitives/Icons/X.d.ts +23 -0
  69. package/dist/components/primitives/Icons/index.d.ts +27 -0
  70. package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
  71. package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
  72. package/dist/components/primitives/Popover/Popover.d.ts +19 -19
  73. package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +7 -2
  74. package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
  75. package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
  76. package/dist/contexts/Organization/useOrganization.d.ts +104 -0
  77. package/dist/contexts/Theme/types.d.ts +38 -9
  78. package/dist/contexts/User/UserContext.d.ts +3 -2
  79. package/dist/contexts/User/UserProvider.d.ts +2 -1
  80. package/dist/hooks/useForm.d.ts +52 -52
  81. package/dist/index.d.ts +53 -1
  82. package/dist/index.js +9725 -17303
  83. package/dist/index.js.map +4 -4
  84. package/package.json +1 -1
  85. package/dist/api/scim2/getMeProfile.d.ts +0 -39
  86. package/dist/api/scim2/getSchemas.d.ts +0 -39
  87. package/dist/api/scim2/updateMeProfile.d.ts +0 -38
@@ -15,20 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
19
18
  import { WithPreferences } from '@asgardeo/browser';
19
+ import { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
20
20
  /**
21
21
  * Common props shared by all {@link BaseSignInButton} components.
22
22
  */
23
23
  export interface CommonBaseSignInButtonProps {
24
- /**
25
- * Function to initiate the sign-in process
26
- */
27
- signIn: () => Promise<void>;
28
24
  /**
29
25
  * Loading state during sign-in process
30
26
  */
31
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-in process
30
+ */
31
+ signIn: () => Promise<void>;
32
32
  }
33
33
  /**
34
34
  * Props passed to the render function of {@link BaseSignInButton}
@@ -15,20 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
19
18
  import { WithPreferences } from '@asgardeo/browser';
19
+ import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
20
20
  /**
21
21
  * Common props shared by all {@link BaseSignOutButton} components.
22
22
  */
23
23
  export interface CommonBaseSignOutButtonProps {
24
- /**
25
- * Function to initiate the sign-out process
26
- */
27
- signOut: () => Promise<void>;
28
24
  /**
29
25
  * Loading state during sign-out process
30
26
  */
31
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-out process
30
+ */
31
+ signOut: () => Promise<void>;
32
32
  }
33
33
  /**
34
34
  * Props passed to the render function of {@link BaseSignOutButton}
@@ -15,20 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
19
18
  import { WithPreferences } from '@asgardeo/browser';
19
+ import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
20
20
  /**
21
21
  * Common props shared by all {@link BaseSignUpButton} components.
22
22
  */
23
23
  export interface CommonBaseSignUpButtonProps {
24
- /**
25
- * Function to initiate the sign-up process
26
- */
27
- signUp?: () => Promise<void>;
28
24
  /**
29
25
  * Loading state during sign-up process
30
26
  */
31
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-up process
30
+ */
31
+ signUp?: () => Promise<void>;
32
32
  }
33
33
  /**
34
34
  * Props passed to the render function of {@link BaseSignUpButton}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { FC, PropsWithChildren, ReactNode } from 'react';
19
+ /**
20
+ * Props for the Loading component.
21
+ */
22
+ export interface AsgardeoLoadingProps {
23
+ /**
24
+ * Content to show when the user is not signed in.
25
+ */
26
+ fallback?: ReactNode;
27
+ }
28
+ /**
29
+ * A component that only renders its children when the Asgardeo is loading.
30
+ *
31
+ * @remarks This component is only supported in browser based React applications (CSR).
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * import { AsgardeoLoading } from '@asgardeo/auth-react';
36
+ *
37
+ * const App = () => {
38
+ * return (
39
+ * <AsgardeoLoading fallback={<p>Finished Loading...</p>}>
40
+ * <p>Loading...</p>
41
+ * </AsgardeoLoading>
42
+ * );
43
+ * }
44
+ * ```
45
+ */
46
+ declare const AsgardeoLoading: FC<PropsWithChildren<AsgardeoLoadingProps>>;
47
+ export default AsgardeoLoading;
@@ -28,6 +28,8 @@ export interface SignedInProps {
28
28
  /**
29
29
  * A component that only renders its children when the user is signed in.
30
30
  *
31
+ * @remarks This component is only supported in browser based React applications (CSR).
32
+ *
31
33
  * @example
32
34
  * ```tsx
33
35
  * import { SignedIn } from '@asgardeo/auth-react';
@@ -28,6 +28,8 @@ export interface SignedOutProps {
28
28
  /**
29
29
  * A component that only renders its children when the user is signed out.
30
30
  *
31
+ * @remarks This component is only supported in browser based React applications (CSR).
32
+ *
31
33
  * @example
32
34
  * ```tsx
33
35
  * import { SignedOut } from '@asgardeo/auth-react';
@@ -22,9 +22,12 @@ import { FieldType } from '@asgardeo/browser';
22
22
  * Interface for field configuration.
23
23
  */
24
24
  export interface FieldConfig {
25
+ /**
26
+ * The name of the field.
27
+ */
25
28
  name: string;
26
29
  /**
27
- * The field type based on ApplicationNativeAuthenticationAuthenticatorParamType.
30
+ * The field type.
28
31
  */
29
32
  type: FieldType;
30
33
  /**
@@ -68,20 +71,12 @@ export interface FieldConfig {
68
71
  */
69
72
  placeholder?: string;
70
73
  }
71
- /**
72
- * Utility function to parse multi-valued string into array
73
- */
74
- export declare const parseMultiValuedString: (value: string) => string[];
75
- /**
76
- * Utility function to format array into multi-valued string
77
- */
78
- export declare const formatMultiValuedString: (values: string[]) => string;
79
74
  /**
80
75
  * Utility function to validate field values based on type
81
76
  */
82
77
  export declare const validateFieldValue: (value: string, type: FieldType, required?: boolean, touched?: boolean) => string | null;
83
78
  /**
84
- * Factory function to create form fields based on the ApplicationNativeAuthenticationAuthenticatorParamType.
79
+ * Factory function to create form fields based on the EmbeddedSignInFlowAuthenticatorParamType.
85
80
  *
86
81
  * @param config - The field configuration
87
82
  * @returns The appropriate React component for the field type
@@ -90,7 +85,7 @@ export declare const validateFieldValue: (value: string, type: FieldType, requir
90
85
  * ```tsx
91
86
  * const field = createField({
92
87
  * param: 'username',
93
- * type: ApplicationNativeAuthenticationAuthenticatorParamType.String,
88
+ * type: EmbeddedSignInFlowAuthenticatorParamType.String,
94
89
  * label: 'Username',
95
90
  * confidential: false,
96
91
  * required: true,
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { CreateOrganizationPayload } from '@asgardeo/browser';
19
+ import { CSSProperties, FC, ReactNode } from 'react';
20
+ /**
21
+ * Interface for organization form data.
22
+ */
23
+ export interface OrganizationFormData {
24
+ description: string;
25
+ handle: string;
26
+ name: string;
27
+ }
28
+ /**
29
+ * Props interface for the BaseCreateOrganization component.
30
+ */
31
+ export interface BaseCreateOrganizationProps {
32
+ cardLayout?: boolean;
33
+ className?: string;
34
+ defaultParentId?: string;
35
+ error?: string | null;
36
+ initialValues?: Partial<OrganizationFormData>;
37
+ loading?: boolean;
38
+ mode?: 'inline' | 'popup';
39
+ onCancel?: () => void;
40
+ onOpenChange?: (open: boolean) => void;
41
+ onSubmit?: (payload: CreateOrganizationPayload) => void | Promise<void>;
42
+ onSuccess?: (organization: any) => void;
43
+ open?: boolean;
44
+ renderAdditionalFields?: () => ReactNode;
45
+ style?: CSSProperties;
46
+ title?: string;
47
+ }
48
+ /**
49
+ * BaseCreateOrganization component provides the core functionality for creating organizations.
50
+ * This component serves as the base for framework-specific implementations.
51
+ */
52
+ export declare const BaseCreateOrganization: FC<BaseCreateOrganizationProps>;
53
+ export default BaseCreateOrganization;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { FC, ReactElement } from 'react';
19
+ import { BaseCreateOrganizationProps } from './BaseCreateOrganization';
20
+ import { CreateOrganizationPayload } from '@asgardeo/browser';
21
+ /**
22
+ * Props interface for the CreateOrganization component.
23
+ */
24
+ export interface CreateOrganizationProps extends Omit<BaseCreateOrganizationProps, 'onSubmit' | 'loading' | 'error'> {
25
+ /**
26
+ * Fallback element to render when the user is not signed in.
27
+ */
28
+ fallback?: ReactElement;
29
+ /**
30
+ * Custom organization creation handler (will use default API if not provided).
31
+ */
32
+ onCreateOrganization?: (payload: CreateOrganizationPayload) => Promise<any>;
33
+ }
34
+ /**
35
+ * CreateOrganization component that provides organization creation functionality.
36
+ * This component automatically integrates with the Asgardeo and Organization contexts.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * import { CreateOrganization } from '@asgardeo/react';
41
+ *
42
+ * // Basic usage - uses default API and contexts
43
+ * <CreateOrganization
44
+ * onSuccess={(org) => console.log('Created:', org)}
45
+ * onCancel={() => navigate('/organizations')}
46
+ * />
47
+ *
48
+ * // With custom organization creation handler
49
+ * <CreateOrganization
50
+ * onCreateOrganization={async (payload) => {
51
+ * const result = await myCustomAPI.createOrganization(payload);
52
+ * return result;
53
+ * }}
54
+ * onSuccess={(org) => {
55
+ * console.log('Organization created:', org.name);
56
+ * // Custom success logic here
57
+ * }}
58
+ * />
59
+ *
60
+ * // With fallback for unauthenticated users
61
+ * <CreateOrganization
62
+ * fallback={<div>Please sign in to create an organization</div>}
63
+ * />
64
+ * ```
65
+ */
66
+ export declare const CreateOrganization: FC<CreateOrganizationProps>;
67
+ export default CreateOrganization;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Organization as IOrganization } from '@asgardeo/browser';
19
+ import { FC, ReactNode } from 'react';
20
+ /**
21
+ * Props for the BaseOrganization component.
22
+ */
23
+ export interface BaseOrganizationProps {
24
+ /**
25
+ * Render prop that takes the organization object and returns a ReactNode.
26
+ * @param organization - The organization object from Asgardeo.
27
+ * @returns A ReactNode to render.
28
+ */
29
+ children: (organization: IOrganization | null) => ReactNode;
30
+ /**
31
+ * Optional element to render when no organization is provided.
32
+ */
33
+ fallback?: ReactNode;
34
+ /**
35
+ * The organization object to display. If not provided, the component will render the fallback.
36
+ */
37
+ organization: IOrganization | null;
38
+ }
39
+ /**
40
+ * Base Organization component that provides the core functionality for displaying organization information.
41
+ * This component takes an organization object as a prop and uses render props to expose it.
42
+ *
43
+ * @remarks This is the base component that can be used in any context where you have
44
+ * an organization object available. For React applications, use the Organization component which
45
+ * automatically retrieves the current organization from Organization context.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * import { BaseOrganization } from '@asgardeo/auth-react';
50
+ *
51
+ * const MyComponent = ({ organization }) => {
52
+ * return (
53
+ * <BaseOrganization organization={organization} fallback={<p>No organization data</p>}>
54
+ * {(org) => (
55
+ * <div>
56
+ * <h1>Organization: {org.name}</h1>
57
+ * <p>ID: {org.id}</p>
58
+ * </div>
59
+ * )}
60
+ * </BaseOrganization>
61
+ * );
62
+ * }
63
+ * ```
64
+ */
65
+ declare const BaseOrganization: FC<BaseOrganizationProps>;
66
+ export default BaseOrganization;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Organization as IOrganization } from '@asgardeo/browser';
19
+ import { FC, ReactNode } from 'react';
20
+ import { BaseOrganizationProps } from './BaseOrganization';
21
+ /**
22
+ * Props for the Organization component.
23
+ * Extends BaseOrganizationProps but makes the organization prop optional since it will be obtained from useOrganization
24
+ */
25
+ export interface OrganizationProps extends Omit<BaseOrganizationProps, 'organization'> {
26
+ /**
27
+ * Render prop that takes the organization object and returns a ReactNode.
28
+ * @param organization - The current organization object from Organization context.
29
+ * @returns A ReactNode to render.
30
+ */
31
+ children: (organization: IOrganization | null) => ReactNode;
32
+ /**
33
+ * Optional element to render when no organization is selected.
34
+ */
35
+ fallback?: ReactNode;
36
+ }
37
+ /**
38
+ * A component that uses render props to expose the current organization object.
39
+ * This component automatically retrieves the current organization from Organization context.
40
+ *
41
+ * @remarks This component is only supported in browser based React applications (CSR).
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * import { Organization } from '@asgardeo/auth-react';
46
+ *
47
+ * const App = () => {
48
+ * return (
49
+ * <Organization fallback={<p>No organization selected</p>}>
50
+ * {(organization) => (
51
+ * <div>
52
+ * <h1>Current Organization: {organization.name}!</h1>
53
+ * <p>ID: {organization.id}</p>
54
+ * <p>Role: {organization.role}</p>
55
+ * {organization.memberCount && (
56
+ * <p>Members: {organization.memberCount}</p>
57
+ * )}
58
+ * </div>
59
+ * )}
60
+ * </Organization>
61
+ * );
62
+ * }
63
+ * ```
64
+ */
65
+ declare const Organization: FC<OrganizationProps>;
66
+ export default Organization;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { FC, ReactNode } from 'react';
19
+ import { OrganizationWithSwitchAccess } from '../../../contexts/Organization/OrganizationContext';
20
+ /**
21
+ * Props interface for the BaseOrganizationList component.
22
+ */
23
+ export interface BaseOrganizationListProps {
24
+ /**
25
+ * Additional CSS class names to apply to the container
26
+ */
27
+ className?: string;
28
+ /**
29
+ * List of organizations with switch access information
30
+ */
31
+ data: OrganizationWithSwitchAccess[];
32
+ /**
33
+ * Error message to display
34
+ */
35
+ error?: string | null;
36
+ /**
37
+ * Function called when "Load More" is clicked
38
+ */
39
+ fetchMore?: () => Promise<void>;
40
+ /**
41
+ * Whether there are more organizations to load
42
+ */
43
+ hasMore?: boolean;
44
+ /**
45
+ * Whether the initial data is loading
46
+ */
47
+ isLoading?: boolean;
48
+ /**
49
+ * Whether more data is being loaded
50
+ */
51
+ isLoadingMore?: boolean;
52
+ /**
53
+ * Function called when refresh is requested
54
+ */
55
+ onRefresh?: () => Promise<void>;
56
+ /**
57
+ * Custom renderer for when no organizations are found
58
+ */
59
+ renderEmpty?: () => ReactNode;
60
+ /**
61
+ * Custom renderer for the error state
62
+ */
63
+ renderError?: (error: string) => ReactNode;
64
+ /**
65
+ * Custom renderer for the load more button
66
+ */
67
+ renderLoadMore?: (onLoadMore: () => Promise<void>, isLoading: boolean) => ReactNode;
68
+ /**
69
+ * Custom renderer for the loading state
70
+ */
71
+ renderLoading?: () => ReactNode;
72
+ /**
73
+ * Custom renderer for each organization item
74
+ */
75
+ renderOrganization?: (organization: OrganizationWithSwitchAccess, index: number) => ReactNode;
76
+ /**
77
+ * Inline styles to apply to the container
78
+ */
79
+ style?: React.CSSProperties;
80
+ /**
81
+ * Total number of organizations
82
+ */
83
+ totalCount?: number;
84
+ /**
85
+ * Display mode: 'inline' for normal display, 'popup' for modal dialog
86
+ */
87
+ mode?: 'inline' | 'popup';
88
+ /**
89
+ * Function called when popup open state changes (only used in popup mode)
90
+ */
91
+ onOpenChange?: (open: boolean) => void;
92
+ /**
93
+ * Whether the popup is open (only used in popup mode)
94
+ */
95
+ open?: boolean;
96
+ /**
97
+ * Title for the popup dialog (only used in popup mode)
98
+ */
99
+ title?: string;
100
+ }
101
+ /**
102
+ * BaseOrganizationList component displays a list of organizations with pagination support.
103
+ * This component serves as the base for framework-specific implementations.
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * <BaseOrganizationList
108
+ * data={organizations}
109
+ * isLoading={isLoading}
110
+ * hasMore={hasMore}
111
+ * fetchMore={fetchMore}
112
+ * error={error}
113
+ * />
114
+ * ```
115
+ */
116
+ export declare const BaseOrganizationList: FC<BaseOrganizationListProps>;
117
+ export default BaseOrganizationList;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { FC } from 'react';
19
+ import { BaseOrganizationListProps } from './BaseOrganizationList';
20
+ import { OrganizationWithSwitchAccess } from '../../../contexts/Organization/OrganizationContext';
21
+ /**
22
+ * Configuration options for the OrganizationList component.
23
+ */
24
+ export interface OrganizationListConfig {
25
+ /**
26
+ * Whether to automatically fetch organizations on mount
27
+ */
28
+ autoFetch?: boolean;
29
+ /**
30
+ * Filter string for organizations
31
+ */
32
+ filter?: string;
33
+ /**
34
+ * Number of organizations to fetch per page
35
+ */
36
+ limit?: number;
37
+ /**
38
+ * Whether to include recursive organizations
39
+ */
40
+ recursive?: boolean;
41
+ }
42
+ /**
43
+ * Props interface for the OrganizationList component.
44
+ * Uses the enhanced OrganizationContext instead of the useOrganizations hook.
45
+ */
46
+ export interface OrganizationListProps extends Omit<BaseOrganizationListProps, 'data' | 'error' | 'fetchMore' | 'hasMore' | 'isLoading' | 'isLoadingMore' | 'totalCount'>, OrganizationListConfig {
47
+ /**
48
+ * Function called when an organization is selected/clicked
49
+ */
50
+ onOrganizationSelect?: (organization: OrganizationWithSwitchAccess) => void;
51
+ }
52
+ /**
53
+ * OrganizationList component that provides organization listing functionality with pagination.
54
+ * This component uses the enhanced OrganizationContext, eliminating the polling issue and
55
+ * providing better integration with the existing context system.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * import { OrganizationList } from '@asgardeo/react';
60
+ *
61
+ * // Basic usage
62
+ * <OrganizationList />
63
+ *
64
+ * // With custom limit and filter
65
+ * <OrganizationList
66
+ * limit={20}
67
+ * filter="active"
68
+ * onOrganizationSelect={(org) => {
69
+ * console.log('Selected organization:', org.name);
70
+ * }}
71
+ * />
72
+ *
73
+ * // As a popup dialog
74
+ * <OrganizationList
75
+ * mode="popup"
76
+ * open={isOpen}
77
+ * onOpenChange={setIsOpen}
78
+ * title="Select Organization"
79
+ * />
80
+ *
81
+ * // With custom organization renderer
82
+ * <OrganizationList
83
+ * renderOrganization={(org) => (
84
+ * <div key={org.id}>
85
+ * <h3>{org.name}</h3>
86
+ * <p>Can switch: {org.canSwitch ? 'Yes' : 'No'}</p>
87
+ * </div>
88
+ * )}
89
+ * />
90
+ * ```
91
+ */
92
+ export declare const OrganizationList: FC<OrganizationListProps>;
93
+ export default OrganizationList;