@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.
- package/README.md +5 -1
- package/dist/AsgardeoReactClient.d.ts +12 -4
- package/dist/__temp__/api.d.ts +26 -21
- package/dist/__temp__/models.d.ts +14 -22
- package/dist/api/scim2/createOrganization.d.ts +74 -0
- package/dist/api/scim2/getAllOrganizations.d.ts +56 -0
- package/dist/api/scim2/getMeOrganizations.d.ts +52 -0
- package/dist/api/scim2/getOrganization.d.ts +61 -0
- package/dist/api/scim2/updateOrganization.d.ts +74 -0
- package/dist/cjs/index.js +9863 -1190
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +7 -6
- package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +7 -6
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +6 -5
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -0
- package/dist/components/control/AsgardeoLoading.d.ts +45 -0
- package/dist/components/factories/FieldFactory.d.ts +107 -0
- package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
- package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
- package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
- package/dist/components/presentation/Organization/Organization.d.ts +66 -0
- package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
- package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
- package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
- package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
- package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
- package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +114 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +63 -0
- package/dist/components/presentation/SignIn/options/EmailOtp.d.ts +25 -0
- 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/components/presentation/SignIn/options/MicrosoftButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
- package/dist/components/presentation/SignIn/options/SignInWithEthereumButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SmsOtp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/Totp.d.ts +25 -0
- 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/SignUp/BaseSignUp.d.ts +126 -0
- package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
- package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
- package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
- package/dist/components/presentation/User/BaseUser.d.ts +66 -0
- package/dist/components/presentation/{User.d.ts → User/User.d.ts} +9 -4
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +34 -11
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +132 -0
- package/dist/components/primitives/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +1 -1
- 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/Building.d.ts +40 -0
- package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
- package/dist/components/primitives/Icons/Check.d.ts +40 -0
- package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
- package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
- package/dist/components/primitives/Icons/Eye.d.ts +23 -0
- package/dist/components/primitives/Icons/EyeOff.d.ts +23 -0
- package/dist/components/primitives/Icons/Info.d.ts +23 -0
- package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
- package/dist/components/primitives/Icons/Plus.d.ts +23 -0
- package/dist/components/primitives/Icons/Settings.d.ts +0 -0
- package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/User.d.ts +23 -0
- package/dist/components/primitives/Icons/X.d.ts +23 -0
- package/dist/components/primitives/Icons/index.d.ts +27 -0
- package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
- package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
- package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +31 -0
- package/dist/components/primitives/Popover/Popover.d.ts +73 -36
- package/dist/components/primitives/Select/Select.d.ts +1 -1
- package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
- package/dist/components/primitives/TextField/TextField.d.ts +18 -2
- package/dist/components/primitives/Typography/Typography.d.ts +81 -0
- package/dist/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +3 -1
- package/dist/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +1 -1
- package/dist/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
- 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/contexts/I18n/I18nProvider.d.ts +31 -0
- package/dist/contexts/I18n/useI18n.d.ts +27 -0
- package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
- package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
- package/dist/contexts/Organization/useOrganization.d.ts +104 -0
- package/dist/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
- package/dist/{theme → contexts/Theme}/types.d.ts +38 -9
- package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
- package/dist/contexts/User/UserContext.d.ts +33 -0
- package/dist/contexts/User/UserProvider.d.ts +56 -0
- package/dist/contexts/User/useUser.d.ts +94 -0
- package/dist/hooks/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +133 -9
- package/dist/index.js +9949 -1203
- package/dist/index.js.map +4 -4
- package/dist/utils/getMappedUserProfileValue.d.ts +33 -1
- package/package.json +6 -5
- package/dist/utils/getUserProfile.d.ts +0 -59
- /package/dist/{theme → contexts/Theme}/ThemeContext.d.ts +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
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 { EmbeddedSignInFlowAuthenticator, EmbeddedSignInFlowAuthenticatorParamType } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Interface for form field state.
|
|
21
|
+
*/
|
|
22
|
+
export interface FormField {
|
|
23
|
+
param: string;
|
|
24
|
+
type: EmbeddedSignInFlowAuthenticatorParamType;
|
|
25
|
+
displayName: string;
|
|
26
|
+
confidential: boolean;
|
|
27
|
+
required: boolean;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base props that all authenticator components share.
|
|
32
|
+
*/
|
|
33
|
+
export interface BaseAuthenticatorProps {
|
|
34
|
+
/**
|
|
35
|
+
* The authenticator configuration.
|
|
36
|
+
*/
|
|
37
|
+
authenticator: EmbeddedSignInFlowAuthenticator;
|
|
38
|
+
/**
|
|
39
|
+
* Current form values.
|
|
40
|
+
*/
|
|
41
|
+
formValues: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the component is in loading state.
|
|
44
|
+
*/
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Error message to display.
|
|
48
|
+
*/
|
|
49
|
+
error?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Callback function called when input values change.
|
|
52
|
+
*/
|
|
53
|
+
onInputChange: (param: string, value: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback function called when the authenticator is submitted.
|
|
56
|
+
*/
|
|
57
|
+
onSubmit: (authenticator: EmbeddedSignInFlowAuthenticator, formData?: Record<string, string>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Custom CSS class name for form inputs.
|
|
60
|
+
*/
|
|
61
|
+
inputClassName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Custom CSS class name for the submit button.
|
|
64
|
+
*/
|
|
65
|
+
buttonClassName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Text for the submit button.
|
|
68
|
+
*/
|
|
69
|
+
submitButtonText?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Props for authenticator selector component.
|
|
73
|
+
*/
|
|
74
|
+
export interface AuthenticatorSelectorProps {
|
|
75
|
+
/**
|
|
76
|
+
* Available authenticators for selection.
|
|
77
|
+
*/
|
|
78
|
+
authenticators: EmbeddedSignInFlowAuthenticator[];
|
|
79
|
+
/**
|
|
80
|
+
* Current form values.
|
|
81
|
+
*/
|
|
82
|
+
formValues: Record<string, string>;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the component is in loading state.
|
|
85
|
+
*/
|
|
86
|
+
isLoading: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Error message to display.
|
|
89
|
+
*/
|
|
90
|
+
error?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Messages to display to the user.
|
|
93
|
+
*/
|
|
94
|
+
messages: Array<{
|
|
95
|
+
type: string;
|
|
96
|
+
message: string;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Callback function called when input values change.
|
|
100
|
+
*/
|
|
101
|
+
onInputChange: (param: string, value: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback function called when an authenticator is selected.
|
|
104
|
+
*/
|
|
105
|
+
onAuthenticatorSelection: (authenticator: EmbeddedSignInFlowAuthenticator, formData?: Record<string, string>) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Custom CSS class names.
|
|
108
|
+
*/
|
|
109
|
+
inputClassName?: string;
|
|
110
|
+
buttonClassName?: string;
|
|
111
|
+
errorClassName?: string;
|
|
112
|
+
messageClassName?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Text for the submit button.
|
|
115
|
+
*/
|
|
116
|
+
submitButtonText?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Style configuration for authenticators.
|
|
120
|
+
*/
|
|
121
|
+
export interface AuthenticatorStyle {
|
|
122
|
+
variant: 'solid' | 'outline';
|
|
123
|
+
color: string;
|
|
124
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from '@asgardeo/browser';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
import { CardProps } from '../../primitives/Card/Card';
|
|
21
|
+
/**
|
|
22
|
+
* Props for the BaseSignUp component.
|
|
23
|
+
*/
|
|
24
|
+
export interface BaseSignUpProps {
|
|
25
|
+
/**
|
|
26
|
+
* URL to redirect after successful sign-up.
|
|
27
|
+
*/
|
|
28
|
+
afterSignUpUrl?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Custom CSS class name for the submit button.
|
|
31
|
+
*/
|
|
32
|
+
buttonClassName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Custom CSS class name for the form container.
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Custom CSS class name for error messages.
|
|
39
|
+
*/
|
|
40
|
+
errorClassName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Custom CSS class name for form inputs.
|
|
43
|
+
*/
|
|
44
|
+
inputClassName?: string;
|
|
45
|
+
isInitialized?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Custom CSS class name for info messages.
|
|
48
|
+
*/
|
|
49
|
+
messageClassName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Callback function called when the sign-up flow completes and requires redirection.
|
|
52
|
+
* This allows platform-specific handling of redirects (e.g., Next.js router.push).
|
|
53
|
+
* @param response - The response from the sign-up flow containing the redirect URL, etc.
|
|
54
|
+
*/
|
|
55
|
+
onComplete?: (response: EmbeddedFlowExecuteResponse) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Callback function called when sign-up fails.
|
|
58
|
+
* @param error - The error that occurred during sign-up.
|
|
59
|
+
*/
|
|
60
|
+
onError?: (error: Error) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback function called when sign-up flow status changes.
|
|
63
|
+
* @param response - The current sign-up response.
|
|
64
|
+
*/
|
|
65
|
+
onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Function to initialize sign-up flow.
|
|
68
|
+
* @returns Promise resolving to the initial sign-up response.
|
|
69
|
+
*/
|
|
70
|
+
onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Function to handle sign-up steps.
|
|
73
|
+
* @param payload - The sign-up payload.
|
|
74
|
+
* @returns Promise resolving to the sign-up response.
|
|
75
|
+
*/
|
|
76
|
+
onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Size variant for the component.
|
|
79
|
+
*/
|
|
80
|
+
size?: 'small' | 'medium' | 'large';
|
|
81
|
+
/**
|
|
82
|
+
* Theme variant for the component.
|
|
83
|
+
*/
|
|
84
|
+
variant?: CardProps['variant'];
|
|
85
|
+
/**
|
|
86
|
+
* Whether to redirect after sign-up.
|
|
87
|
+
*/
|
|
88
|
+
shouldRedirectAfterSignUp?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Base SignUp component that provides embedded sign-up flow.
|
|
92
|
+
* This component handles both the presentation layer and sign-up flow logic.
|
|
93
|
+
* It accepts API functions as props to maintain framework independence.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* import { BaseSignUp } from '@asgardeo/react';
|
|
98
|
+
*
|
|
99
|
+
* const MySignUp = () => {
|
|
100
|
+
* return (
|
|
101
|
+
* <BaseSignUp
|
|
102
|
+
* onInitialize={async (payload) => {
|
|
103
|
+
* // Your API call to initialize sign-up
|
|
104
|
+
* return await initializeSignUp(payload);
|
|
105
|
+
* }}
|
|
106
|
+
* onSubmit={async (payload) => {
|
|
107
|
+
* // Your API call to handle sign-up
|
|
108
|
+
* return await handleSignUp(payload);
|
|
109
|
+
* }}
|
|
110
|
+
* onSuccess={(response) => {
|
|
111
|
+
* console.log('Success:', response);
|
|
112
|
+
* }} * onError={(error) => {
|
|
113
|
+
* console.error('Error:', error);
|
|
114
|
+
* }}
|
|
115
|
+
* onComplete={(redirectUrl) => {
|
|
116
|
+
* // Platform-specific redirect handling (e.g., Next.js router.push)
|
|
117
|
+
* router.push(redirectUrl); // or window.location.href = redirectUrl
|
|
118
|
+
* }}
|
|
119
|
+
* className="max-w-md mx-auto"
|
|
120
|
+
* />
|
|
121
|
+
* );
|
|
122
|
+
* };
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare const BaseSignUp: FC<BaseSignUpProps>;
|
|
126
|
+
export default BaseSignUp;
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { BaseSignUpProps } from './BaseSignUp';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the SignUp component.
|
|
22
|
+
*/
|
|
23
|
+
export type SignUpProps = BaseSignUpProps;
|
|
24
|
+
/**
|
|
25
|
+
* A styled SignUp component that provides embedded sign-up flow with pre-built styling.
|
|
26
|
+
* This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { SignUp } from '@asgardeo/react';
|
|
31
|
+
*
|
|
32
|
+
* const App = () => {
|
|
33
|
+
* return (
|
|
34
|
+
* <SignUp
|
|
35
|
+
* onSuccess={(response) => {
|
|
36
|
+
* console.log('Sign-up successful:', response);
|
|
37
|
+
* // Handle successful sign-up (e.g., redirect, show confirmation)
|
|
38
|
+
* }}
|
|
39
|
+
* onError={(error) => {
|
|
40
|
+
* console.error('Sign-up failed:', error);
|
|
41
|
+
* }}
|
|
42
|
+
* onComplete={(redirectUrl) => {
|
|
43
|
+
* // Platform-specific redirect handling (e.g., Next.js router.push)
|
|
44
|
+
* router.push(redirectUrl); // or window.location.href = redirectUrl
|
|
45
|
+
* }}
|
|
46
|
+
* size="medium"
|
|
47
|
+
* variant="outlined"
|
|
48
|
+
* afterSignUpUrl="/welcome"
|
|
49
|
+
* />
|
|
50
|
+
* );
|
|
51
|
+
* };
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const SignUp: FC<SignUpProps>;
|
|
55
|
+
export default SignUp;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Checkbox input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const CheckboxInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default CheckboxInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Date input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const DateInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default DateInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Divider component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const DividerComponent: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default DividerComponent;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Email input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const EmailInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default EmailInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Form container component that renders child components.
|
|
22
|
+
*/
|
|
23
|
+
declare const FormContainer: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default FormContainer;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Google Sign-Up Button Component.
|
|
22
|
+
* Handles registration with Google identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const GoogleButton: FC<BaseSignUpOptionProps>;
|
|
25
|
+
export default GoogleButton;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Image component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const ImageComponent: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default ImageComponent;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Number input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const NumberInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default NumberInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Password input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const PasswordInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { EmbeddedFlowComponent, WithPreferences } from '@asgardeo/browser';
|
|
19
|
+
import { ReactElement } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Base props that all sign-up option components share.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseSignUpOptionProps extends WithPreferences {
|
|
24
|
+
/**
|
|
25
|
+
* Custom CSS class name for buttons.
|
|
26
|
+
*/
|
|
27
|
+
buttonClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The component configuration from the flow response.
|
|
30
|
+
*/
|
|
31
|
+
component: EmbeddedFlowComponent;
|
|
32
|
+
/**
|
|
33
|
+
* Global error message to display.
|
|
34
|
+
*/
|
|
35
|
+
error?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Form validation errors.
|
|
38
|
+
*/
|
|
39
|
+
formErrors: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Current form values.
|
|
42
|
+
*/
|
|
43
|
+
formValues: Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Custom CSS class name for form inputs.
|
|
46
|
+
*/
|
|
47
|
+
inputClassName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the form is valid.
|
|
50
|
+
*/
|
|
51
|
+
isFormValid: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the component is in loading state.
|
|
54
|
+
*/
|
|
55
|
+
isLoading: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Callback function called when input values change.
|
|
58
|
+
*/
|
|
59
|
+
onInputChange: (name: string, value: string) => void;
|
|
60
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Component size variant.
|
|
63
|
+
*/
|
|
64
|
+
size?: 'small' | 'medium' | 'large';
|
|
65
|
+
/**
|
|
66
|
+
* Touched state for form fields.
|
|
67
|
+
*/
|
|
68
|
+
touchedFields: Record<string, boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Component theme variant.
|
|
71
|
+
*/
|
|
72
|
+
variant?: any;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Creates the appropriate sign-up component based on the component type.
|
|
76
|
+
*/
|
|
77
|
+
export declare const createSignUpComponent: (props: BaseSignUpOptionProps) => ReactElement;
|
|
78
|
+
/**
|
|
79
|
+
* Convenience function that creates the appropriate sign-up component from flow component data.
|
|
80
|
+
*/
|
|
81
|
+
export declare const createSignUpOptionFromComponent: (component: EmbeddedFlowComponent, formValues: Record<string, string>, touchedFields: Record<string, boolean>, formErrors: Record<string, string>, isLoading: boolean, isFormValid: boolean, onInputChange: (name: string, value: string) => void, options?: {
|
|
82
|
+
buttonClassName?: string;
|
|
83
|
+
error?: string | null;
|
|
84
|
+
inputClassName?: string;
|
|
85
|
+
key?: string | number;
|
|
86
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;
|
|
87
|
+
size?: "small" | "medium" | "large";
|
|
88
|
+
variant?: any;
|
|
89
|
+
}) => ReactElement;
|
|
90
|
+
/**
|
|
91
|
+
* Processes an array of components and renders them as React elements.
|
|
92
|
+
*/
|
|
93
|
+
export declare const renderSignUpComponents: (components: EmbeddedFlowComponent[], formValues: Record<string, string>, touchedFields: Record<string, boolean>, formErrors: Record<string, string>, isLoading: boolean, isFormValid: boolean, onInputChange: (name: string, value: string) => void, options?: {
|
|
94
|
+
buttonClassName?: string;
|
|
95
|
+
error?: string | null;
|
|
96
|
+
inputClassName?: string;
|
|
97
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;
|
|
98
|
+
size?: "small" | "medium" | "large";
|
|
99
|
+
variant?: any;
|
|
100
|
+
}) => ReactElement[];
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Social button component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const SocialButton: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default SocialButton;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Button component for sign-up forms that handles all button variants.
|
|
22
|
+
*/
|
|
23
|
+
declare const ButtonComponent: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default ButtonComponent;
|