import { UserSubscription } from '../models/user-subscription'; export interface offersMap { [key: string]: string; } /** * Parse JSON * @param offerId ID of the offer to be mapped. * @param offersToDisplayNameMap Static map of the display names. * @returns The friendly name value of an offer or an empty string. */ export function getOfferDisplayName(offerId: string, offersToDisplayNameMap: offersMap = {}): string { return offersToDisplayNameMap && offersToDisplayNameMap[offerId] || ''; } export function resolvePrintOfferName(subscription: UserSubscription) { const baseName = 'Print'; if (subscription.isWeekdayOnlyProduct) { return `Weekday ${baseName}`; } if (subscription.isWeekendOnlyProduct) { return `Weekend ${baseName}`; } // Fallback return baseName; }