@asgardeo/javascript 0.16.2 → 0.18.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.
@@ -34,13 +34,13 @@ export interface EmbeddedUserOnboardingFlowResponse {
34
34
  components?: any[];
35
35
  };
36
36
  /**
37
- * Reason for failure if flowStatus is ERROR.
37
+ * Unique identifier for the flow execution.
38
38
  */
39
- failureReason?: string;
39
+ executionId: string;
40
40
  /**
41
- * Unique identifier for the flow execution.
41
+ * Reason for failure if flowStatus is ERROR.
42
42
  */
43
- flowId: string;
43
+ failureReason?: string;
44
44
  /**
45
45
  * Current status of the flow.
46
46
  */
@@ -78,7 +78,7 @@ export interface EmbeddedUserOnboardingFlowResponse {
78
78
  * const response = await executeEmbeddedUserOnboardingFlowV2({
79
79
  * baseUrl: "https://api.thunder.io",
80
80
  * payload: {
81
- * flowId: "flow-id-from-url",
81
+ * executionId: "flow-id-from-url",
82
82
  * inputs: { inviteToken: "token-from-url" }
83
83
  * }
84
84
  * });
package/dist/cjs/index.js CHANGED
@@ -488,11 +488,14 @@ Message: ${this.message}`;
488
488
  // src/utils/processOpenIDScopes.ts
489
489
  var processOpenIDScopes = (scopes) => {
490
490
  let processedScopes = [];
491
- if (scopes) {
491
+ let userConfiguredScopes = false;
492
+ if (scopes !== void 0 && scopes !== null) {
492
493
  if (Array.isArray(scopes)) {
493
494
  processedScopes = scopes;
495
+ userConfiguredScopes = scopes.length > 0;
494
496
  } else if (typeof scopes === "string") {
495
- processedScopes = scopes.split(" ");
497
+ processedScopes = scopes ? scopes.split(" ") : [];
498
+ userConfiguredScopes = scopes.length > 0;
496
499
  } else {
497
500
  throw new AsgardeoRuntimeError(
498
501
  "Scopes must be a string or an array of strings.",
@@ -502,11 +505,13 @@ var processOpenIDScopes = (scopes) => {
502
505
  );
503
506
  }
504
507
  }
505
- OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
506
- if (!processedScopes.includes(defaultScope)) {
507
- processedScopes.push(defaultScope);
508
- }
509
- });
508
+ if (!userConfiguredScopes) {
509
+ OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
510
+ if (!processedScopes.includes(defaultScope)) {
511
+ processedScopes.push(defaultScope);
512
+ }
513
+ });
514
+ }
510
515
  return processedScopes.join(" ");
511
516
  };
512
517
  var processOpenIDScopes_default = processOpenIDScopes;
@@ -3157,7 +3162,7 @@ var executeEmbeddedSignInFlowV2 = async ({
3157
3162
  const endpoint = url ?? `${baseUrl}/flow/execute`;
3158
3163
  const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
3159
3164
  const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
3160
- const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "flowId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3165
+ const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3161
3166
  const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
3162
3167
  const response = await fetch(endpoint, {
3163
3168
  ...requestConfig,
@@ -3257,7 +3262,7 @@ var executeEmbeddedSignUpFlowV2 = async ({
3257
3262
  const endpoint = url ?? `${baseUrl}/flow/execute`;
3258
3263
  const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
3259
3264
  const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
3260
- const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "flowId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3265
+ const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3261
3266
  const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
3262
3267
  const response = await fetch(endpoint, {
3263
3268
  ...requestConfig,
@@ -3343,8 +3348,8 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
3343
3348
  const endpoint = url ?? `${baseUrl}/flow/execute`;
3344
3349
  const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
3345
3350
  const hasOnlyFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 1;
3346
- const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "flowId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3347
- const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "flowId" in cleanPayload && "inputs" in cleanPayload;
3351
+ const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
3352
+ const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && "inputs" in cleanPayload;
3348
3353
  const requestPayload = hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? { ...cleanPayload, verbose: true } : cleanPayload;
3349
3354
  if ("flowType" in requestPayload && requestPayload["flowType"] !== "USER_ONBOARDING" /* UserOnboarding */) {
3350
3355
  requestPayload["flowType"] = "USER_ONBOARDING" /* UserOnboarding */;