@asgardeo/javascript 0.18.1 → 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/index.d.ts CHANGED
@@ -55,7 +55,8 @@ export { FlowMetaType, ApplicationMetadata, OUMetadata, DesignMetadata, I18nMeta
55
55
  export { EmbeddedFlowType, EmbeddedFlowStatus, EmbeddedFlowExecuteResponse, EmbeddedFlowResponseType, EmbeddedSignUpFlowData, EmbeddedFlowComponent, EmbeddedFlowComponentType, EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteRequestConfig, EmbeddedFlowExecuteErrorResponse, } from './models/embedded-flow';
56
56
  export { FlowMode } from './models/flow';
57
57
  export { AsgardeoClient } from './models/client';
58
- export { BaseConfig, Config, Preferences, ThemePreferences, I18nPreferences, I18nStorageStrategy, WithPreferences, SignInOptions, SignOutOptions, SignUpOptions, } from './models/config';
58
+ export { BaseConfig, Config, Preferences, ThemePreferences, I18nPreferences, I18nStorageStrategy, WithPreferences, Extensions, WithExtensions, SignInOptions, SignOutOptions, SignUpOptions, } from './models/config';
59
+ export type { ComponentRenderContext, ComponentRenderer, ComponentsExtensions } from './models/v2/extensions/components';
59
60
  export { TokenResponse, IdToken, TokenExchangeRequestConfig } from './models/token';
60
61
  export { AgentConfig } from './models/agent';
61
62
  export { AuthCodeResponse } from './models/auth-code-response';
@@ -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
  /**
@@ -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.18.1",
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
  },