@asgardeo/react 0.3.0 → 0.5.0

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 (131) hide show
  1. package/README.md +5 -1
  2. package/dist/AsgardeoReactClient.d.ts +12 -4
  3. package/dist/__temp__/api.d.ts +26 -21
  4. package/dist/__temp__/models.d.ts +14 -22
  5. package/dist/api/scim2/createOrganization.d.ts +74 -0
  6. package/dist/api/scim2/getAllOrganizations.d.ts +56 -0
  7. package/dist/api/scim2/getMeOrganizations.d.ts +52 -0
  8. package/dist/api/scim2/getOrganization.d.ts +61 -0
  9. package/dist/api/scim2/updateOrganization.d.ts +74 -0
  10. package/dist/cjs/index.js +9863 -1190
  11. package/dist/cjs/index.js.map +4 -4
  12. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +7 -6
  13. package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
  14. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +7 -6
  15. package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
  16. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +6 -5
  17. package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -0
  18. package/dist/components/control/AsgardeoLoading.d.ts +45 -0
  19. package/dist/components/factories/FieldFactory.d.ts +107 -0
  20. package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
  21. package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
  22. package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
  23. package/dist/components/presentation/Organization/Organization.d.ts +66 -0
  24. package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
  25. package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
  26. package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
  27. package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
  28. package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
  29. package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
  30. package/dist/components/presentation/SignIn/BaseSignIn.d.ts +114 -0
  31. package/dist/components/presentation/SignIn/SignIn.d.ts +63 -0
  32. package/dist/components/presentation/SignIn/options/EmailOtp.d.ts +25 -0
  33. package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
  34. package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
  35. package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
  36. package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
  37. package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
  38. package/dist/components/presentation/SignIn/options/MicrosoftButton.d.ts +25 -0
  39. package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
  40. package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
  41. package/dist/components/presentation/SignIn/options/SignInWithEthereumButton.d.ts +25 -0
  42. package/dist/components/presentation/SignIn/options/SmsOtp.d.ts +25 -0
  43. package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
  44. package/dist/components/presentation/SignIn/options/Totp.d.ts +25 -0
  45. package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
  46. package/dist/components/presentation/SignIn/types.d.ts +124 -0
  47. package/dist/components/presentation/SignUp/BaseSignUp.d.ts +126 -0
  48. package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
  49. package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
  50. package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
  51. package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
  52. package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
  53. package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
  54. package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
  55. package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
  56. package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
  57. package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
  58. package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
  59. package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
  60. package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
  61. package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
  62. package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
  63. package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
  64. package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
  65. package/dist/components/presentation/User/BaseUser.d.ts +66 -0
  66. package/dist/components/presentation/{User.d.ts → User/User.d.ts} +9 -4
  67. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
  68. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
  69. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +34 -11
  70. package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
  71. package/dist/components/primitives/Alert/Alert.d.ts +74 -0
  72. package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
  73. package/dist/components/primitives/Button/Button.d.ts +83 -0
  74. package/dist/components/primitives/Card/Card.d.ts +132 -0
  75. package/dist/components/primitives/Checkbox/Checkbox.d.ts +1 -1
  76. package/dist/components/primitives/DatePicker/DatePicker.d.ts +1 -1
  77. package/dist/components/primitives/Divider/Divider.d.ts +58 -0
  78. package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
  79. package/dist/components/primitives/Icons/Building.d.ts +40 -0
  80. package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
  81. package/dist/components/primitives/Icons/Check.d.ts +40 -0
  82. package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
  83. package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
  84. package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
  85. package/dist/components/primitives/Icons/Eye.d.ts +23 -0
  86. package/dist/components/primitives/Icons/EyeOff.d.ts +23 -0
  87. package/dist/components/primitives/Icons/Info.d.ts +23 -0
  88. package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
  89. package/dist/components/primitives/Icons/Plus.d.ts +23 -0
  90. package/dist/components/primitives/Icons/Settings.d.ts +0 -0
  91. package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
  92. package/dist/components/primitives/Icons/User.d.ts +23 -0
  93. package/dist/components/primitives/Icons/X.d.ts +23 -0
  94. package/dist/components/primitives/Icons/index.d.ts +27 -0
  95. package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
  96. package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
  97. package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
  98. package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
  99. package/dist/components/primitives/PasswordField/PasswordField.d.ts +31 -0
  100. package/dist/components/primitives/Popover/Popover.d.ts +73 -36
  101. package/dist/components/primitives/Select/Select.d.ts +1 -1
  102. package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
  103. package/dist/components/primitives/TextField/TextField.d.ts +18 -2
  104. package/dist/components/primitives/Typography/Typography.d.ts +81 -0
  105. package/dist/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +3 -1
  106. package/dist/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +1 -1
  107. package/dist/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
  108. package/dist/contexts/Flow/FlowContext.d.ts +73 -0
  109. package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
  110. package/dist/contexts/Flow/useFlow.d.ts +48 -0
  111. package/dist/contexts/I18n/I18nContext.d.ts +42 -0
  112. package/dist/contexts/I18n/I18nProvider.d.ts +31 -0
  113. package/dist/contexts/I18n/useI18n.d.ts +27 -0
  114. package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
  115. package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
  116. package/dist/contexts/Organization/useOrganization.d.ts +104 -0
  117. package/dist/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
  118. package/dist/{theme → contexts/Theme}/types.d.ts +38 -9
  119. package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
  120. package/dist/contexts/User/UserContext.d.ts +33 -0
  121. package/dist/contexts/User/UserProvider.d.ts +56 -0
  122. package/dist/contexts/User/useUser.d.ts +94 -0
  123. package/dist/hooks/useForm.d.ts +192 -0
  124. package/dist/hooks/useTranslation.d.ts +52 -0
  125. package/dist/index.d.ts +133 -9
  126. package/dist/index.js +9949 -1203
  127. package/dist/index.js.map +4 -4
  128. package/dist/utils/getMappedUserProfileValue.d.ts +33 -1
  129. package/package.json +6 -5
  130. package/dist/utils/getUserProfile.d.ts +0 -59
  131. /package/dist/{theme → contexts/Theme}/ThemeContext.d.ts +0 -0
