@scayle/storefront-core
Version:
Collection of essential utilities to work with the Storefront API
24 lines (23 loc) • 870 B
TypeScript
import type { Campaign } from '@scayle/storefront-api';
import type { RpcHandler } from '../../types';
/**
* Retrieves the active campaign.
*
* This RPC method retrieves the active campaign.
* It then returns the first active campaign.
*
* @param context The RPC Context
* @returns The current active campaign.
*/
export declare const getCampaign: RpcHandler<Campaign | undefined>;
/**
* Retrieves the active campaign key.
*
* This RPC method retrieves the key for the earliest active campaign. It first checks the `context`
* for an existing `campaignKey`. If not present, it fetches active campaigns from the SAPI
* `list-campaigns` endpoint using the `sapiClient`, caching the result for 5 minutes.
*
* @param context The RPC Context
* @returns The current active campaign key.
*/
export declare const getCampaignKey: RpcHandler<string | undefined>;