@asgardeo/react 0.13.0 → 0.13.3
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 +2421 -1778
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +7 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.d.ts +79 -0
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.d.ts +20 -0
- package/dist/components/presentation/LanguageSwitcher/LanguageSwitcher.d.ts +77 -0
- package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +7 -1
- package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +7 -1
- package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +7 -0
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +7 -1
- package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +7 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +14 -1
- package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +7 -1
- package/dist/components/presentation/auth/SignIn/SignIn.d.ts +5 -0
- package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +7 -1
- package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts +7 -1
- package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +7 -1
- package/dist/{utils/v2/resolveTranslation.d.ts → components/primitives/Icons/ArrowLeftRight.d.ts} +11 -9
- package/dist/components/primitives/Icons/flowIconRegistry.d.ts +28 -0
- package/dist/components/primitives/Icons/index.d.ts +1 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +13 -0
- package/dist/contexts/FlowMeta/FlowMetaContext.d.ts +5 -0
- package/dist/contexts/I18n/ComponentPreferencesContext.d.ts +26 -0
- package/dist/contexts/I18n/I18nContext.d.ts +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1604 -947
- package/dist/index.js.map +4 -4
- package/dist/utils/v2/flowTransformer.d.ts +3 -3
- package/dist/utils/v2/resolveTranslationsInArray.d.ts +4 -2
- package/dist/utils/v2/resolveTranslationsInObject.d.ts +5 -3
- package/package.json +4 -3
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { CreateOrganizationPayload } from '@asgardeo/browser';
|
|
18
|
+
import { CreateOrganizationPayload, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
20
20
|
/**
|
|
21
21
|
* Interface for organization form data.
|
|
@@ -41,6 +41,12 @@ export interface BaseCreateOrganizationProps {
|
|
|
41
41
|
onSubmit?: (payload: CreateOrganizationPayload) => void | Promise<void>;
|
|
42
42
|
onSuccess?: (organization: any) => void;
|
|
43
43
|
open?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
46
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
47
|
+
* taking precedence. Affects this component and all its descendants.
|
|
48
|
+
*/
|
|
49
|
+
preferences?: Preferences;
|
|
44
50
|
renderAdditionalFields?: () => ReactNode;
|
|
45
51
|
style?: CSSProperties;
|
|
46
52
|
title?: string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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
|
+
/**
|
|
20
|
+
* A resolved language option with display name and emoji flag.
|
|
21
|
+
*/
|
|
22
|
+
export interface LanguageOption {
|
|
23
|
+
/** BCP 47 language tag (e.g. "en", "fr", "en-US") */
|
|
24
|
+
code: string;
|
|
25
|
+
/** Human-readable display name resolved via Intl.DisplayNames */
|
|
26
|
+
displayName: string;
|
|
27
|
+
/** Flag emoji or globe emoji for the language */
|
|
28
|
+
emoji: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Render props exposed to consumers when using the render-prop pattern.
|
|
32
|
+
*/
|
|
33
|
+
export interface LanguageSwitcherRenderProps {
|
|
34
|
+
/** The currently active language code */
|
|
35
|
+
currentLanguage: string;
|
|
36
|
+
/** Whether a language switch is in progress */
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
/** Resolved language options */
|
|
39
|
+
languages: LanguageOption[];
|
|
40
|
+
/** Call this to switch to a different language */
|
|
41
|
+
onLanguageChange: (language: string) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface BaseLanguageSwitcherProps {
|
|
44
|
+
/**
|
|
45
|
+
* Render-props callback. When provided, the default dropdown UI is replaced with
|
|
46
|
+
* whatever JSX the callback returns.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <BaseLanguageSwitcher {...props}>
|
|
51
|
+
* {({languages, currentLanguage, onLanguageChange}) => (
|
|
52
|
+
* <select value={currentLanguage} onChange={e => onLanguageChange(e.target.value)}>
|
|
53
|
+
* {languages.map(l => <option key={l.code} value={l.code}>{l.emoji} {l.displayName}</option>)}
|
|
54
|
+
* </select>
|
|
55
|
+
* )}
|
|
56
|
+
* </BaseLanguageSwitcher>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
children?: (props: LanguageSwitcherRenderProps) => ReactNode;
|
|
60
|
+
/** Additional CSS class applied to the root element (default UI only) */
|
|
61
|
+
className?: string;
|
|
62
|
+
/** The currently active language code */
|
|
63
|
+
currentLanguage: string;
|
|
64
|
+
/** Whether a language switch is in progress */
|
|
65
|
+
isLoading?: boolean;
|
|
66
|
+
/** Resolved language options to display */
|
|
67
|
+
languages: LanguageOption[];
|
|
68
|
+
/** Called when the user selects a language */
|
|
69
|
+
onLanguageChange: (language: string) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Pure-UI language switcher dropdown.
|
|
73
|
+
* Accepts resolved `LanguageOption[]` (code + displayName + emoji) and delegates
|
|
74
|
+
* language switching to the `onLanguageChange` callback.
|
|
75
|
+
*
|
|
76
|
+
* Supports render props for full UI customisation.
|
|
77
|
+
*/
|
|
78
|
+
declare const BaseLanguageSwitcher: FC<BaseLanguageSwitcherProps>;
|
|
79
|
+
export default BaseLanguageSwitcher;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 { Theme } from '@asgardeo/browser';
|
|
19
|
+
declare const useStyles: (theme: Theme, colorScheme: string) => Record<string, string>;
|
|
20
|
+
export default useStyles;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 { LanguageOption, LanguageSwitcherRenderProps } from './BaseLanguageSwitcher';
|
|
20
|
+
export type { LanguageOption, LanguageSwitcherRenderProps };
|
|
21
|
+
export interface LanguageSwitcherProps {
|
|
22
|
+
/**
|
|
23
|
+
* Render-props callback for fully custom UI.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <LanguageSwitcher>
|
|
28
|
+
* {({languages, currentLanguage, onLanguageChange, isLoading}) => (
|
|
29
|
+
* <select
|
|
30
|
+
* value={currentLanguage}
|
|
31
|
+
* disabled={isLoading}
|
|
32
|
+
* onChange={e => onLanguageChange(e.target.value)}
|
|
33
|
+
* >
|
|
34
|
+
* {languages.map(l => (
|
|
35
|
+
* <option key={l.code} value={l.code}>{l.emoji} {l.displayName}</option>
|
|
36
|
+
* ))}
|
|
37
|
+
* </select>
|
|
38
|
+
* )}
|
|
39
|
+
* </LanguageSwitcher>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
children?: (props: LanguageSwitcherRenderProps) => ReactNode;
|
|
43
|
+
/** Additional CSS class for the root element (default UI only) */
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A v2 LanguageSwitcher component that reads available languages from `FlowMetaContext`
|
|
48
|
+
* and switches both the UI language (via `I18nContext`) and the flow metadata translations
|
|
49
|
+
* (by re-fetching `GET /flow/meta` with the new language).
|
|
50
|
+
*
|
|
51
|
+
* Must be rendered inside a `FlowMetaProvider`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* // Default dropdown UI
|
|
56
|
+
* <LanguageSwitcher />
|
|
57
|
+
*
|
|
58
|
+
* // Custom UI with render props
|
|
59
|
+
* <LanguageSwitcher>
|
|
60
|
+
* {({languages, currentLanguage, onLanguageChange}) => (
|
|
61
|
+
* <div>
|
|
62
|
+
* {languages.map(lang => (
|
|
63
|
+
* <button
|
|
64
|
+
* key={lang.code}
|
|
65
|
+
* onClick={() => onLanguageChange(lang.code)}
|
|
66
|
+
* style={{fontWeight: lang.code === currentLanguage ? 'bold' : 'normal'}}
|
|
67
|
+
* >
|
|
68
|
+
* {lang.emoji} {lang.displayName}
|
|
69
|
+
* </button>
|
|
70
|
+
* ))}
|
|
71
|
+
* </div>
|
|
72
|
+
* )}
|
|
73
|
+
* </LanguageSwitcher>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare const LanguageSwitcher: FC<LanguageSwitcherProps>;
|
|
77
|
+
export default LanguageSwitcher;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AllOrganizationsApiResponse, Organization } from '@asgardeo/browser';
|
|
18
|
+
import { AllOrganizationsApiResponse, Organization, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
20
20
|
export interface OrganizationWithSwitchAccess extends Organization {
|
|
21
21
|
canSwitch: boolean;
|
|
@@ -76,6 +76,12 @@ export interface BaseOrganizationListProps {
|
|
|
76
76
|
* Whether the popup is open (only used in popup mode)
|
|
77
77
|
*/
|
|
78
78
|
open?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
81
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
82
|
+
* taking precedence. Affects this component and all its descendants.
|
|
83
|
+
*/
|
|
84
|
+
preferences?: Preferences;
|
|
79
85
|
/**
|
|
80
86
|
* Custom renderer for when no organizations are found
|
|
81
87
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { OrganizationDetails } from '@asgardeo/browser';
|
|
18
|
+
import { OrganizationDetails, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactElement, ReactNode } from 'react';
|
|
20
20
|
export interface BaseOrganizationProfileProps {
|
|
21
21
|
/**
|
|
@@ -75,6 +75,12 @@ export interface BaseOrganizationProfileProps {
|
|
|
75
75
|
* The organization details to display.
|
|
76
76
|
*/
|
|
77
77
|
organization?: OrganizationDetails | null;
|
|
78
|
+
/**
|
|
79
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
80
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
81
|
+
* taking precedence. Affects this component and all its descendants.
|
|
82
|
+
*/
|
|
83
|
+
preferences?: Preferences;
|
|
78
84
|
/**
|
|
79
85
|
* Text for the save button (only used in editable mode).
|
|
80
86
|
*/
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { Preferences } from '@asgardeo/browser';
|
|
18
19
|
import { CSSProperties, FC, ReactElement, ReactNode } from 'react';
|
|
19
20
|
interface MenuItem {
|
|
20
21
|
href?: string;
|
|
@@ -103,6 +104,12 @@ export interface BaseOrganizationSwitcherProps {
|
|
|
103
104
|
* The HTML element ID where the portal should be mounted
|
|
104
105
|
*/
|
|
105
106
|
portalId?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
109
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
110
|
+
* taking precedence. Affects this component and all its descendants.
|
|
111
|
+
*/
|
|
112
|
+
preferences?: Preferences;
|
|
106
113
|
/**
|
|
107
114
|
* Custom render function for the error state.
|
|
108
115
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User } from '@asgardeo/browser';
|
|
18
|
+
import { User, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactElement } from 'react';
|
|
20
20
|
interface ExtendedFlatSchema {
|
|
21
21
|
path?: string;
|
|
@@ -57,6 +57,12 @@ export interface BaseUserProfileProps {
|
|
|
57
57
|
onOpenChange?: (open: boolean) => void;
|
|
58
58
|
onUpdate?: (payload: any) => Promise<void>;
|
|
59
59
|
open?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
62
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
63
|
+
* taking precedence. Affects this component and all its descendants.
|
|
64
|
+
*/
|
|
65
|
+
preferences?: Preferences;
|
|
60
66
|
profile?: User;
|
|
61
67
|
schemas?: Schema[];
|
|
62
68
|
showFields?: string[];
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FlowMetadataResponse } from '@asgardeo/browser';
|
|
18
|
+
import { FlowMetadataResponse, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
20
|
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
@@ -162,6 +162,12 @@ export interface BaseAcceptInviteProps {
|
|
|
162
162
|
* This makes a request to the flow/execute endpoint.
|
|
163
163
|
*/
|
|
164
164
|
onSubmit: (payload: Record<string, any>) => Promise<AcceptInviteFlowResponse>;
|
|
165
|
+
/**
|
|
166
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
167
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
168
|
+
* taking precedence. Affects this component and all its descendants.
|
|
169
|
+
*/
|
|
170
|
+
preferences?: Preferences;
|
|
165
171
|
/**
|
|
166
172
|
* Whether to show the subtitle.
|
|
167
173
|
*/
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
18
|
+
import { FlowMetadataResponse, EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
|
|
19
19
|
import { ReactElement } from 'react';
|
|
20
|
+
import { UseTranslation } from '../../../hooks/useTranslation';
|
|
20
21
|
export type AuthType = 'signin' | 'signup';
|
|
21
22
|
/**
|
|
22
23
|
* Processes an array of components and renders them as React elements for sign-in.
|
|
@@ -24,9 +25,13 @@ export type AuthType = 'signin' | 'signup';
|
|
|
24
25
|
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?: {
|
|
25
26
|
buttonClassName?: string;
|
|
26
27
|
inputClassName?: string;
|
|
28
|
+
/** Flow metadata for resolving {{meta(...)}} expressions at render time */
|
|
29
|
+
meta?: FlowMetadataResponse | null;
|
|
27
30
|
onInputBlur?: (name: string) => void;
|
|
28
31
|
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
29
32
|
size?: "small" | "medium" | "large";
|
|
33
|
+
/** Translation function for resolving {{t(...)}} expressions at render time */
|
|
34
|
+
t?: UseTranslation["t"];
|
|
30
35
|
variant?: any;
|
|
31
36
|
}) => ReactElement[];
|
|
32
37
|
/**
|
|
@@ -35,9 +40,13 @@ export declare const renderSignInComponents: (components: EmbeddedFlowComponent[
|
|
|
35
40
|
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
41
|
buttonClassName?: string;
|
|
37
42
|
inputClassName?: string;
|
|
43
|
+
/** Flow metadata for resolving {{meta(...)}} expressions at render time */
|
|
44
|
+
meta?: FlowMetadataResponse | null;
|
|
38
45
|
onInputBlur?: (name: string) => void;
|
|
39
46
|
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
40
47
|
size?: "small" | "medium" | "large";
|
|
48
|
+
/** Translation function for resolving {{t(...)}} expressions at render time */
|
|
49
|
+
t?: UseTranslation["t"];
|
|
41
50
|
variant?: any;
|
|
42
51
|
}) => ReactElement[];
|
|
43
52
|
/**
|
|
@@ -47,8 +56,12 @@ export declare const renderSignUpComponents: (components: EmbeddedFlowComponent[
|
|
|
47
56
|
export declare const renderInviteUserComponents: (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?: {
|
|
48
57
|
buttonClassName?: string;
|
|
49
58
|
inputClassName?: string;
|
|
59
|
+
/** Flow metadata for resolving {{meta(...)}} expressions at render time */
|
|
60
|
+
meta?: FlowMetadataResponse | null;
|
|
50
61
|
onInputBlur?: (name: string) => void;
|
|
51
62
|
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
52
63
|
size?: "small" | "medium" | "large";
|
|
64
|
+
/** Translation function for resolving {{t(...)}} expressions at render time */
|
|
65
|
+
t?: UseTranslation["t"];
|
|
53
66
|
variant?: any;
|
|
54
67
|
}) => ReactElement[];
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FlowMetadataResponse } from '@asgardeo/browser';
|
|
18
|
+
import { FlowMetadataResponse, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
20
|
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
@@ -154,6 +154,12 @@ export interface BaseInviteUserProps {
|
|
|
154
154
|
* This should make an authenticated request to the flow/execute endpoint.
|
|
155
155
|
*/
|
|
156
156
|
onSubmit: (payload: Record<string, any>) => Promise<InviteUserFlowResponse>;
|
|
157
|
+
/**
|
|
158
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
159
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
160
|
+
* taking precedence. Affects this component and all its descendants.
|
|
161
|
+
*/
|
|
162
|
+
preferences?: Preferences;
|
|
157
163
|
/**
|
|
158
164
|
* Whether to show the subtitle.
|
|
159
165
|
*/
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { Preferences } from '@asgardeo/browser';
|
|
18
19
|
import { FC, ReactElement } from 'react';
|
|
19
20
|
import { BaseSignInProps } from './BaseSignIn';
|
|
20
21
|
import { SignInRenderProps } from './v2/SignIn';
|
|
@@ -27,6 +28,10 @@ export type SignInProps = Pick<BaseSignInProps, 'className' | 'onSuccess' | 'onE
|
|
|
27
28
|
* Render function for custom UI (render props pattern).
|
|
28
29
|
*/
|
|
29
30
|
children?: (props: SignInRenderProps) => ReactElement;
|
|
31
|
+
/**
|
|
32
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
33
|
+
*/
|
|
34
|
+
preferences?: Preferences;
|
|
30
35
|
};
|
|
31
36
|
/**
|
|
32
37
|
* A styled SignIn component that provides native authentication flow with pre-built styling.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest, EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse } from '@asgardeo/browser';
|
|
18
|
+
import { EmbeddedSignInFlowRequestV2 as EmbeddedSignInFlowRequest, EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
20
|
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
@@ -141,6 +141,12 @@ export interface BaseSignInProps {
|
|
|
141
141
|
* @param authData - The authentication data returned upon successful completion.
|
|
142
142
|
*/
|
|
143
143
|
onSuccess?: (authData: Record<string, any>) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
146
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
147
|
+
* taking precedence. Affects this component and all its descendants.
|
|
148
|
+
*/
|
|
149
|
+
preferences?: Preferences;
|
|
144
150
|
/**
|
|
145
151
|
* Whether to show the logo.
|
|
146
152
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent, EmbeddedSignInFlowRequestV2, FlowMetadataResponse } from '@asgardeo/browser';
|
|
18
|
+
import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent, EmbeddedSignInFlowRequestV2, FlowMetadataResponse, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
20
|
import { BaseSignInProps } from './BaseSignIn';
|
|
21
21
|
/**
|
|
@@ -74,6 +74,12 @@ export type SignInProps = {
|
|
|
74
74
|
* @param authData - The authentication data returned upon successful completion.
|
|
75
75
|
*/
|
|
76
76
|
onSuccess?: (authData: Record<string, any>) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
79
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
80
|
+
* taking precedence. Affects this component and all its descendants.
|
|
81
|
+
*/
|
|
82
|
+
preferences?: Preferences;
|
|
77
83
|
/**
|
|
78
84
|
* Size variant for the component.
|
|
79
85
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from '@asgardeo/browser';
|
|
18
|
+
import { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse, Preferences } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
20
|
import { CardProps } from '../../../../primitives/Card/Card';
|
|
21
21
|
/**
|
|
@@ -145,6 +145,12 @@ export interface BaseSignUpProps {
|
|
|
145
145
|
* @returns Promise resolving to the sign-up response.
|
|
146
146
|
*/
|
|
147
147
|
onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;
|
|
148
|
+
/**
|
|
149
|
+
* Component-level preferences to override global i18n and theme settings.
|
|
150
|
+
* Preferences are deep-merged with global ones, with component preferences
|
|
151
|
+
* taking precedence. Affects this component and all its descendants.
|
|
152
|
+
*/
|
|
153
|
+
preferences?: Preferences;
|
|
148
154
|
/**
|
|
149
155
|
* Whether to redirect after sign-up.
|
|
150
156
|
*/
|
package/dist/{utils/v2/resolveTranslation.d.ts → components/primitives/Icons/ArrowLeftRight.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
3
|
*
|
|
4
4
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
export interface ArrowLeftRightProps {
|
|
20
|
+
/** Color of the icon stroke */
|
|
21
|
+
color?: string;
|
|
22
|
+
/** Icon size in pixels */
|
|
23
|
+
size?: number;
|
|
24
|
+
}
|
|
19
25
|
/**
|
|
20
|
-
*
|
|
21
|
-
* If the text is not a translation string, returns the original text.
|
|
22
|
-
* @param text - The text to resolve (could be a translation string or regular text)
|
|
23
|
-
* @param t - The translation function from useTranslation
|
|
24
|
-
* @returns The resolved text
|
|
26
|
+
* ArrowLeftRight Icon component (lucide-compatible).
|
|
25
27
|
*/
|
|
26
|
-
|
|
27
|
-
export default
|
|
28
|
+
declare const ArrowLeftRight: FC<ArrowLeftRightProps>;
|
|
29
|
+
export default ArrowLeftRight;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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
|
+
export interface FlowIconProps {
|
|
20
|
+
color?: string;
|
|
21
|
+
size?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Registry of icon components keyed by their lucide-compatible name.
|
|
25
|
+
* Add new icons here as needed by flow definitions.
|
|
26
|
+
*/
|
|
27
|
+
declare const flowIconRegistry: Record<string, FC<FlowIconProps>>;
|
|
28
|
+
export default flowIconRegistry;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
export { default as ArrowLeftRight } from './ArrowLeftRight';
|
|
18
19
|
export { default as CircleAlert } from './CircleAlert';
|
|
19
20
|
export { default as CircleCheck } from './CircleCheck';
|
|
20
21
|
export { default as Eye } from './Eye';
|
|
@@ -103,6 +103,19 @@ export type AsgardeoContextProps = {
|
|
|
103
103
|
* @returns Promise resolving to boolean indicating success.
|
|
104
104
|
*/
|
|
105
105
|
reInitialize: (config: Partial<AsgardeoReactConfig>) => Promise<boolean>;
|
|
106
|
+
/**
|
|
107
|
+
* Resolves `{{ t(key) }}` and `{{ meta(path) }}` template expressions in a string,
|
|
108
|
+
* using the current i18n translation function and flow metadata from context.
|
|
109
|
+
*
|
|
110
|
+
* Useful in render-props patterns where consumers need to expand template strings
|
|
111
|
+
* that come from the server (e.g. component labels, placeholders, headings).
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* const {resolveVars} = useAsgardeo();
|
|
115
|
+
* resolveVars('{{ t(signin.heading.label) }}') // → 'Sign In'
|
|
116
|
+
* resolveVars('Login to {{ meta(application.name) }}') // → 'Login to My App'
|
|
117
|
+
*/
|
|
118
|
+
resolveVars: (text: string | undefined) => string;
|
|
106
119
|
/**
|
|
107
120
|
* Sign-in function to initiate the authentication process.
|
|
108
121
|
* @remark This is the programmatic version of the `SignInButton` component.
|
|
@@ -34,6 +34,11 @@ export interface FlowMetaContextValue {
|
|
|
34
34
|
* The fetched flow metadata response, or null while loading / on error
|
|
35
35
|
*/
|
|
36
36
|
meta: FlowMetadataResponse | null;
|
|
37
|
+
/**
|
|
38
|
+
* Fetches flow metadata for the given language and activates it in the i18n system.
|
|
39
|
+
* Use this to switch the UI language at runtime.
|
|
40
|
+
*/
|
|
41
|
+
switchLanguage: (language: string) => Promise<void>;
|
|
37
42
|
}
|
|
38
43
|
declare const FlowMetaContext: Context<FlowMetaContextValue | null>;
|
|
39
44
|
export default FlowMetaContext;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, 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 { Preferences } from '@asgardeo/browser';
|
|
19
|
+
import { Context } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Context for component-level preferences overrides.
|
|
22
|
+
* Presentational components can provide this context to override the global i18n
|
|
23
|
+
* and theme settings for their entire subtree, including all nested components.
|
|
24
|
+
*/
|
|
25
|
+
declare const ComponentPreferencesContext: Context<Preferences | undefined>;
|
|
26
|
+
export default ComponentPreferencesContext;
|
|
@@ -30,6 +30,11 @@ export interface I18nContextValue {
|
|
|
30
30
|
* The fallback language code
|
|
31
31
|
*/
|
|
32
32
|
fallbackLanguage: string;
|
|
33
|
+
/**
|
|
34
|
+
* Injects additional bundles into the i18n system (e.g., from flow metadata).
|
|
35
|
+
* Injected bundles take precedence over defaults but are overridden by prop-provided bundles.
|
|
36
|
+
*/
|
|
37
|
+
injectBundles: (bundles: Record<string, I18nBundle>) => void;
|
|
33
38
|
/**
|
|
34
39
|
* Function to change the current language
|
|
35
40
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,10 @@ export * from './components/presentation/OrganizationProfile/OrganizationProfile
|
|
|
127
127
|
export { BaseCreateOrganization } from './components/presentation/CreateOrganization/BaseCreateOrganization';
|
|
128
128
|
export type { BaseCreateOrganizationProps, OrganizationFormData, } from './components/presentation/CreateOrganization/BaseCreateOrganization';
|
|
129
129
|
export { CreateOrganization } from './components/presentation/CreateOrganization/CreateOrganization';
|
|
130
|
+
export { default as BaseLanguageSwitcher } from './components/presentation/LanguageSwitcher/BaseLanguageSwitcher';
|
|
131
|
+
export type { BaseLanguageSwitcherProps, LanguageOption, LanguageSwitcherRenderProps, } from './components/presentation/LanguageSwitcher/BaseLanguageSwitcher';
|
|
132
|
+
export { default as LanguageSwitcher } from './components/presentation/LanguageSwitcher/LanguageSwitcher';
|
|
133
|
+
export type { LanguageSwitcherProps } from './components/presentation/LanguageSwitcher/LanguageSwitcher';
|
|
130
134
|
export { default as Button } from './components/primitives/Button/Button';
|
|
131
135
|
export * from './components/primitives/Button/Button';
|
|
132
136
|
export { default as Card } from './components/primitives/Card/Card';
|