@asgardeo/javascript 0.2.9 → 0.2.11

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.
@@ -15,80 +15,121 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { EmbeddedFlowExecuteRequestConfig, EmbeddedFlowResponseType, EmbeddedFlowType } from '../embedded-flow';
18
+ import { EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1, EmbeddedFlowType as EmbeddedFlowTypeV1 } from '../embedded-flow';
19
19
  /**
20
- * Status enumeration for AsgardeoV2 embedded sign-up flow responses.
20
+ * Status enumeration for Asgardeo embedded sign-up flow operations.
21
21
  *
22
- * This enum defines the possible states of a sign-up flow operation,
23
- * allowing client applications to determine the next appropriate action.
22
+ * These statuses indicate the current state of the registration flow and determine
23
+ * the next action required by the client application. Each status provides specific
24
+ * guidance on how to proceed with the user registration process.
24
25
  *
25
- * @experimental Part of the new AsgardeoV2 API
26
+ * @example
27
+ * ```typescript
28
+ * switch (response.flowStatus) {
29
+ * case EmbeddedSignUpFlowStatus.Incomplete:
30
+ * // More user input needed - render registration form components
31
+ * break;
32
+ * case EmbeddedSignUpFlowStatus.Complete:
33
+ * // Registration successful - handle completion
34
+ * break;
35
+ * case EmbeddedSignUpFlowStatus.Error:
36
+ * // Registration failed - show detailed error message
37
+ * const errorResponse = response as EmbeddedSignUpFlowErrorResponse;
38
+ * showError(errorResponse.failureReason);
39
+ * break;
40
+ * }
41
+ * ```
42
+ *
43
+ * @experimental Part of the new Asgardeo API
26
44
  */
