@asgardeo/react 0.3.0 → 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 +5 -1
- package/dist/AsgardeoReactClient.d.ts +3 -2
- package/dist/__temp__/api.d.ts +17 -18
- package/dist/__temp__/models.d.ts +13 -21
- package/dist/cjs/index.js +17252 -1209
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +4 -3
- package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +4 -3
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +2 -1
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -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/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/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 +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +23 -2
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +133 -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/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/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/components/primitives/PasswordField/PasswordField.d.ts +31 -0
- package/dist/components/primitives/Popover/Popover.d.ts +71 -34
- 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} +1 -0
- 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/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
- package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
- 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/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +94 -9
- package/dist/index.js +17242 -1113
- 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
- /package/dist/{theme → contexts/Theme}/types.d.ts +0 -0
|
@@ -15,45 +15,82 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { UseFloatingReturn, UseInteractionsReturn } from '@floating-ui/react';
|
|
20
|
+
interface DialogOptions {
|
|
21
|
+
initialOpen?: boolean;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
interface DialogHookReturn extends UseFloatingReturn, UseInteractionsReturn {
|
|
26
|
+
open: boolean;
|
|
27
|
+
setOpen: (open: boolean) => void;
|
|
28
|
+
labelId: string | undefined;
|
|
29
|
+
descriptionId: string | undefined;
|
|
30
|
+
setLabelId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
31
|
+
setDescriptionId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
25
32
|
}
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
export declare function useDialog({ initialOpen, open: controlledOpen, onOpenChange: setControlledOpen, }?: DialogOptions): DialogHookReturn;
|
|
34
|
+
interface PopoverOptions {
|
|
35
|
+
initialOpen?: boolean;
|
|
36
|
+
open?: boolean;
|
|
37
|
+
onOpenChange?: (open: boolean) => void;
|
|
38
|
+
placement?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
39
|
+
offset?: number;
|
|
40
|
+
}
|
|
41
|
+
interface PopoverHookReturn extends UseFloatingReturn, UseInteractionsReturn {
|
|
42
|
+
open: boolean;
|
|
43
|
+
setOpen: (open: boolean) => void;
|
|
44
|
+
labelId: string | undefined;
|
|
45
|
+
descriptionId: string | undefined;
|
|
46
|
+
setLabelId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
47
|
+
setDescriptionId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
48
|
+
}
|
|
49
|
+
export declare function usePopover({ initialOpen, open: controlledOpen, onOpenChange: setControlledOpen, placement, offset: offsetValue, }?: PopoverOptions): PopoverHookReturn;
|
|
50
|
+
export declare const useDialogContext: () => DialogHookReturn;
|
|
51
|
+
export declare const usePopoverContext: () => PopoverHookReturn;
|
|
52
|
+
export declare function Dialog({ children, ...options }: {
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
} & DialogOptions): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
interface DialogTriggerProps {
|
|
56
|
+
children: React.ReactNode;
|
|
57
|
+
asChild?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLElement> & DialogTriggerProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
60
|
+
export declare const DialogContent: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
export declare function Popover({ children, ...options }: {
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
} & PopoverOptions): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
interface PopoverTriggerProps {
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
asChild?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLElement> & PopoverTriggerProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
69
|
+
export declare const PopoverContent: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
export declare const PopoverHeading: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
71
|
+
export declare const DialogHeading: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
72
|
+
export declare const PopoverDescription: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
73
|
+
export declare const DialogDescription: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
74
|
+
export declare const PopoverClose: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
75
|
+
export declare const DialogClose: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
76
|
+
interface LegacyPopoverProps {
|
|
31
77
|
isOpen: boolean;
|
|
32
|
-
|
|
33
|
-
* The content to display inside the popover
|
|
34
|
-
*/
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* Callback when the popover should close
|
|
38
|
-
*/
|
|
78
|
+
children: React.ReactNode;
|
|
39
79
|
onClose: () => void;
|
|
40
|
-
/**
|
|
41
|
-
* Optional custom class name for the popover container
|
|
42
|
-
*/
|
|
43
80
|
className?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The HTML element ID where the portal should be mounted
|
|
46
|
-
*/
|
|
47
|
-
portalId?: string;
|
|
48
|
-
/**
|
|
49
|
-
* The display mode of the popover
|
|
50
|
-
* 'modal' - shows overlay and centers content
|
|
51
|
-
* 'dropdown' - no overlay, content positioned relative to trigger
|
|
52
|
-
*/
|
|
53
81
|
mode?: 'modal' | 'dropdown';
|
|
82
|
+
trigger?: HTMLElement | null;
|
|
83
|
+
placement?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
84
|
+
offset?: number;
|
|
54
85
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
86
|
+
declare const LegacyPopoverHeader: React.FC<{
|
|
87
|
+
children?: React.ReactNode;
|
|
88
|
+
}>;
|
|
89
|
+
declare const LegacyPopoverContent: React.FC<{
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const LegacyPopover: React.FC<LegacyPopoverProps> & {
|
|
93
|
+
Header: typeof LegacyPopoverHeader;
|
|
94
|
+
Content: typeof LegacyPopoverContent;
|
|
58
95
|
};
|
|
59
|
-
export default
|
|
96
|
+
export default LegacyPopover;
|
|
@@ -0,0 +1,54 @@
|
|
|
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, CSSProperties } from 'react';
|
|
19
|
+
export type SpinnerSize = 'small' | 'medium' | 'large';
|
|
20
|
+
export interface SpinnerProps {
|
|
21
|
+
/**
|
|
22
|
+
* Size of the spinner
|
|
23
|
+
*/
|
|
24
|
+
size?: SpinnerSize;
|
|
25
|
+
/**
|
|
26
|
+
* Custom color for the spinner
|
|
27
|
+
*/
|
|
28
|
+
color?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Additional CSS class names
|
|
31
|
+
*/
|
|
32
|
+
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Custom styles
|
|
35
|
+
*/
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Spinner component for loading states
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Basic spinner
|
|
44
|
+
* <Spinner />
|
|
45
|
+
*
|
|
46
|
+
* // Large spinner with custom color
|
|
47
|
+
* <Spinner size="large" color="#3b82f6" />
|
|
48
|
+
*
|
|
49
|
+
* // Small spinner
|
|
50
|
+
* <Spinner size="small" />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare const Spinner: FC<SpinnerProps>;
|
|
54
|
+
export default Spinner;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FC, InputHTMLAttributes } from 'react';
|
|
18
|
+
import { FC, InputHTMLAttributes, ReactNode } from 'react';
|
|
19
19
|
export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className'> {
|
|
20
20
|
/**
|
|
21
21
|
* Label text to display above the input
|
|
@@ -41,6 +41,22 @@ export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
41
41
|
* Helper text to display below the input
|
|
42
42
|
*/
|
|
43
43
|
helperText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Icon to display at the start (left) of the input
|
|
46
|
+
*/
|
|
47
|
+
startIcon?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Icon to display at the end (right) of the input
|
|
50
|
+
*/
|
|
51
|
+
endIcon?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Click handler for the start icon
|
|
54
|
+
*/
|
|
55
|
+
onStartIconClick?: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Click handler for the end icon
|
|
58
|
+
*/
|
|
59
|
+
onEndIconClick?: () => void;
|
|
44
60
|
}
|
|
45
|
-
|
|
61
|
+
declare const TextField: FC<TextFieldProps>;
|
|
46
62
|
export default TextField;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { CSSProperties, FC, ReactNode, ElementType } from 'react';
|
|
19
|
+
export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'overline' | 'button';
|
|
20
|
+
export type TypographyAlign = 'left' | 'center' | 'right' | 'justify';
|
|
21
|
+
export type TypographyColor = 'primary' | 'secondary' | 'error' | 'success' | 'warning' | 'info' | 'textPrimary' | 'textSecondary' | 'inherit';
|
|
22
|
+
export interface TypographyProps {
|
|
23
|
+
/**
|
|
24
|
+
* The content to be rendered
|
|
25
|
+
*/
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The typography variant to apply
|
|
29
|
+
*/
|
|
30
|
+
variant?: TypographyVariant;
|
|
31
|
+
/**
|
|
32
|
+
* The HTML element or React component to render
|
|
33
|
+
*/
|
|
34
|
+
component?: ElementType;
|
|
35
|
+
/**
|
|
36
|
+
* Text alignment
|
|
37
|
+
*/
|
|
38
|
+
align?: TypographyAlign;
|
|
39
|
+
/**
|
|
40
|
+
* Color variant
|
|
41
|
+
*/
|
|
42
|
+
color?: TypographyColor;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the text should be clipped with ellipsis when it overflows
|
|
45
|
+
*/
|
|
46
|
+
noWrap?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Additional CSS class names
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Custom styles
|
|
53
|
+
*/
|
|
54
|
+
style?: CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the text should be displayed inline
|
|
57
|
+
*/
|
|
58
|
+
inline?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Custom font weight
|
|
61
|
+
*/
|
|
62
|
+
fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;
|
|
63
|
+
/**
|
|
64
|
+
* Custom font size (overrides variant sizing)
|
|
65
|
+
*/
|
|
66
|
+
fontSize?: string | number;
|
|
67
|
+
/**
|
|
68
|
+
* Line height
|
|
69
|
+
*/
|
|
70
|
+
lineHeight?: string | number;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to disable gutters (margin bottom)
|
|
73
|
+
*/
|
|
74
|
+
gutterBottom?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Typography component for consistent text rendering throughout the application.
|
|
78
|
+
* Integrates with the theme system and provides semantic HTML elements.
|
|
79
|
+
*/
|
|
80
|
+
declare const Typography: FC<TypographyProps>;
|
|
81
|
+
export default Typography;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC, PropsWithChildren } from 'react';
|
|
19
|
-
import { AsgardeoReactConfig } from '
|
|
19
|
+
import { AsgardeoReactConfig } from '../../models/config';
|
|
20
20
|
/**
|
|
21
21
|
* Props interface of {@link AsgardeoProvider}
|
|
22
22
|
*/
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoContextProps } from '
|
|
18
|
+
import { AsgardeoContextProps } from './AsgardeoContext';
|
|
19
19
|
declare const useAsgardeo: () => AsgardeoContextProps;
|
|
20
20
|
export default useAsgardeo;
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Types of authentication flows/steps that can be displayed.
|
|
20
|
+
*/
|
|
21
|
+
export type FlowStep = {
|
|
22
|
+
id: string;
|
|
23
|
+
type: 'signin' | 'signup' | 'organization-signin' | 'forgot-password' | 'reset-password' | 'verify-email' | 'mfa';
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
canGoBack?: boolean;
|
|
27
|
+
metadata?: Record<string, any>;
|
|
28
|
+
} | null;
|
|
29
|
+
/**
|
|
30
|
+
* Message types for displaying in authentication flows.
|
|
31
|
+
*/
|
|
32
|
+
export interface FlowMessage {
|
|
33
|
+
id?: string;
|
|
34
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
35
|
+
message: string;
|
|
36
|
+
dismissible?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Context value for managing authentication flow UI state.
|
|
40
|
+
*/
|
|
41
|
+
export interface FlowContextValue {
|
|
42
|
+
currentStep: FlowStep;
|
|
43
|
+
setCurrentStep: (step: FlowStep) => void;
|
|
44
|
+
title: string;
|
|
45
|
+
setTitle: (title: string) => void;
|
|
46
|
+
subtitle?: string;
|
|
47
|
+
setSubtitle: (subtitle?: string) => void;
|
|
48
|
+
messages: FlowMessage[];
|
|
49
|
+
addMessage: (message: FlowMessage) => void;
|
|
50
|
+
removeMessage: (messageId: string) => void;
|
|
51
|
+
clearMessages: () => void;
|
|
52
|
+
error: string | null;
|
|
53
|
+
setError: (error: string | null) => void;
|
|
54
|
+
isLoading: boolean;
|
|
55
|
+
setIsLoading: (loading: boolean) => void;
|
|
56
|
+
showBackButton: boolean;
|
|
57
|
+
setShowBackButton: (show: boolean) => void;
|
|
58
|
+
onGoBack?: () => void;
|
|
59
|
+
setOnGoBack: (callback?: () => void) => void;
|
|
60
|
+
reset: () => void;
|
|
61
|
+
navigateToFlow: (flowType: NonNullable<FlowStep>['type'], options?: {
|
|
62
|
+
title?: string;
|
|
63
|
+
subtitle?: string;
|
|
64
|
+
metadata?: Record<string, any>;
|
|
65
|
+
}) => void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Context for managing authentication flow UI state.
|
|
69
|
+
* This context handles titles, messages, navigation, and loading states
|
|
70
|
+
* for authentication flows like SignIn, SignUp, organization signin, etc.
|
|
71
|
+
*/
|
|
72
|
+
declare const FlowContext: import("react").Context<FlowContextValue>;
|
|
73
|
+
export default FlowContext;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, PropsWithChildren } from 'react';
|
|
19
|
+
import { FlowStep } from './FlowContext';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the FlowProvider component.
|
|
22
|
+
*/
|
|
23
|
+
export interface FlowProviderProps {
|
|
24
|
+
/**
|
|
25
|
+
* Initial step to start with.
|
|
26
|
+
*/
|
|
27
|
+
initialStep?: FlowStep;
|
|
28
|
+
/**
|
|
29
|
+
* Initial title.
|
|
30
|
+
*/
|
|
31
|
+
initialTitle?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Initial subtitle.
|
|
34
|
+
*/
|
|
35
|
+
initialSubtitle?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Callback when flow type changes.
|
|
38
|
+
*/
|
|
39
|
+
onFlowChange?: (step: FlowStep) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Provider component for flow context.
|
|
43
|
+
* Manages shared UI state for authentication flows including titles, messages, and navigation.
|
|
44
|
+
*/
|
|
45
|
+
declare const FlowProvider: FC<PropsWithChildren<FlowProviderProps>>;
|
|
46
|
+
export default FlowProvider;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { FlowContextValue } from './FlowContext';
|
|
19
|
+
/**
|
|
20
|
+
* Hook to access the flow context.
|
|
21
|
+
* Must be used within a FlowProvider.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const MyAuthComponent = () => {
|
|
26
|
+
* const { title, setTitle, addMessage, isLoading } = useFlow();
|
|
27
|
+
*
|
|
28
|
+
* const handleSuccess = () => {
|
|
29
|
+
* addMessage({
|
|
30
|
+
* type: 'success',
|
|
31
|
+
* message: 'Authentication successful!'
|
|
32
|
+
* });
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <div>
|
|
37
|
+
* <h1>{title}</h1>
|
|
38
|
+
* {isLoading && <p>Loading...</p>}
|
|
39
|
+
* </div>
|
|
40
|
+
* );
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @returns The flow context value
|
|
45
|
+
* @throws Error if used outside of FlowProvider
|
|
46
|
+
*/
|
|
47
|
+
declare const useFlow: () => FlowContextValue;
|
|
48
|
+
export default useFlow;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { I18nBundle } from '@asgardeo/browser';
|
|
19
|
+
export interface I18nContextValue {
|
|
20
|
+
/**
|
|
21
|
+
* The current language code (e.g., 'en-US', 'fr-FR')
|
|
22
|
+
*/
|
|
23
|
+
currentLanguage: string;
|
|
24
|
+
/**
|
|
25
|
+
* The fallback language code
|
|
26
|
+
*/
|
|
27
|
+
fallbackLanguage: string;
|
|
28
|
+
/**
|
|
29
|
+
* All available i18n bundles (default + user provided)
|
|
30
|
+
*/
|
|
31
|
+
bundles: Record<string, I18nBundle>;
|
|
32
|
+
/**
|
|
33
|
+
* Function to change the current language
|
|
34
|
+
*/
|
|
35
|
+
setLanguage: (language: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Function to get a translation by key with optional parameters
|
|
38
|
+
*/
|
|
39
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
40
|
+
}
|
|
41
|
+
declare const I18nContext: import("react").Context<I18nContextValue>;
|
|
42
|
+
export default I18nContext;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 } from 'react';
|
|
19
|
+
import { I18nPreferences } from '@asgardeo/browser';
|
|
20
|
+
export interface I18nProviderProps {
|
|
21
|
+
/**
|
|
22
|
+
* The i18n preferences from the AsgardeoProvider
|
|
23
|
+
*/
|
|
24
|
+
preferences?: I18nPreferences;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* I18nProvider component that manages internationalization state and provides
|
|
28
|
+
* translation functions to child components.
|
|
29
|
+
*/
|
|
30
|
+
declare const I18nProvider: FC<PropsWithChildren<I18nProviderProps>>;
|
|
31
|
+
export default I18nProvider;
|
|
@@ -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 { I18nContextValue } from './I18nContext';
|
|
19
|
+
/**
|
|
20
|
+
* Hook for accessing the I18n context directly.
|
|
21
|
+
* Provides access to the full i18n context including bundles and all utilities.
|
|
22
|
+
*
|
|
23
|
+
* @returns The complete I18n context value
|
|
24
|
+
* @throws Error if used outside of I18nProvider context
|
|
25
|
+
*/
|
|
26
|
+
declare const useI18n: () => I18nContextValue;
|
|
27
|
+
export default useI18n;
|
|
@@ -21,4 +21,5 @@ export interface ThemeProviderProps {
|
|
|
21
21
|
theme?: RecursivePartial<ThemeConfig>;
|
|
22
22
|
defaultColorScheme?: 'light' | 'dark';
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
declare const ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>;
|
|
25
|
+
export default ThemeProvider;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Context } from 'react';
|
|
19
|
+
import { User, Schema } from '@asgardeo/browser';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link UserContext}
|
|
22
|
+
*/
|
|
23
|
+
export type UserContextProps = {
|
|
24
|
+
profile: User | null;
|
|
25
|
+
schemas: Schema[] | null;
|
|
26
|
+
flattenedProfile: User | null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Context object for managing user profile data and related operations.
|
|
30
|
+
*/
|
|
31
|
+
declare const UserContext: Context<UserContextProps | null>;
|
|
32
|
+
export default UserContext;
|