UNPKG

1.1 kBTypeScriptView Raw
1import { ReactNode } from 'react';
2import { Price } from '@jetshop/core/types';
3export interface UsePrice {
4 price: Price;
5 previousPrice?: Price;
6 currencyOverride?: {
7 code: string;
8 culture: string;
9 };
10 /**Optional formatter to format currency */
11 formatter?(price: number, currencyCode?: string, culture?: string): string;
12 /** Override the channel settings for includeVat */
13 includeVat?: boolean;
14}
15export declare function usePrice({ currencyOverride, price, previousPrice, includeVat, formatter: defaultFormatter }: UsePrice): {
16 hasDiscount: boolean;
17 includesVat: boolean;
18 currencyLocale: {
19 code: string;
20 culture: string;
21 };
22 pricing: {
23 [k: string]: {
24 vat: number;
25 value: number;
26 };
27 };
28 formattedPricing: {
29 previousPrice: ReactNode;
30 price: ReactNode;
31 };
32};
33/**
34 * Normalise the price to an object with keys `value` and `vat`
35 */
36export declare function selectPriceType(includeVat: boolean, priceObj: Price): {
37 vat: number;
38 value: number;
39} | null;