UNPKG

@klevu/core

Version:

Typescript SDK that simplifies development on Klevu backend. Klevu provides advanced AI-powered search and discovery solutions for online retailers.

124 lines (123 loc) 3.53 kB
import { KlevuFetchFunctionReturnValue, KlevuSearchOptions } from "../index.js"; import { KlevuFetchModifer } from "../../modifiers/index.js"; export type KlevuKMCRecommendationOptions = { id: string; /** * If KMC recommendation is category based then category path is required. * Requires categories to be separated with semicolon. For example * "Mens;Shoes" */ categoryPath?: string; /** * If KMC recommendation is Product based then it is required to pass current pages * product id */ currentProductId?: string; /** * If KMC recommendation is Product based then Item group id (the parent id) is required information. */ itemGroupId?: string; /** * If KMC recommendation is Checkout page based then its required to provide * productIds that are currently in the cart */ cartProductIds?: string[]; }; declare enum KMCRecommendationPagetype { Home = "HOME", Category = "CATEGORY", Product = "PRODUCT", Checkout = "CHECKOUT" } export declare enum KMCRecommendationLogic { Trending = "TRENDING", TrendingPersonalized = "TRENDING_PERSONALIZED", NewestArrivals = "NEWEST_ARRIVALS", RecentlyViewed = "RECENTLY_VIEWED", HandPicked = "HAND_PICKED", OtherAlsoViewed = "OTHER_ALSO_VIEWED", Similar = "SIMILAR", BoughtTogether = "BOUGHT_TOGETHER", BoughtTogetherPDP = "BOUGHT_TOGETHER_PDP", VisuallySimilar = "VISUALLY_SIMILAR", Custom = "CUSTOM_LOGIC" } export type KlevuKMCRecommendations = { metadata: { /** * Title of the recommendation */ title: string; /** * ID of the recommendation */ recsKey: string; /** * Target page type of recommendation */ pageType: KMCRecommendationPagetype; /** * Logic used in recommendation */ logic: KMCRecommendationLogic; /** * Amount of products to fetch */ maxProducts: number; productThreshold: number; enabled: boolean; /** * ID of the spot */ spotKey: string; /** * Spot name */ spotName: string; /** * User segment key */ segmentKey: string | null; /** * User segment name */ segmentName: string | null; /** * Special cases of recommendation */ action?: "STATIC_CONTENT" | "HIDE_RECOMMENDATION" | "FILTER" | null; }; search: { basePath: string; payload: string; recsAction?: "STATIC_CONTENT" | "HIDE_RECOMMENDATION" | "FILTER"; }; templates: { base: string; }; styles: { base: string; }; scripts: { recsObject?: unknown; }; staticContent?: Array<{ targetUrl: string; contentType: "image"; image: Array<{ resolution: string; url: string; altTag: string; maxWidth: number; }>; }>; }; /** * Fetches products based on KMC recommendation. Provide id created in KMC * * @category RecommendationQuery * @param recommendationId Id of recommendation in the backend * @returns */ export declare function kmcRecommendation(recommendationId: string, options?: Partial<KlevuKMCRecommendationOptions> & Partial<KlevuSearchOptions>, ...modifiers: KlevuFetchModifer[]): Promise<KlevuFetchFunctionReturnValue>; export {};