diff --git a/storefront/utils/recommender/getRecommenderClientIdentifier.ts b/storefront/utils/recommender/getRecommenderClientIdentifier.ts index 42d98edf12..5e56b36eac 100644 --- a/storefront/utils/recommender/getRecommenderClientIdentifier.ts +++ b/storefront/utils/recommender/getRecommenderClientIdentifier.ts @@ -1,13 +1,22 @@ +import { logException } from 'utils/errors/logException'; + const RECOMMENDER_PATHNAMES = { '/': 'homepage', - '/products/[productSlug]': 'product-detail', + '/blogArticles/[blogArticleSlug]': 'blog-article-detail', '/cart': 'cart', + '/categories/[categorySlug]': 'category-detail', + '/flags/[flagSlug]': 'flag-detail', + '/product-comparison': 'product-comparison', + '/products/[productSlug]': 'product-detail', + '/search': 'search', + '/wishlist': 'wishlist', } as const; export const getRecommenderClientIdentifier = (pathname: string): string => { const splitPathname = pathname.split('?')[0]; if (!(splitPathname in RECOMMENDER_PATHNAMES)) { - throw new Error(`Pathname ${splitPathname} does not have a corresponding recommender client identifier`); + logException(`Pathname ${splitPathname} does not have a corresponding identifier in RECOMMENDER_PATHNAMES`); + return splitPathname; } return RECOMMENDER_PATHNAMES[splitPathname as RecommenderClientIdentifierKeyType];