@asgardeo/react 0.5.3 → 0.5.5
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/AsgardeoReactClient.d.ts +8 -5
- package/dist/__temp__/api.d.ts +1 -1
- package/dist/__temp__/models.d.ts +1 -1
- package/dist/api/getAllOrganizations.d.ts +2 -2
- package/dist/cjs/index.js +2839 -2208
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +18 -7
- package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +2 -3
- package/dist/components/primitives/Logo/Logo.d.ts +55 -0
- package/dist/components/primitives/MultiInput/MultiInput.d.ts +86 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +2 -0
- package/dist/contexts/Branding/BrandingContext.d.ts +51 -0
- package/dist/contexts/Branding/BrandingProvider.d.ts +88 -0
- package/dist/contexts/Branding/useBrandingContext.d.ts +44 -0
- package/dist/contexts/Organization/OrganizationContext.d.ts +4 -42
- package/dist/contexts/Organization/OrganizationProvider.d.ts +10 -11
- package/dist/contexts/Organization/useOrganization.d.ts +2 -2
- package/dist/contexts/Theme/ThemeContext.d.ts +12 -0
- package/dist/contexts/Theme/ThemeProvider.d.ts +65 -2
- package/dist/contexts/Theme/types.d.ts +55 -0
- package/dist/contexts/User/UserContext.d.ts +9 -1
- package/dist/contexts/User/UserProvider.d.ts +9 -1
- package/dist/hooks/useBranding.d.ts +127 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +2516 -1876
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
|
@@ -64,7 +64,62 @@ export interface ThemeConfig {
|
|
|
64
64
|
spacing: {
|
|
65
65
|
unit: number;
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* The prefix used for CSS variables.
|
|
69
|
+
* @default 'asgardeo' (from VendorConstants.VENDOR_PREFIX)
|
|
70
|
+
*/
|
|
71
|
+
cssVarPrefix?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface ThemeVars {
|
|
74
|
+
colors: {
|
|
75
|
+
primary: {
|
|
76
|
+
main: string;
|
|
77
|
+
contrastText: string;
|
|
78
|
+
};
|
|
79
|
+
secondary: {
|
|
80
|
+
main: string;
|
|
81
|
+
contrastText: string;
|
|
82
|
+
};
|
|
83
|
+
background: {
|
|
84
|
+
surface: string;
|
|
85
|
+
disabled: string;
|
|
86
|
+
body: {
|
|
87
|
+
main: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
error: {
|
|
91
|
+
main: string;
|
|
92
|
+
contrastText: string;
|
|
93
|
+
};
|
|
94
|
+
success: {
|
|
95
|
+
main: string;
|
|
96
|
+
contrastText: string;
|
|
97
|
+
};
|
|
98
|
+
warning: {
|
|
99
|
+
main: string;
|
|
100
|
+
contrastText: string;
|
|
101
|
+
};
|
|
102
|
+
text: {
|
|
103
|
+
primary: string;
|
|
104
|
+
secondary: string;
|
|
105
|
+
};
|
|
106
|
+
border: string;
|
|
107
|
+
};
|
|
108
|
+
spacing: {
|
|
109
|
+
unit: string;
|
|
110
|
+
};
|
|
111
|
+
borderRadius: {
|
|
112
|
+
small: string;
|
|
113
|
+
medium: string;
|
|
114
|
+
large: string;
|
|
115
|
+
};
|
|
116
|
+
shadows: {
|
|
117
|
+
small: string;
|
|
118
|
+
medium: string;
|
|
119
|
+
large: string;
|
|
120
|
+
};
|
|
67
121
|
}
|
|
68
122
|
export interface Theme extends ThemeConfig {
|
|
69
123
|
cssVariables: Record<string, string>;
|
|
124
|
+
vars: ThemeVars;
|
|
70
125
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User, Schema } from '@asgardeo/browser';
|
|
18
|
+
import { User, Schema, UpdateMeProfileConfig } from '@asgardeo/browser';
|
|
19
19
|
import { Context } from 'react';
|
|
20
20
|
/**
|
|
21
21
|
* Props interface of {@link UserContext}
|
|
@@ -25,6 +25,14 @@ export type UserContextProps = {
|
|
|
25
25
|
profile: User | null;
|
|
26
26
|
revalidateProfile: () => Promise<void>;
|
|
27
27
|
schemas: Schema[] | null;
|
|
28
|
+
updateProfile: (requestConfig: UpdateMeProfileConfig, sessionId?: string) => Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
data: {
|
|
31
|
+
user: User;
|
|
32
|
+
};
|
|
33
|
+
error: string;
|
|
34
|
+
}>;
|
|
35
|
+
onUpdateProfile: (payload: User) => void;
|
|
28
36
|
};
|
|
29
37
|
/**
|
|
30
38
|
* Context object for managing user profile data and related operations.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { UserProfile } from '@asgardeo/browser';
|
|
18
|
+
import { UpdateMeProfileConfig, User, UserProfile } from '@asgardeo/browser';
|
|
19
19
|
import { FC, PropsWithChildren } from 'react';
|
|
20
20
|
/**
|
|
21
21
|
* Props interface of {@link UserProvider}
|
|
@@ -23,6 +23,14 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
23
23
|
export interface UserProviderProps {
|
|
24
24
|
profile: UserProfile;
|
|
25
25
|
revalidateProfile?: () => Promise<void>;
|
|
26
|
+
updateProfile?: (requestConfig: UpdateMeProfileConfig, sessionId?: string) => Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
data: {
|
|
29
|
+
user: User;
|
|
30
|
+
};
|
|
31
|
+
error: string;
|
|
32
|
+
}>;
|
|
33
|
+
onUpdateProfile?: (payload: User) => void;
|
|
26
34
|
}
|
|
27
35
|
/**
|
|
28
36
|
* UserProvider component that manages user profile data and provides it through UserContext.
|
|
@@ -0,0 +1,127 @@
|
|
|
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 { BrandingPreference, Theme } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Configuration options for the useBranding hook
|
|
21
|
+
* @deprecated Use BrandingProvider instead for better performance and consistency
|
|
22
|
+
*/
|
|
23
|
+
export interface UseBrandingConfig {
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
26
|
+
*/
|
|
27
|
+
locale?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
34
|
+
*/
|
|
35
|
+
type?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
38
|
+
*/
|
|
39
|
+
forceTheme?: 'light' | 'dark';
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
42
|
+
*/
|
|
43
|
+
autoFetch?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated This configuration is now handled by BrandingProvider
|
|
46
|
+
*/
|
|
47
|
+
fetcher?: (url: string, config: RequestInit) => Promise<Response>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Return type of the useBranding hook
|
|
51
|
+
*/
|
|
52
|
+
export interface UseBrandingReturn {
|
|
53
|
+
/**
|
|
54
|
+
* The raw branding preference data
|
|
55
|
+
*/
|
|
56
|
+
brandingPreference: BrandingPreference | null;
|
|
57
|
+
/**
|
|
58
|
+
* The transformed theme object
|
|
59
|
+
*/
|
|
60
|
+
theme: Theme | null;
|
|
61
|
+
/**
|
|
62
|
+
* The active theme mode from branding preference ('light' | 'dark')
|
|
63
|
+
*/
|
|
64
|
+
activeTheme: 'light' | 'dark' | null;
|
|
65
|
+
/**
|
|
66
|
+
* Loading state
|
|
67
|
+
*/
|
|
68
|
+
isLoading: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Error state
|
|
71
|
+
*/
|
|
72
|
+
error: Error | null;
|
|
73
|
+
/**
|
|
74
|
+
* Function to manually fetch branding preference
|
|
75
|
+
*/
|
|
76
|
+
fetchBranding: () => Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Function to refetch branding preference
|
|
79
|
+
* This bypasses the single-call restriction and forces a new API call
|
|
80
|
+
*/
|
|
81
|
+
refetch: () => Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* React hook for accessing branding preferences from the BrandingProvider context.
|
|
85
|
+
* This hook provides access to branding preferences, theme data, and loading states.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated Consider using useBrandingContext directly for better performance.
|
|
88
|
+
* This hook is maintained for backward compatibility.
|
|
89
|
+
*
|
|
90
|
+
* @param config - Configuration options (deprecated, use BrandingProvider props instead)
|
|
91
|
+
* @returns Object containing branding preference data, theme, loading state, error, and refetch function
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* Basic usage:
|
|
95
|
+
* ```tsx
|
|
96
|
+
* function MyComponent() {
|
|
97
|
+
* const { theme, activeTheme, isLoading, error } = useBranding();
|
|
98
|
+
*
|
|
99
|
+
* if (isLoading) return <div>Loading branding...</div>;
|
|
100
|
+
* if (error) return <div>Error: {error.message}</div>;
|
|
101
|
+
*
|
|
102
|
+
* return (
|
|
103
|
+
* <div style={{ color: theme?.colors?.primary?.main }}>
|
|
104
|
+
* <p>Active theme mode: {activeTheme}</p>
|
|
105
|
+
* <p>Styled with Asgardeo branding</p>
|
|
106
|
+
* </div>
|
|
107
|
+
* );
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* For new implementations, use BrandingProvider with useBrandingContext:
|
|
113
|
+
* ```tsx
|
|
114
|
+
* // In your root component
|
|
115
|
+
* <BrandingProvider baseUrl="https://api.asgardeo.io/t/your-org">
|
|
116
|
+
* <App />
|
|
117
|
+
* </BrandingProvider>
|
|
118
|
+
*
|
|
119
|
+
* // In your component
|
|
120
|
+
* function MyComponent() {
|
|
121
|
+
* const { theme, activeTheme, isLoading, error } = useBrandingContext();
|
|
122
|
+
* // ... rest of your component
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare const useBranding: (config?: UseBrandingConfig) => UseBrandingReturn;
|
|
127
|
+
export default useBranding;
|
package/dist/index.d.ts
CHANGED
|
@@ -51,12 +51,20 @@ export { default as ThemeProvider } from './contexts/Theme/ThemeProvider';
|
|
|
51
51
|
export * from './contexts/Theme/ThemeProvider';
|
|
52
52
|
export { default as useTheme } from './contexts/Theme/useTheme';
|
|
53
53
|
export * from './contexts/Theme/useTheme';
|
|
54
|
+
export { default as BrandingContext } from './contexts/Branding/BrandingContext';
|
|
55
|
+
export * from './contexts/Branding/BrandingContext';
|
|
56
|
+
export { default as BrandingProvider } from './contexts/Branding/BrandingProvider';
|
|
57
|
+
export * from './contexts/Branding/BrandingProvider';
|
|
58
|
+
export { default as useBrandingContext } from './contexts/Branding/useBrandingContext';
|
|
59
|
+
export * from './contexts/Branding/useBrandingContext';
|
|
54
60
|
export { default as useBrowserUrl } from './hooks/useBrowserUrl';
|
|
55
61
|
export * from './hooks/useBrowserUrl';
|
|
56
62
|
export { default as useTranslation } from './hooks/useTranslation';
|
|
57
63
|
export * from './hooks/useTranslation';
|
|
58
64
|
export { default as useForm } from './hooks/useForm';
|
|
59
65
|
export * from './hooks/useForm';
|
|
66
|
+
export { default as useBranding } from './hooks/useBranding';
|
|
67
|
+
export * from './hooks/useBranding';
|
|
60
68
|
export { default as BaseSignInButton } from './components/actions/SignInButton/BaseSignInButton';
|
|
61
69
|
export * from './components/actions/SignInButton/BaseSignInButton';
|
|
62
70
|
export { default as SignInButton } from './components/actions/SignInButton/SignInButton';
|
|
@@ -139,6 +147,8 @@ export { default as OtpField } from './components/primitives/OtpField/OtpField';
|
|
|
139
147
|
export * from './components/primitives/OtpField/OtpField';
|
|
140
148
|
export { default as TextField } from './components/primitives/TextField/TextField';
|
|
141
149
|
export * from './components/primitives/TextField/TextField';
|
|
150
|
+
export { default as MultiInput } from './components/primitives/MultiInput/MultiInput';
|
|
151
|
+
export * from './components/primitives/MultiInput/MultiInput';
|
|
142
152
|
export { default as PasswordField } from './components/primitives/PasswordField/PasswordField';
|
|
143
153
|
export * from './components/primitives/PasswordField/PasswordField';
|
|
144
154
|
export { default as Select } from './components/primitives/Select/Select';
|
|
@@ -157,6 +167,8 @@ export { default as Typography } from './components/primitives/Typography/Typogr
|
|
|
157
167
|
export * from './components/primitives/Typography/Typography';
|
|
158
168
|
export { default as Divider } from './components/primitives/Divider/Divider';
|
|
159
169
|
export * from './components/primitives/Divider/Divider';
|
|
170
|
+
export { default as Logo } from './components/primitives/Logo/Logo';
|
|
171
|
+
export * from './components/primitives/Logo/Logo';
|
|
160
172
|
export { default as Spinner } from './components/primitives/Spinner/Spinner';
|
|
161
173
|
export * from './components/primitives/Spinner/Spinner';
|
|
162
174
|
export { default as Eye } from './components/primitives/Icons/Eye';
|
|
@@ -169,6 +181,7 @@ export { default as UserIcon } from './components/primitives/Icons/User';
|
|
|
169
181
|
export { default as LogOut } from './components/primitives/Icons/LogOut';
|
|
170
182
|
export { createField, FieldFactory, validateFieldValue } from './components/factories/FieldFactory';
|
|
171
183
|
export * from './components/factories/FieldFactory';
|
|
184
|
+
export { default as BuildingAlt } from './components/primitives/Icons/BuildingAlt';
|
|
172
185
|
export type { FlowStep, FlowMessage, FlowContextValue } from './contexts/Flow/FlowContext';
|
|
173
186
|
export type { FlowProviderProps } from './contexts/Flow/FlowProvider';
|
|
174
187
|
export { default as getAllOrganizations, GetAllOrganizationsConfig } from './api/getAllOrganizations';
|