@scayle/storefront-nuxt
Version:
Nuxt integration for the SCAYLE Commerce Engine and Storefront API
29 lines (28 loc) • 1.34 kB
TypeScript
import type { WithContext, BreadcrumbList } from 'schema-dts';
import type { BreadcrumbItem } from '@scayle/storefront-core';
/**
* Sanitizes a canonical URL by removing query parameters not present in the whitelist.
*
* This function parses the URL, filters the query parameters based on the provided whitelist,
* and then reconstructs the URL with only the allowed parameters.
*
* @param url The URL to sanitize.
* @param whitelistParams An array of query parameters to keep. Defaults to `CANONICAL_PARAMS_WHITELIST`.
*
* @returns The sanitized URL.
*/
export declare const sanitizeCanonicalURL: (url: string, whitelistParams?: string[]) => string;
/**
* Generates a BreadcrumbList schema for structured data based on an array of BreadcrumbItems.
*
* This function iterates through the provided `breadcrumbs` array and creates a
* `BreadcrumbList` object conforming to the schema.org specification.
* Each breadcrumb item is transformed into a `ListItem` with its position, name, and URL.
*
* @see https://schema.org/BreadcrumbList
*
* @param breadcrumbs An array of breadcrumb items used to generate the schema.
*
* @returns A BreadcrumbList schema object ready to be included in structured data.
*/
export declare const generateCategoryBreadcrumbSchema: (breadcrumbs: BreadcrumbItem[]) => WithContext<BreadcrumbList>;