Skip to content

Commit

Permalink
CR Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
orius123 committed Jul 23, 2024
1 parent 7cd5f05 commit c38660b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class BaseDescopeWc extends HTMLElement {
redirectAuthBackupCallbackUri,
redirectAuthCodeChallenge,
redirectAuthInitiator,
ssoQueryParams,
ssoQueryParams
} = handleUrlParams();

// we want to update the state when user clicks on back in the browser
Expand Down Expand Up @@ -740,7 +740,7 @@ class BaseDescopeWc extends HTMLElement {
redirectAuthBackupCallbackUri,
redirectAuthCodeChallenge,
redirectAuthInitiator,
ssoQueryParams,
...ssoQueryParams,
});

this.#init = true;
Expand Down
12 changes: 8 additions & 4 deletions packages/sdks/web-component/src/lib/descope-wc/DescopeWc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
NextFnReturnPromiseValue,
SdkConfig,
StepState,
extractOIDCOptions,
} from '../types';
import BaseDescopeWc from './BaseDescopeWc';
import loadSdkScript, { getScriptResultPath } from './sdkScripts';
Expand Down Expand Up @@ -214,7 +213,7 @@ class DescopeWc extends BaseDescopeWc {
samlIdpResponseUrl,
samlIdpResponseSamlResponse,
samlIdpResponseRelayState,
ssoQueryParams,
...ssoQueryParams
} = currentState;

let startScreenId: string;
Expand Down Expand Up @@ -440,6 +439,9 @@ class DescopeWc extends BaseDescopeWc {
readyScreenId,
);

const { oidcLoginHint, oidcPrompt, oidcErrorRedirectUri, samlIdpUsername } =
ssoQueryParams;

// generate step state update data
const stepStateUpdate: Partial<StepState> = {
direction: getAnimationDirection(stepId, prevState.stepId),
Expand All @@ -466,8 +468,10 @@ class DescopeWc extends BaseDescopeWc {
filename: filenameWithLocale,
baseUrl: this.baseStaticUrl,
}),
samlIdpUsername: ssoQueryParams.samlIdpUsername,
...extractOIDCOptions(ssoQueryParams),
samlIdpUsername,
oidcLoginHint,
oidcPrompt,
oidcErrorRedirectUri,
openInNewTabUrl,
};

Expand Down
15 changes: 1 addition & 14 deletions packages/sdks/web-component/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ export type OIDCOptions = {
oidcErrorRedirectUri?: string;
};

export const extractOIDCOptions = (params: SSOQueryParams): OIDCOptions => {
const {
oidcIdpStateId,
samlIdpStateId,
samlIdpUsername,
descopeIdpInitiated,
ssoAppId,
...oidcOptions
} = params;
return oidcOptions;
};

export type FlowState = {
flowId: string;
projectId: string;
Expand Down Expand Up @@ -87,8 +75,7 @@ export type FlowState = {
samlIdpResponseUrl: string;
samlIdpResponseSamlResponse: string;
samlIdpResponseRelayState: string;
ssoQueryParams: SSOQueryParams;
};
} & SSOQueryParams;

export type StepState = {
screenState: ScreenState;
Expand Down

0 comments on commit c38660b

Please sign in to comment.