Skip to content

Standalone functions in PCA #7810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: msal-v5
Choose a base branch
from
Open

Standalone functions in PCA #7810

wants to merge 15 commits into from

Conversation

hectormmg
Copy link
Member

@hectormmg hectormmg commented Jun 5, 2025

Turns the following into standalone exported functions to help minify them on build output:

  1. BaseInteractionClient:
    • getRedirectUri()
    • getDiscoveredAuthority
    • initializeServerTelemetryManager()
  2. StandardInteractionClient:
    • InitializeAuthorizationRequest()
  3. PopupClient:
    • monitorPopupForHash()
    • cleanPopup()

@github-actions github-actions bot added the msal-browser Related to msal-browser package label Jun 5, 2025
@hectormmg hectormmg requested a review from a team as a code owner June 16, 2025 20:50
@github-actions github-actions bot added the msal-node Related to msal-node package label Jun 16, 2025
@github-actions github-actions bot removed the msal-node Related to msal-node package label Jun 16, 2025
*/
export function initializeServerTelemetryManager(
apiId: number,
config: BrowserConfiguration,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the whole config here or can we just pass in the clientId?

// Clear all accounts and tokens
await browserStorage.clear(correlationId);
// Clear any stray keys from IndexedDB
await browserCrypto.clearKeystore();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like something that should be handled by the clear function above. Thoughts?

* @param popupWindow - window that is being monitored
* @param timeout - timeout for processing hash once popup is redirected back to application
*/
export async function monitorPopupForHash(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO it's preferable to keep all the popup code together in the same file

export async function monitorPopupForHash(
popupWindow: Window,
popupWindowParent: Window,
config: BrowserConfiguration,
Copy link
Collaborator

@tnorling tnorling Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to pass in the whole config object or can this accept the timeout & responseMode directly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just pass the whole config object around? Is there a penalty for doing so? Minification impact?

Copy link
Collaborator

@tnorling tnorling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions but nothing blocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-browser Related to msal-browser package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants