import React from 'react'; import { compact, groupBy, isEmpty } from 'lodash'; import { getDateText } from '../../booking-wizard/features/sidebar/sidebar-util'; export const renderEditablePackagingEntrySummaryOptions = (editablePackagingEntry: any, priceDetails: any, translations: any) => { const priceDetailsByProduct = groupBy(priceDetails?.details ?? [], (detail: any) => `${detail.productCode}|${detail.accommodationCode}`); return (editablePackagingEntry?.lines ?? []).map((line: any) => { const groupedPriceDetails = priceDetailsByProduct[`${line.productCode}|${line.accommodationCode}`] ?? []; const visiblePriceDetails = groupedPriceDetails.filter((detail: any) => detail.showPrice || detail.isSeparate); return (
  • {line.productName}

    ( {line.from === line.to ? ( getDateText(line.from) ) : ( <> {getDateText(line.from)} > {getDateText(line.to)} )} )

  • ); }); }; export const getImageSrcFromHtml = (html?: string | null): string | undefined => { if (!html || typeof window === 'undefined') { return undefined; } const doc = new DOMParser().parseFromString(html, 'text/html'); const img = doc.querySelector('img'); return img?.getAttribute('src') ?? undefined; };