@justeattakeaway/cc-filters
Version:
Filter function for content card loader
61 lines (51 loc) • 1.83 kB
TypeScript
import * as _justeattakeaway_cc_types from '@justeattakeaway/cc-types';
import { Card, LocationData } from '@justeattakeaway/cc-types';
declare const filterByBrands: (cards: Card[], brands: string[]) => Card[];
declare const filterByCurrentlyActive: (cards: Card[]) => Card[];
declare const filterByEnabledCardTypes: (cards: Card[], enabledCardTypes: string[]) => Card[];
/**
* @param cards
* @param currentLocation
* @returns Array
*/
declare const locationFilter: (cards: Card[], { location, latitude, longitude }: LocationData) => Card[];
declare const removeDuplicateContentCards: (cards: Card[]) => Card[];
declare const sortByCardOrder: (cards: Card[]) => Card[];
declare const urlLocationSubstitution: (cards: Card[], { location, longitude, latitude }: LocationData) => {
url: string;
id: string;
source: string;
type: string;
order: number;
deduplicationKey: string;
title: string;
subtitle: string;
expiryLine: string;
expiryDate: string;
description: string[];
code?: string | undefined;
image: string;
icon: string;
ctaText: string;
metadata: {
coordinates: _justeattakeaway_cc_types.Coordinates;
viewTime: number;
};
discountPercentage: number;
totalRequiredStamps: number;
earnedStamps: number;
rewardValue: number;
currentDiscountValue: number;
brand: string;
restaurantId: string;
voucherCode: string;
location: string;
isVisible: boolean;
displayTimes: any;
isReadyToClaim: boolean;
pinned: boolean;
updated: string;
target: any;
}[];
declare const pipe: (...fns: any[]) => (x: any) => any;
export { filterByBrands, filterByCurrentlyActive, filterByEnabledCardTypes, locationFilter, pipe, removeDuplicateContentCards, sortByCardOrder, urlLocationSubstitution };