@asgardeo/react 0.2.3 → 0.3.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.
- package/README.md +108 -6
- package/dist/AsgardeoReactClient.d.ts +37 -0
- package/dist/__temp__/api.d.ts +229 -0
- package/dist/__temp__/models.d.ts +105 -0
- package/dist/api/scim2/getMeProfile.d.ts +39 -0
- package/dist/api/scim2/getSchemas.d.ts +39 -0
- package/dist/api/scim2/updateMeProfile.d.ts +38 -0
- package/dist/cjs/index.js +1888 -45111
- package/dist/cjs/index.js.map +7 -1
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +65 -0
- package/dist/components/actions/SignInButton/SignInButton.d.ts +46 -0
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +65 -0
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +44 -0
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +65 -0
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +45 -0
- package/dist/components/control/SignedIn.d.ts +45 -0
- package/dist/components/control/SignedOut.d.ts +45 -0
- package/dist/components/presentation/User.d.ts +57 -0
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +76 -0
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +49 -0
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +42 -0
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +49 -0
- package/dist/{cjs/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts} +25 -14
- package/dist/{esm/types/models/use-on.d.ts → components/primitives/Checkbox/Checkbox.d.ts} +20 -9
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +50 -0
- package/dist/components/primitives/Popover/Popover.d.ts +59 -0
- package/dist/components/primitives/Select/Select.d.ts +60 -0
- package/dist/components/primitives/TextField/TextField.d.ts +46 -0
- package/dist/contexts/AsgardeoContext.d.ts +56 -0
- package/dist/{cjs/types/contexts/i18n-context.d.ts → hooks/useAsgardeo.d.ts} +4 -5
- package/dist/hooks/useBrowserUrl.d.ts +47 -0
- package/dist/index.d.ts +36 -348
- package/dist/index.js +1935 -0
- package/dist/index.js.map +7 -0
- package/dist/{cjs/types/models/public-models.d.ts → models/config.d.ts} +3 -3
- package/dist/{cjs/types/hooks/use-config.d.ts → providers/AsgardeoProvider.d.ts} +7 -5
- package/dist/{cjs/types/models/asgardeo-provider-props.d.ts → theme/ThemeContext.d.ts} +8 -7
- package/dist/{esm/types/models/asgardeo-provider-props.d.ts → theme/ThemeProvider.d.ts} +7 -7
- package/dist/{cjs/types/models/use-on.d.ts → theme/types.d.ts} +22 -12
- package/dist/{esm/types/oxygen-ui-react-auth-components/index.d.ts → theme/useTheme.d.ts} +3 -3
- package/dist/{cjs/types/models/use-config.d.ts → utils/getMappedUserProfileValue.d.ts} +3 -6
- package/dist/utils/getUserProfile.d.ts +59 -0
- package/package.json +55 -58
- package/dist/cjs/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
- package/dist/cjs/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
- package/dist/cjs/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
- package/dist/cjs/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
- package/dist/cjs/types/components/SignIn/fragments/SmsOtp.d.ts +0 -21
- package/dist/cjs/types/components/SignIn/fragments/Totp.d.ts +0 -33
- package/dist/cjs/types/components/SignInButton/SignInButton.d.ts +0 -29
- package/dist/cjs/types/components/SignOutButton/SignOutButton.d.ts +0 -27
- package/dist/cjs/types/components/SignedIn/SignedIn.d.ts +0 -29
- package/dist/cjs/types/components/SignedOut/SignedOut.d.ts +0 -29
- package/dist/cjs/types/components/public-components.d.ts +0 -22
- package/dist/cjs/types/contexts/asgardeo-context.d.ts +0 -21
- package/dist/cjs/types/contexts/branding-preference-context.d.ts +0 -21
- package/dist/cjs/types/hooks/use-authentication.d.ts +0 -27
- package/dist/cjs/types/hooks/use-on.d.ts +0 -20
- package/dist/cjs/types/hooks/use-translations.d.ts +0 -33
- package/dist/cjs/types/index.d.ts +0 -22
- package/dist/cjs/types/models/auth-context.d.ts +0 -43
- package/dist/cjs/types/models/basic-auth-props.d.ts +0 -29
- package/dist/cjs/types/models/branding-preference-provider-props.d.ts +0 -22
- package/dist/cjs/types/models/email-otp-props.d.ts +0 -26
- package/dist/cjs/types/models/i18n.d.ts +0 -34
- package/dist/cjs/types/models/jwt-verify-options.d.ts +0 -25
- package/dist/cjs/types/models/login-options-box-props.d.ts +0 -24
- package/dist/cjs/types/models/sign-in.d.ts +0 -49
- package/dist/cjs/types/models/signed-props.d.ts +0 -22
- package/dist/cjs/types/models/totp-props.d.ts +0 -26
- package/dist/cjs/types/models/use-authentication.d.ts +0 -29
- package/dist/cjs/types/models/use-translations.d.ts +0 -22
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
- package/dist/cjs/types/oxygen-ui-react-auth-components/index.d.ts +0 -19
- package/dist/cjs/types/oxygen-ui-react-auth-components/models/component.d.ts +0 -27
- package/dist/cjs/types/providers/AsgardeoProvider.d.ts +0 -34
- package/dist/cjs/types/providers/BrandingPreferenceProvider.d.ts +0 -32
- package/dist/cjs/types/providers/I18nProvider.d.ts +0 -33
- package/dist/cjs/types/theme/generate-theme-sign-in.d.ts +0 -28
- package/dist/cjs/types/theme/generate-theme.d.ts +0 -30
- package/dist/cjs/types/utils/crypto-utils.d.ts +0 -52
- package/dist/cjs/types/utils/session-store.d.ts +0 -25
- package/dist/esm/index.js +0 -45151
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/components/SignIn/SignIn.d.ts +0 -31
- package/dist/esm/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
- package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
- package/dist/esm/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
- package/dist/esm/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
- package/dist/esm/types/components/SignIn/fragments/SmsOtp.d.ts +0 -21
- package/dist/esm/types/components/SignIn/fragments/Totp.d.ts +0 -33
- package/dist/esm/types/components/SignInButton/SignInButton.d.ts +0 -29
- package/dist/esm/types/components/SignOutButton/SignOutButton.d.ts +0 -27
- package/dist/esm/types/components/SignedIn/SignedIn.d.ts +0 -29
- package/dist/esm/types/components/SignedOut/SignedOut.d.ts +0 -29
- package/dist/esm/types/components/public-components.d.ts +0 -22
- package/dist/esm/types/contexts/asgardeo-context.d.ts +0 -21
- package/dist/esm/types/contexts/branding-preference-context.d.ts +0 -21
- package/dist/esm/types/contexts/i18n-context.d.ts +0 -21
- package/dist/esm/types/hooks/use-authentication.d.ts +0 -27
- package/dist/esm/types/hooks/use-config.d.ts +0 -23
- package/dist/esm/types/hooks/use-on.d.ts +0 -20
- package/dist/esm/types/hooks/use-translations.d.ts +0 -33
- package/dist/esm/types/index.d.ts +0 -22
- package/dist/esm/types/models/auth-context.d.ts +0 -43
- package/dist/esm/types/models/basic-auth-props.d.ts +0 -29
- package/dist/esm/types/models/branding-preference-provider-props.d.ts +0 -22
- package/dist/esm/types/models/email-otp-props.d.ts +0 -26
- package/dist/esm/types/models/i18n.d.ts +0 -34
- package/dist/esm/types/models/jwt-verify-options.d.ts +0 -25
- package/dist/esm/types/models/login-options-box-props.d.ts +0 -24
- package/dist/esm/types/models/public-models.d.ts +0 -19
- package/dist/esm/types/models/sign-in.d.ts +0 -49
- package/dist/esm/types/models/signed-props.d.ts +0 -22
- package/dist/esm/types/models/totp-props.d.ts +0 -26
- package/dist/esm/types/models/use-authentication.d.ts +0 -29
- package/dist/esm/types/models/use-config.d.ts +0 -22
- package/dist/esm/types/models/use-translations.d.ts +0 -22
- package/dist/esm/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
- package/dist/esm/types/oxygen-ui-react-auth-components/models/component.d.ts +0 -27
- package/dist/esm/types/providers/AsgardeoProvider.d.ts +0 -34
- package/dist/esm/types/providers/BrandingPreferenceProvider.d.ts +0 -32
- package/dist/esm/types/providers/I18nProvider.d.ts +0 -33
- package/dist/esm/types/theme/generate-theme-sign-in.d.ts +0 -28
- package/dist/esm/types/theme/generate-theme.d.ts +0 -30
- package/dist/esm/types/utils/crypto-utils.d.ts +0 -52
- package/dist/esm/types/utils/session-store.d.ts +0 -25
|
@@ -0,0 +1,65 @@
|
|
|
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 { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Common props shared by all {@link BaseSignInButton} components.
|
|
21
|
+
*/
|
|
22
|
+
export interface CommonBaseSignInButtonProps {
|
|
23
|
+
/**
|
|
24
|
+
* Function to initiate the sign-in process
|
|
25
|
+
*/
|
|
26
|
+
signIn?: () => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Loading state during sign-in process
|
|
29
|
+
*/
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Props passed to the render function of {@link BaseSignInButton}
|
|
34
|
+
*/
|
|
35
|
+
export type BaseSignInButtonRenderProps = CommonBaseSignInButtonProps;
|
|
36
|
+
/**
|
|
37
|
+
* Props interface of {@link BaseSignInButton}
|
|
38
|
+
*/
|
|
39
|
+
export interface BaseSignInButtonProps extends CommonBaseSignInButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
40
|
+
/**
|
|
41
|
+
* Render prop function that receives sign-in props, or traditional ReactNode children
|
|
42
|
+
*/
|
|
43
|
+
children?: ((props: BaseSignInButtonRenderProps) => ReactNode) | ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Base SignInButton component that supports both render props and traditional props patterns.
|
|
47
|
+
*
|
|
48
|
+
* @example Using render props
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <BaseSignInButton>
|
|
51
|
+
* {({ signIn, isLoading }) => (
|
|
52
|
+
* <button onClick={signIn} disabled={isLoading}>
|
|
53
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
54
|
+
* </button>
|
|
55
|
+
* )}
|
|
56
|
+
* </BaseSignInButton>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Using traditional props
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <BaseSignInButton className="custom-button">Sign In</BaseSignInButton>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const BaseSignInButton: ForwardRefExoticComponent<BaseSignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export default BaseSignInButton;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
19
|
+
import { BaseSignInButtonProps } from './BaseSignInButton';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignInButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignInButtonProps = BaseSignInButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignInButton component that supports both render props and traditional props patterns.
|
|
26
|
+
*
|
|
27
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
28
|
+
*
|
|
29
|
+
* @example Using render props
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <SignInButton>
|
|
32
|
+
* {({ handleSignIn, isLoading }) => (
|
|
33
|
+
* <button onClick={handleSignIn} disabled={isLoading}>
|
|
34
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
35
|
+
* </button>
|
|
36
|
+
* )}
|
|
37
|
+
* </SignInButton>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Using traditional props
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <SignInButton className="custom-button">Sign In</SignInButton>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
export default SignInButton;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Common props shared by all {@link BaseSignOutButton} components.
|
|
21
|
+
*/
|
|
22
|
+
export interface CommonBaseSignOutButtonProps {
|
|
23
|
+
/**
|
|
24
|
+
* Function to initiate the sign-out process
|
|
25
|
+
*/
|
|
26
|
+
signOut?: () => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Loading state during sign-out process
|
|
29
|
+
*/
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Props passed to the render function of {@link BaseSignOutButton}
|
|
34
|
+
*/
|
|
35
|
+
export type BaseSignOutButtonRenderProps = CommonBaseSignOutButtonProps;
|
|
36
|
+
/**
|
|
37
|
+
* Props interface of {@link BaseSignOutButton}
|
|
38
|
+
*/
|
|
39
|
+
export interface BaseSignOutButtonProps extends CommonBaseSignOutButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
40
|
+
/**
|
|
41
|
+
* Render prop function that receives sign-out props, or traditional ReactNode children
|
|
42
|
+
*/
|
|
43
|
+
children?: ((props: BaseSignOutButtonRenderProps) => ReactNode) | ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Base SignOutButton component that supports both render props and traditional props patterns.
|
|
47
|
+
*
|
|
48
|
+
* @example Using render props
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <BaseSignOutButton>
|
|
51
|
+
* {({ signOut, isLoading }) => (
|
|
52
|
+
* <button onClick={signOut} disabled={isLoading}>
|
|
53
|
+
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
54
|
+
* </button>
|
|
55
|
+
* )}
|
|
56
|
+
* </BaseSignOutButton>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Using traditional props
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <BaseSignOutButton className="custom-button">Sign Out</BaseSignOutButton>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const BaseSignOutButton: ForwardRefExoticComponent<BaseSignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export default BaseSignOutButton;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
19
|
+
import { BaseSignOutButtonProps } from './BaseSignOutButton';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignOutButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignOutButtonProps = BaseSignOutButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignOutButton component that supports both render props and traditional props patterns.
|
|
26
|
+
*
|
|
27
|
+
* @example Using render props pattern
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <SignOutButton>
|
|
30
|
+
* {({ signOut, isLoading }) => (
|
|
31
|
+
* <button onClick={signOut} disabled={isLoading}>
|
|
32
|
+
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
33
|
+
* </button>
|
|
34
|
+
* )}
|
|
35
|
+
* </SignOutButton>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example Using traditional props pattern
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <SignOutButton className="custom-button">Sign Out</SignOutButton>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
export default SignOutButton;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Common props shared by all {@link BaseSignUpButton} components.
|
|
21
|
+
*/
|
|
22
|
+
export interface CommonBaseSignUpButtonProps {
|
|
23
|
+
/**
|
|
24
|
+
* Function to initiate the sign-up process
|
|
25
|
+
*/
|
|
26
|
+
signUp?: () => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Loading state during sign-up process
|
|
29
|
+
*/
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Props passed to the render function of {@link BaseSignUpButton}
|
|
34
|
+
*/
|
|
35
|
+
export type BaseSignUpButtonRenderProps = CommonBaseSignUpButtonProps;
|
|
36
|
+
/**
|
|
37
|
+
* Props interface of {@link BaseSignUpButton}
|
|
38
|
+
*/
|
|
39
|
+
export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
40
|
+
/**
|
|
41
|
+
* Render prop function that receives sign-up props, or traditional ReactNode children
|
|
42
|
+
*/
|
|
43
|
+
children?: ((props: BaseSignUpButtonRenderProps) => ReactNode) | ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Base SignUpButton component that supports both render props and traditional props patterns.
|
|
47
|
+
*
|
|
48
|
+
* @example Using render props
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <BaseSignUpButton>
|
|
51
|
+
* {({ signUp, isLoading }) => (
|
|
52
|
+
* <button onClick={signUp} disabled={isLoading}>
|
|
53
|
+
* {isLoading ? 'Creating account...' : 'Create Account'}
|
|
54
|
+
* </button>
|
|
55
|
+
* )}
|
|
56
|
+
* </BaseSignUpButton>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Using traditional props
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <BaseSignUpButton className="custom-button">Create Account</BaseSignUpButton>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const BaseSignUpButton: ForwardRefExoticComponent<BaseSignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export default BaseSignUpButton;
|
|
@@ -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 { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
19
|
+
import { BaseSignUpButtonProps } from './BaseSignUpButton';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link SignUpButton}
|
|
22
|
+
*/
|
|
23
|
+
export type SignUpButtonProps = BaseSignUpButtonProps;
|
|
24
|
+
/**
|
|
25
|
+
* SignUpButton component that supports both render props and traditional props patterns.
|
|
26
|
+
* It redirects the user to the Asgardeo sign-up page configured for the application.
|
|
27
|
+
*
|
|
28
|
+
* @example Using render props pattern
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <SignUpButton>
|
|
31
|
+
* {({ signUp, isLoading }) => (
|
|
32
|
+
* <button onClick={signUp} disabled={isLoading}>
|
|
33
|
+
* {isLoading ? 'Creating Account...' : 'Create Account'}
|
|
34
|
+
* </button>
|
|
35
|
+
* )}
|
|
36
|
+
* </SignUpButton>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Using traditional props pattern
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <SignUpButton className="custom-button">Create Account</SignUpButton>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
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 SignedIn component.
|
|
21
|
+
*/
|
|
22
|
+
export interface SignedInProps {
|
|
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 user is signed in.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { SignedIn } from '@asgardeo/auth-react';
|
|
34
|
+
*
|
|
35
|
+
* const App = () => {
|
|
36
|
+
* return (
|
|
37
|
+
* <SignedIn fallback={<p>Please sign in to continue</p>}>
|
|
38
|
+
* <p>Welcome! You are signed in.</p>
|
|
39
|
+
* </SignedIn>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const SignedIn: FC<PropsWithChildren<SignedInProps>>;
|
|
45
|
+
export default SignedIn;
|
|
@@ -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 SignedOut component.
|
|
21
|
+
*/
|
|
22
|
+
export interface SignedOutProps {
|
|
23
|
+
/**
|
|
24
|
+
* Content to show when the user is signed in.
|
|
25
|
+
*/
|
|
26
|
+
fallback?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A component that only renders its children when the user is signed out.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { SignedOut } from '@asgardeo/auth-react';
|
|
34
|
+
*
|
|
35
|
+
* const App = () => {
|
|
36
|
+
* return (
|
|
37
|
+
* <SignedOut fallback={<p>You are already signed in</p>}>
|
|
38
|
+
* <p>Please sign in to continue</p>
|
|
39
|
+
* </SignedOut>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const SignedOut: FC<PropsWithChildren<SignedOutProps>>;
|
|
45
|
+
export default SignedOut;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { User as AsgardeoUser } from '@asgardeo/browser';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the User component.
|
|
22
|
+
*/
|
|
23
|
+
export interface UserProps {
|
|
24
|
+
/**
|
|
25
|
+
* Render prop that takes the user object and returns a ReactNode.
|
|
26
|
+
* @param user - The authenticated user object from Asgardeo.
|
|
27
|
+
* @returns A ReactNode to render.
|
|
28
|
+
*/
|
|
29
|
+
children: (user: AsgardeoUser | null) => ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Optional element to render when no user is signed in.
|
|
32
|
+
*/
|
|
33
|
+
fallback?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A component that uses render props to expose the authenticated user object.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* import { User } from '@asgardeo/auth-react';
|
|
41
|
+
*
|
|
42
|
+
* const App = () => {
|
|
43
|
+
* return (
|
|
44
|
+
* <User fallback={<p>Please sign in</p>}>
|
|
45
|
+
* {(user) => (
|
|
46
|
+
* <div>
|
|
47
|
+
* <h1>Welcome, {user.displayName}!</h1>
|
|
48
|
+
* <p>Email: {user.email}</p>
|
|
49
|
+
* </div>
|
|
50
|
+
* )}
|
|
51
|
+
* </User>
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const User: FC<UserProps>;
|
|
57
|
+
export default User;
|
|
@@ -0,0 +1,76 @@
|
|
|
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, ReactNode } from 'react';
|
|
19
|
+
export interface MenuItem {
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
href?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface BaseUserDropdownProps {
|
|
26
|
+
/**
|
|
27
|
+
* Optional element to render when no user is signed in.
|
|
28
|
+
*/
|
|
29
|
+
fallback?: ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Optional className for the dropdown container.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The user object containing profile information
|
|
36
|
+
*/
|
|
37
|
+
user: any;
|
|
38
|
+
/**
|
|
39
|
+
* The HTML element ID where the portal should be mounted
|
|
40
|
+
*/
|
|
41
|
+
portalId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Menu items to display in the dropdown
|
|
44
|
+
*/
|
|
45
|
+
menuItems?: MenuItem[];
|
|
46
|
+
/**
|
|
47
|
+
* Show user's display name next to avatar in the trigger button
|
|
48
|
+
*/
|
|
49
|
+
showTriggerLable?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Show dropdown header with user information
|
|
52
|
+
*/
|
|
53
|
+
showDropdownHeader?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Optional size for the avatar
|
|
56
|
+
*/
|
|
57
|
+
avatarSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Mapping of component attribute names to identity provider field names.
|
|
60
|
+
* Allows customizing which user profile fields should be used for each attribute.
|
|
61
|
+
*/
|
|
62
|
+
attributeMapping?: {
|
|
63
|
+
picture?: string | string[];
|
|
64
|
+
firstName?: string | string[];
|
|
65
|
+
lastName?: string | string[];
|
|
66
|
+
username?: string | string[];
|
|
67
|
+
[key: string]: string | string[] | undefined;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* BaseUserDropdown component displays a user avatar with a dropdown menu.
|
|
72
|
+
* When clicked, it shows a popover with customizable menu items.
|
|
73
|
+
* This component serves as the base for framework-specific implementations.
|
|
74
|
+
*/
|
|
75
|
+
export declare const BaseUserDropdown: FC<BaseUserDropdownProps>;
|
|
76
|
+
export default BaseUserDropdown;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { BaseUserDropdownProps } from './BaseUserDropdown';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the UserDropdown component.
|
|
22
|
+
* Extends BaseUserDropdownProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
23
|
+
*/
|
|
24
|
+
export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user'>;
|
|
25
|
+
/**
|
|
26
|
+
* UserDropdown component displays a user avatar with a dropdown menu.
|
|
27
|
+
* When clicked, it shows a popover with customizable menu items.
|
|
28
|
+
* This component is the React-specific implementation that uses the BaseUserDropdown
|
|
29
|
+
* and automatically retrieves the user data from Asgardeo context.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Basic usage - will use user from Asgardeo context
|
|
34
|
+
* <UserDropdown menuItems={[
|
|
35
|
+
* { label: 'Profile', onClick: () => {} },
|
|
36
|
+
* { label: 'Settings', href: '/settings' },
|
|
37
|
+
* { label: 'Sign Out', onClick: () => {} }
|
|
38
|
+
* ]} />
|
|
39
|
+
*
|
|
40
|
+
* // With custom configuration
|
|
41
|
+
* <UserDropdown
|
|
42
|
+
* showUsername={false}
|
|
43
|
+
* avatarSize={40}
|
|
44
|
+
* fallback={<div>Please sign in</div>}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare const UserDropdown: FC<UserDropdownProps>;
|
|
49
|
+
export default UserDropdown;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
export interface BaseUserProfileProps {
|
|
20
|
+
fallback?: ReactElement;
|
|
21
|
+
className?: string;
|
|
22
|
+
cardLayout?: boolean;
|
|
23
|
+
user: any;
|
|
24
|
+
mode?: 'inline' | 'popup';
|
|
25
|
+
portalId?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
attributeMapping?: {
|
|
28
|
+
picture?: string | string[];
|
|
29
|
+
firstName?: string | string[];
|
|
30
|
+
lastName?: string | string[];
|
|
31
|
+
username?: string | string[];
|
|
32
|
+
[key: string]: string | string[] | undefined;
|
|
33
|
+
};
|
|
34
|
+
editable?: boolean;
|
|
35
|
+
onChange?: (field: string, value: any) => void;
|
|
36
|
+
onSubmit?: (data: any) => void;
|
|
37
|
+
saveButtonText?: string;
|
|
38
|
+
cancelButtonText?: string;
|
|
39
|
+
onUpdate?: (payload: any) => Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
declare const BaseUserProfile: FC<BaseUserProfileProps>;
|
|
42
|
+
export default BaseUserProfile;
|