@scayle/storefront-nuxt
Version:
Nuxt integration for the SCAYLE Commerce Engine and Storefront API
28 lines (27 loc) • 1.41 kB
TypeScript
import type { ComputedRef, MaybeRefOrGetter } from 'vue';
import type { AppliedReduction, BasketItem, CentAmount, OrderItem, Price } from '@scayle/storefront-core';
interface RelativeReductions {
value: number;
category: 'promotion' | 'sale' | 'campaign' | 'voucher';
}
export type BasketItemPrice = BasketItem['price']['total'];
export type OrderPrice = OrderItem['price'];
export interface UseProductPriceReturn {
/** Ordered applied reductions. The first applied reduction will be in the first position of the array. */
appliedReductions: ComputedRef<AppliedReduction[]>;
/** Strike through prices, calculated by adding the reduction prices to the original price. */
strikeThroughPrices: ComputedRef<CentAmount[]>;
/** Reductions representing the relative amount and their respective categories. */
/** @deprecated Use {@link appliedReductions} instead. */
relativeReductions: ComputedRef<RelativeReductions[]>;
/** Total price with tax. */
totalPrice: ComputedRef<CentAmount>;
}
/**
* Composable for extracted product price data.
*
* @param price - Product or basket item price object containing all price relevant data.
* @returns An {@link UseProductPriceReturn} object containing product price reactive data.
*/
export declare function useProductPrice(price: MaybeRefOrGetter<Price | BasketItemPrice | OrderPrice>): UseProductPriceReturn;
export {};