UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

29 lines (28 loc) 1.32 kB
/** * Gets normalized URLs (absolute and relative) for redirect lookup. * * Normalizes the provided URL by removing trailing slashes and optionally filtering query parameters * based on a whitelist. This prepares the URL for use in redirect lookups. * * @param url The incoming URL. * @param queryParamWhitelist A set of query parameters to include in the lookup URL. Other parameters will be removed. * * @returns An object containing the relative and absolute normalized URLs. */ export declare function getRedirectLookupUrls(url: URL, queryParamWhitelist?: Set<string>): { relativeSourceUrl: string; absoluteSourceUrl: string; }; /** * Constructs a target URL for redirection, handling relative and absolute URLs and query parameters. * * Copies query parameters from the source URL to the target URL, unless they are present in the * `queryParamWhitelist`. If the target is a relative URL, it uses the source URL as the base. * * @param source The source URL. * @param target The target redirect URL (can be relative or absolute). * @param queryParamWhitelist A set of query parameters to exclude from the final redirect URL. * * @returns The decoded target URL string. */ export declare function getTargetLocation(source: URL, target: string, queryParamWhitelist?: Set<string>): string;