UNPKG

3.11 kBTypeScriptView Raw
1import { FlattenedProductListItem, NormalizedProductList, ProductsQuery } from '.';
2import { CustomerProductListResult, Product } from '../../types';
3/**
4 * Converts a product list returned from the API to our normalized structure
5 * When a base product is selected, it will have a value for `options`.
6 * When it has variants, it will have one or more keys for `variants`
7 * Either variants or options may be null, but not both.
8 */
9export declare function normalizeServerList(serverList: CustomerProductListResult): NormalizedProductList;
10/**
11 * Takes a flattened product list and result of a products query and returns
12 * product details for each item in the flattened list. */
13export declare function getProductDetailForFlattenedProductList(
14/** May contain base products, variants, or a combination of both. */
15flattenedList: FlattenedProductListItem[],
16/** Contains the results of a products query, which returns only base products */
17productQueryResult: ProductsQuery): {
18 validation: import(".").ProductListProductValidation;
19 quantity: number;
20 isVariant: boolean;
21 variant: import("../../types").ProductVariant;
22 breadcrumbText?: string;
23 head?: import("../../types").HtmlHead;
24 primaryRoute?: import("../../types").Route;
25 __typename?: "Product";
26 articleNumber: string;
27 badges?: import("../../types").ProductBadge[];
28 barcode?: string;
29 campaigns?: import("../../types").Category[];
30 canonicalCategory?: import("../../types").Category;
31 categories?: import("../../types").Category[];
32 configurationPrice?: import("../../types").ProductConfigurationPrice;
33 configurations?: import("../../types").ProductConfiguration[];
34 customerComments?: import("../../types").ProductComment[];
35 customFields?: import("../../types").CustomField[];
36 defaultPreviousPrice?: import("../../types").Price;
37 defaultPrice?: import("../../types").Price;
38 description: string;
39 distributionPackageSize: number;
40 hasConfigurations: boolean;
41 hasVariants: boolean;
42 id: number;
43 images?: import("../../types").ProductImage[];
44 inPackages?: Product[];
45 isPackage?: boolean;
46 isPreOrder?: boolean;
47 mainHeader: string;
48 name: string;
49 package?: import("../../types").Package;
50 preOrder?: import("../../types").ProductPreOrder;
51 previousPrice?: import("../../types").Price;
52 price?: import("../../types").Price;
53 publishedDate?: any;
54 quantitySuffix?: string;
55 recommendedPrice?: import("../../types").Price;
56 recommendedProducts?: import("../../types").RecommendedProducts;
57 relatedProducts?: Product[];
58 shortDescription: string;
59 stockStatus?: import("../../types").StockStatus;
60 subName: string;
61 upsell?: import("../../types").Upsell;
62 variants?: import("../../types").ProductVariants;
63 warehouseStock?: import("../../types").Warehouse[];
64}[];
65export declare function getVariantFromProductDetails(variant: Product['articleNumber'], product: Product): import("../../types").ProductVariant;
66export declare function flattenList(list: NormalizedProductList): FlattenedProductListItem[];