27
- export declare enum EmbeddedSignUpFlowStatusV2 {
45
+ export declare enum EmbeddedSignUpFlowStatus {
28
46
  /**
29
- * Sign-up flow has completed successfully.
47
+ * Sign-up flow completed successfully.
30
48
  *
31
- * When this status is returned, the user has successfully registered
32
- * and the flow can proceed to redirection or completion handling.
33
- * The response will typically contain redirect information.
49
+ * The user has successfully registered and the flow can proceed to
50
+ * OAuth2 completion or redirection. Check for redirectUrl or assertion
51
+ * data in the response for next steps.
34
52
  */
35
53
  Complete = "COMPLETE",
36
54
  /**
37
- * Sign-up flow is in progress and requires additional user input.
55
+ * Sign-up flow requires additional user input.
38
56
  *
39
- * This status indicates that more steps are needed to complete the
40
- * sign-up process. The response will contain form components or
41
- * actions that need to be presented to the user.
57
+ * More registration steps are needed. The response will contain
58
+ * components in data.meta.components that should be rendered to
59
+ * collect additional user information (e.g., profile data, verification).
42
60
  */
43
61
  Incomplete = "INCOMPLETE",
44
62
  /**
45
63
  * Sign-up flow encountered an error and cannot proceed.
46
64
  *
47
- * When this status is returned, the response will be of type
48
- * `EmbeddedSignUpFlowErrorResponseV2` and will contain a `failureReason`
49
- * field with details about what went wrong. This triggers error
50
- * handling in the React components to display user-friendly messages.
65
+ * Registration failed due to validation errors, duplicate user,
66
+ * system errors, or other issues. The response will be of type
67
+ * `EmbeddedSignUpFlowErrorResponse` containing detailed failure
68
+ * information that can be displayed to the user.
51
69
  *
52
- * @see {@link EmbeddedSignUpFlowErrorResponseV2} for error response structure
70
+ * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
53
71
  */
54
72
  Error = "ERROR"
55
73
  }
56
- export declare enum EmbeddedSignUpFlowTypeV2 {
74
+ /**
75
+ * Type enumeration for Asgardeo embedded sign-up flow responses.
76
+ *
77
+ * Determines the nature of the registration flow response and how the client
78
+ * should handle the returned data. This affects both UI rendering and flow
79
+ * continuation logic during the user registration process.
80
+ *
81
+ * @experimental Part of the new Asgardeo API
82
+ */
83
+ export declare enum EmbeddedSignUpFlowType {
84
+ /**
85
+ * Response requires external redirection.
86
+ *
87
+ * Used for social registration providers, external identity providers,
88
+ * or other flows that require navigating to an external URL during
89
+ * the registration process. The response will contain redirection information.
90
+ */
57
91
  Redirection = "REDIRECTION",
92
+ /**
93
+ * Response contains view components for rendering.
94
+ *
95
+ * Standard embedded registration flow response containing UI components
96
+ * that should be rendered within the current application context.
97
+ * Most common type for embedded user registration.
98
+ */
58
99
  View = "VIEW"
59
100
  }
60
101
  /**
61
- * Extended response structure for the embedded sign-up flow V2.
102
+ * Extended response structure for the embedded sign-up flow.
62
103
  * @remarks This response is only done from the SDK level.
63
104
  * @experimental
64
105
  */
65
- export interface ExtendedEmbeddedSignUpFlowResponseV2 {
106
+ export interface ExtendedEmbeddedSignUpFlowResponse {
66
107
  /**
67
108
  * The URL to redirect the user after completing the sign-up flow.
68
109
  */
69
110
  redirectUrl?: string;
70
111
  }
71
112
  /**
72
- * Response structure for the new Asgardeo V2 embedded sign-up flow.
113
+ * Response structure for the new Asgardeo embedded sign-up flow.
73
114
  *
74
115
  * This interface defines the structure for successful sign-up flow responses
75
- * from AsgardeoV2 APIs. For error responses, see `EmbeddedSignUpFlowErrorResponseV2`.
116
+ * from Asgardeo APIs. For error responses, see `EmbeddedSignUpFlowErrorResponse`.
76
117
  *
77
118
  * **Flow States:**
78
119
  * - `INCOMPLETE`: More user input required, `data` contains form components
79
120
  * - `COMPLETE`: Sign-up finished, may contain redirect information
80
- * - For `ERROR` status, a separate `EmbeddedSignUpFlowErrorResponseV2` structure is used
121
+ * - For `ERROR` status, a separate `EmbeddedSignUpFlowErrorResponse` structure is used
81
122
  *
82
123
  * **Component-Driven UI:**
83
124
  * The `data.inputs` and `data.actions` are transformed by the React transformer
84
125
  * into component-driven format for consistent UI rendering across different
85
126
  * Asgardeo versions.
86
127
  *
87
- * @experimental Part of the new AsgardeoV2 API
88
- * @see {@link EmbeddedSignUpFlowErrorResponseV2} for error response structure
89
- * @see {@link EmbeddedSignUpFlowStatusV2} for available flow statuses
128
+ * @experimental Part of the new Asgardeo API
129
+ * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure
130
+ * @see {@link EmbeddedSignUpFlowStatus} for available flow statuses
90
131
  */
91
- export interface EmbeddedSignUpFlowResponseV2 extends ExtendedEmbeddedSignUpFlowResponseV2 {
132
+ export interface EmbeddedSignUpFlowResponse extends ExtendedEmbeddedSignUpFlowResponse {
92
133
  /**
93
134
  * Unique identifier for this sign-up flow instance.
94
135
  */
@@ -97,11 +138,11 @@ export interface EmbeddedSignUpFlowResponseV2 extends ExtendedEmbeddedSignUpFlow
97
138
  * Current status of the sign-up flow.
98
139
  * Determines whether more input is needed or the flow is complete.
99
140
  */
100
- flowStatus: EmbeddedSignUpFlowStatusV2;
141
+ flowStatus: EmbeddedSignUpFlowStatus;
101
142
  /**
102
143
  * Type of response, indicating the expected user interaction.
103
144
  */
104
- type: EmbeddedSignUpFlowTypeV2;
145
+ type: EmbeddedSignUpFlowType;
105
146
  /**
106
147
  * Flow data containing form inputs and available actions.
107
148
  * This is transformed to component-driven format by the React transformer.
@@ -111,7 +152,7 @@ export interface EmbeddedSignUpFlowResponseV2 extends ExtendedEmbeddedSignUpFlow
111
152
  * Available actions the user can take (e.g., form submission, social sign-up).
112
153
  */
113
154
  actions?: {
114
- type: EmbeddedFlowResponseType;
155
+ type: EmbeddedFlowResponseTypeV1;
115
156
  id: string;
116
157
  }[];
117
158
  /**
@@ -125,42 +166,35 @@ export interface EmbeddedSignUpFlowResponseV2 extends ExtendedEmbeddedSignUpFlow
125
166
  };
126
167
  }
127
168
  /**
128
- * Response structure for the new Asgardeo V2 embedded sign-up flow when the flow is complete.
169
+ * Response structure for the new Asgardeo embedded sign-up flow when the flow is complete.
129
170
  * @experimental
130
171
  */
131
172
  export interface EmbeddedSignUpFlowCompleteResponse {
132
173
  redirect_uri: string;
133
174
  }
134
175
  /**
135
- * Request payload for initiating the new Asgardeo V2 embedded sign-up flow.
176
+ * Request payload for initiating the new Asgardeo embedded sign-up flow.
136
177
  * @experimental
137
178
  */
138
- export type EmbeddedSignUpFlowInitiateRequestV2 = {
179
+ export type EmbeddedSignUpFlowInitiateRequest = {
139
180
  applicationId: string;
140
- flowType: EmbeddedFlowType;
181
+ flowType: EmbeddedFlowTypeV1;
141
182
  };
142
183
  /**
143
- * Request payload for executing steps in the new Asgardeo V2 embedded sign-up flow.
184
+ * Request payload for executing steps in the new Asgardeo embedded sign-up flow.
144
185
  * @experimental
145
186
  */
146
- export interface EmbeddedSignUpFlowRequestV2 extends Partial<EmbeddedSignUpFlowInitiateRequestV2> {
187
+ export interface EmbeddedSignUpFlowRequest extends Partial<EmbeddedSignUpFlowInitiateRequest> {
147
188
  flowId?: string;
148
189
  actionId?: string;
149
190
  inputs?: Record<string, any>;
150
191
  }
151
192
  /**
152
- * Request config for executing the new Asgardeo V2 embedded sign-up flow.
153
- * @experimental
154
- */
155
- export interface EmbeddedFlowExecuteRequestConfigV2<T = any> extends EmbeddedFlowExecuteRequestConfig<T> {
156
- authId?: string;
157
- }
158
- /**
159
- * Error response structure for the new Asgardeo V2 embedded sign-up flow.
193
+ * Error response structure for the new Asgardeo embedded sign-up flow.
160
194
  *
161
- * This interface defines the structure of error responses returned by AsgardeoV2 APIs
195
+ * This interface defines the structure of error responses returned by Asgardeo APIs
162
196
  * when sign-up operations fail. Unlike AsgardeoV1 which uses generic error codes and
163
- * descriptions, AsgardeoV2 provides more specific failure reasons within the flow context.
197
+ * descriptions, Asgardeo provides more specific failure reasons within the flow context.
164
198
  *
165
199
  * **Key Differences from AsgardeoV1:**
166
200
  * - Uses `failureReason` instead of `message`/`description` for error details
@@ -175,10 +209,10 @@ export interface EmbeddedFlowExecuteRequestConfigV2<T = any> extends EmbeddedFlo
175
209
  *
176
210
  * @example
177
211
  * ```typescript
178
- * // Typical AsgardeoV2 error response
179
- * const errorResponse: EmbeddedSignUpFlowErrorResponseV2 = {
212
+ * // Typical Asgardeo error response
213
+ * const errorResponse: EmbeddedSignUpFlowErrorResponse = {
180
214
  * flowId: "0ccfeaf9-18b3-43a5-bcc1-07d863dcb2c0",
181
- * flowStatus: EmbeddedSignUpFlowStatusV2.Error,
215
+ * flowStatus: EmbeddedSignUpFlowStatus.Error,
182
216
  * data: {},
183
217
  * failureReason: "User already exists with the provided username."
184
218
  * };
@@ -187,11 +221,11 @@ export interface EmbeddedFlowExecuteRequestConfigV2<T = any> extends EmbeddedFlo
187
221
  * // "User already exists with the provided username."
188
222
  * ```
189
223
  *
190
- * @experimental This is part of the new AsgardeoV2 API and may change in future versions
191
- * @see {@link EmbeddedSignUpFlowStatusV2.Error} for the error status enum value
192
- * @see {@link EmbeddedSignUpFlowResponseV2} for the corresponding success response structure
224
+ * @experimental This is part of the new Asgardeo API and may change in future versions
225
+ * @see {@link EmbeddedSignUpFlowStatus.Error} for the error status enum value
226
+ * @see {@link EmbeddedSignUpFlowResponse} for the corresponding success response structure
193
227
  */
194
- export interface EmbeddedSignUpFlowErrorResponseV2 {
228
+ export interface EmbeddedSignUpFlowErrorResponse {
195
229
  /**
196
230
  * Unique identifier for the sign-up flow instance.
197
231
  * This ID is used to track the flow state and correlate error responses
@@ -199,11 +233,11 @@ export interface EmbeddedSignUpFlowErrorResponseV2 {
199
233
  */
200
234
  flowId: string;
201
235
  /**
202
- * Status of the sign-up flow, which will be `EmbeddedSignUpFlowStatusV2.Error`
236
+ * Status of the sign-up flow, which will be `EmbeddedSignUpFlowStatus.Error`
203
237
  * for error responses. This field is used by error detection logic to
204
238
  * identify failed flow responses.
205
239
  */
206
- flowStatus: EmbeddedSignUpFlowStatusV2;
240
+ flowStatus: EmbeddedSignUpFlowStatus;
207
241
  /**
208
242
  * Additional response data, typically empty for error responses.
209
243
  * Maintained for structural consistency with successful flow responses
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "tslib": "2.8.1",
49
- "@asgardeo/i18n": "0.3.7"
49
+ "@asgardeo/i18n": "0.3.8"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"