import defaultImageBase64 from './defaultImageBase64';

export const parseProductSlide = slideData => {
    const { selectedProduct: { blurb, overviewImageUrl, url, title, name } = {} } = slideData;
    const parsedSlideData = {
        title: title || name || 'Product name',
        text: blurb || 'Product description',
        slideLink: url,
        image: {
            url: overviewImageUrl || defaultImageBase64
        }
    };
    const updatedSlideData = Object.assign(slideData, parsedSlideData);
    return updatedSlideData;
};
