@asgardeo/react 0.2.4 → 0.4.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 +112 -6
- package/dist/AsgardeoReactClient.d.ts +38 -0
- package/dist/__temp__/api.d.ts +228 -0
- package/dist/__temp__/models.d.ts +97 -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 +17998 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +66 -0
- package/dist/components/actions/SignInButton/SignInButton.d.ts +65 -0
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +66 -0
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +65 -0
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +66 -0
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +66 -0
- package/dist/components/control/SignedIn.d.ts +45 -0
- package/dist/components/control/SignedOut.d.ts +45 -0
- package/dist/components/factories/FieldFactory.d.ts +107 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +125 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +62 -0
- package/dist/{esm/types/hooks/use-config.d.ts → components/presentation/SignIn/options/EmailOtp.d.ts} +7 -5
- package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
- package/dist/{esm/types/components/SignIn/fragments/SmsOtp.d.ts → components/presentation/SignIn/options/MicrosoftButton.d.ts} +9 -5
- package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
- package/dist/{esm/types/components/SignOutButton/SignOutButton.d.ts → components/presentation/SignIn/options/SignInWithEthereumButton.d.ts} +7 -9
- package/dist/{esm/types/contexts/branding-preference-context.d.ts → components/presentation/SignIn/options/SmsOtp.d.ts} +9 -5
- package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
- package/dist/{esm/types/contexts/asgardeo-context.d.ts → components/presentation/SignIn/options/Totp.d.ts} +9 -5
- package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
- package/dist/components/presentation/SignIn/types.d.ts +124 -0
- package/dist/components/presentation/User/BaseUser.d.ts +66 -0
- package/dist/components/presentation/User/User.d.ts +62 -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 +63 -0
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +49 -0
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/{esm/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts} +25 -14
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +133 -0
- package/dist/{esm/types/oxygen-ui-react-auth-components/models/component.d.ts → components/primitives/Checkbox/Checkbox.d.ts} +22 -7
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +50 -0
- package/dist/components/primitives/Divider/Divider.d.ts +58 -0
- package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
- package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
- package/dist/{esm/types/models/use-config.d.ts → components/primitives/Icons/Eye.d.ts} +7 -6
- package/dist/{esm/types/contexts/i18n-context.d.ts → components/primitives/Icons/EyeOff.d.ts} +7 -5
- package/dist/{esm/types/hooks/use-on.d.ts → components/primitives/Icons/Info.d.ts} +7 -4
- package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
- package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
- package/dist/{esm/types/components/SignInButton/SignInButton.d.ts → components/primitives/PasswordField/PasswordField.d.ts} +13 -11
- package/dist/components/primitives/Popover/Popover.d.ts +96 -0
- package/dist/components/primitives/Select/Select.d.ts +60 -0
- package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
- package/dist/components/primitives/TextField/TextField.d.ts +62 -0
- package/dist/components/primitives/Typography/Typography.d.ts +81 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +57 -0
- package/dist/{esm/types/components/public-components.d.ts → contexts/Asgardeo/AsgardeoProvider.d.ts} +9 -6
- package/dist/contexts/Asgardeo/useAsgardeo.d.ts +20 -0
- package/dist/contexts/Flow/FlowContext.d.ts +73 -0
- package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
- package/dist/contexts/Flow/useFlow.d.ts +48 -0
- package/dist/contexts/I18n/I18nContext.d.ts +42 -0
- package/dist/{esm/types/components/SignedIn/SignedIn.d.ts → contexts/I18n/I18nProvider.d.ts} +12 -10
- package/dist/contexts/I18n/useI18n.d.ts +27 -0
- package/dist/{esm/types/models/asgardeo-provider-props.d.ts → contexts/Theme/ThemeContext.d.ts} +8 -7
- package/dist/{esm/types/models/branding-preference-provider-props.d.ts → contexts/Theme/ThemeProvider.d.ts} +8 -5
- package/dist/{esm/types/models/use-on.d.ts → contexts/Theme/types.d.ts} +22 -12
- package/dist/{esm/types/models/signed-props.d.ts → contexts/Theme/useTheme.d.ts} +4 -6
- package/dist/contexts/User/UserContext.d.ts +32 -0
- package/dist/contexts/User/UserProvider.d.ts +55 -0
- package/dist/contexts/User/useUser.d.ts +94 -0
- package/dist/hooks/useBrowserUrl.d.ts +47 -0
- package/dist/hooks/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +121 -348
- package/dist/index.js +18064 -0
- package/dist/index.js.map +7 -0
- package/dist/{esm/types/models/public-models.d.ts → models/config.d.ts} +3 -3
- package/dist/utils/getMappedUserProfileValue.d.ts +51 -0
- package/package.json +55 -59
- package/dist/esm/index.js +0 -45278
- package/dist/esm/index.js.map +0 -1
- 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/Totp.d.ts +0 -33
- package/dist/esm/types/components/SignedOut/SignedOut.d.ts +0 -29
- package/dist/esm/types/hooks/use-authentication.d.ts +0 -27
- 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/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/sign-in.d.ts +0 -49
- 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-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/index.d.ts +0 -19
- 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,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 { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
20
|
+
/**
|
|
21
|
+
* Common props shared by all {@link BaseSignInButton} components.
|
|
22
|
+
*/
|
|
23
|
+
export interface CommonBaseSignInButtonProps {
|
|
24
|
+
/**
|
|
25
|
+
* Function to initiate the sign-in process
|
|
26
|
+
*/
|
|
27
|
+
signIn: () => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Loading state during sign-in process
|
|
30
|
+
*/
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Props passed to the render function of {@link BaseSignInButton}
|
|
35
|
+
*/
|
|
36
|
+
export type BaseSignInButtonRenderProps = CommonBaseSignInButtonProps;
|
|
37
|
+
/**
|
|
38
|
+
* Props interface of {@link BaseSignInButton}
|
|
39
|
+
*/
|
|
40
|
+
export interface BaseSignInButtonProps extends Partial<CommonBaseSignInButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
41
|
+
/**
|
|
42
|
+
* Render prop function that receives sign-in props, or traditional ReactNode children
|
|
43
|
+
*/
|
|
44
|
+
children?: ((props: BaseSignInButtonRenderProps) => ReactNode) | ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Base SignInButton component that supports both render props and traditional props patterns.
|
|
48
|
+
*
|
|
49
|
+
* @example Using render props
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <BaseSignInButton>
|
|
52
|
+
* {({signIn, isLoading}) => (
|
|
53
|
+
* <button onClick={signIn} disabled={isLoading}>
|
|
54
|
+
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
55
|
+
* </button>
|
|
56
|
+
* )}
|
|
57
|
+
* </BaseSignInButton>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Using traditional props
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <BaseSignInButton className="custom-button">Sign In</BaseSignInButton>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const BaseSignInButton: ForwardRefExoticComponent<BaseSignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
export default BaseSignInButton;
|
|
@@ -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, 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
|
+
* {({signIn, isLoading}) => (
|
|
33
|
+
* <button onClick={signIn} 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
|
+
* @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
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export default SignInButton;
|
|
@@ -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 { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
20
|
+
/**
|
|
21
|
+
* Common props shared by all {@link BaseSignOutButton} components.
|
|
22
|
+
*/
|
|
23
|
+
export interface CommonBaseSignOutButtonProps {
|
|
24
|
+
/**
|
|
25
|
+
* Function to initiate the sign-out process
|
|
26
|
+
*/
|
|
27
|
+
signOut: () => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Loading state during sign-out process
|
|
30
|
+
*/
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Props passed to the render function of {@link BaseSignOutButton}
|
|
35
|
+
*/
|
|
36
|
+
export type BaseSignOutButtonRenderProps = CommonBaseSignOutButtonProps;
|
|
37
|
+
/**
|
|
38
|
+
* Props interface of {@link BaseSignOutButton}
|
|
39
|
+
*/
|
|
40
|
+
export interface BaseSignOutButtonProps extends Partial<CommonBaseSignOutButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
41
|
+
/**
|
|
42
|
+
* Render prop function that receives sign-out props, or traditional ReactNode children
|
|
43
|
+
*/
|
|
44
|
+
children?: ((props: BaseSignOutButtonRenderProps) => ReactNode) | ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Base SignOutButton component that supports both render props and traditional props patterns.
|
|
48
|
+
*
|
|
49
|
+
* @example Using render props
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <BaseSignOutButton>
|
|
52
|
+
* {({signOut, isLoading}) => (
|
|
53
|
+
* <button onClick={signOut} disabled={isLoading}>
|
|
54
|
+
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
55
|
+
* </button>
|
|
56
|
+
* )}
|
|
57
|
+
* </BaseSignOutButton>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Using traditional props
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <BaseSignOutButton className="custom-button">Sign Out</BaseSignOutButton>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const BaseSignOutButton: ForwardRefExoticComponent<BaseSignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
export default BaseSignOutButton;
|
|
@@ -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, 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
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
28
|
+
*
|
|
29
|
+
* @example Using render props pattern
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <SignOutButton>
|
|
32
|
+
* {({signOut, isLoading}) => (
|
|
33
|
+
* <button onClick={signOut} disabled={isLoading}>
|
|
34
|
+
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
35
|
+
* </button>
|
|
36
|
+
* )}
|
|
37
|
+
* </SignOutButton>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Using traditional props pattern
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <SignOutButton className="custom-button">Sign Out</SignOutButton>
|
|
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
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
export default SignOutButton;
|
|
@@ -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 { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
20
|
+
/**
|
|
21
|
+
* Common props shared by all {@link BaseSignUpButton} components.
|
|
22
|
+
*/
|
|
23
|
+
export interface CommonBaseSignUpButtonProps {
|
|
24
|
+
/**
|
|
25
|
+
* Function to initiate the sign-up process
|
|
26
|
+
*/
|
|
27
|
+
signUp?: () => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Loading state during sign-up process
|
|
30
|
+
*/
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Props passed to the render function of {@link BaseSignUpButton}
|
|
35
|
+
*/
|
|
36
|
+
export type BaseSignUpButtonRenderProps = CommonBaseSignUpButtonProps;
|
|
37
|
+
/**
|
|
38
|
+
* Props interface of {@link BaseSignUpButton}
|
|
39
|
+
*/
|
|
40
|
+
export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
41
|
+
/**
|
|
42
|
+
* Render prop function that receives sign-up props, or traditional ReactNode children
|
|
43
|
+
*/
|
|
44
|
+
children?: ((props: BaseSignUpButtonRenderProps) => ReactNode) | ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Base SignUpButton component that supports both render props and traditional props patterns.
|
|
48
|
+
*
|
|
49
|
+
* @example Using render props
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <BaseSignUpButton>
|
|
52
|
+
* {({ signUp, isLoading }) => (
|
|
53
|
+
* <button onClick={signUp} disabled={isLoading}>
|
|
54
|
+
* {isLoading ? 'Creating account...' : 'Create Account'}
|
|
55
|
+
* </button>
|
|
56
|
+
* )}
|
|
57
|
+
* </BaseSignUpButton>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Using traditional props
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <BaseSignUpButton className="custom-button">Create Account</BaseSignUpButton>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const BaseSignUpButton: ForwardRefExoticComponent<BaseSignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
export default BaseSignUpButton;
|
|
@@ -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 { 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
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
29
|
+
*
|
|
30
|
+
* @example Using render props pattern
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <SignUpButton>
|
|
33
|
+
* {({ signUp, isLoading }) => (
|
|
34
|
+
* <button onClick={signUp} disabled={isLoading}>
|
|
35
|
+
* {isLoading ? 'Creating Account...' : 'Create Account'}
|
|
36
|
+
* </button>
|
|
37
|
+
* )}
|
|
38
|
+
* </SignUpButton>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Using traditional props pattern
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <SignUpButton className="custom-button">Create Account</SignUpButton>
|
|
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
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
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 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,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 ApplicationNativeAuthenticationAuthenticatorParamType.
|
|
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 ApplicationNativeAuthenticationAuthenticatorParamType.
|
|
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: ApplicationNativeAuthenticationAuthenticatorParamType.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;
|