UNPKG

3.45 kBTypeScriptView Raw
1import { IUri } from "../IUri";
2import { ServerRequestParameters } from "../ServerRequestParameters";
3/**
4 * @hidden
5 */
6export declare class UrlUtils {
7 /**
8 * generates the URL with QueryString Parameters
9 * @param scopes
10 */
11 static createNavigateUrl(serverRequestParams: ServerRequestParameters): string;
12 /**
13 * Generate the array of all QueryStringParams to be sent to the server
14 * @param scopes
15 */
16 static createNavigationUrlString(serverRequestParams: ServerRequestParameters): Array<string>;
17 /**
18 * Returns current window URL as redirect uri
19 */
20 static getCurrentUrl(): string;
21 /**
22 * Returns given URL with query string removed
23 */
24 static removeHashFromUrl(url: string): string;
25 /**
26 * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d
27 * @param href The url
28 * @param tenantId The tenant id to replace
29 */
30 static replaceTenantPath(url: string, tenantId: string): string;
31 static constructAuthorityUriFromObject(urlObject: IUri, pathArray: string[]): string;
32 /**
33 * Checks if an authority is common (ex. https://a:b/common/)
34 * @param url The url
35 * @returns true if authority is common and false otherwise
36 */
37 static isCommonAuthority(url: string): boolean;
38 /**
39 * Checks if an authority is for organizations (ex. https://a:b/organizations/)
40 * @param url The url
41 * @returns true if authority is for and false otherwise
42 */
43 static isOrganizationsAuthority(url: string): boolean;
44 /**
45 * Checks if an authority is for consumers (ex. https://a:b/consumers/)
46 * @param url The url
47 * @returns true if authority is for and false otherwise
48 */
49 static isConsumersAuthority(url: string): boolean;
50 /**
51 * Parses out the components from a url string.
52 * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
53 */
54 static GetUrlComponents(url: string): IUri;
55 /**
56 * Given a url or path, append a trailing slash if one doesnt exist
57 *
58 * @param url
59 */
60 static CanonicalizeUri(url: string): string;
61 /**
62 * Checks to see if the url ends with the suffix
63 * Required because we are compiling for es5 instead of es6
64 * @param url
65 * @param str
66 */
67 static endsWith(url: string, suffix: string): boolean;
68 /**
69 * Utils function to remove the login_hint and domain_hint from the i/p extraQueryParameters
70 * @param url
71 * @param name
72 */
73 static urlRemoveQueryStringParameter(url: string, name: string): string;
74 /**
75 * @hidden
76 * @ignore
77 *
78 * Returns the anchor part(#) of the URL
79 */
80 static getHashFromUrl(urlStringOrFragment: string): string;
81 /**
82 * @hidden
83 * Check if the url contains a hash with known properties
84 * @ignore
85 */
86 static urlContainsHash(urlString: string): boolean;
87 /**
88 * @hidden
89 * Returns deserialized portion of URL hash
90 * @ignore
91 */
92 static deserializeHash(urlFragment: string): object;
93 /**
94 * @ignore
95 * @param {string} URI
96 * @returns {string} host from the URI
97 *
98 * extract URI from the host
99 */
100 static getHostFromUri(uri: string): string;
101}