@asgardeo/react 0.6.17 → 0.6.19
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/dist/cjs/index.js +1760 -1316
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/adapters/CheckboxInput.d.ts +2 -2
- package/dist/components/adapters/DateInput.d.ts +2 -2
- package/dist/components/adapters/DividerComponent.d.ts +2 -2
- package/dist/components/adapters/EmailInput.d.ts +2 -2
- package/dist/components/adapters/FormContainer.d.ts +2 -2
- package/dist/components/adapters/ImageComponent.d.ts +2 -2
- package/dist/components/adapters/NumberInput.d.ts +2 -2
- package/dist/components/adapters/PasswordInput.d.ts +2 -2
- package/dist/components/adapters/SelectInput.d.ts +2 -2
- package/dist/components/adapters/SocialButton.d.ts +2 -2
- package/dist/components/adapters/SubmitButton.d.ts +2 -2
- package/dist/components/adapters/TelephoneInput.d.ts +2 -2
- package/dist/components/adapters/TextInput.d.ts +2 -2
- package/dist/components/adapters/Typography.d.ts +2 -2
- package/dist/components/presentation/{SignIn/component-driven/SignInOptionFactory.d.ts → auth/AuthOptionFactory.d.ts} +14 -2
- package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.d.ts +2 -2
- package/dist/components/presentation/{SignIn → auth/SignIn}/SignIn.d.ts +3 -3
- package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/BaseSignIn.d.ts +1 -1
- package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/BaseSignIn.d.ts +3 -3
- package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/SignIn.d.ts +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +27 -0
- package/dist/components/presentation/{SignUp → auth/SignUp}/SignUp.d.ts +6 -13
- package/dist/components/presentation/{SignUp → auth/SignUp/v1}/BaseSignUp.d.ts +3 -53
- package/dist/components/presentation/auth/SignUp/v1/SignUp.d.ts +38 -0
- package/dist/components/presentation/{SignUp → auth/SignUp/v1}/SignUpOptionFactory.d.ts +3 -52
- package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +171 -0
- package/dist/components/presentation/auth/SignUp/v2/SignUp.d.ts +38 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.js +1463 -1011
- package/dist/index.js.map +4 -4
- package/dist/models/adapters.d.ts +68 -0
- package/dist/utils/v2/flowTransformer.d.ts +111 -0
- package/dist/utils/v2/getAuthComponentHeadings.d.ts +69 -0
- package/dist/utils/v2/resolveTranslation.d.ts +27 -0
- package/dist/utils/v2/resolveTranslationsInArray.d.ts +27 -0
- package/dist/{components/presentation/SignIn/component-driven/transformer.d.ts → utils/v2/resolveTranslationsInObject.d.ts} +8 -11
- package/package.json +3 -3
- package/dist/components/presentation/SignUp/transformer.d.ts +0 -104
- /package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.styles.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/EmailOtp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/IdentifierFirst.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/MultiOptionButton.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SignInOptionFactory.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SmsOtp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SocialButton.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/Totp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/UsernamePassword.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/types.d.ts +0 -0
- /package/dist/components/presentation/{SignUp → auth/SignUp}/BaseSignUp.styles.d.ts +0 -0
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Checkbox input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const CheckboxInput: FC<
|
|
23
|
+
declare const CheckboxInput: FC<AdapterProps>;
|
|
24
24
|
export default CheckboxInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Date input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const DateInput: FC<
|
|
23
|
+
declare const DateInput: FC<AdapterProps>;
|
|
24
24
|
export default DateInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Divider component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const DividerComponent: FC<
|
|
23
|
+
declare const DividerComponent: FC<AdapterProps>;
|
|
24
24
|
export default DividerComponent;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Email input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const EmailInput: FC<
|
|
23
|
+
declare const EmailInput: FC<AdapterProps>;
|
|
24
24
|
export default EmailInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Form container component that renders child components.
|
|
22
22
|
*/
|
|
23
|
-
declare const FormContainer: FC<
|
|
23
|
+
declare const FormContainer: FC<AdapterProps>;
|
|
24
24
|
export default FormContainer;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Image component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const ImageComponent: FC<
|
|
23
|
+
declare const ImageComponent: FC<AdapterProps>;
|
|
24
24
|
export default ImageComponent;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Number input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const NumberInput: FC<
|
|
23
|
+
declare const NumberInput: FC<AdapterProps>;
|
|
24
24
|
export default NumberInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Password input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const PasswordInput: FC<
|
|
23
|
+
declare const PasswordInput: FC<AdapterProps>;
|
|
24
24
|
export default PasswordInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Select input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const SelectInput: FC<
|
|
23
|
+
declare const SelectInput: FC<AdapterProps>;
|
|
24
24
|
export default SelectInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Social button component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const SocialButton: FC<
|
|
23
|
+
declare const SocialButton: FC<AdapterProps>;
|
|
24
24
|
export default SocialButton;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Button component for sign-up forms that handles all button variants.
|
|
22
22
|
*/
|
|
23
|
-
declare const ButtonComponent: FC<
|
|
23
|
+
declare const ButtonComponent: FC<AdapterProps>;
|
|
24
24
|
export default ButtonComponent;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Telephone input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const TelephoneInput: FC<
|
|
23
|
+
declare const TelephoneInput: FC<AdapterProps>;
|
|
24
24
|
export default TelephoneInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Text input component for sign-up forms.
|
|
22
22
|
*/
|
|
23
|
-
declare const TextInput: FC<
|
|
23
|
+
declare const TextInput: FC<AdapterProps>;
|
|
24
24
|
export default TextInput;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { AdapterProps } from '../../models/adapters';
|
|
20
20
|
/**
|
|
21
21
|
* Typography component for sign-up forms (titles, descriptions, etc.).
|
|
22
22
|
*/
|
|
23
|
-
declare const TypographyComponent: FC<
|
|
23
|
+
declare const TypographyComponent: FC<AdapterProps>;
|
|
24
24
|
export default TypographyComponent;
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { ReactElement } from 'react';
|
|
19
|
-
import { EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
19
|
+
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
20
|
+
export type AuthType = 'signin' | 'signup';
|
|
20
21
|
/**
|
|
21
|
-
* Processes an array of components and renders them as React elements.
|
|
22
|
+
* Processes an array of components and renders them as React elements for sign-in.
|
|
22
23
|
*/
|
|
23
24
|
export declare const renderSignInComponents: (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?: {
|
|
24
25
|
buttonClassName?: string;
|
|
@@ -28,3 +29,14 @@ export declare const renderSignInComponents: (components: EmbeddedFlowComponent[
|
|
|
28
29
|
size?: "small" | "medium" | "large";
|
|
29
30
|
variant?: any;
|
|
30
31
|
}) => ReactElement[];
|
|
32
|
+
/**
|
|
33
|
+
* Processes an array of components and renders them as React elements for sign-up.
|
|
34
|
+
*/
|
|
35
|
+
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?: {
|
|
36
|
+
buttonClassName?: string;
|
|
37
|
+
inputClassName?: string;
|
|
38
|
+
onInputBlur?: (name: string) => void;
|
|
39
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;
|
|
40
|
+
size?: "small" | "medium" | "large";
|
|
41
|
+
variant?: any;
|
|
42
|
+
}) => ReactElement[];
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import { BaseSignInProps as BaseSignInV1Props } from './
|
|
20
|
-
import { BaseSignInProps as BaseSignInV2Props } from './
|
|
19
|
+
import { BaseSignInProps as BaseSignInV1Props } from './v1/BaseSignIn';
|
|
20
|
+
import { BaseSignInProps as BaseSignInV2Props } from './v2/BaseSignIn';
|
|
21
21
|
/**
|
|
22
22
|
* Props for the BaseSignIn component.
|
|
23
23
|
* Extends BaseSignInV1Props & BaseSignInV2Props for full compatibility with both React BaseSignIn components.
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC, ReactElement } from 'react';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { SignInRenderProps } from './v2/SignIn';
|
|
20
|
+
import { BaseSignInProps } from './BaseSignIn';
|
|
21
21
|
/**
|
|
22
22
|
* Props for the SignIn component.
|
|
23
23
|
* Extends BaseSignInProps for full compatibility with the React BaseSignIn component
|
|
24
24
|
*/
|
|
25
|
-
export type SignInProps = Pick<
|
|
25
|
+
export type SignInProps = Pick<BaseSignInProps, 'className' | 'onSuccess' | 'onError' | 'variant' | 'size'> & {
|
|
26
26
|
/**
|
|
27
27
|
* Render function for custom UI (render props pattern).
|
|
28
28
|
*/
|
package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/BaseSignIn.d.ts
RENAMED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { EmbeddedSignInFlowInitiateResponse, EmbeddedSignInFlowHandleResponse, EmbeddedSignInFlowHandleRequestPayload, EmbeddedFlowExecuteRequestConfig } from '@asgardeo/browser';
|
|
19
19
|
import { FC } from 'react';
|
|
20
|
-
import { CardProps } from '
|
|
20
|
+
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
22
22
|
* Props for the BaseSignIn component.
|
|
23
23
|
*/
|
package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/BaseSignIn.d.ts
RENAMED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC, ReactNode } from 'react';
|
|
19
|
-
import {
|
|
20
|
-
import { CardProps } from '
|
|
19
|
+
import { EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest, EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
20
|
+
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
22
22
|
* Render props for custom UI rendering
|
|
23
23
|
*/
|
|
@@ -119,7 +119,7 @@ export interface BaseSignInProps {
|
|
|
119
119
|
* @param payload - The form data to submit.
|
|
120
120
|
* @param component - The component that triggered the submission.
|
|
121
121
|
*/
|
|
122
|
-
onSubmit?: (payload:
|
|
122
|
+
onSubmit?: (payload: EmbeddedSignInFlowRequest, component: EmbeddedFlowComponent) => Promise<void>;
|
|
123
123
|
/**
|
|
124
124
|
* Callback function called when authentication is successful.
|
|
125
125
|
* @param authData - The authentication data returned upon successful completion.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { FC, ReactNode } from 'react';
|
|
19
19
|
import { BaseSignInProps } from './BaseSignIn';
|
|
20
|
-
import { EmbeddedFlowComponent, EmbeddedSignInFlowRequestV2 } from '@asgardeo/browser';
|
|
20
|
+
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent, EmbeddedSignInFlowRequestV2 } from '@asgardeo/browser';
|
|
21
21
|
/**
|
|
22
22
|
* Render props function parameters
|
|
23
23
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
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 as BaseSignUpV1Props } from './v1/BaseSignUp';
|
|
20
|
+
import { BaseSignUpProps as BaseSignUpV2Props } from './v2/BaseSignUp';
|
|
21
|
+
/**
|
|
22
|
+
* Props for the BaseSignUp component.
|
|
23
|
+
* Extends BaseSignUpV1Props & BaseSignUpV2Props for full compatibility with both React BaseSignUp components.
|
|
24
|
+
*/
|
|
25
|
+
export type BaseSignUpProps = BaseSignUpV1Props | BaseSignUpV2Props;
|
|
26
|
+
declare const BaseSignUp: FC<BaseSignUpProps>;
|
|
27
|
+
export default BaseSignUp;
|
|
@@ -15,24 +15,17 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FC
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
* Render props function parameters (re-exported from BaseSignUp for convenience)
|
|
22
|
-
*/
|
|
23
|
-
export type SignUpRenderProps = BaseSignUpRenderProps;
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { SignUpProps as SignUpV1Props } from './v1/SignUp';
|
|
20
|
+
import { SignUpProps as SignUpV2Props } from './v2/SignUp';
|
|
24
21
|
/**
|
|
25
22
|
* Props for the SignUp component.
|
|
23
|
+
* Extends SignUpV1Props & SignUpV2Props for full compatibility with both React SignUp components.
|
|
26
24
|
*/
|
|
27
|
-
export type SignUpProps =
|
|
28
|
-
/**
|
|
29
|
-
* Render props function for custom UI
|
|
30
|
-
*/
|
|
31
|
-
children?: (props: SignUpRenderProps) => ReactNode;
|
|
32
|
-
};
|
|
25
|
+
export type SignUpProps = SignUpV1Props | SignUpV2Props;
|
|
33
26
|
/**
|
|
34
27
|
* A styled SignUp component that provides embedded sign-up flow with pre-built styling.
|
|
35
|
-
* This component
|
|
28
|
+
* This component routes to the appropriate version-specific implementation based on the platform.
|
|
36
29
|
*
|
|
37
30
|
* @example
|
|
38
31
|
* // Default UI
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
|
-
import { CardProps } from '
|
|
20
|
+
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
22
22
|
* Render props for custom UI rendering
|
|
23
23
|
*/
|
|
@@ -163,61 +163,11 @@ export interface BaseSignUpProps {
|
|
|
163
163
|
showLogo?: boolean;
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
166
|
+
* BaseSignUp component that provides embedded sign-up flow for Asgardeo.
|
|
167
167
|
* This component handles both the presentation layer and sign-up flow logic.
|
|
168
168
|
* It accepts API functions as props to maintain framework independence.
|
|
169
169
|
*
|
|
170
|
-
* @
|
|
171
|
-
* // Default UI
|
|
172
|
-
* ```tsx
|
|
173
|
-
* import { BaseSignUp } from '@asgardeo/react';
|
|
174
|
-
*
|
|
175
|
-
* const MySignUp = () => {
|
|
176
|
-
* return (
|
|
177
|
-
* <BaseSignUp
|
|
178
|
-
* onInitialize={async (payload) => {
|
|
179
|
-
* // Your API call to initialize sign-up
|
|
180
|
-
* return await initializeSignUp(payload);
|
|
181
|
-
* }}
|
|
182
|
-
* onSubmit={async (payload) => {
|
|
183
|
-
* // Your API call to handle sign-up
|
|
184
|
-
* return await handleSignUp(payload);
|
|
185
|
-
* }}
|
|
186
|
-
* onError={(error) => {
|
|
187
|
-
* console.error('Error:', error);
|
|
188
|
-
* }}
|
|
189
|
-
* onComplete={(response) => {
|
|
190
|
-
* // Platform-specific redirect handling (e.g., Next.js router.push)
|
|
191
|
-
* router.push(response); // or window.location.href = redirectUrl
|
|
192
|
-
* }}
|
|
193
|
-
* className="max-w-md mx-auto"
|
|
194
|
-
* />
|
|
195
|
-
* );
|
|
196
|
-
* };
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* // Custom UI with render props
|
|
201
|
-
* ```tsx
|
|
202
|
-
* <BaseSignUp onInitialize={initializeSignUp} onSubmit={handleSignUp}>
|
|
203
|
-
* {({values, errors, handleInputChange, handleSubmit, isLoading, components}) => (
|
|
204
|
-
* <div className="custom-form">
|
|
205
|
-
* <input
|
|
206
|
-
* name="username"
|
|
207
|
-
* value={values.username || ''}
|
|
208
|
-
* onChange={(e) => handleInputChange('username', e.target.value)}
|
|
209
|
-
* />
|
|
210
|
-
* {errors.username && <span>{errors.username}</span>}
|
|
211
|
-
* <button
|
|
212
|
-
* onClick={() => handleSubmit(components[0], values)}
|
|
213
|
-
* disabled={isLoading}
|
|
214
|
-
* >
|
|
215
|
-
* Sign Up
|
|
216
|
-
* </button>
|
|
217
|
-
* </div>
|
|
218
|
-
* )}
|
|
219
|
-
* </BaseSignUp>
|
|
220
|
-
* ```
|
|
170
|
+
* @internal
|
|
221
171
|
*/
|
|
222
172
|
declare const BaseSignUp: FC<BaseSignUpProps>;
|
|
223
173
|
export default BaseSignUp;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, ReactNode } from 'react';
|
|
19
|
+
import { BaseSignUpProps, BaseSignUpRenderProps } from './BaseSignUp';
|
|
20
|
+
/**
|
|
21
|
+
* Render props function parameters (re-exported from BaseSignUp for convenience)
|
|
22
|
+
*/
|
|
23
|
+
export type SignUpRenderProps = BaseSignUpRenderProps;
|
|
24
|
+
/**
|
|
25
|
+
* Props for the SignUp component.
|
|
26
|
+
*/
|
|
27
|
+
export type SignUpProps = BaseSignUpProps & {
|
|
28
|
+
/**
|
|
29
|
+
* Render props function for custom UI
|
|
30
|
+
*/
|
|
31
|
+
children?: (props: SignUpRenderProps) => ReactNode;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A styled SignUp component for Asgardeo platform that provides embedded sign-up flow with pre-built styling.
|
|
35
|
+
* This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
|
|
36
|
+
*/
|
|
37
|
+
declare const SignUp: FC<SignUpProps>;
|
|
38
|
+
export default SignUp;
|
|
@@ -15,62 +15,13 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { EmbeddedFlowComponent
|
|
18
|
+
import { EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
19
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
|
-
* Form validation errors.
|
|
34
|
-
*/
|
|
35
|
-
formErrors: Record<string, string>;
|
|
36
|
-
/**
|
|
37
|
-
* Current form values.
|
|
38
|
-
*/
|
|
39
|
-
formValues: Record<string, string>;
|
|
40
|
-
/**
|
|
41
|
-
* Custom CSS class name for form inputs.
|
|
42
|
-
*/
|
|
43
|
-
inputClassName?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the form is valid.
|
|
46
|
-
*/
|
|
47
|
-
isFormValid: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Whether the component is in loading state.
|
|
50
|
-
*/
|
|
51
|
-
isLoading: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Callback function called when input values change.
|
|
54
|
-
*/
|
|
55
|
-
onInputChange: (name: string, value: string) => void;
|
|
56
|
-
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>) => void;
|
|
57
|
-
/**
|
|
58
|
-
* Component size variant.
|
|
59
|
-
*/
|
|
60
|
-
size?: 'small' | 'medium' | 'large';
|
|
61
|
-
/**
|
|
62
|
-
* Touched state for form fields.
|
|
63
|
-
*/
|
|
64
|
-
touchedFields: Record<string, boolean>;
|
|
65
|
-
/**
|
|
66
|
-
* Component theme variant.
|
|
67
|
-
*/
|
|
68
|
-
variant?: any;
|
|
69
|
-
}
|
|
20
|
+
import { AdapterProps } from 'packages/react/src/models/adapters';
|
|
70
21
|
/**
|
|
71
22
|
* Creates the appropriate sign-up component based on the component type.
|
|
72
23
|
*/
|
|
73
|
-
export declare const createSignUpComponent: ({ component, onSubmit, ...rest }:
|
|
24
|
+
export declare const createSignUpComponent: ({ component, onSubmit, ...rest }: AdapterProps) => ReactElement;
|
|
74
25
|
/**
|
|
75
26
|
* Convenience function that creates the appropriate sign-up component from flow component data.
|
|
76
27
|
*/
|