import bestsellerIds from './bestseller-ids'; import trendingIds from './trending-ids'; import {TagType} from './tag-types'; type Environment = | 'development' | 'sandbox' | 'integration' | 'staging' | 'production'; export const isPdpTagAvailable = ( type: TagType, productId: number, environment?: Environment ) => { if (!environment) { environment = 'production'; } switch (type) { case 'bestseller': { if ( bestsellerIds[environment] && typeof bestsellerIds[environment].has === 'function' ) { return bestsellerIds[environment].has(productId); } break; } case 'trending': { if ( trendingIds[environment] && typeof trendingIds[environment].has === 'function' ) { return trendingIds[environment].has(productId); } break; } } return false; };