import { IkasLanguageOption, IkasLocaleOption, IkasProduct, IkasStorefrontRouting, IkasThemePageType } from "../../../storefront-models/src";
import { BaseStore } from "../../../stores/base";
/**
* Initializes the base store by setting the current page type.
*
* @ai-category BaseStore, Store
*
* @param pageType - The page type to assign as the current page type in the base store.
* @returns void
*
* @example
* ```typescript
* import { initBaseStore } from "@ikas/bp-storefront";
* import { IkasThemePageType } from "@ikas/bp-storefront";
*
* initBaseStore(IkasThemePageType.PRODUCT_DETAIL);
* ```
*/
export declare function initBaseStore(pageType: IkasThemePageType): void;
/**
* Switches the storefront to the routing associated with `localeOption` and redirects the browser
* to the equivalent URL under that routing.
*
* Reads the routing directly from `localeOption.routing`, then performs a full-page redirect via
* `window.location.replace`. For CATEGORY/BRAND/PRODUCT pages, the localized slug from the page's
* metadata translations is used when available, and a CUSTOM page uses its per-routing slug from the
* theme (or the target routing's home page when it is not published there); otherwise the visitor
* stays on the current path (with the current routing prefix swapped for the new one). Query string
* and hash are preserved.
*
* Which one: `setLocalization` backs a country/region picker (`baseStore.localeOptions`, one entry per country;
* the routing it leads to sets the language and the currency together). `setLanguage` backs a language picker
* (`baseStore.languageOptions`, the languages of the current market). Both only switch the routing; a header
* can show either one, or both (region picker to change market, language picker within it).
*
* The options, filled by the SDK on every page:
* - `baseStore.languageOptions`: one entry per routing of the current market (the routings sharing a country with
* the current one; routings without countries form one market). Filled on the server too, so it renders without
* a flash. `language` is the language name in the page's language. Two routings of a market can serve the same
* language, so tell equal names apart (e.g. by the routing's `path`). With a single entry there is nothing to pick.
* - `baseStore.localeOptions`: browser-only (empty on the server and until the visitor's country is looked up). One
* entry per country of every routing (the first routing serving it) plus one per routing without countries.
* `isRecommended` marks the visitor's country, detected by IP.
* - `baseStore.showLocaleOptions`: browser-only; true when the visitor's country is served by another routing than
* the current one. Use it with the `isRecommended` entry for a dismissable "switch to …" suggestion; never
* redirect automatically (IP detection is wrong behind a VPN).
* - One entry per routing instead (e.g. a country served by several routings): list `IkasStorefrontConfig.routings`,
* mark `IkasStorefrontConfig.getCurrentRouting()`, and pass `{ id: routing.id, routing, isRecommended: false }`
* to `setLocalization`.
*
* @ai-category BaseStore, Store
*
* @param baseStore - The base store instance (used to read the current page type for slug
* resolution on detail pages).
* @param localeOption - The locale option the visitor selected. Render `baseStore.localeOptions`
* as a list (e.g. a country/region picker) and pass the chosen entry directly to this function.
* @returns void.
*
* @example
* ```tsx
* import { setLocalization, baseStore } from "@ikas/bp-storefront";
*
* function LocalizationSwitcher() {
* return (
*
* {baseStore.localeOptions.map(option => (
*
*
*
* ))}
*
* );
* }
* ```
*/
export declare function setLocalization(baseStore: BaseStore, localeOption: IkasLocaleOption): void;
/**
* Switches the storefront to the routing identified by `language` and redirects the browser to
* the equivalent URL under that routing.
*
* Looks up the routing by `language.id`, then performs a full-page redirect via
* `window.location.replace`. For CATEGORY/BRAND/PRODUCT pages, the localized slug from the
* page's metadata translations is used when available, and a CUSTOM page uses its per-routing slug
* from the theme (or the target routing's home page when it is not published there); otherwise the
* visitor stays on the current path (with the current routing prefix swapped for the new one). Query string and
* hash are preserved.
*
* Which one: see `setLocalization` — a language picker uses this, a country/region picker (language and
* currency together) uses `setLocalization`; a header can show either, or both. `setLocalization` also
* describes what `baseStore.languageOptions`, `localeOptions` and `showLocaleOptions` contain and when.
*
* @ai-category BaseStore, Store
*
* @param baseStore - The base store instance (used to read the current page type for slug
* resolution on detail pages).
* @param language - The language option the visitor selected. Render `baseStore.languageOptions`
* as a list (e.g. a dropdown) and pass the chosen entry directly to this function.
* @returns void. No-op if no routing matches `language.id`.
*
* @example
* ```tsx
* import { setLanguage, baseStore } from "@ikas/bp-storefront";
*
* function LanguageSwitcher() {
* return (
*
* {baseStore.languageOptions.map(option => (
*
*
*
* ))}
*
* );
* }
* ```
*/
export declare function setLanguage(baseStore: BaseStore, language: IkasLanguageOption): void;
/**
* Lets the editor take over routing switches made from the canvas (`setLocalization` / `setLanguage`).
*/
export declare function setPreviewRoutingHandler(handler?: (routing: IkasStorefrontRouting) => void): void;
/**
* Fetches a single product by id and returns it as a full `IkasProduct`.
*
* Use this when a lightweight reference (e.g. a cart line's `IkasOrderLineVariant`, which carries
* neither `salesChannels` nor `stock`) needs product-level data: the returned product includes
* `salesChannels` filtered to the active sales channel (with `minQuantityPerCart` /
* `maxQuantityPerCart`) and per-variant `stock` (summed over the sales channel's configured
* stock locations). `selectedVariantValues` is seeded from the first active variant (or the
* first variant when none is active). For multiple ids, prefer `bs_searchProductsById` — one
* batched request.
*
* @ai-category Product, Search
* @ai-related bs_searchProductsById
*
* @param baseStore - The base store instance
* @param params - `{ productId }` — id of the product to fetch
* @returns `{ isSuccess, product }` — `product` is null when not found or on failure
*
* @example
* ```tsx
* import { baseStore, bs_searchProductById, IkasStorefrontConfig } from "@ikas/bp-storefront";
*
* const { isSuccess, product } = await bs_searchProductById(baseStore, { productId });
* if (isSuccess && product) {
* const channel = product.salesChannels?.find(sc => sc.id === IkasStorefrontConfig.salesChannelId);
* console.log(channel?.maxQuantityPerCart);
* }
* ```
*/
export declare function bs_searchProductById(baseStore: BaseStore, params: {
productId: string;
}): Promise<{
isSuccess: boolean;
product: IkasProduct | null;
}>;
/**
* Batch-fetches products by id in a single request and returns them as full `IkasProduct` objects.
*
* The go-to function when cart lines (or any lightweight reference) need product-level data they
* do not carry: `IkasOrderLineVariant` has neither `salesChannels` nor `stock`, while the products
* returned here include `salesChannels` filtered to the active sales channel (with
* `minQuantityPerCart` / `maxQuantityPerCart`) and per-variant `stock` (summed over the sales
* channel's configured stock locations). Collect the distinct `productId`s of the lines and
* fetch them in ONE call instead of one request per line. Called with an empty `productIds`,
* it returns `{ isSuccess: true, products: [] }` without a network request.
*
* @ai-category Product, Cart, Search
* @ai-related bs_searchProductById, changeItemQuantity
*
* @param baseStore - The base store instance
* @param params - `{ productIds }` — product ids to fetch (deduplicate before calling)
* @returns `{ isSuccess, products }` — `products` is null on failure
*
* @example
* ```tsx
* import { baseStore, bs_searchProductsById, cartStore, IkasStorefrontConfig } from "@ikas/bp-storefront";
*
* // Enforce per-cart quantity limits on cart lines:
* const productIds = [
* ...new Set(
* (cartStore.cart?.orderLineItems ?? [])
* .map(item => item.variant.productId)
* .filter((id): id is string => !!id)
* ),
* ];
* const { products } = await bs_searchProductsById(baseStore, { productIds });
* const maxByProductId = new Map();
* for (const p of products ?? []) {
* const channel = p.salesChannels?.find(sc => sc.id === IkasStorefrontConfig.salesChannelId);
* maxByProductId.set(p.id, channel?.maxQuantityPerCart ?? null);
* }
* ```
*/
export declare function bs_searchProductsById(baseStore: BaseStore, params: {
productIds: string[];
}): Promise<{
isSuccess: boolean;
products: IkasProduct[] | null;
}>;