@scayle/storefront-nuxt
Version:
Nuxt integration for the SCAYLE Commerce Engine and Storefront API
21 lines (20 loc) • 1.01 kB
TypeScript
import type { StorefrontAPIClient, CachedType, Log } from '@scayle/storefront-core';
/**
* Fetches the key of the first active campaign.
*
* Retrieves campaigns from the Storefront API, filters for non-ended campaigns,
* sorts them, and returns the key of the first active one.
* The retrieved campaigns are cached for a specified duration.
*
* @see https://scayle.dev/en/core-documentation/checkout-guide/features/promotions/discounts-and-offers/price-campaigns
* @see https://scayle.dev/en/api-guides/storefront-api/resources/campaigns/list-campaigns
*
* @param sapiClient The Storefront API client.
* @param cached The caching function.
* @param log The logging instance.
*
* @throws {Error} If fetching or processing campaigns fails.
*
* @returns The key of the first active campaign, or undefined if no active campaign is found or an error occurs.
*/
export declare const fetchCampaignKey: (sapiClient: StorefrontAPIClient, cached: CachedType, log: Log) => Promise<string | undefined>;