@@ -15,19 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ import { WithPreferences } from '@asgardeo/browser';
18
19
  import { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
19
20
  /**
20
21
  * Common props shared by all {@link BaseSignInButton} components.
21
22
  */
22
23
  export interface CommonBaseSignInButtonProps {
23
- /**
24
- * Function to initiate the sign-in process
25
- */
26
- signIn?: () => Promise<void>;
27
24
  /**
28
25
  * Loading state during sign-in process
29
26
  */
30
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-in process
30
+ */
31
+ signIn: () => Promise<void>;
31
32
  }
32
33
  /**
33
34
  * Props passed to the render function of {@link BaseSignInButton}
@@ -36,7 +37,7 @@ export type BaseSignInButtonRenderProps = CommonBaseSignInButtonProps;
36
37
  /**
37
38
  * Props interface of {@link BaseSignInButton}
38
39
  */
39
- export interface BaseSignInButtonProps extends CommonBaseSignInButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
40
+ export interface BaseSignInButtonProps extends Partial<CommonBaseSignInButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
40
41
  /**
41
42
  * Render prop function that receives sign-in props, or traditional ReactNode children
42
43
  */
@@ -48,7 +49,7 @@ export interface BaseSignInButtonProps extends CommonBaseSignInButtonProps, Omit
48
49
  * @example Using render props
49
50
  * ```tsx
50
51
  * <BaseSignInButton>
51
- * {({ signIn, isLoading }) => (
52
+ * {({signIn, isLoading}) => (
52
53
  * <button onClick={signIn} disabled={isLoading}>
53
54
  * {isLoading ? 'Signing in...' : 'Sign In'}
54
55
  * </button>
@@ -29,8 +29,8 @@ export type SignInButtonProps = BaseSignInButtonProps;
29
29
  * @example Using render props
30
30
  * ```tsx
31
31
  * <SignInButton>
32
- * {({ handleSignIn, isLoading }) => (
33
- * <button onClick={handleSignIn} disabled={isLoading}>
32
+ * {({signIn, isLoading}) => (
33
+ * <button onClick={signIn} disabled={isLoading}>
34
34
  * {isLoading ? 'Signing in...' : 'Sign In'}
35
35
  * </button>
36
36
  * )}
@@ -41,6 +41,25 @@ export type SignInButtonProps = BaseSignInButtonProps;
41
41
  * ```tsx
42
42
  * <SignInButton className="custom-button">Sign In</SignInButton>
43
43
  * ```
44
+ *
45
+ * @example Using component-level preferences
46
+ * ```tsx
47
+ * <SignInButton
48
+ * preferences={{
49
+ * i18n: {
50
+ * bundles: {
51
+ * 'en-US': {
52
+ * translations: {
53
+ * 'buttons.signIn': 'Custom Sign In Text'
54
+ * }
55
+ * }
56
+ * }
57
+ * }
58
+ * }}
59
+ * >
60
+ * Custom Sign In
61
+ * </SignInButton>
62
+ * ```
44
63
  */
45
64
  declare const SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>;
46
65
  export default SignInButton;
@@ -15,19 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ import { WithPreferences } from '@asgardeo/browser';
18
19
  import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
19
20
  /**
20
21
  * Common props shared by all {@link BaseSignOutButton} components.
21
22
  */
22
23
  export interface CommonBaseSignOutButtonProps {
23
- /**
24
- * Function to initiate the sign-out process
25
- */
26
- signOut?: () => Promise<void>;
27
24
  /**
28
25
  * Loading state during sign-out process
29
26
  */
30
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-out process
30
+ */
31
+ signOut: () => Promise<void>;
31
32
  }
32
33
  /**
33
34
  * Props passed to the render function of {@link BaseSignOutButton}
@@ -36,7 +37,7 @@ export type BaseSignOutButtonRenderProps = CommonBaseSignOutButtonProps;
36
37
  /**
37
38
  * Props interface of {@link BaseSignOutButton}
38
39
  */
39
- export interface BaseSignOutButtonProps extends CommonBaseSignOutButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
40
+ export interface BaseSignOutButtonProps extends Partial<CommonBaseSignOutButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
40
41
  /**
41
42
  * Render prop function that receives sign-out props, or traditional ReactNode children
42
43
  */
@@ -48,7 +49,7 @@ export interface BaseSignOutButtonProps extends CommonBaseSignOutButtonProps, Om
48
49
  * @example Using render props
49
50
  * ```tsx
50
51
  * <BaseSignOutButton>
51
- * {({ signOut, isLoading }) => (
52
+ * {({signOut, isLoading}) => (
52
53
  * <button onClick={signOut} disabled={isLoading}>
53
54
  * {isLoading ? 'Signing out...' : 'Sign Out'}
54
55
  * </button>
@@ -24,10 +24,12 @@ export type SignOutButtonProps = BaseSignOutButtonProps;
24
24
  /**
25
25
  * SignOutButton component that supports both render props and traditional props patterns.
26
26
  *
27
+ * @remarks This component is only supported in browser based React applications (CSR).
28
+ *
27
29
  * @example Using render props pattern
28
30
  * ```tsx
29
31
  * <SignOutButton>
30
- * {({ signOut, isLoading }) => (
32
+ * {({signOut, isLoading}) => (
31
33
  * <button onClick={signOut} disabled={isLoading}>
32
34
  * {isLoading ? 'Signing out...' : 'Sign Out'}
33
35
  * </button>
@@ -39,6 +41,25 @@ export type SignOutButtonProps = BaseSignOutButtonProps;
39
41
  * ```tsx
40
42
  * <SignOutButton className="custom-button">Sign Out</SignOutButton>
41
43
  * ```
44
+ *
45
+ * @example Using component-level preferences
46
+ * ```tsx
47
+ * <SignOutButton
48
+ * preferences={{
49
+ * i18n: {
50
+ * bundles: {
51
+ * 'en-US': {
52
+ * translations: {
53
+ * 'buttons.signOut': 'Custom Sign Out Text'
54
+ * }
55
+ * }
56
+ * }
57
+ * }
58
+ * }}
59
+ * >
60
+ * Custom Sign Out
61
+ * </SignOutButton>
62
+ * ```
42
63
  */
43
64
  declare const SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>;
44
65
  export default SignOutButton;
@@ -15,19 +15,20 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ import { WithPreferences } from '@asgardeo/browser';
18
19
  import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
19
20
  /**
20
21
  * Common props shared by all {@link BaseSignUpButton} components.
21
22
  */
22
23
  export interface CommonBaseSignUpButtonProps {
23
- /**
24
- * Function to initiate the sign-up process
25
- */
26
- signUp?: () => Promise<void>;
27
24
  /**
28
25
  * Loading state during sign-up process
29
26
  */
30
27
  isLoading?: boolean;
28
+ /**
29
+ * Function to initiate the sign-up process
30
+ */
31
+ signUp?: () => Promise<void>;
31
32
  }
32
33
  /**
33
34
  * Props passed to the render function of {@link BaseSignUpButton}
@@ -36,7 +37,7 @@ export type BaseSignUpButtonRenderProps = CommonBaseSignUpButtonProps;
36
37
  /**
37
38
  * Props interface of {@link BaseSignUpButton}
38
39
  */
39
- export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
40
+ export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
40
41
  /**
41
42
  * Render prop function that receives sign-up props, or traditional ReactNode children
42
43
  */
@@ -25,6 +25,8 @@ export type SignUpButtonProps = BaseSignUpButtonProps;
25
25
  * SignUpButton component that supports both render props and traditional props patterns.
26
26
  * It redirects the user to the Asgardeo sign-up page configured for the application.
27
27
  *
28
+ * @remarks This component is only supported in browser based React applications (CSR).
29
+ *
28
30
  * @example Using render props pattern
29
31
  * ```tsx
30
32
  * <SignUpButton>
@@ -40,6 +42,25 @@ export type SignUpButtonProps = BaseSignUpButtonProps;
40
42
  * ```tsx
41
43
  * <SignUpButton className="custom-button">Create Account</SignUpButton>
42
44
  * ```
45
+ *
46
+ * @example Using component-level preferences
47
+ * ```tsx
48
+ * <SignUpButton
49
+ * preferences={{
50
+ * i18n: {
51
+ * bundles: {
52
+ * 'en-US': {
53
+ * translations: {
54
+ * 'buttons.signUp': 'Custom Sign Up Text'
55
+ * }
56
+ * }
57
+ * }
58
+ * }
59
+ * }}
60
+ * >
61
+ * Custom Sign Up
62
+ * </SignUpButton>
63
+ * ```
43
64
  */
44
65
  declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
45
66
  export default SignUpButton;
@@ -0,0 +1,45 @@
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
+ * @example
32
+ * ```tsx
33
+ * import { AsgardeoLoading } from '@asgardeo/auth-react';
34
+ *
35
+ * const App = () => {
36
+ * return (
37
+ * <AsgardeoLoading fallback={<p>Finished Loading...</p>}>
38
+ * <p>Loading...</p>
39
+ * </AsgardeoLoading>
40
+ * );
41
+ * }
42
+ * ```
43
+ */
44
+ declare const AsgardeoLoading: FC<PropsWithChildren<AsgardeoLoadingProps>>;
45
+ export default AsgardeoLoading;
@@ -0,0 +1,107 @@
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 { SelectOption } from '../primitives/Select/Select';
20
+ import { FieldType } from '@asgardeo/browser';
21
+ /**
22
+ * Interface for field configuration.
23
+ */
24
+ export interface FieldConfig {
25
+ name: string;
26
+ /**
27
+ * The field type based on EmbeddedSignInFlowAuthenticatorParamType.
28
+ */
29
+ type: FieldType;
30
+ /**
31
+ * Display name for the field.
32
+ */
33
+ label: string;
34
+ /**
35
+ * Whether the field is required.
36
+ */
37
+ required: boolean;
38
+ /**
39
+ * Current value of the field.
40
+ */
41
+ value: string;
42
+ /**
43
+ * Callback function when the field value changes.
44
+ */
45
+ onChange: (value: string) => void;
46
+ /**
47
+ * Whether the field is disabled.
48
+ */
49
+ disabled?: boolean;
50
+ /**
51
+ * Error message to display.
52
+ */
53
+ error?: string;
54
+ /**
55
+ * Additional CSS class name.
56
+ */
57
+ className?: string;
58
+ /**
59
+ * Additional options for multi-valued fields.
60
+ */
61
+ options?: SelectOption[];
62
+ /**
63
+ * Whether the field has been touched/interacted with by the user.
64
+ */
65
+ touched?: boolean;
66
+ /**
67
+ * Placeholder text for the field.
68
+ */
69
+ placeholder?: string;
70
+ }
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
+ /**
80
+ * Utility function to validate field values based on type
81
+ */
82
+ export declare const validateFieldValue: (value: string, type: FieldType, required?: boolean, touched?: boolean) => string | null;
83
+ /**
84
+ * Factory function to create form fields based on the EmbeddedSignInFlowAuthenticatorParamType.
85
+ *
86
+ * @param config - The field configuration
87
+ * @returns The appropriate React component for the field type
88
+ *
89
+ * @example
90
+ * ```tsx
91
+ * const field = createField({
92
+ * param: 'username',
93
+ * type: EmbeddedSignInFlowAuthenticatorParamType.String,
94
+ * label: 'Username',
95
+ * confidential: false,
96
+ * required: true,
97
+ * value: '',
98
+ * onChange: (value) => console.log(value)
99
+ * });
100
+ * ```
101
+ */
102
+ export declare const createField: (config: FieldConfig) => ReactElement;
103
+ /**
104
+ * React component wrapper for the field factory.
105
+ */
106
+ export declare const FieldFactory: FC<FieldConfig>;
107
+ export default FieldFactory;
@@ -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 { CSSProperties, FC, ReactNode } from 'react';
19
+ import { CreateOrganizationPayload } from '../../../api/scim2/createOrganization';
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 '../../../api/scim2/createOrganization';
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;