/** * Helper functions related to path manipulation. * @private */ export declare class PathUtils { /** * Returns if the code executes in the browser context or not by checking for the * existance of the window object * * @returns The result of the check of the existance of the window object. */ static isBrowser(): boolean; /** * Returns the context path of the given location. * If no location is provided, it fallbacks to the current location. * @param [location] Location to be used to detect the context path from. * @returns */ static getContextPath(location?: string | null): string; /** * Adapts the provided path to a valid model path. * Returns an empty string if the given path is equal to the root model path. * This function is a utility tool that converts a provided root model path into an internal specific empty path * * @param [path] Raw model path. * @private * @return The valid model path. */ static adaptPagePath(path: string, rootPath?: string): string; /** * Returns the given URL externalized by adding the optional context path. * @param url URL to externalize. * @returns */ static externalize(url: string): string; /** * Returns the given URL internalized by removing the optional context path. * @param url URL to internalize. * @returns */ static internalize(url: string | null): string; /** * Returns the value of the meta property with the given key. * @param propertyName Name of the meta property. * @return */ static getMetaPropertyValue(propertyName: string): string | null; /** * Returns a model path for the given URL. * @param url Raw URL for which to get a model URL. */ static convertToModelUrl(url: string): string | undefined; /** * Returns the model URL as contained in the current page URL. */ static getCurrentPageModelUrl(): string | null; /** * Returns the URL of the page model to initialize the page model manager with. * It is either derived from a meta tag property called 'cq:pagemodel_root_url' or from the given location. * If no location is provided, it derives it from the current location. * @param [url] - path or URL to be used to derive the page model URL from * @returns */ static getModelUrl(url?: string): string | null | undefined; /** * Returns the given path after sanitizing it. * This function should be called on page paths before storing them in the page model, * to make sure only properly formatted paths (e.g., "/content/mypage") are stored. * @param path - Path of the page to be sanitized. */ static sanitize(path: string | null): string | null; /** * Returns the given path extended with the given extension. * @param path - Path to be extended. * @param extension - Extension to be added. */ static addExtension(path: string, extension: string): string; /** * Returns path after removing resource path * /content/dummy.html/abc/def -> html/abc/def * /content/dummy.selector1.selector2.test.html/abc/def -> selector1.selector2.test.html/abc/def * @param path - Url pathName */ private static _extractPathWithoutResource; /** * Returns given path with added extension or replaces html with extension * @param pathWithoutResource - url path without reosurce path * @param extension - extension to be added */ private static _replaceExtension; /** * Returns the given path extended with the given selector. * @param path - Path to be extended. * @param selector - Selector to be added. */ static addSelector(path: string, selector: string): string; /** * Returns the current location as a string. */ static getCurrentPathname(): string | null; /** * Returns empty string or current URL if called in the browser. * @returns Current URL. */ static getCurrentURL(): string; /** * Dispatches a custom event on the window object, when in the browser context. * @param eventName The name of the custom event. * @param options The custom event options. */ static dispatchGlobalCustomEvent(eventName: string, options: any): void; /** * Joins given path segments into a string using slash. */ static join(paths?: string[]): string; /** * Normalizes given path by replacing repeated slash with a single one. */ static normalize(path?: string): string; /** * Returns path that starts with slash. */ static makeAbsolute(path?: string): string; /** * Returns path without the leading slash. */ static makeRelative(path?: string): string; /** * Returns path to the direct parent. */ static getParentNodePath(path: string | null): string | null; /** * Checks if given path is an JCR path. */ static isItem(path: string): boolean; /** * Returns the name of the last node of the given path. */ static getNodeName(path: string): string | null; /** * Returns the subpath of the targetPath relative to the rootPath, * or the targetPath if the rootPath is not a root of the targetPath. */ static subpath(targetPath?: string, rootPath?: string): string; /** * Returns an array of segments of the path, split by the custom set of delimitators passed as an array. */ static splitByDelimitators(path: string, delimitators: string[]): string[]; /** * Returns an JCR path based on pagePath and dataPath. * @param pagePath Path to the page. * @param dataPath Path to the item on the page. */ static _getJCRPath(pagePath: string, dataPath: string): string; /** * Returns object containing pagePath (path to a page) and, if exists, itemPath (path to the item on that page) * from the passed path. */ static splitPageContentPaths(path: string): { itemPath?: string; pagePath: string; } | undefined; /** * Returns path that is no longer prefixed nor suffixed by the set of strings passed as an array. */ static trimStrings(path: string, strings: string[]): string; static _getStartStrings(path: string, strings: string[]): string; /** * Helper for handling remote react app routing in edit mode * * When an external SPA is opened in the editor, the router needs updated path parameter * to account for the AEM specific prefix in the URL * eg: /home will become /content/{aem_project_name}/home * * @param path Path to route to * @param aemHost Origin information of the AEM instance in which to edit * @param rootPath AEM path which forms the root path of the remote app * @returns Updated path to match against */ static toAEMPath(path: string, aemHost: string, rootPath: string): string; } //# sourceMappingURL=PathUtils.d.ts.map