@asgardeo/javascript 0.7.3 → 0.8.1
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/AsgardeoJavaScriptClient.d.ts +36 -33
- package/dist/DefaultCacheStore.d.ts +30 -0
- package/dist/DefaultCrypto.d.ts +29 -0
- package/dist/IsomorphicCrypto.d.ts +1 -1
- package/dist/api/v2/getFlowMetaV2.d.ts +55 -0
- package/dist/cjs/index.js +391 -33
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +8 -0
- package/dist/index.js +376 -33
- package/dist/index.js.map +4 -4
- package/dist/models/agent.d.ts +44 -0
- package/dist/models/auth-code-response.d.ts +34 -0
- package/dist/models/config.d.ts +5 -0
- package/dist/models/crypto.d.ts +1 -1
- package/dist/models/v2/embedded-flow-v2.d.ts +67 -1
- package/dist/models/v2/flow-meta-v2.d.ts +290 -0
- package/dist/models/v2/translation.d.ts +34 -0
- package/dist/models/v2/vars.d.ts +35 -0
- package/dist/utils/v2/resolveMeta.d.ts +34 -0
- package/dist/utils/v2/resolveVars.d.ts +41 -0
- package/package.json +4 -3
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Interface representing the configuration for an agent.
|
|
20
|
+
*/
|
|
21
|
+
export interface AgentConfig {
|
|
22
|
+
/**
|
|
23
|
+
* The unique identifier for the agent
|
|
24
|
+
*/
|
|
25
|
+
agentID: string;
|
|
26
|
+
/**
|
|
27
|
+
* The secret credential for the agent
|
|
28
|
+
*/
|
|
29
|
+
agentSecret: string;
|
|
30
|
+
/**
|
|
31
|
+
* The authenticator name to match during the embedded sign-in flow.
|
|
32
|
+
* Defaults to {@link AgentConfig.DEFAULT_AUTHENTICATOR_NAME} if not provided.
|
|
33
|
+
*/
|
|
34
|
+
authenticatorName?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Namespace that holds constants related to {@link AgentConfig}.
|
|
38
|
+
*/
|
|
39
|
+
export declare namespace AgentConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Default authenticator name used when none is specified.
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_AUTHENTICATOR_NAME: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Interface representing the authorization code response from the OAuth2/OIDC flow.
|
|
20
|
+
*/
|
|
21
|
+
export interface AuthCodeResponse {
|
|
22
|
+
/**
|
|
23
|
+
* The authorization code returned from the authorization endpoint
|
|
24
|
+
*/
|
|
25
|
+
code: string;
|
|
26
|
+
/**
|
|
27
|
+
* The session state identifier
|
|
28
|
+
*/
|
|
29
|
+
session_state: string;
|
|
30
|
+
/**
|
|
31
|
+
* The state parameter returned from the authorization endpoint
|
|
32
|
+
*/
|
|
33
|
+
state: string;
|
|
34
|
+
}
|
package/dist/models/config.d.ts
CHANGED
|
@@ -262,6 +262,11 @@ export interface Preferences {
|
|
|
262
262
|
* Internationalization preferences for the Asgardeo UI components
|
|
263
263
|
*/
|
|
264
264
|
i18n?: I18nPreferences;
|
|
265
|
+
/**
|
|
266
|
+
* Whether to resolve the theme from the Flow Meta API (GET /flow/meta).
|
|
267
|
+
* @remarks This is only applicable when using platform `Asgardeo V2` (Thunder).
|
|
268
|
+
*/
|
|
269
|
+
resolveFromMeta?: boolean;
|
|
265
270
|
/**
|
|
266
271
|
* Theme preferences for the Asgardeo UI components
|
|
267
272
|
*/
|
package/dist/models/crypto.d.ts
CHANGED
|
@@ -44,14 +44,22 @@ export declare enum EmbeddedFlowComponentType {
|
|
|
44
44
|
Divider = "DIVIDER",
|
|
45
45
|
/** Email input field with validation for email addresses. */
|
|
46
46
|
EmailInput = "EMAIL_INPUT",
|
|
47
|
+
/** Icon display component for rendering named vector icons */
|
|
48
|
+
Icon = "ICON",
|
|
49
|
+
/** Image display component for logos and illustrations */
|
|
50
|
+
Image = "IMAGE",
|
|
47
51
|
/** One-time password input field for multi-factor authentication */
|
|
48
52
|
OtpInput = "OTP_INPUT",
|
|
49
53
|
/** Password input field with masking for sensitive data */
|
|
50
54
|
PasswordInput = "PASSWORD_INPUT",
|
|
51
55
|
/** Phone number input field with country code support */
|
|
52
56
|
PhoneInput = "PHONE_INPUT",
|
|
57
|
+
/** Rich text display component that renders formatted HTML content */
|
|
58
|
+
RichText = "RICH_TEXT",
|
|
53
59
|
/** Select/dropdown input component for single choice selection */
|
|
54
60
|
Select = "SELECT",
|
|
61
|
+
/** Stack layout component for arranging children in a row or column */
|
|
62
|
+
Stack = "STACK",
|
|
55
63
|
/** Text display component for labels, headings, and messages */
|
|
56
64
|
Text = "TEXT",
|
|
57
65
|
/** Standard text input field for user data entry */
|
|
@@ -159,23 +167,64 @@ export declare enum EmbeddedFlowEventType {
|
|
|
159
167
|
*/
|
|
160
168
|
export interface EmbeddedFlowComponent {
|
|
161
169
|
/**
|
|
162
|
-
*
|
|
170
|
+
* Alignment of children along the cross axis (for Stack components).
|
|
171
|
+
*/
|
|
172
|
+
align?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Alternative text for Image components.
|
|
175
|
+
*/
|
|
176
|
+
alt?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Icon color, CSS color value (for Icon components).
|
|
179
|
+
*/
|
|
180
|
+
color?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Nested child components for container components like Block and Stack.
|
|
163
183
|
*/
|
|
164
184
|
components?: EmbeddedFlowComponent[];
|
|
185
|
+
/**
|
|
186
|
+
* Layout direction for Stack components ('row' | 'column').
|
|
187
|
+
*/
|
|
188
|
+
direction?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Icon to render at the end of an Action button (URL string).
|
|
191
|
+
*/
|
|
192
|
+
endIcon?: string;
|
|
165
193
|
/**
|
|
166
194
|
* Event type for action components that defines the interaction behavior.
|
|
167
195
|
* Only relevant for Action components.
|
|
168
196
|
*/
|
|
169
197
|
eventType?: EmbeddedFlowEventType | string;
|
|
198
|
+
/**
|
|
199
|
+
* Gap between children in Stack components (number, maps to spacing units).
|
|
200
|
+
*/
|
|
201
|
+
gap?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Height of the component (for Image components, can be string with units or number for pixels).
|
|
204
|
+
* The value depends on the component type (e.g., for Image components).
|
|
205
|
+
*/
|
|
206
|
+
height?: string | number;
|
|
170
207
|
/**
|
|
171
208
|
* Unique identifier for the component
|
|
172
209
|
*/
|
|
173
210
|
id: string;
|
|
211
|
+
/**
|
|
212
|
+
* Number of items across the main axis (for Stack grid-like layouts).
|
|
213
|
+
*/
|
|
214
|
+
items?: string | number;
|
|
215
|
+
/**
|
|
216
|
+
* Justification of children along the main axis (for Stack components).
|
|
217
|
+
*/
|
|
218
|
+
justify?: string;
|
|
174
219
|
/**
|
|
175
220
|
* Display label for the component (e.g., field label, button text).
|
|
176
221
|
* Supports internationalization and may contain template strings.
|
|
177
222
|
*/
|
|
178
223
|
label?: string;
|
|
224
|
+
/**
|
|
225
|
+
* Icon name for Icon components (e.g., lucide-react icon names like 'ArrowLeftRight').
|
|
226
|
+
*/
|
|
227
|
+
name?: string;
|
|
179
228
|
/**
|
|
180
229
|
* Options for SELECT components.
|
|
181
230
|
* Each option can be a string value or an object with value and label.
|
|
@@ -198,6 +247,18 @@ export interface EmbeddedFlowComponent {
|
|
|
198
247
|
* Used for form validation and UI indicators.
|
|
199
248
|
*/
|
|
200
249
|
required?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Icon size in pixels (for Icon components).
|
|
252
|
+
*/
|
|
253
|
+
size?: number;
|
|
254
|
+
/**
|
|
255
|
+
* Image source URL (for Image components).
|
|
256
|
+
*/
|
|
257
|
+
src?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Icon to render at the start of an Action button (URL string).
|
|
260
|
+
*/
|
|
261
|
+
startIcon?: string;
|
|
201
262
|
/**
|
|
202
263
|
* Component type that determines rendering behavior
|
|
203
264
|
*/
|
|
@@ -207,6 +268,11 @@ export interface EmbeddedFlowComponent {
|
|
|
207
268
|
* The value depends on the component type (e.g., button variants, text variants).
|
|
208
269
|
*/
|
|
209
270
|
variant?: EmbeddedFlowActionVariant | EmbeddedFlowTextVariant | string;
|
|
271
|
+
/**
|
|
272
|
+
* Width of the component (for Image components, can be string with units or number for pixels).
|
|
273
|
+
* The value depends on the component type (e.g., for Image components).
|
|
274
|
+
*/
|
|
275
|
+
width?: string | number;
|
|
210
276
|
}
|
|
211
277
|
/**
|
|
212
278
|
* Response data structure for embedded flow API.
|
|
@@ -0,0 +1,290 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* The type of entity to retrieve flow metadata for.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const config: GetFlowMetaRequestConfig = {
|
|
24
|
+
* baseUrl: 'https://localhost:8090',
|
|
25
|
+
* type: FlowMetaType.App,
|
|
26
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @experimental This API may change in future versions
|
|
31
|
+
*/
|
|
32
|
+
export declare enum FlowMetaType {
|
|
33
|
+
/** Retrieve metadata scoped to a specific application */
|
|
34
|
+
App = "APP",
|
|
35
|
+
/** Retrieve metadata scoped to a specific organization unit */
|
|
36
|
+
Ou = "OU"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Application metadata returned when `type=APP`.
|
|
40
|
+
*
|
|
41
|
+
* @experimental This API may change in future versions
|
|
42
|
+
*/
|
|
43
|
+
export interface ApplicationMetadata {
|
|
44
|
+
/** Application UUID */
|
|
45
|
+
id: string;
|
|
46
|
+
/** URL of the application logo */
|
|
47
|
+
logo_url?: string;
|
|
48
|
+
/** Human-readable application name */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Privacy Policy URI */
|
|
51
|
+
policy_uri?: string;
|
|
52
|
+
/** Terms of Service URI */
|
|
53
|
+
tos_uri?: string;
|
|
54
|
+
/** Application home URL */
|
|
55
|
+
url?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Organization unit metadata.
|
|
59
|
+
*
|
|
60
|
+
* Always present when `type=OU`. For `type=APP`, only included when the
|
|
61
|
+
* deployment has exactly one organization unit.
|
|
62
|
+
*
|
|
63
|
+
* @experimental This API may change in future versions
|
|
64
|
+
*/
|
|
65
|
+
export interface OUMetadata {
|
|
66
|
+
/** Cookie Policy URI */
|
|
67
|
+
cookie_policy_uri?: string;
|
|
68
|
+
/** Optional description of the organization unit */
|
|
69
|
+
description?: string;
|
|
70
|
+
/** Unique handle / slug for the organization unit */
|
|
71
|
+
handle: string;
|
|
72
|
+
/** Organization unit UUID */
|
|
73
|
+
id: string;
|
|
74
|
+
/** URL of the organization unit logo */
|
|
75
|
+
logo_url?: string;
|
|
76
|
+
/** Human-readable organization unit name */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Privacy Policy URI */
|
|
79
|
+
policy_uri?: string;
|
|
80
|
+
/** Terms of Service URI */
|
|
81
|
+
tos_uri?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A single color entry in the v2 theme color scheme.
|
|
85
|
+
*
|
|
86
|
+
* @experimental This API may change in future versions
|
|
87
|
+
*/
|
|
88
|
+
export interface FlowMetaThemeColorSet {
|
|
89
|
+
/** Text color that contrasts against this color */
|
|
90
|
+
contrastText?: string;
|
|
91
|
+
/** The darker variant of the color */
|
|
92
|
+
dark?: string;
|
|
93
|
+
/** The main/primary variant of the color */
|
|
94
|
+
main: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Background colors in a v2 theme color scheme.
|
|
98
|
+
*
|
|
99
|
+
* @experimental This API may change in future versions
|
|
100
|
+
*/
|
|
101
|
+
export interface FlowMetaThemeBackground {
|
|
102
|
+
/** Default background color (maps to body background) */
|
|
103
|
+
default?: string;
|
|
104
|
+
/** Surface / paper background color */
|
|
105
|
+
paper?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Text colors in a v2 theme color scheme.
|
|
109
|
+
*
|
|
110
|
+
* @experimental This API may change in future versions
|
|
111
|
+
*/
|
|
112
|
+
export interface FlowMetaThemeTextColors {
|
|
113
|
+
/** Primary text color */
|
|
114
|
+
primary?: string;
|
|
115
|
+
/** Secondary / muted text color */
|
|
116
|
+
secondary?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* All colors defined for a single v2 theme color scheme (light or dark).
|
|
120
|
+
*
|
|
121
|
+
* @experimental This API may change in future versions
|
|
122
|
+
*/
|
|
123
|
+
export interface FlowMetaThemeColors {
|
|
124
|
+
/** Background colors for the theme (e.g., body, paper) */
|
|
125
|
+
background?: FlowMetaThemeBackground;
|
|
126
|
+
/** Primary color set for the theme */
|
|
127
|
+
primary?: FlowMetaThemeColorSet;
|
|
128
|
+
/** Secondary color set for the theme */
|
|
129
|
+
secondary?: FlowMetaThemeColorSet;
|
|
130
|
+
/** Text colors for the theme */
|
|
131
|
+
text?: FlowMetaThemeTextColors;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* A single color scheme (light or dark) in the v2 theme.
|
|
135
|
+
*
|
|
136
|
+
* @experimental This API may change in future versions
|
|
137
|
+
*/
|
|
138
|
+
export interface FlowMetaThemeColorScheme {
|
|
139
|
+
/** All colors defined for this color scheme (light or dark) */
|
|
140
|
+
palette: FlowMetaThemeColors;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Shape / geometry configuration in the v2 theme.
|
|
144
|
+
*
|
|
145
|
+
* @experimental This API may change in future versions
|
|
146
|
+
*/
|
|
147
|
+
export interface FlowMetaThemeShape {
|
|
148
|
+
/** Border radius in pixels applied uniformly across components */
|
|
149
|
+
borderRadius?: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Typography configuration in the v2 theme.
|
|
153
|
+
*
|
|
154
|
+
* @experimental This API may change in future versions
|
|
155
|
+
*/
|
|
156
|
+
export interface FlowMetaThemeTypography {
|
|
157
|
+
/** CSS font-family string */
|
|
158
|
+
fontFamily?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Resolved theme configuration returned inside the flow metadata response.
|
|
162
|
+
*
|
|
163
|
+
* Maps to the `design.theme` field of {@link FlowMetadataResponse}.
|
|
164
|
+
*
|
|
165
|
+
* @experimental This API may change in future versions
|
|
166
|
+
*/
|
|
167
|
+
export interface FlowMetaTheme {
|
|
168
|
+
/** Per-scheme color definitions (light and dark) */
|
|
169
|
+
colorSchemes?: {
|
|
170
|
+
/** Dark color scheme */
|
|
171
|
+
dark?: FlowMetaThemeColorScheme;
|
|
172
|
+
/** Light color scheme */
|
|
173
|
+
light?: FlowMetaThemeColorScheme;
|
|
174
|
+
};
|
|
175
|
+
/** The color scheme to apply by default */
|
|
176
|
+
defaultColorScheme?: 'light' | 'dark';
|
|
177
|
+
/** Text direction for the theme */
|
|
178
|
+
direction?: 'ltr' | 'rtl';
|
|
179
|
+
/** Shape/geometry configuration for the theme */
|
|
180
|
+
shape?: FlowMetaThemeShape;
|
|
181
|
+
/** Typography configuration for the theme */
|
|
182
|
+
typography?: FlowMetaThemeTypography;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Resolved design configuration (theme and layout) for the flow.
|
|
186
|
+
*
|
|
187
|
+
* @experimental This API may change in future versions
|
|
188
|
+
*/
|
|
189
|
+
export interface DesignMetadata {
|
|
190
|
+
/** Resolved layout configuration (shape is server-defined) */
|
|
191
|
+
layout: Record<string, unknown>;
|
|
192
|
+
/** Resolved theme configuration for the flow */
|
|
193
|
+
theme: FlowMetaTheme;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Internationalisation metadata for the flow.
|
|
197
|
+
*
|
|
198
|
+
* @experimental This API may change in future versions
|
|
199
|
+
*/
|
|
200
|
+
export interface I18nMetadata {
|
|
201
|
+
/** The language used for the returned translations (defaults to `en`) */
|
|
202
|
+
language: string;
|
|
203
|
+
/** List of all available language tags (BCP 47) for the entity */
|
|
204
|
+
languages: string[];
|
|
205
|
+
/** Total number of translation keys returned */
|
|
206
|
+
totalResults?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Translations organised by namespace.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```json
|
|
212
|
+
* {
|
|
213
|
+
* "auth": {
|
|
214
|
+
* "login.button": "Login",
|
|
215
|
+
* "login.title": "Welcome"
|
|
216
|
+
* }
|
|
217
|
+
* }
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
translations: Record<string, Record<string, string>>;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Aggregated flow metadata response returned by `GET /flow/meta`.
|
|
224
|
+
*
|
|
225
|
+
* @experimental This API may change in future versions
|
|
226
|
+
*/
|
|
227
|
+
export interface FlowMetadataResponse {
|
|
228
|
+
/**
|
|
229
|
+
* Application metadata.
|
|
230
|
+
* Only present when `type=APP`.
|
|
231
|
+
*/
|
|
232
|
+
application?: ApplicationMetadata;
|
|
233
|
+
/** Resolved design configuration */
|
|
234
|
+
design: DesignMetadata;
|
|
235
|
+
/** Internationalisation metadata and translations */
|
|
236
|
+
i18n: I18nMetadata;
|
|
237
|
+
/** Indicates whether the registration flow is enabled for the entity */
|
|
238
|
+
is_registration_flow_enabled: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Organization unit metadata.
|
|
241
|
+
* Always present when `type=OU`.
|
|
242
|
+
* For `type=APP`, only present when the deployment has exactly one OU.
|
|
243
|
+
*/
|
|
244
|
+
ou?: OUMetadata;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Request configuration for `getFlowMetaV2`.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const config: GetFlowMetaRequestConfig = {
|
|
252
|
+
* baseUrl: 'https://localhost:8090',
|
|
253
|
+
* type: FlowMetaType.App,
|
|
254
|
+
* id: '60a9b38b-6eba-9f9e-55f9-267067de4680',
|
|
255
|
+
* language: 'en',
|
|
256
|
+
* namespace: 'auth',
|
|
257
|
+
* };
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @experimental This API may change in future versions
|
|
261
|
+
*/
|
|
262
|
+
export interface GetFlowMetaRequestConfig extends Omit<Partial<RequestInit>, 'method' | 'body'> {
|
|
263
|
+
/**
|
|
264
|
+
* Base URL of the Flow API server (e.g. `https://localhost:8090`).
|
|
265
|
+
* Either `baseUrl` or `url` must be provided.
|
|
266
|
+
*/
|
|
267
|
+
baseUrl?: string;
|
|
268
|
+
/** UUID of the entity (application ID or organization unit ID) */
|
|
269
|
+
id: string;
|
|
270
|
+
/**
|
|
271
|
+
* Language tag in BCP 47 format for i18n translations.
|
|
272
|
+
* Defaults to `en` on the server side when omitted.
|
|
273
|
+
*
|
|
274
|
+
* @example "en", "es", "fr-CA"
|
|
275
|
+
*/
|
|
276
|
+
language?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Filter translations by a specific namespace.
|
|
279
|
+
*
|
|
280
|
+
* @example "auth", "errors", "common"
|
|
281
|
+
*/
|
|
282
|
+
namespace?: string;
|
|
283
|
+
/** The type of entity to retrieve metadata for */
|
|
284
|
+
type: FlowMetaType;
|
|
285
|
+
/**
|
|
286
|
+
* Fully qualified URL of the `/flow/meta` endpoint.
|
|
287
|
+
* When provided, `baseUrl` is ignored.
|
|
288
|
+
*/
|
|
289
|
+
url?: string;
|
|
290
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Generic translation function type.
|
|
20
|
+
*
|
|
21
|
+
* The default parameter type (`Record<string, string | number>`) matches the
|
|
22
|
+
* common i18n signature used throughout the SDK. Consumers can supply a more
|
|
23
|
+
* specific type when integrating with third-party i18n libraries.
|
|
24
|
+
*
|
|
25
|
+
* @template TParams - The type of the optional interpolation parameters object.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Using the default (SDK-native) signature
|
|
29
|
+
* const t: TranslationFn = (key, params) => i18n.t(key, params);
|
|
30
|
+
*
|
|
31
|
+
* // Using react-i18next's TFunction as TParams
|
|
32
|
+
* const t: TranslationFn<Record<string, unknown>> = i18nextT;
|
|
33
|
+
*/
|
|
34
|
+
export type TranslationFn<TParams = Record<string, string | number>> = (key: string, params?: TParams) => string;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { FlowMetadataResponse } from './flow-meta-v2';
|
|
19
|
+
import { TranslationFn } from './translation';
|
|
20
|
+
/**
|
|
21
|
+
* Options for the resolveVars function.
|
|
22
|
+
*
|
|
23
|
+
* @template TFn - The concrete translation function type.
|
|
24
|
+
* Defaults to the SDK-native {@link TranslationFn} signature.
|
|
25
|
+
*/
|
|
26
|
+
export interface ResolveVarsOptions<TFn extends TranslationFn = TranslationFn> {
|
|
27
|
+
/**
|
|
28
|
+
* Optional flow metadata for resolving `{{ meta(path) }}` expressions.
|
|
29
|
+
*/
|
|
30
|
+
meta?: FlowMetadataResponse | null;
|
|
31
|
+
/**
|
|
32
|
+
* i18n translation function for resolving `{{ t(key) }}` expressions.
|
|
33
|
+
*/
|
|
34
|
+
t: TFn;
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { FlowMetadataResponse } from '../../models/v2/flow-meta-v2';
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a dot-path expression against a FlowMetadataResponse object.
|
|
21
|
+
*
|
|
22
|
+
* Supports both camelCase paths (e.g. `logoUrl`) and snake_case API responses
|
|
23
|
+
* (e.g. `logo_url`). When a camelCase segment is not found directly, the
|
|
24
|
+
* function falls back to its snake_case equivalent.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* resolveMeta('application.name', meta) // → 'My App'
|
|
28
|
+
* resolveMeta('ou.name', meta) // → 'My Org'
|
|
29
|
+
*
|
|
30
|
+
* @param path - Dot-separated path into the meta object (e.g. 'application.name')
|
|
31
|
+
* @param meta - The FlowMetadataResponse to look up
|
|
32
|
+
* @returns The resolved string value, or empty string if not found
|
|
33
|
+
*/
|
|
34
|
+
export default function resolveMeta(path: string, meta: FlowMetadataResponse): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { TranslationFn } from '../../models/v2/translation';
|
|
19
|
+
import { ResolveVarsOptions } from '../../models/v2/vars';
|
|
20
|
+
/**
|
|
21
|
+
* Resolves all template expressions in a string.
|
|
22
|
+
*
|
|
23
|
+
* Supported patterns:
|
|
24
|
+
* - `{{ t(key) }}` — resolved via the i18n translation function.
|
|
25
|
+
* Colon-separated namespaces are converted to dots:
|
|
26
|
+
* `{{ t(signin:heading.label) }}` → `t('signin.heading.label')`
|
|
27
|
+
* - `{{ meta(path) }}` — resolved via a dot-path lookup on FlowMetadataResponse.
|
|
28
|
+
* `{{ meta(application.name) }}` → `meta.application?.name`
|
|
29
|
+
*
|
|
30
|
+
* Template expressions can be embedded inside larger strings:
|
|
31
|
+
* `"Login using {{ meta(application.name) }}"` → `"Login using My App"`
|
|
32
|
+
*
|
|
33
|
+
* Unrecognised expressions are left unchanged.
|
|
34
|
+
*
|
|
35
|
+
* @template TFn - The concrete translation function type.
|
|
36
|
+
*
|
|
37
|
+
* @param text - The string to resolve (may contain zero or more template expressions)
|
|
38
|
+
* @param options - Resolution context: translation function and optional flow metadata
|
|
39
|
+
* @returns The resolved string
|
|
40
|
+
*/
|
|
41
|
+
export default function resolveVars<TFn extends TranslationFn = TranslationFn>(text: string | undefined, { t, meta }: ResolveVarsOptions<TFn>): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/javascript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Framework agnostic JavaScript SDK for Asgardeo.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.15.30",
|
|
38
|
-
"@wso2/eslint-plugin": "git+https://github.com/brionmario/wso2-ui-configs.git#
|
|
39
|
-
"@wso2/prettier-config": "git+https://github.com/brionmario/wso2-ui-configs.git#
|
|
38
|
+
"@wso2/eslint-plugin": "git+https://github.com/brionmario/wso2-ui-configs.git#d3041825a4f8f235c8f9fa36b55cf29d54e791c8&path:packages/eslint-plugin",
|
|
39
|
+
"@wso2/prettier-config": "git+https://github.com/brionmario/wso2-ui-configs.git#d3041825a4f8f235c8f9fa36b55cf29d54e791c8&path:packages/prettier-config",
|
|
40
40
|
"esbuild": "0.25.9",
|
|
41
41
|
"eslint": "8.57.0",
|
|
42
42
|
"prettier": "2.6.2",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"tslib": "2.8.1",
|
|
49
|
+
"jose": "^5.2.0",
|
|
49
50
|
"@asgardeo/i18n": "0.4.2"
|
|
50
51
|
},
|
|
51
52
|
"publishConfig": {
|