Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { NavigationOptions } from "./NavigationOptions.js";
export interface INavigationClient {
/**
* Navigates to other pages within the same web application
* Return false if this doesn't cause the page to reload i.e. Client-side navigation
* @param url
* @param options
*/
navigateInternal(url: string, options: NavigationOptions): Promise<boolean>;
/**
* Navigates to other pages outside the web application i.e. the Identity Provider
* @param url
* @param options
*/
navigateExternal(url: string, options: NavigationOptions): Promise<boolean>;
}
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { INavigationClient } from "./INavigationClient.js";
import { NavigationOptions } from "./NavigationOptions.js";
export class NavigationClient implements INavigationClient {
/**
* Navigates to other pages within the same web application
* @param url
* @param options
*/
navigateInternal(
url: string,
options: NavigationOptions
): Promise<boolean> {
return NavigationClient.defaultNavigateWindow(url, options);
}
/**
* Navigates to other pages outside the web application i.e. the Identity Provider
* @param url
* @param options
*/
navigateExternal(
url: string,
options: NavigationOptions
): Promise<boolean> {
return NavigationClient.defaultNavigateWindow(url, options);
}
/**
* Default navigation implementation invoked by the internal and external functions
* @param url
* @param options
*/
private static defaultNavigateWindow(
url: string,
options: NavigationOptions
): Promise<boolean> {
if (options.noHistory) {
window.location.replace(url);
} else {
window.location.assign(url);
}
return new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, options.timeout);
});
}
}
+18
View File
@@ -0,0 +1,18 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { ApiId } from "../utils/BrowserConstants.js";
/**
* Additional information passed to the navigateInternal and navigateExternal functions
*/
export type NavigationOptions = {
/** The Id of the API that initiated navigation */
apiId: ApiId;
/** Suggested timeout (ms) based on the configuration provided to PublicClientApplication */
timeout: number;
/** When set to true the url should not be added to the browser history */
noHistory: boolean;
};