@asgardeo/javascript 0.18.0 → 0.19.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/dist/cjs/index.js.map +1 -1
- package/dist/edge/index.js +5496 -0
- package/dist/edge/index.js.map +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js.map +1 -1
- package/dist/models/config.d.ts +14 -1
- package/dist/models/v2/embedded-signin-flow-v2.d.ts +10 -0
- package/dist/models/v2/embedded-signup-flow-v2.d.ts +6 -0
- package/dist/models/v2/extensions/components.d.ts +88 -0
- package/package.json +2 -1
package/dist/models/config.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { I18nBundle } from '@asgardeo/i18n';
|
|
19
|
+
import { ComponentsExtensions } from './v2/extensions/components';
|
|
19
20
|
import { Platform } from './platforms';
|
|
20
21
|
import { RecursivePartial } from './utility-types';
|
|
21
22
|
import { ThemeConfig, ThemeMode } from '../theme/types';
|
|
@@ -49,7 +50,7 @@ export type SignOutOptions = Record<string, unknown>;
|
|
|
49
50
|
* signUpOptions: { appId: "your-app-id" }
|
|
50
51
|
*/
|
|
51
52
|
export type SignUpOptions = Record<string, unknown>;
|
|
52
|
-
export interface BaseConfig<T = unknown> extends WithPreferences {
|
|
53
|
+
export interface BaseConfig<T = unknown> extends WithPreferences, WithExtensions {
|
|
53
54
|
/**
|
|
54
55
|
* Optional URL where the authorization server should redirect after authentication.
|
|
55
56
|
* This must match one of the allowed redirect URIs configured in your IdP.
|
|
@@ -328,6 +329,18 @@ export interface WithPreferences {
|
|
|
328
329
|
*/
|
|
329
330
|
preferences?: Preferences;
|
|
330
331
|
}
|
|
332
|
+
export interface Extensions {
|
|
333
|
+
/**
|
|
334
|
+
* Extension configuration for flow component rendering.
|
|
335
|
+
*/
|
|
336
|
+
components?: ComponentsExtensions;
|
|
337
|
+
}
|
|
338
|
+
export interface WithExtensions {
|
|
339
|
+
/**
|
|
340
|
+
* Extensions for customizing SDK behavior at defined integration points.
|
|
341
|
+
*/
|
|
342
|
+
extensions?: Extensions;
|
|
343
|
+
}
|
|
331
344
|
export type Config<T = unknown> = BaseConfig<T>;
|
|
332
345
|
export interface ThemePreferences {
|
|
333
346
|
/**
|
|
@@ -155,6 +155,11 @@ export interface ExtendedEmbeddedSignInFlowResponse {
|
|
|
155
155
|
* @experimental This interface is part of the new Asgardeo platform
|
|
156
156
|
*/
|
|
157
157
|
export interface EmbeddedSignInFlowResponse extends ExtendedEmbeddedSignInFlowResponse {
|
|
158
|
+
/**
|
|
159
|
+
* Per-step challenge token for replay protection.
|
|
160
|
+
* Must be included in the next request to continue this flow.
|
|
161
|
+
*/
|
|
162
|
+
challengeToken?: string;
|
|
158
163
|
/**
|
|
159
164
|
* Core response data containing UI components and flow metadata.
|
|
160
165
|
* Includes both modern meta.components structure and legacy fields for compatibility.
|
|
@@ -302,6 +307,11 @@ export interface EmbeddedSignInFlowRequest extends Partial<EmbeddedSignInFlowIni
|
|
|
302
307
|
* Corresponds to action components in the UI (e.g., submit button, social login).
|
|
303
308
|
*/
|
|
304
309
|
action?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Per-step challenge token received from the previous flow response.
|
|
312
|
+
* Required when continuing an existing flow to prevent replay attacks.
|
|
313
|
+
*/
|
|
314
|
+
challengeToken?: string;
|
|
305
315
|
/**
|
|
306
316
|
* Identifier of the flow instance to continue.
|
|
307
317
|
* Required when submitting data for an existing flow.
|
|
@@ -130,6 +130,11 @@ export interface ExtendedEmbeddedSignUpFlowResponse {
|
|
|
130
130
|
* @see {@link EmbeddedSignUpFlowStatus} for available flow statuses
|
|
131
131
|
*/
|
|
132
132
|
export interface EmbeddedSignUpFlowResponse extends ExtendedEmbeddedSignUpFlowResponse {
|
|
133
|
+
/**
|
|
134
|
+
* Per-step challenge token for replay protection.
|
|
135
|
+
* Must be included in the next request to continue this flow.
|
|
136
|
+
*/
|
|
137
|
+
challengeToken?: string;
|
|
133
138
|
/**
|
|
134
139
|
* Flow data containing form inputs and available actions.
|
|
135
140
|
* This is transformed to component-driven format by the React transformer.
|
|
@@ -191,6 +196,7 @@ export type EmbeddedSignUpFlowInitiateRequest = {
|
|
|
191
196
|
*/
|
|
192
197
|
export interface EmbeddedSignUpFlowRequest extends Partial<EmbeddedSignUpFlowInitiateRequest> {
|
|
193
198
|
action?: string;
|
|
199
|
+
challengeToken?: string;
|
|
194
200
|
executionId?: string;
|
|
195
201
|
inputs?: Record<string, any>;
|
|
196
202
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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 type { EmbeddedFlowComponent as EmbeddedFlowComponentV2 } from '../embedded-flow-v2';
|
|
19
|
+
import type { FlowMetadataResponse } from '../flow-meta-v2';
|
|
20
|
+
/**
|
|
21
|
+
* Framework-agnostic context passed to every custom component renderer.
|
|
22
|
+
* Contains form state and callbacks needed to render and submit flow components.
|
|
23
|
+
*/
|
|
24
|
+
export interface ComponentRenderContext {
|
|
25
|
+
/**
|
|
26
|
+
* Extra payload propagated by the flow engine for component rendering.
|
|
27
|
+
*/
|
|
28
|
+
additionalData?: Record<string, any>;
|
|
29
|
+
/**
|
|
30
|
+
* Authentication flow type currently being rendered.
|
|
31
|
+
*/
|
|
32
|
+
authType: 'signin' | 'signup';
|
|
33
|
+
/**
|
|
34
|
+
* Validation messages keyed by field name.
|
|
35
|
+
*/
|
|
36
|
+
formErrors: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Current form values keyed by field name.
|
|
39
|
+
*/
|
|
40
|
+
formValues: Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the current form state passes validation.
|
|
43
|
+
*/
|
|
44
|
+
isFormValid: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether a submit action is currently in progress.
|
|
47
|
+
*/
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Optional flow metadata associated with the current step.
|
|
51
|
+
*/
|
|
52
|
+
meta?: FlowMetadataResponse | null;
|
|
53
|
+
/**
|
|
54
|
+
* Optional callback fired when an input loses focus.
|
|
55
|
+
*/
|
|
56
|
+
onInputBlur?: (name: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Callback to update the value of a named input field.
|
|
59
|
+
*/
|
|
60
|
+
onInputChange: (name: string, value: string) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Optional submit handler for progressing the flow.
|
|
63
|
+
*/
|
|
64
|
+
onSubmit?: (component: EmbeddedFlowComponentV2, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Tracks whether each field has been interacted with.
|
|
67
|
+
*/
|
|
68
|
+
touchedFields: Record<string, boolean>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A function that renders a flow component of a given type.
|
|
72
|
+
* `TElement` is `unknown` at the JS SDK level; each framework narrows it
|
|
73
|
+
* (React: `ReactElement`, Vue: `VNode`, etc.).
|
|
74
|
+
*
|
|
75
|
+
* Returning `null` hides the component. If no renderer is registered for a
|
|
76
|
+
* component type, the SDK falls back to its built-in rendering.
|
|
77
|
+
*/
|
|
78
|
+
export type ComponentRenderer<TElement = unknown> = (component: EmbeddedFlowComponentV2, context: ComponentRenderContext) => TElement | null;
|
|
79
|
+
/**
|
|
80
|
+
* Extension configuration for flow component rendering.
|
|
81
|
+
* Keyed by component type string (e.g. `"PASSWORD_INPUT"`, `"ACTION"`).
|
|
82
|
+
*/
|
|
83
|
+
export interface ComponentsExtensions {
|
|
84
|
+
/**
|
|
85
|
+
* Custom renderers keyed by flow component type.
|
|
86
|
+
*/
|
|
87
|
+
renderers?: Record<string, ComponentRenderer<unknown>>;
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/javascript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Framework agnostic JavaScript SDK for Asgardeo.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"main": "dist/cjs/index.js",
|
|
20
20
|
"module": "dist/index.js",
|
|
21
21
|
"exports": {
|
|
22
|
+
"edge-light": "./dist/edge/index.js",
|
|
22
23
|
"import": "./dist/index.js",
|
|
23
24
|
"require": "./dist/cjs/index.js"
|
|
24
25
|
},
|